diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b6345292c..52ba665db2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: - node-version: [20.x] + node-version: [22.x] concurrency: group: vchart-release-${{ github.ref_name }} @@ -78,7 +78,7 @@ jobs: cache-dependency-path: './common/config/rush/pnpm-lock.yaml' - name: Update npm - run: npm install -g npm@latest + run: npm install -g npm@^11.5.1 - name: Install latest pnpm run: npm install -g pnpm@10.7.0 diff --git a/common/changes/@visactor/vchart/feat-4615-linear-x-auto-bar-width_2026-07-08-10-34.json b/common/changes/@visactor/vchart/feat-4615-linear-x-auto-bar-width_2026-07-08-10-34.json deleted file mode 100644 index 82141e54b6..0000000000 --- a/common/changes/@visactor/vchart/feat-4615-linear-x-auto-bar-width_2026-07-08-10-34.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "feat: support automatic bar width for linear x axis", - "type": "minor", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "lixuef1313@163.com" -} diff --git a/common/changes/@visactor/vchart/feat-funnel-conversion-arrow-theme_2026-07-14-08-58.json b/common/changes/@visactor/vchart/feat-funnel-conversion-arrow-theme_2026-07-14-08-58.json deleted file mode 100644 index 9e6fc98f22..0000000000 --- a/common/changes/@visactor/vchart/feat-funnel-conversion-arrow-theme_2026-07-14-08-58.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "feat: support theming conversion funnel arrow (line / symbol / text) via series.funnel.conversionArrow theme token", - "type": "minor", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "e@erlanzhou.com" -} diff --git a/common/changes/@visactor/vchart/fix-restore-axis-grid-after-update_2026-07-15.json b/common/changes/@visactor/vchart/fix-restore-axis-grid-after-update_2026-07-15.json deleted file mode 100644 index a99dd9502e..0000000000 --- a/common/changes/@visactor/vchart/fix-restore-axis-grid-after-update_2026-07-15.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "changes": [ - { - "comment": "fix: restore existing axis grid graphics when grid visibility is enabled again through updateSpec with animation disabled", - "type": "patch", - "packageName": "@visactor/vchart" - } - ], - "packageName": "@visactor/vchart", - "email": "lixuef1313@163.com" -} diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index cbddee7570..3f97119195 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -19,16 +19,16 @@ importers: specifier: 2.46.1 version: 2.46.1(@types/react@18.3.31)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@visactor/openinula-vchart': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../packages/openinula-vchart '@visactor/react-vchart': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../packages/react-vchart '@visactor/vchart': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../packages/vchart '@visactor/vchart-extension': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../packages/vchart-extension '@visactor/vchart-theme': specifier: ~1.6.6 @@ -200,7 +200,7 @@ importers: ../../packages/openinula-vchart: dependencies: '@visactor/vchart': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../vchart '@visactor/vrender-core': specifier: ~1.1.4 @@ -288,10 +288,10 @@ importers: ../../packages/react-vchart: dependencies: '@visactor/vchart': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../vchart '@visactor/vchart-extension': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../vchart-extension '@visactor/vrender-core': specifier: ~1.1.4 @@ -388,10 +388,10 @@ importers: ../../packages/taro-vchart: dependencies: '@visactor/vchart': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../vchart '@visactor/vchart-extension': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../vchart-extension devDependencies: '@babel/core': @@ -550,7 +550,7 @@ importers: specifier: ~1.0.23 version: 1.0.23 '@visactor/vutils-extension': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../vutils-extension devDependencies: '@esbuild-plugins/node-globals-polyfill': @@ -686,7 +686,7 @@ importers: ../../packages/vchart-extension: dependencies: '@visactor/vchart': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../vchart '@visactor/vdataset': specifier: ~1.0.23 @@ -994,10 +994,10 @@ importers: ../../tools/bugserver-trigger: dependencies: '@visactor/vchart': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../../packages/vchart '@visactor/vchart-extension': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../../packages/vchart-extension devDependencies: '@internal/bundler': @@ -1260,7 +1260,7 @@ importers: ../../tools/story-player: dependencies: '@visactor/vchart': - specifier: workspace:2.1.3 + specifier: workspace:2.1.4 version: link:../../packages/vchart '@visactor/vrender': specifier: ~1.1.4 diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index da55ffa4be..f52175bc06 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"2.1.2","mainProject":"@visactor/vchart","nextBump":"patch"}] +[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"2.1.4","mainProject":"@visactor/vchart","nextBump":"patch"}] diff --git a/common/scripts/verify-release-workflows.js b/common/scripts/verify-release-workflows.js index 2ca168814f..7ebc44ea7a 100644 --- a/common/scripts/verify-release-workflows.js +++ b/common/scripts/verify-release-workflows.js @@ -98,6 +98,16 @@ function run() { validateBranchStep.run.includes('For workflow_dispatch recovery'), 'release.yml branch validation must enforce documented semver branch names and explain manual recovery refs' ); + assert( + release.data.jobs.release.strategy.matrix['node-version'].length === 1 && + release.data.jobs.release.strategy.matrix['node-version'][0] === '22.x', + 'release.yml must use Node 22.x for npm trusted publishing' + ); + const updateNpmStep = getStep(release, 'release', 'Update npm'); + assert( + updateNpmStep && updateNpmStep.run === 'npm install -g npm@^11.5.1', + 'release.yml must use the npm 11 line required for trusted publishing' + ); assert(getStep(release, 'release', 'Check npm version (release)'), 'release.yml must check npm before stable publish'); assertUsesPublishablePackageSet(getStep(release, 'release', 'Check npm version (release)'), 'release npm check'); assertUsesPublishablePackageSet(getStep(release, 'release', 'Check npm version (hotfix)'), 'hotfix npm check'); diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index a77c5b611d..61e971abd9 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,3 +1,19 @@ +# v2.1.4 + +2026-07-16 + +**🆕 New Features** + +- **@visactor/vchart**: support automatic bar width for linear x axis +- **@visactor/vchart**: support theming conversion funnel arrow (line / symbol / text) via series.funnel.conversionArrow theme token + +**🐛 Bug Fixes** + +- **@visactor/vchart**: restore existing axis grid graphics when grid visibility is enabled again through updateSpec with animation disabled + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.1.3...v2.1.4 + +[more detail about v2.1.4](https://github.com/VisActor/VChart/releases/tag/v2.1.4) # v2.1.3 2026-07-08 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index d318b67c4f..e865eaf521 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,3 +1,19 @@ +# v2.1.4 + +2026-07-16 + +**🆕 新增功能** + +- **@visactor/vchart**: 支持 automatic bar width for linear x axis +- **@visactor/vchart**: 支持 theming conversion funnel arrow (line / symbol / text) via series.funnel.conversionArrow theme token + +**🐛 问题修复** + +- **@visactor/vchart**: restore existing axis grid graphics when grid visibility is enabled again through updateSpec with animation disabled + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.1.3...v2.1.4 + +[更多详情请查看 v2.1.4](https://github.com/VisActor/VChart/releases/tag/v2.1.4) # v2.1.3 2026-07-08 diff --git a/docs/package.json b/docs/package.json index 1f2a1ff8e0..a0cef9c0c4 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,10 +12,10 @@ }, "dependencies": { "@arco-design/web-react": "2.46.1", - "@visactor/openinula-vchart": "workspace:2.1.3", - "@visactor/react-vchart": "workspace:2.1.3", - "@visactor/vchart": "workspace:2.1.3", - "@visactor/vchart-extension": "workspace:2.1.3", + "@visactor/openinula-vchart": "workspace:2.1.4", + "@visactor/react-vchart": "workspace:2.1.4", + "@visactor/vchart": "workspace:2.1.4", + "@visactor/vchart-extension": "workspace:2.1.4", "@visactor/vchart-theme": "~1.6.6", "@visactor/vmind": "1.2.4-alpha.5", "@visactor/vutils": "~1.0.23", diff --git a/packages/block-vchart/block/vchart/index.js b/packages/block-vchart/block/vchart/index.js index 2422440f2d..be26c32aea 100644 --- a/packages/block-vchart/block/vchart/index.js +++ b/packages/block-vchart/block/vchart/index.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=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 M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(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(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Ot=t=>0,It=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ie(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{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}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,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 Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{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 Xe(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 Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={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 Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(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=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(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=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(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 ni(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=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{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`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(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}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(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 ni(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:Ke});function oi(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 li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(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 di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(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 Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{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 Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal: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?Ci[8+bi/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 C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=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")+_i(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 wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Fi(){return new zi}function zi(){this.reset()}zi.prototype={constructor:zi,reset:function(){this.s=this.t=0},add:function(t){ji(Hi,t,this.t),ji(this,Hi.s,this.s),this.s?this.t+=Hi.t:this.s=Hi.t},valueOf:function(){return this.s}};var Hi=new zi;function ji(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Ni=1e-6,Ui=Math.PI,Vi=Ui/2,Wi=Ui/4,Gi=2*Ui,Yi=180/Ui,Xi=Ui/180,Ki=Math.abs,$i=Math.atan,qi=Math.atan2,Zi=Math.cos,Ji=Math.exp,Qi=Math.log,ts=Math.pow,es=Math.sin,is=Math.sign||function(t){return t>0?1:t<0?-1:0},ss=Math.sqrt,ns=Math.tan;function rs(t){return t>1?0:t<-1?Ui:Math.acos(t)}function as(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function os(){}function ls(t,e){t&&cs.hasOwnProperty(t.type)&&cs[t.type](t,e)}var hs={Feature:function(t,e){ls(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sUi?t+Math.round(-t/Gi)*Gi:t,e]}function As(t,e,i){return(t%=Gi)?e||i?xs(Cs(t),Ts(e,i)):Cs(t):e||i?Ts(e,i):Ss}function ks(t){return function(e,i){return[(e+=t)>Ui?e-Gi:e<-Ui?e+Gi:e,i]}}function Cs(t){var e=ks(t);return e.invert=ks(-t),e}function Ts(t,e){var i=Zi(t),s=es(t),n=Zi(e),r=es(e);function a(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*i+o*s;return[qi(l*n-c*r,o*i-h*s),as(c*n+l*r)]}return a.invert=function(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*n-l*r;return[qi(l*n+h*r,o*i+c*s),as(c*i-o*s)]},a}function Ms(t,e){(e=fs(e))[0]-=t,bs(e);var i=rs(-e[1]);return((-e[2]<0?-i:i)+Gi-Ni)%Gi}function ws(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:os,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Es(t,e){return Ki(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 Rs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function zs(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 Hs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ws(),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=zs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=es(s),r=[es(i),-Zi(i),0],a=0,o=0;Ls.reset(),1===n?s=Vi+Ni:-1===n&&(s=-Vi-Ni);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ui,M=f*x;if(Ls.add(qi(M*k*es(C),m*S+M*Zi(C))),a+=T?A+k*Gi:A,T^p>=i^_>=i){var w=vs(fs(u),fs(y));bs(w);var E=vs(r,w);bs(E);var B=(T^A>=0?-1:1)*as(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Ni||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(js))}return u}}function js(t){return t.length>1}function Ns(t,e){return((t=t.x)[0]<0?t[1]-Vi-Ni:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-Ni:Vi-e[1])}1===(Os=Fs).length&&(Is=Os,Os=function(t,e){return Fs(Is(t),e)});var Us=Hs((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?Ui:-Ui,l=Ki(r-i);Ki(l-Ui)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ui&&(Ki(i-n)Ni?$i((es(e)*(r=Zi(s))*es(i)-es(s)*(n=Zi(e))*es(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*Vi,s.point(-Ui,n),s.point(0,n),s.point(Ui,n),s.point(Ui,0),s.point(Ui,-n),s.point(0,-n),s.point(-Ui,-n),s.point(-Ui,0),s.point(-Ui,n);else if(Ki(t[0]-e[0])>Ni){var r=t[0]0,n=Ki(e)>Ni;function r(t,i){return Zi(t)*Zi(i)>e}function a(t,i,s){var n=[1,0,0],r=vs(fs(t),fs(i)),a=ms(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=vs(n,r),u=_s(n,h);ys(u,_s(r,c));var p=d,g=ms(u,p),f=ms(p,p),m=g*g-f*(ms(u,u)-1);if(!(m<0)){var v=ss(m),y=_s(p,(-g-v)/f);if(ys(y,u),y=gs(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Ki(y[0]-b)Ui^(b<=y[0]&&y[0]<=x)){var T=_s(p,(-g+v)/f);return ys(T,u),[y,gs(T)]}}}function o(e,i){var n=s?t:Ui-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Hs(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?Ui:-Ui),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Es(e,p)||Es(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&&Es(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=Zi(e),o=es(e),l=s*i;null==n?(n=e+s*Gi,r=e-l/2):(n=Ms(a,n),r=Ms(a,r),(s>0?nr)&&(n+=s*Gi));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 Ki(s[0]-t)0?0:3:Ki(s[0]-i)0?2:1:Ki(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=ws(),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=zs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ps(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(Gs,Math.min(Ws,g)),f=Math.max(Gs,Math.min(Ws,f))],b=[r=Math.max(Gs,Math.min(Ws,r)),a=Math.max(Gs,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&&(_.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 Xs(t){return t}var Ks,$s,qs,Zs,Js=Fi(),Qs=Fi(),tn={point:os,lineStart:os,lineEnd:os,polygonStart:function(){tn.lineStart=en,tn.lineEnd=rn},polygonEnd:function(){tn.lineStart=tn.lineEnd=tn.point=os,Js.add(Ki(Qs)),Qs.reset()},result:function(){var t=Js/2;return Js.reset(),t}};function en(){tn.point=sn}function sn(t,e){tn.point=nn,Ks=qs=t,$s=Zs=e}function nn(t,e){Qs.add(Zs*t-qs*e),qs=t,Zs=e}function rn(){nn(Ks,$s)}var an=tn,on=1/0,ln=on,hn=-on,cn=hn;var dn,un,pn,gn,fn={point:function(t,e){thn&&(hn=t);ecn&&(cn=e)},lineStart:os,lineEnd:os,polygonStart:os,polygonEnd:os,result:function(){var t=[[on,ln],[hn,cn]];return hn=cn=-(ln=on=1/0),t}},mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn=0,Cn={point:Tn,lineStart:Mn,lineEnd:Bn,polygonStart:function(){Cn.lineStart=Pn,Cn.lineEnd=Rn},polygonEnd:function(){Cn.point=Tn,Cn.lineStart=Mn,Cn.lineEnd=Bn},result:function(){var t=kn?[Sn/kn,An/kn]:xn?[_n/xn,bn/xn]:yn?[mn/yn,vn/yn]:[NaN,NaN];return mn=vn=yn=_n=bn=xn=Sn=An=kn=0,t}};function Tn(t,e){mn+=t,vn+=e,++yn}function Mn(){Cn.point=wn}function wn(t,e){Cn.point=En,Tn(pn=t,gn=e)}function En(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Tn(pn=t,gn=e)}function Bn(){Cn.point=Tn}function Pn(){Cn.point=On}function Rn(){In(dn,un)}function On(t,e){Cn.point=In,Tn(dn=pn=t,un=gn=e)}function In(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Sn+=(n=gn*t-pn*e)*(pn+t),An+=n*(gn+e),kn+=3*n,Tn(pn=t,gn=e)}var Ln=Cn;function Dn(t){this._context=t}Dn.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,Gi)}},result:os};var Fn,zn,Hn,jn,Nn,Un=Fi(),Vn={point:os,lineStart:function(){Vn.point=Wn},lineEnd:function(){Fn&&Gn(zn,Hn),Vn.point=os},polygonStart:function(){Fn=!0},polygonEnd:function(){Fn=null},result:function(){var t=+Un;return Un.reset(),t}};function Wn(t,e){Vn.point=Gn,zn=jn=t,Hn=Nn=e}function Gn(t,e){jn-=t,Nn-=e,Un.add(ss(jn*jn+Nn*Nn)),jn=t,Nn=e}var Yn=Vn;function Xn(){this._string=[]}function Kn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $n(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ps(t,i(s))),s.result()}return r.area=function(t){return ps(t,i(an)),an.result()},r.measure=function(t){return ps(t,i(Yn)),Yn.result()},r.bounds=function(t){return ps(t,i(fn)),fn.result()},r.centroid=function(t){return ps(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Xs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Xn):new Dn(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 qn(t){return function(e){var i=new Zn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Zn(){}function Jn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ps(i,t.stream(fn)),e(fn.result()),null!=s&&t.clipExtent(s),t}function Qn(t,e,i){return Jn(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 tr(t,e,i){return Qn(t,[[0,0],e],i)}function er(t,e,i){return Jn(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 ir(t,e,i){return Jn(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)}Xn.prototype={_radius:4.5,_circle:Kn(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=Kn(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}},Zn.prototype={constructor:Zn,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 sr=16,nr=Zi(30*Xi);function rr(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=ss(b*b+x*x+S*S),k=as(S/=A),C=Ki(Ki(S)-1)e||Ki((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Xi:0,E()):[m*Yi,v*Yi,y*Yi]},M.angle=function(t){return arguments.length?(_=t%360*Xi,E()):_*Yi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=rr(o,T=t*t),B()):ss(T)},M.fitExtent=function(t,e){return Qn(M,t,e)},M.fitSize=function(t,e){return tr(M,t,e)},M.fitWidth=function(t,e){return er(M,t,e)},M.fitHeight=function(t,e){return ir(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function dr(t){var e=0,i=Ui/3,s=cr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Xi,i=t[1]*Xi):[e*Yi,i*Yi]},n}function ur(t,e){var i=es(t),s=(i+es(e))/2;if(Ki(s)2?t[2]*Xi:0),e.invert=function(e){return(e=t.invert(e[0]*Xi,e[1]*Xi))[0]*=Yi,e[1]*=Yi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===_r?[[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 xr(t){return ns((Vi+t)/2)}function Sr(t,e){var i=Zi(t),s=t===e?es(t):Qi(i/Zi(e))/Qi(xr(e)/xr(t)),n=i*ts(xr(t),s)/s;if(!s)return _r;function r(t,e){n>0?e<-Vi+Ni&&(e=-Vi+Ni):e>Vi-Ni&&(e=Vi-Ni);var i=n/ts(xr(e),s);return[i*es(s*t),n-i*Zi(s*t)]}return r.invert=function(t,e){var i=n-e,r=is(s)*ss(t*t+i*i),a=qi(t,Ki(i))*is(i);return i*s<0&&(a-=Ui*is(t)*is(i)),[a/s,2*$i(ts(n/r,1/s))-Vi]},r}function Ar(t,e){return[t,e]}function kr(t,e){var i=Zi(t),s=t===e?es(t):(i-Zi(e))/(e-t),n=i/s+t;if(Ki(s)Ni&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Or.invert=mr(as),Ir.invert=mr((function(t){return 2*$i(t)})),Lr.invert=function(t,e){return[-e,2*$i(Ji(t))-Vi]};var zr={exports:{}},Hr=function(t,e){this.p1=t,this.p2=e};Hr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Hr.prototype.run=function(){return this.p2[0]-this.p1[0]},Hr.prototype.slope=function(){return this.rise()/this.run()},Hr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Hr.prototype.isVertical=function(){return!isFinite(this.slope())},Hr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Hr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Hr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Hr.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)},Hr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var jr=Hr,Nr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new jr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Nr(t.slice(0,s),e),o=Nr(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},Ur=Nr;!function(t){var e=Ur;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Xr,e),{tolerance:s}=i;return Vr(t,s)};var $r;!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"}($r||($r={}));const qr=(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a},Zr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return Jr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return Jr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},ta=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",O=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var ea={},ia={};function sa(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function na(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ra(t,e){var i=t+"",s=i.length;return s9999?"+"+ra(e,6):ra(e,4))+"-"+ra(t.getUTCMonth()+1,2)+"-"+ra(t.getUTCDate(),2)+(r?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"."+ra(r,3)+"Z":n?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"Z":s||i?"T"+ra(i,2)+":"+ra(s,2)+"Z":"")}function oa(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 ia;if(h)return h=!1,ea;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=$r.DSV;const s=Wr(ca,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return oa(n).parse(t)},ua=(t,e={},i)=>(i.type=$r.DSV,la(t)),pa=(t,e={},i)=>(i.type=$r.DSV,ha(t));function ga(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return fa(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 fa(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return va(t);default:throw new Error("unknown GeoJSON type")}}function fa(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=ma(t.properties),e.geometry=va(t.geometry),e}function ma(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]=ma(s):e[i]=s})),e):e}function va(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return va(t)})),e):(e.coordinates=ya(t.coordinates),e)}function ya(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return ya(t)}))}function _a(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 ba(t){for(var e,i,s=_a(t),n=0,r=1;r0}function xa(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=ga(t));var r=[];switch(t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,s)})),t;case"FeatureCollection":return xa(t,(function(t){xa(ka(t,s),(function(t){r.push(t)}))})),di(r)}return ka(t,s)}function ka(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,e)})),t;case"LineString":return Ca(_a(t),e),t;case"Polygon":return Ta(_a(t),e),t;case"MultiLineString":return _a(t).forEach((function(t){Ca(t,e)})),t;case"MultiPolygon":return _a(t).forEach((function(t){Ta(t,e)})),t;case"Point":case"MultiPoint":return t}}function Ca(t,e){ba(t)===e&&t.reverse()}function Ta(t,e){ba(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Pa=(t,e={},i)=>{i.type=$r.GEO;const s=Wr(Ea,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Aa(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=wa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=wa.bounds(t);t.bbox=e}})),t.features=l,t},Ra={},Oa=(t,e,i)=>{i.type=$r.GEO;const s=Wr(Ea,Ra,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 Fr(a,t)}))}:Fr(a,o));var a,o;return Pa(r,s,i)},Ia=(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 La=0;function Da(t="dataset"){return La>1e8&&(La=0),t+"_"+La++}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:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class za{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof za||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Zr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}$n();const Ha={},ja={albers:gr,albersusa:function(){var t,e,i,s,n,r,a=gr(),o=pr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=pr().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)}},Na=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ua(t,e){return function i(){const s=e();return s.type=t,s.path=$n().projection(s),s.copy=s.copy||function(){const t=i();return Na.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ga 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=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Za.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Ja(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(Ja(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,Ja(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Ja(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 $a))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Za.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Qa(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ka,this.rootWheelEvent=new $a,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const so=Nt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,fo;function mo(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;tfo){let t,e=uo;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 wo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Fo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Ho(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new jo(i,n),new jo(n,s)]}class jo extends Eo{constructor(t,e){super(),this.type=xo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p1.x):t===bo.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class No{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new jo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===bo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===bo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Uo extends No{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?bo.ROW:bo.COLUMN;return"monotoneY"===t?new Uo(t,s):new No(t,s)}class Go{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,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Xo(new Go(n,s),t),n}function Xo(t,e){return Vo(t,e,1)}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 $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&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 qo(t,e){return Vo(t,e,2)}function Zo(t,e={}){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 qo(new $o(n,s),t),n}function Jo(t){return t<0?-1:1}function Qo(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(Jo(r)+Jo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function tl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function el(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 il{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:el(this,this._t0,tl(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,el(this,tl(this,e=Qo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:el(this,this._t0,e=Qo(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 sl extends il{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function nl(t,e){return Vo(t,e,2)}function rl(t,e={}){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 nl(new il(n,s),t),n}function al(t,e){return Vo(t,e,2)}function ol(t,e={}){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 al(new sl(n,s),t),n}let ll=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class hl extends ll{lineEnd(){this.context.closePath()}}function cl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new ll(r,e,n),t),r}function dl(t,e){return Vo(t,e,1)}function ul(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new hl(r,e,n),t),r}class pl extends Go{lineEnd(){this.context.closePath()}}function gl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return fl(new pl(n,s),t),n}function fl(t,e){return Vo(t,e,1)}function ml(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function vl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Yo(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const yl=vl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const _l=vl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class bl extends Eo{constructor(t,e,i){super(),this.type=xo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Lo(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p2.x):t===bo.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Lo(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new bl(i,a,r),new bl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class xl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new jo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new bl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Sl(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return Zo(t,i);case"monotoneX":return rl(t,i);case"monotoneY":return ol(t,i);case"step":return cl(t,.5,i);case"stepClosed":return ul(t,.5,i);case"stepBefore":return cl(t,0,i);case"stepAfter":return cl(t,1,i);case"catmullRom":return yl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return _l(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return gl(t,i)}}class Al extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.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([lo.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([lo.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([lo.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([lo.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([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new xl(this);wo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];To(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.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=mo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Sl(e,i);"x"===s?this.direction=bo.ROW:"y"===s?this.direction=bo.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[lo.M]=this.moveToTransform,t[lo.L]=this.lineToTransform,t[lo.Q]=this.quadraticCurveToTransform,t[lo.C]=this.bezierCurveToTransform,t[lo.AT]=this.arcToTransform,t[lo.E]=this.ellipseTransform,t[lo.R]=this.rectTransform,t[lo.A]=this.arcTransform,t[lo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),wo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===bo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===bo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),$l=Object.assign(Object.assign({},Nl),{points:[],cornerRadius:0,closePath:!0}),ql=Object.assign(Object.assign({},Nl),{width:100,height:100,spikes:5,thickness:.5}),Zl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Ql=Object.assign(Object.assign({},Nl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),th=Object.assign(Object.assign(Object.assign({},Nl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),eh=Object.assign(Object.assign(Object.assign({},Nl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ih=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Nl),{fill:!0,cornerRadius:0,cornerType:"round"}),sh=Object.assign(Object.assign({},ih),{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});class nh{}const rh=Symbol.for("@visactor/vrender-core/application-state");function ah(){const t=globalThis;return t[rh]||(t[rh]={application:new nh}),t[rh]}const oh=ah().application;class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?oh.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):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?oh.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"},lh.cache.set(t,s),s.dataPromise=oh.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oh.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oh.global.loadBlob(t):"json"===e&&(i.dataPromise=oh.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=oh.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{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 Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Ph=new class extends Th{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Ih(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{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 Ih(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ih(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{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 Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Gh=new class extends Th{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(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 Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+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(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{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 Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{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 ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{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 sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{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 rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(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 dc=new class extends Th{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 cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(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 pc=new class extends Th{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 uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(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 fc=new class extends Th{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 gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(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 vc=new class extends Th{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 mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(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 Ac=new class extends Th{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 Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{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)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),wo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(wo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}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 Ec=[wh,Eh,Ph,Oh,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{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 Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ic(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ic(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ic(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 Rc(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 Rc(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 Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;eqc.set(t,!0)));const Zc=new Map;function Jc(t){if(qc.has(t))return!0;if(Zc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Qc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Zc.set(t,!0)));const td=Xc(),ed=Xc(),id=Xc(),sd=Xc(),nd=Xc(),rd=Xc(),ad=Xc(),od=Xc(),ld=Xc(),hd=Xc(),cd=Xc(),dd=Xc(),ud=Xc(),pd=Xc(),gd=Xc(),fd=Xc(),md=Xc(),vd=Symbol.for("GraphicService"),yd=Symbol.for("GraphicCreator"),_d={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},bd=Object.keys(_d),xd={"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"},Sd=Object.keys(xd),Ad={duration:200,easing:"cubicOut"},kd=Symbol.for("CanvasFactory"),Cd=Symbol.for("Context2dFactory");function Td(t){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.canvasFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Md=1e-4,wd=Math.sqrt(3),Ed=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Rd(t){return"number"==typeof t&&Number.isFinite(t)}const Od=[0,0],Id=[0,0],Ld=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Fd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function zd(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 Hd(t){return(t%=Ut)<0&&(t+=Ut),t}function jd(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+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Vd(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(Bd(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 Yd=[-1,-1,-1],Xd=[-1,-1];function Kd(){const t=Xd[0];Xd[0]=Xd[1],Xd[1]=t}function $d(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(Bd(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,Ed):Math.pow(i,Ed),s=s<0?-Math.pow(-s,Ed):Math.pow(s,Ed);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+wd*Math.sin(e)))/(3*a),h=(-o+i*(s-wd*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,Yd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Kd(),p=zd(e,s,r,o,Xd[0]),u>1&&(g=zd(e,s,r,o,Xd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Yd);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=Fd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Yd[0]=-l,Yd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Yd[0]+t&&a<=Yd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Yd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Jd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function Qd(t,e){let i=Jd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Jd(i-n)):e&&i1&&(i||(h+=Oe(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;tu[0]=S,tu[1]=A,Qd(tu,Boolean(a[6])),S=tu[0],A=tu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case lo.M:u=m,p=v,c=u,d=p;break;case lo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case lo.C:if(i){if(Nd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(jd(c,d,m,v,y,_,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case lo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Ud(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Zd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case lo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case lo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class su{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(su.IsGradientStr(t))try{const e=iu(t)[0];if(e){if("linear"===e.type)return su.ParseLinear(e);if("radial"===e.type)return su.ParseRadial(e);if("conic"===e.type)return su.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:su.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:su.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function au(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ou(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];return 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}function lu(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];return 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}function hu(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];return 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,t}function cu(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 du(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 uu(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function pu(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 gu(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];return Math.abs(g-b)0&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Cu),function(t,e,i){return eu(t,0,!1,e,i)}(this.path.commandList,Cu.x,Cu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Cu);const i=nu(this,this.lineWidth,this.dpr);return function(t,e,i,s){return eu(t,e,!0,i,s)}(this.path.commandList,i,Cu.x,Cu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ku,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}const Mu={WIDTH:500,HEIGHT:500,DPR:1};class wu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Mu.WIDTH,height:n=Mu.HEIGHT,dpr:r=Mu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Eu;wu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Eu||(Eu={}));class Bu{static Get(t,e=Eu.Color1,i=[0,0,0,1]){if(e===Eu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Eu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Pu(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ru(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ou(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ou(t,e,i,s,n)}function Ou(t,e,i,s,n){if(!t||!e)return t&&Pu(t)||e&&Pu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Eu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Eu.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:Pu(a)})))});return o?Ru(r,l,i,s,n):Ru(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 Iu(s,n,i);if("radial"===s.gradient)return Lu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Pu(Fu(r,a,i),s)}function Iu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(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]}function zu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const Hu=[0,0,0,0],ju=[0,0,0,0];function Nu(t,e,i){return Bu.Get(t,Eu.Color255,Hu),Bu.Get(e,Eu.Color255,ju),`rgba(${Math.round(Hu[0]+(ju[0]-Hu[0])*i)},${Math.round(Hu[1]+(ju[1]-Hu[1])*i)},${Math.round(Hu[2]+(ju[2]-Hu[2])*i)},${Hu[3]+(ju[3]-Hu[3])*i})`}class Uu{static GetCanvas(){try{return Uu.canvas||(Uu.canvas=oh.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 Vu extends Ye{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Gu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;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),Ru(o.color,l.color,h,!1)}function Yu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Uu.GetCanvas(),d=Uu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Ku(t){return null==t?void 0:t}class $u{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Ku(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Xu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Ku(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function qu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Zu(t){if(!qu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Zu(t[i])})),e}function Ju(t,e){var i;const s=null!==(i=Zu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];qu(n)&&qu(i)?s[t]=Ju(n,i):s[t]=Zu(i)})),s}class Qu{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Zu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];qu(r)&&qu(n)?t[i]=Ju(r,n):!qu(r)&&qu(a)&&qu(n)?t[i]=Ju(a,n):t[i]=Zu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?tp.PAINT|tp.BOUNDS|tp.PICK:tp.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?tp.PAINT|tp.BOUNDS:tp.PAINT}};class sp{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Ad;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:_o.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:_o.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:_o.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const np=new $u;function rp(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,ap(t),!0)}function ap(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=np.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function op(t){if(t)return t.parentScope&&op(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&ap(t),t}function lp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function hp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function cp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,hp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),lp(null!=e?e:t.ownerStage))}const dp=new Ve,up=new Ge,pp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],gp=["x","y"],fp=["scaleX","scaleY"],mp=["angle"],vp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),yp=new re,_p=[],bp=tp.PAINT|tp.SHAPE|tp.BOUNDS|tp.TRANSFORM|tp.LAYOUT;function xp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Sp(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Sp(s):s})),i}function Ap(t,e){return t===e||!!(xp(t)||xp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function kp(t,e){var i;const s=null!==(i=Sp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];xp(n)&&xp(i)?s[t]=kp(n,i):s[t]=Sp(i)})),s}const Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Tp extends Ga{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,hp(this.stage,this),lp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&op(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(op(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new $u).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Sp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&xp(n)&&xp(s)?e[t]=kp(n,s):e[t]=Sp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Sp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Ap(a,o)||(s.set(n,{prev:a,next:o}),t[n]=Sp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ip[t];return n?n(e,i):null!==(s=ep[t])&&void 0!==s?s:tp.PAINT}(e,i,s):null!==(n=ep[e])&&void 0!==n?n:tp.PAINT;return r&tp.PICK&&(r|=tp.BOUNDS),r===tp.PAINT&&this.needUpdateTag(e)&&(r=tp.SHAPE|tp.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&bp)!==bp?(t&tp.SHAPE?this.addUpdateShapeAndBoundsTag():t&tp.BOUNDS&&this.addUpdateBoundTag(),t&tp.PAINT&&this.addUpdatePaintTag(),t&tp.TRANSFORM&&this.addUpdatePositionTag(),t&tp.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=tp.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&vo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Ep.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];dp.clear();const n=[];s.forEach((t=>{const e=(new Al).fromString(t.d),i={};Sd.forEach((e=>{t[e]&&(i[xd[e]]=t[e])})),n.push({path:e,attribute:i}),dp.union(e.bounds)}));const r=dp.width(),a=dp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Ep.userSymbolMap[t]=l,l}const i=(new Al).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Ep.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return wo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&vo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&vo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&vo.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&vo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=vo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===yo.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===_o.STATE||null!=i&&i>=_o.ANIMATE_BIND&&i<=_o.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===_o.STATE||null!=o&&o>=_o.ANIMATE_BIND&&o<=_o.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Ap(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:_p,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ad}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:_p,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Sp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:_o.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:_p,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:_p,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,scaleX:i=Rl.scaleX,scaleY:s=Rl.scaleY,angle:n=Rl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(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,!0),oh.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Rl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=up.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=oh.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Al).fromString(t):this.pathProxy=new Al,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:oh.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new qa(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ga.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:_o.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:_o.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||oh.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Tu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Tp.userSymbolMap={};const Mp=Symbol.for("@visactor/vrender-core/graphic-class");function wp(){var t;const e=globalThis;return null!==(t=e[Mp])&&void 0!==t||(e[Mp]={Graphic:Tp}),e[Mp]}const Ep=wp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!vp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Lp=Op();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Rp.forEach((t=>{this._defaultTheme[t]=Object.create(Lp[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Rp.forEach((s=>{const n=Object.create(Lp[s]);t&&t[s]&&Ip(n,t[s]),i[s]&&Ip(n,i[s]),e[s]&&Ip(n,e[s]),this.combinedTheme[s]=n})),e.common&&Rp.forEach((t=>{Ip(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 Fp=new Dp;function zp(t,e){return t.glyphHost?zp(t.glyphHost):e?(t.isContainer,e):Hp(t)||t.attachedThemeGraphic&&zp(t.attachedThemeGraphic)||Fp.getTheme()}function Hp(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)):Fp.getTheme()}return null}const jp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Np=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...pp];class Up extends Ep{constructor(t){super(t),this.type="arc",this.numberType=td}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return zp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Np)}needUpdateTag(t){return super.needUpdateTag(t,Np)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const Wp=["segments","points","curveType","curveTension",...pp];class Gp extends Ep{constructor(t){super(t),this.type="area",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return zp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Al;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Gp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gp.NOWORK_ANIMATE_ATTR}}function Yp(t){return new Gp(t)}Gp.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Xp=["radius","startAngle","endAngle",...pp];class Kp extends Ep{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return zp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Xp)}needUpdateTag(t){return super.needUpdateTag(t,Xp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Al,s.arc(0,0,r,a,o),s}clone(){return new Kp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kp.NOWORK_ANIMATE_ATTR}}function $p(t){return new Kp(t)}Kp.NOWORK_ANIMATE_ATTR=Cp;class qp extends Ep{constructor(t){super(t),this.type="glyph",this.numberType=nd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return zp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new qp(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return qp.NOWORK_ANIMATE_ATTR}}function Zp(t){return new qp(t)}var Jp;qp.NOWORK_ANIMATE_ATTR=Cp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Jp||(Jp={}));let Qp=class t extends Ep{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rd,this._childUpdateTag=vo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(rp(this.sharedStateScope,t),cp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===yo.GLOBAL){const i=new re(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&vo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,dx:i=Rl.dx,dy:s=Rl.dy,scaleX:n=Rl.scaleX,scaleY:r=Rl.scaleY,angle:a=Rl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return zp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=vo.CLEAR_BOUNDS,this._childUpdateTag&=vo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&vo.UPDATE_BOUNDS||(this._childUpdateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&vo.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=oh.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&rp(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return ap({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Cp;const eg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...pp];class ig extends Ep{constructor(t){super(t),this.type="image",this.numberType=ad,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return zp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ih[t]}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}clone(){return new ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ig.NOWORK_ANIMATE_ATTR}}function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Cp);const ng=["segments","points","curveType","curveTension",...pp];let rg=class t extends Ep{constructor(t={}){super(t),this.type="line",this.numberType=od}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=bh(i,s,e))}getGraphicTheme(){return zp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,ng)}needUpdateTag(t){return super.needUpdateTag(t,ng)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Al;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ag(t){return new rg(t)}rg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const og=["path","customPath",...pp];class lg extends Ep{constructor(t){super(t),this.type="path",this.numberType=ld}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Al?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Al?this.cache:t.path)}getGraphicTheme(){return zp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Al).fromString(t.path):t.customPath&&(this.cache=new Al,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,og)}needUpdateTag(t){return super.needUpdateTag(t,og)}toCustomPath(){return(new Al).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new lg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lg.NOWORK_ANIMATE_ATTR}}function hg(t){return new lg(t)}lg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const cg=["points","cornerRadius",...pp];class dg extends Ep{constructor(t){super(t),this.type="polygon",this.numberType=hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return zp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,cg)}needUpdateTag(t){return super.needUpdateTag(t,cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Al,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Cp;const pg=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}},gg=["width","x1","y1","height","cornerRadius",...pp];class fg extends Ep{constructor(t){super(t),this.type="rect",this.numberType=dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return zp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,gg)}needUpdateTag(t){return super.needUpdateTag(t,gg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=pg(e);return t=new Al,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fg.NOWORK_ANIMATE_ATTR}}function mg(t){return new fg(t)}fg.NOWORK_ANIMATE_ATTR=Cp;const vg=Symbol.for("EnvContribution"),yg=Symbol.for("VGlobal"),_g="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",bg={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"}},xg=!0,Sg=!1,Ag=/\w|\(|\)|-/,kg=/[.?!,;:/,。?!、;:]/,Cg=/\S/,Tg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=oh.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=wg(t,a)),a}function wg(t,e,i=!1){let s=e;for(;Ag.test(t[s-1])&&Ag.test(t[s])||kg.test(t[s]);)if(s--,s<=0)return i?Eg(t,e):e;return s}function Eg(t,e){let i=e;for(;Ag.test(t[i+1])&&Ag.test(t[i])||kg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=oh.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Pg{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=bg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Rg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Og{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Rg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Mg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Ig extends ig{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(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=ih.width,height:e=ih.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 Lg{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 Ig?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Cg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Ig)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sg;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,Tg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ru(t,s,{AABBBounds:i}):s,Tg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Ig)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Ig?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=bg[this.direction]}store(t){if(t instanceof Ig){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 Lg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Ig?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character,t.ascentDescentMode),new Og(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Fg=!1;try{Fg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Fg=!1}const zg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...pp];class Hg extends Ep{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=pd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return zp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1)))}static splitText(t){if(Fg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Hg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),oh.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Hg.AllSingleCharacter(y)&&(y=Hg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Pg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Hg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Hg.NOWORK_ANIMATE_ATTR}}function jg(t){return new Hg(t)}Hg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);class Ng extends Qp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ug(t){return new Ng(t)}const Vg=["symbolType","size",...pp];let Wg=class t extends Ep{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=fd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return zp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Gc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Al).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Al).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Gg(t){return new Wg(t)}function Yg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Xg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Kg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);class $g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Tl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=md}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return zp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Zg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=oh.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Gc(n,o/Math.abs(r+a),!0,l),i.union(n)}return oh.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new $g(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new $g(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Yg(y,a),e=this.cache.verticalList.length*v,i=Xg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>$c(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Kc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Yg(y,a),A=x.verticalList.length*v,k=Xg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=qg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=qg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Zg.baselineMapAlign}getAlignMapBaseline(){return Zg.alignMapBaseline}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),Zg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Zg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Qg=["heightLimit","lineClamp"];class tf extends Zg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new $g(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 uf extends df{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let pf=0;class gf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=oh.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++pf,t),this.tryRunAnimationFrameNextFrame(),pf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class ff{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var mf=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 vf extends ff{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new uf(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return mf(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class yf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Td(Object.assign({nativeCanvas:oh.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Td(Object.assign({nativeCanvas:oh.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const _f=new yf,bf=Symbol.for("VWindow"),xf=Symbol.for("WindowHandlerContribution");function Sf(t){const e=oh.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Af extends ff{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(t=oh.global,e=Sf){super(),this.handlerFactory=e,this.hooks={onChange:new uf(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class kf{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=oh.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=_f.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=oh.windowFactory)||void 0===s?void 0:s.call(oh))&&void 0!==n?n:new Af(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var Cf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Cf||(Cf={}));const Tf=new Ge;class Mf{constructor(){this.matrix=new Ge}init(t){return this.mode=Cf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Cf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}scale(t,e,i){return this.mode===Cf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Cf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Tf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}translate(t,e){return this.mode===Cf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Cf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const wf=Symbol.for("@visactor/vrender-core/factory-state");function Ef(){const t=globalThis;return t[wf]||(t[wf]={pluginClasses:{}}),t[wf]}class Bf{constructor(){this.global=oh.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Pf=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 Rf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Of(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Ff{constructor(){this.time=So.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(jf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=zp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Kf(t,e,i,s)}}const zf=new Ff,Hf=new Set(["top","center","bottom"]);function jf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Nf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Uf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Uf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Nf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Gf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Hf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Yf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Xf(t){if(!t)return null;const e=Yf(t.naturalWidth,t.videoWidth,t.width),i=Yf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Kf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Xf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Gf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=_f.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),_f.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class $f{constructor(t){this.subRenderContribitions=t,this.time=So.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)}))}}class qf{constructor(){this.time=So.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Zf=new qf;class Jf{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Qf=new Jf,tm={getContributions:()=>[]};class em{constructor(t=[],e=tm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Of(e,Nl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:oh.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:tm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Su.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lf(e,i,Nl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Su.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),Su.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||function(){const t=oh.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class sm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class nm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class am{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const om={getContributions:()=>[]};class lm{constructor(t=om,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new rm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class hm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class cm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=oh.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=oh.global.getRequestAnimationFrame();this.rafId=t((()=>{oh.global.devicePixelRatio!==this.dpr&&(this.dpr=oh.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=oh.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class dm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oh.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const um=new Ve;class pm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&vo.UPDATE_PAINT)||s._updateTag&vo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(um.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(um,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let gm;function fm(){if(null==gm)try{const t=document.createElement("canvas"),e=t.getContext("2d");gm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),gm&&(gm=!!document.createElement)}catch(t){gm=!1}}function mm(){fm();const t=oh.global&&oh.global.env;return t?"browser"===t:gm}function vm(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(au(t),cu(t,t,[n+o,r+l,a+h]),cu(t,t,[y[0],y[1],y[2]]),ou(t,t,g),lu(t,t,p),cu(t,t,[-y[0],-y[1],y[2]]),uu(t,t,[c,d,u]),f){const i=Au.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]}cu(i,i,[s[0],s[1],0]),hu(i,i,f),cu(i,i,[-s[0],-s[1],0]),pu(t,t,i)}}function ym(t){const{alpha:e,beta:i}=t.attribute;return e||i}class _m{constructor(t=lf){this.creator=t,this.hooks={onAttributeUpdate:new uf(["graphic"]),onSetStage:new uf(["graphic","stage"]),onRemove:new uf(["graphic"]),onRelease:new uf(["graphic"]),onAddIncremental:new uf(["graphic","group","stage"]),onClearIncremental:new uf(["graphic","group","stage"]),beforeUpdateAABBBounds:new uf(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uf(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uf(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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=Xg(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=Yg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Gc(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;Gc(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&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const bm="white";class xm extends Qp{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:bm}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new uf(["stage"]),afterRender:new uf(["stage"]),afterClearScreen:new uf(["stage"]),afterClearRect:new uf(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:oh.global,!this.global.env&&mm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:oh.windowFactory)&&void 0!==n?n:()=>new Af(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=oh.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=oh.renderServiceFactory)||void 0===h?void 0:h.call(oh))&&void 0!==c?c:oh.renderService)&&void 0!==d?d:new im,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=oh.pluginServiceFactory)||void 0===p?void 0:p.call(oh))&&void 0!==g?g:oh.pluginService)&&void 0!==f?f:new lm,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:oh.layerService)&&void 0!==v?v:new Mm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:oh.graphicService)&&void 0!==b?b:new _m,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:bm,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,ap(s)),cp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new io(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=Cm.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=Cm.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Cm.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new hm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new cm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new dm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new pm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Cm.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Cm.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Cm.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return ap({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class Sm{constructor(t=xm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Am extends Qp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oh.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=>{oh.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)))}}class km{constructor(t=Am){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let Cm=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Tm(t){const e=oh.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}Cm._pluginClasses=Ef().pluginClasses;class Mm{static GenerateLayerId(){return`${Mm.idprefix}_${Mm.prefix_count++}`}constructor(t=oh.global,e=new km,i=Tm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Mm.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)}}Mm.idprefix="visactor_layer",Mm.prefix_count=0;const wm=Symbol.for("TransformUtil"),Em=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Pm=Symbol.for("StaticLayerHandlerContribution"),Rm=Symbol.for("DynamicLayerHandlerContribution"),Om=Symbol.for("VirtualLayerHandlerContribution"),Im=Symbol.for("@visactor/vrender-core/contribution-store-state");function Lm(){const t=globalThis;return t[Im]||(t[Im]={store:new Map}),t[Im]}const Dm=Symbol("ContributionProvider");class Fm{constructor(t,e){this.serviceIdentifier=t,this.container=e,Nm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function zm(t,e){return new Fm(t,e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).inSingletonScope().whenTargetNamed(e)}function jm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).whenTargetNamed(e)}class Nm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}Nm.store=Lm().store;class Um{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=th.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=wg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Um{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Gm({bind:t}){t(yg).toDynamicValue((({container:t})=>new vf(zm(vg,t)))).inSingletonScope(),t(bf).to(Af),t(Em).toDynamicValue((({container:t})=>new kf(zm(Vm,t)))).inSingletonScope(),t(wm).to(Mf).inSingletonScope(),t(Bm).to(Mm).inSingletonScope()}const Ym=Symbol.for("RenderService"),Xm=Symbol.for("BeforeRenderConstribution");function Km({bind:t}){t(Ym).to(im)}const $m=Symbol.for("GraphicPicker"),qm=Symbol.for("PickerService"),Zm=Symbol.for("BoundsPicker"),Jm=Symbol.for("GlobalPickerService"),Qm=Symbol.for("PickItemInterceptor"),tv=Symbol.for("PickServiceInterceptor"),ev=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ed,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},iv=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class sv extends fg{constructor(t){super(t),this.type="rect3d",this.numberType=ud}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return zp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,rv)}needUpdateTag(t){return super.needUpdateTag(t,rv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Al,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new av(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return av.NOWORK_ANIMATE_ATTR}}function ov(t){return new av(t)}av.NOWORK_ANIMATE_ATTR=Cp;class lv extends Up{constructor(t){super(t),this.type="arc3d",this.numberType=ed}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return lv.NOWORK_ANIMATE_ATTR}}function hv(t){return new lv(t)}lv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);class cv extends dg{constructor(t){super(t),this.type="pyramid3d",this.numberType=cd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return cv.NOWORK_ANIMATE_ATTR}}function dv(t){return new cv(t)}let uv,pv;function gv(t){return uv||(uv=cf("text",{})),uv.initAttributes(t),uv.AABBBounds}function fv(t){return pv||(pv=cf("richtext",{})),pv.setAttributes(t),pv.AABBBounds}cv.NOWORK_ANIMATE_ATTR=Cp;class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class vv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=zp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Su.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class _v{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=ev(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function bv({bind:t,isBound:e}){e(qm)||(t(Jm).toSelf(),t(qm).toService(Jm)),t(_v).toSelf().inSingletonScope(),t(Qm).toService(_v),t(vv).toSelf().inSingletonScope(),t(Qm).toService(vv),t(yv).toSelf().inSingletonScope(),t(Qm).toService(yv),Hm(t,Qm),t(mv).toSelf().inSingletonScope(),t(tv).toService(mv),Hm(t,tv)}function xv({bind:t}){t(vd).to(_m),t(yd).toConstantValue(lf)}const Sv=Symbol.for("AutoEnablePlugins"),Av=Symbol.for("PluginService");class kv{constructor(){this.type="static",this.offscreen=!1,this.global=oh.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Td({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()}}function Cv(t){(function({bind:t}){Hm(t,vg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),Hm(t,Vm)}({bind:t.bind}),function({bind:t}){t(kv).toSelf(),t(Pm).toService(kv)}({bind:t.bind})}const Tv=Ht/2;function Mv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Tv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Tv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Tv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Tv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function wv(t,e){return!(!t&&!e)}function Ev(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Pv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Rv(t,e){return t*e>0}function Ov(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Iv(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*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Fv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=Lv(g,f,u,p,n,t,Number(c)),l=Lv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=Lv(S,A,b,x,r,-n,Number(c)),l=Lv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const zv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Hv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=_f.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])),_f.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,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=_f.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Gg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:zv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=_f.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),_f.free(l),c}_f.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const jv=new Hv;class Nv{constructor(){this.time=So.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:nu(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Fv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Uv=new Nv,Vv=jv,Wv=zf;class Gv{constructor(){this.time=So.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Yv=new Gv,Xv=jv,Kv=zf;class $v extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(jf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const qv=new $v;function Zv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Jv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:nu(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Mv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class Qv{constructor(){this.time=So.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;Zv(p)&&(u.doStroke=!1)}}class ty{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Zv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Mv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ey=new Jv,iy=jv,sy=zf;class ny extends Jv{constructor(){super(...arguments),this.time=So.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)}}const ry=new ny,ay=zf;class oy{constructor(){this.time=So.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class ly{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const hy=new oy,cy=new ly,dy=jv,uy=zf,py=jv,gy=zf;class fy extends Hv{constructor(){super(...arguments),this.time=So.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:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class my{constructor(t){this.groupRenderContribitions=t,this.numberType=rd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:zp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Pv(p,m,g,f,c),w=Ov(p,v,g,f),E=wv(c,u),B=Ev(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Mv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===So.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===So.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=oh.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=zp(t,null==s?void 0:s.theme).group,i=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(i,p||i,n),a.modelMatrix=i,Au.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Au.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var vy,yy=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"}(vy||(vy={}));class _y extends em{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=vy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uf([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return yy(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:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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 yy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return yy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>yy(this,void 0,void 0,(function*(){if(2!==t.count)yield If(t,Nl.zIndex,((i,s)=>{if(this.status===vy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return yy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return yy(this,void 0,void 0,(function*(){this.rendering&&(this.status=vy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=vy.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 yy(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:()=>yy(this,void 0,void 0,(function*(){yield If(t,Nl.zIndex,(t=>yy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const by=Symbol.for("IncrementalDrawContribution"),xy=Symbol.for("ArcRender"),Sy=Symbol.for("Arc3dRender"),Ay=Symbol.for("AreaRender"),ky=Symbol.for("CircleRender"),Cy=Symbol.for("GraphicRender"),Ty=Symbol.for("GroupRender"),My=Symbol.for("LineRender"),wy=Symbol.for("PathRender"),Ey=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Py=Symbol.for("Rect3DRender"),Ry=Symbol.for("SymbolRender"),Oy=Symbol.for("TextRender"),Iy=Symbol.for("RichTextRender"),Ly=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Fy=Symbol.for("ImageRender"),zy=Symbol.for("RenderSelector"),Hy=Symbol.for("DrawContribution"),jy=Symbol.for("StarRender"),Ny=Symbol.for("DrawItemInterceptor"),Uy=new Ve,Vy=new Ve;class Wy{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){Uy.copy(s.dirtyBounds),Vy.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,Su.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Uy),s.backupDirtyBounds.copy(Vy)),!0}}class Gy{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}}class Yy{constructor(){this.order=1,this.interceptors=[new Wy,new Ky,new Xy,new Gy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Au.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const $y=Symbol.for("ArcRenderContribution"),qy=Symbol.for("AreaRenderContribution"),Zy=Symbol.for("CircleRenderContribution"),Jy=Symbol.for("GroupRenderContribution"),Qy=Symbol.for("ImageRenderContribution"),t_=Symbol.for("PathRenderContribution"),e_=Symbol.for("PolygonRenderContribution"),i_=Symbol.for("RectRenderContribution"),s_=Symbol.for("SymbolRenderContribution"),n_=Symbol.for("TextRenderContribution"),r_=Symbol.for("StarRenderContribution"),a_=Symbol.for("CommonRenderContribution"),o_=Symbol.for("InteractiveSubRenderContribution");function l_(t){!function({bind:t}){t(Ff).toSelf().inSingletonScope(),t(Hv).toSelf().inSingletonScope(),t(Hy).to(em),t(by).to(_y),t(Ty).toDynamicValue((({container:t})=>new my(zm(Jy,t)))).inSingletonScope(),t(Cy).toService(Ty),Hm(t,Jy),Hm(t,o_),t($f).toDynamicValue((({container:t})=>new $f(zm(o_,t)))).inSingletonScope(),Hm(t,Cy),t(Yy).toSelf().inSingletonScope(),t(Ny).toService(Yy),Hm(t,Ny)}({bind:t.bind})}class h_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class c_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new h_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function d_(){return new c_}const u_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const p_=function(){const t=globalThis;return t[u_]||(t[u_]={legacyBindingContext:d_(),preloaded:!1}),t[u_]}(),g_=p_.legacyBindingContext;function f_(){p_.preloaded||(p_.preloaded=!0,Gm({bind:g_.bind}),xv({bind:g_.bind}),Km({bind:g_.bind}),bv({bind:g_.bind,isBound:g_.isBound}),function({bind:t}){t(Av).to(lm),jm(t,Sv)}({bind:g_.bind}),Cv(g_),l_(g_))}function m_(){return g_}function v_(t){f_();const[e]=g_.getAll(t);return e}function y_(t,e){return f_(),g_.getNamed(t,e)}function __(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const b_=__((()=>v_(yg)));oh.global=b_;class x_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?oh.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:oh.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Kg("text"===t.type&&t.attribute?t.attribute:zp(t).text)}getTransformOfText(t){const e=zp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=oh.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));oh.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===oh.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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&&oh.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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"===oh.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 S_=()=>{Cm.registerPlugin("HtmlAttributePlugin",x_)};class A_ extends x_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?oh.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&oh.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const k_=()=>{Cm.registerPlugin("ReactAttributePlugin",A_)};class C_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return C_.instance||(C_.instance=new C_),C_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function T_(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function M_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:w_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=T_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:w_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=T_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const O=i*x+B;O>0&&E.wait(O);let I=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(E,e,p,L);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=T_(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:w_.builtInAnimateMap[r],m=t.custom?t.customType:T_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{M_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}w_.builtInAnimateMap={};const E_="appear",B_="disappear",P_="update",R_="highlight",O_="unhighlight";class I_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class L_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyHighlightState(t,e){this.applyState([R_],[{name:R_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([O_],[{name:O_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new L_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new I_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class F_{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-F_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*F_.bounceIn(2*t):.5*F_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){F_[t]=e}}function z_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}F_.quadIn=F_.getPowIn(2),F_.quadOut=F_.getPowOut(2),F_.quadInOut=F_.getPowInOut(2),F_.cubicIn=F_.getPowIn(3),F_.cubicOut=F_.getPowOut(3),F_.cubicInOut=F_.getPowInOut(3),F_.quartIn=F_.getPowIn(4),F_.quartOut=F_.getPowOut(4),F_.quartInOut=F_.getPowInOut(4),F_.quintIn=F_.getPowIn(5),F_.quintOut=F_.getPowOut(5),F_.quintInOut=F_.getPowInOut(5),F_.backIn=F_.getBackIn(1.7),F_.backOut=F_.getBackOut(1.7),F_.backInOut=F_.getBackInOut(1.7),F_.elasticIn=F_.getElasticIn(1,.3),F_.elasticOut=F_.getElasticOut(1,.3),F_.elasticInOut=F_.getElasticInOut(1,.3*1.5),F_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),F_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},F_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)F_[`flicker${t}`]=e=>z_(e,t);for(let t=2;t<10;t++)F_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function H_(t,e,i){return t+(e-t)*i}const j_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=H_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=H_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=H_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=H_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=H_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=H_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=H_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=H_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=H_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ru(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?zu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ru(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?zu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=H_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=H_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=H_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=H_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=H_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=H_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=H_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function N_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:_o.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=F_[s])&&void 0!==n?n:F_.linear:F_.linear,"wait"===t&&(this.onUpdate=Z_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=Z_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Bu.Get(i,Eu.Color255),r=Bu.Get(s,Eu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(j_["fill"===e?"fillPure":"strokePure"])}else j_[e]?t.push(j_[e]):t.push(N_)}else j_[e]?t.push(j_[e]):t.push(N_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tb extends Q_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();$_(this.target,t,_o.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class eb extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ib=new eb;ib.isGlobal=!0;class sb extends Q_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class nb extends sb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class rb extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class ab extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){$_(this.target,this.from,_o.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ob(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class cb{constructor(t=Va.GenAutoIncrementId(),e=ib,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(hb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new Q_(El.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tb(El.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new ab(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(hb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&$_(this.target,this._startProps,_o.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const db=new gf;class ub{constructor(){this.released=!1}tick(t,e){db.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class pb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===wl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=wl.INITIAL,oh.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),oh.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new ub;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==wl.INITIAL&&(this.status=wl.PAUSE,!0)}resume(){return this.status!==wl.INITIAL&&(this.status=wl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=wl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===wl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===wl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,oh.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function fb(){G(Ep,D_),G(Ep,gb)}function mb(){hf("arc",Vp)}function vb(){hf("arc3d",hv)}function yb(){hf("area",Yp)}function _b(){hf("circle",$p)}function bb(){hf("glyph",Zp)}function xb(){hf("group",tg)}function Sb(){hf("image",sg)}function Ab(){hf("line",ag)}function kb(){hf("path",hg)}function Cb(){hf("polygon",ug)}function Tb(){hf("pyramid3d",dv)}function Mb(){hf("rect",mg)}function wb(){hf("rect3d",nv)}function Eb(){hf("richtext",jg)}function Bb(){hf("shadowRoot",Ug)}function Pb(){hf("star",ov)}function Rb(){hf("symbol",Gg)}function Ob(){hf("text",Jg)}function Ib(){hf("wrapText",ef)}function Lb(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Fb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Zf),e(Qf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===So.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===So.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=zp(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=Bv(d,u,h),_=Rv(d,g),b=wv(h),x=Ev(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return wo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Rv(o,c),g=wv(n,r),f=Ev(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||ym(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Au.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Au.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class zb extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=td,this.builtinContributions=[Uv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=Lv(v,y,f,m,n,t,Number(u)),o=Lv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=Lv(C,T,A,k,r,-n,Number(u)),o=Lv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Gu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const Hb=new WeakSet;function jb({bind:t}){Lb(Hb,t)||(t(zb).toDynamicValue((({container:t})=>new zb(zm($y,t)))).inSingletonScope(),t(xy).toService(zb),t(Cy).toService(xy),t($y).toService($f),Hm(t,$y))}const Nb=jb;class Ub extends Fb{constructor(){super(...arguments),this.numberType=ed}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Eu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Lb(Vb,t)||(t(Ub).toDynamicValue((()=>new Ub)).inSingletonScope(),t(Sy).toService(Ub),t(Cy).toService(Sy))}const Gb=Wb;function Yb(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 Xb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?bo.ROW:bo.COLUMN,Number.isFinite(c)||(o=bo.COLUMN),Number.isFinite(d)||(o=bo.ROW);const u=i*(o===bo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Yb(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),Yb(t,l,1,s),o=!1):o=!0}t.closePath()}function $b(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function qb(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=$b(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Yb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=bo.ROW:"y"===s?u=bo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Jb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Qb=new fy,tx=zf;class ex extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Qb,tx],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=zp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,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=Sl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Sl(e,E,{curveTension:b}),n=Sl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=bo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?bo.ROW:null==y.y1?bo.COLUMN:Number.isFinite(S+A)?S>A?bo.ROW:bo.COLUMN:bo.ROW,Xb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),qb(t,i[0]?e.top:e.bottom,l,x===bo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ix=new WeakSet;function sx({bind:t}){Lb(ix,t)||(t(ex).toDynamicValue((({container:t})=>new ex(zm(qy,t)))).inSingletonScope(),t(Ay).toService(ex),t(Cy).toService(Ay),t(qy).toService($f),Hm(t,qy))}const nx=sx;class rx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[Yv,Kv,Xv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const ax=new WeakSet;function ox({bind:t}){Lb(ax,t)||(t(rx).toDynamicValue((({container:t})=>new rx(zm(Zy,t)))).inSingletonScope(),t(ky).toService(rx),t(Cy).toService(ky),t(Zy).toService($f),Hm(t,Zy))}const lx=ox;class hx{constructor(){this.numberType=nd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=zp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const cx=new WeakSet;function dx({bind:t}){Lb(cx,t)||(t(hx).toDynamicValue((()=>new hx)).inSingletonScope(),t(Dy).toService(hx),t(Cy).toService(Dy))}const ux=dx,px=["","repeat-x","repeat-y","repeat"];function gx(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?px[i]:"no-repeat"}function fx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=gx(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const mx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function vx(t){return{backgroundMode:mx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function yx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=fx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function _x(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=fx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?vx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Kf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class bx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ad,this.builtinContributions=[ry,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Mv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),_x(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=yx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,T,!1,k,!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&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=zp(t).image;this._draw(t,a,!1,i)}}const xx=new WeakSet;function Sx({bind:t}){Lb(xx,t)||(t(Fy).toDynamicValue((({container:t})=>new bx(zm(Qy,t)))).inSingletonScope(),t(Cy).toService(Fy),t(Qy).toService($f),Hm(t,Qy))}const Ax=Sx;class kx extends Fb{constructor(){super(...arguments),this.numberType=od}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();qb(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Sl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const Cx=new WeakSet;function Tx({bind:t}){Lb(Cx,t)||(t(kx).toDynamicValue((()=>new kx)).inSingletonScope(),t(My).toService(kx),t(Cy).toService(My))}const Mx=Tx,Ex=jv,Bx=zf;class Px extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ld,this.builtinContributions=[Bx,Ex],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:zp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)wo(t.pathShape.commandList,e,i,s,1,1,f);else{wo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Rx=new WeakSet;function Ox({bind:t}){Lb(Rx,t)||(t(Px).toDynamicValue((({container:t})=>new Px(zm(t_,t)))).inSingletonScope(),t(wy).toService(Px),t(Cy).toService(wy),t(t_).toService($f),Hm(t,t_))}const Ix=Ox;function Lx(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Lx(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lx(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Fx(h,y,_,d,u),A=Fx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=Dx(k,C),M=Fx(h,Dx(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const Nx=new WeakSet;function Ux({bind:t}){Lb(Nx,t)||(t(Ey).toDynamicValue((({container:t})=>new jx(zm(e_,t)))).inSingletonScope(),t(Cy).toService(Ey),t(e_).toService($f),Hm(t,e_))}const Vx=Ux;class Wx extends Fb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Eu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Gx extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=cd}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=zp(t).polygon;this._draw(t,s,!1,i)}}const Yx=new WeakSet;function Xx({bind:t}){Lb(Yx,t)||(t(Gx).toDynamicValue((()=>new Gx)).inSingletonScope(),t(Ly).toService(Gx),t(Cy).toService(Ly))}const Kx=Xx;class $x extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=dd,this.builtinContributions=[ey,sy,iy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Pv(g,f,T,M,h),E=Ov(g,v,T,M,C),B=wv(h,c),P=Ev(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Mv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const qx=new WeakSet;function Zx({bind:t}){Lb(qx,t)||(t($x).toDynamicValue((({container:t})=>new $x(zm(i_,t)))).inSingletonScope(),t(By).toService($x),t(Cy).toService(By),t(ty).toSelf(),t(Qv).toSelf(),t(i_).toService(ty),t(i_).toService(Qv),t(i_).toService($f),Hm(t,i_))}const Jx=Zx;class Qx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=ud}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=zp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Pv(v,y,A,k,d),M=Ov(v,b,A,k,S),w=wv(d),E=Ev(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=zp(t).rect;this._draw(t,s,!1,i)}}const tS=new WeakSet;function eS({bind:t}){Lb(tS,t)||(t(Qx).toDynamicValue((()=>new Qx)).inSingletonScope(),t(Py).toService(Qx),t(Cy).toService(Py))}const iS=eS;const sS=new class extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=gv(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 i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),O?Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,O?(Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),D()}};class nS extends Fb{constructor(){super(),this.numberType=pd,this.builtinContributions=[sS],this.init()}drawShape(t,e,i,s,n){const r=zp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=zp(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(),Mv(e,i-t,s-n,v,y,f,!0)),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=zp(t).richtext;this._draw(t,s,!1,i)}}const rS=new WeakSet;function aS({bind:t}){Lb(rS,t)||(t(nS).toDynamicValue((()=>new nS)).inSingletonScope(),t(Iy).toService(nS),t(Cy).toService(Iy))}const oS=aS;class lS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[gy,py],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const hS=new WeakSet;function cS({bind:t}){Lb(hS,t)||(t(lS).toDynamicValue((({container:t})=>new lS(zm(r_,t)))).inSingletonScope(),t(jy).toService(lS),t(Cy).toService(jy),Hm(t,r_))}const dS=cS;class uS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[hy,uy,dy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:zp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const pS=new WeakSet;function gS({bind:t}){Lb(pS,t)||(t(uS).toDynamicValue((({container:t})=>new uS(zm(s_,t)))).inSingletonScope(),t(Ry).toService(uS),t(Cy).toService(Ry),t(s_).toService($f),Hm(t,s_))}const fS=gS;class mS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[sS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=zp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Su.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Su.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Yg(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const vS=new WeakSet;function yS({bind:t}){Lb(vS,t)||(t(Oy).toDynamicValue((({container:t})=>new mS(zm(n_,t)))).inSingletonScope(),t(Cy).toService(Oy),t(n_).toService($f),Hm(t,n_))}const _S=yS,bS=mm();function xS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function SS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const AS=Symbol.for("MathPickerContribution"),kS=Symbol.for("MathArcPicker"),CS=Symbol.for("MathAreaPicker"),TS=Symbol.for("MathCirclePicker"),MS=Symbol.for("MathImagePicker"),wS=Symbol.for("MathLinePicker"),ES=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),PS=Symbol.for("MathSymbolPicker"),RS=Symbol.for("MathTextPicker"),OS=Symbol.for("MathPolygonPicker"),IS=Symbol.for("MathGlyphPicker"),LS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),FS=Symbol.for("CanvasArc3dPicker"),zS=Symbol.for("CanvasAreaPicker"),HS=Symbol.for("CanvasCirclePicker"),jS=Symbol.for("CanvasImagePicker"),NS=Symbol.for("CanvasGifImagePicker"),US=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),GS=Symbol.for("CanvasRectPicker"),YS=Symbol.for("CanvasRect3dPicker"),XS=Symbol.for("CanvasSymbolPicker"),KS=Symbol.for("CanvasTextPicker"),$S=Symbol.for("CanvasPolygonPicker"),qS=Symbol.for("CanvasPyramid3dPicker"),ZS=Symbol.for("CanvasRichTextPicker"),JS=Symbol.for("CanvasGlyphPicker"),QS=Symbol.for("CanvasGroupPicker"),tA=Symbol.for("CanvasStarPicker"),eA=Symbol.for("CanvasPickerContribution"),iA=m_(),sA=__((()=>v_(Em))),nA=__((()=>v_(wm))),rA=__((()=>v_(vd))),aA=__((()=>v_(Bm)));function oA(){oh.global=b_,oh.graphicUtil=sA,oh.transformUtil=nA,oh.graphicService=rA,oh.layerService=aA,oh.canvasFactory=t=>y_(kd,t),oh.context2dFactory=t=>y_(Cd,t),oh.windowFactory=()=>new Af(oh.global),oh.windowHandlerFactory=t=>function(t){const e=y_(xf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),oh.renderServiceFactory=()=>v_(Ym),oh.renderService=__((()=>v_(Ym))),oh.pluginServiceFactory=()=>v_(Av),oh.pluginService=__((()=>v_(Av))),oh.pickerServiceFactory=()=>v_(qm),oh.layerHandlerFactory=t=>v_("static"===t?Pm:"dynamic"===t?Rm:Om),oh.incrementalDrawContributionFactory=()=>v_(by)}oA();var lA=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 hA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return lA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class cA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class dA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Eu.Color1),this.ambient=i;const s=$t(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=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Bu.Get(e,Eu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const uA=()=>{Cm.registerPlugin("DirectionalLight",dA)};class pA{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=Au.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Au.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return gu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return fu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return mu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;mu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const gA=()=>{Cm.registerPlugin("OrthoCamera",pA)},fA={getContributions:()=>[]},mA={getContributions:()=>[]};class vA{constructor(t=fA,e=mA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:fA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:mA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=zp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=zp(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&&Au.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Su.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class yA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new sm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new nm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new am,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new rm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new Sm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new km,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new sf}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new im(new em([],(t=this.registry.contribution,e=Ny,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class _A{constructor(t={}){this.context=new yA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function bA(t={}){return new _A(t)}class xA extends _A{}class SA extends _A{}class AA extends ex{constructor(){super(...arguments),this.numberType=id}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=zp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=wv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=zp(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=Bv(u,p,c),y=Rv(u,g),_=wv(c),b=Ev(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{};function DA(){MA.preloaded||(MA.preloaded=!0,Gm({bind:wA.bind}),xv({bind:wA.bind}),Km({bind:wA.bind}),bv({bind:wA.bind,isBound:wA.isBound}),Cv(wA),l_(wA))}function FA(t,e){const i=NA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function zA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function HA(t,e){let i=PA.get(t);i||(i=new Map,PA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function jA(t,e,i){const s=HA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function NA(){return DA(),wA}function UA(){Nm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=MA.runtimeGlobal)&&void 0!==t||(MA.runtimeGlobal=new vf(zm(vg,wA))),MA.runtimeGlobal}function WA(t){const e=NA(),i=VA();oh.global=i,oh.canvasFactory=t=>e.getNamed(kd,t),oh.context2dFactory=t=>e.getNamed(Cd,t),oh.windowHandlerFactory=t=>FA(xf,t),oh.windowFactory=()=>new Af(i,(t=>FA(xf,t))),oh.pluginServiceFactory=()=>new lm(zm(Sv,e),{pluginRegistry:t.context.registry.plugin}),oh.incrementalDrawContributionFactory=()=>new _y([],new kA,new AA(zm(qy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,Ny))}function GA(t){var e;const i=NA();UA();const s=i.getAll(Cy),n=HA(t.registry.renderer,EA);jA(t.registry.renderer,EA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),zA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,EA)}function YA(t){var e;const i=NA();UA();const s=i.getAll(Ny),n=null!==(e=RA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,Ny,e)})),n.clear(),RA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(Ny));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(Ny,e),r.add(e)),n.add(e)}))}function XA(t,e){var i;const s=NA();UA();const n=s.getAll(e),r=HA(t.registry.picker,BA);jA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),zA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function KA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=OA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,LA,t.isBound,t.rebind),function(t,e){let i=OA.get(t);i||(i=new WeakSet,OA.set(t,i)),i.add(e)}(t,e))}function $A(t,{app:e,legacy:i=!0,targets:s}={}){KA(NA(),t),i&&(f_(),KA(m_(),t)),UA(),e&&function(t,e){const i=null!=e?e:IA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&YA(t),s&&GA(t),r.forEach((e=>{XA(t,e)}))}(e,s)}function qA(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function ZA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function JA(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 QA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ok(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=pg(t.attribute),n=hk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=hk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=hk(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{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(;n{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 _k(l,e,h),h},fk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return pk(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 pk(t,e)}return[]};const mk=t=>t.map((t=>({x:t.x,y:t.y}))),vk=(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]},yk=t=>{const e=new Ue;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 vk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return vk(t,{x:e.x1,y:n},{x:e.x2,y:n})},_k=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=yk(t);_k(n[0],s,i),_k(n[1],e-s,i)}},bk=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:mk(i)}];const s=[];return _k(i,e,s),s},xk=(t,e)=>{const i=ak(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;rObject.assign({},t))):[]}function Ak(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:Sk(t.touches),configurable:!0},changedTouches:{value:Sk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function kk(t,e){try{return t[e]}catch(t){return}}function Ck(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Ak(t),l=kk(t,"target"),h=kk(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Tk=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Ek(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:wk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Tk(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=wk(i,this.selectionStartCursorIdx),a=wk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=Mk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Ek(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),oh.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),oh.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Pk{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=wk(i,Math.ceil(t)),n=wk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=wk(i.attribute.textConfig,a),h=wk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Rk,[this.formatTextCommandCb]),this.commandCbs.set(Ok,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(oh.global.isMacOS()&&t.metaKey&&"c"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return oh.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(oh.global.isMacOS()&&t.metaKey&&"a"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},Mk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=jg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:fv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||mg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},Mk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=tg({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Ik.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=ag({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=tg({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=fv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=fv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(mg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:fv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Qk=new Jk;class tC{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const eC=()=>{Cm.registerPlugin("ViewTransform3dPlugin",tC)},iC=new Ve;class sC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=zp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nC=()=>{Cm.registerPlugin("FlexLayoutPlugin",sC)};var rC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:rh,ARC3D_NUMBER_TYPE:ed,ARC_NUMBER_TYPE:td,AREA_NUMBER_TYPE:id,AbstractGraphicRender:class{},get AnimateMode(){return Ml},get AnimateStatus(){return Bl},get AnimateStepType(){return El},AppContext:yA,Application:nh,Arc:Up,Arc3d:lv,Arc3dRender:Sy,ArcRender:xy,ArcRenderContribution:$y,Area:Gp,AreaRender:Ay,AreaRenderContribution:qy,get AttributeUpdateType(){return _o},AutoEnablePlugins:Sv,Base3dRender:Wx,BaseCanvas:wu,BaseEnvContribution:hA,BaseRender:Fb,get BaseRenderContributionTime(){return So},BaseWindowHandlerContribution:cA,Basis:$o,BeforeRenderConstribution:Xm,BoundsContext:no,BoundsPicker:Zm,BrowserEntry:_A,CIRCLE_NUMBER_TYPE:sd,CONTRIBUTION_STORE_STATE_SYMBOL:Im,Canvas3DDrawItemInterceptor:Ky,Canvas3DPickItemInterceptor:_v,CanvasFactory:kd,CanvasTextLayout:$g,Circle:Kp,CircleRender:ky,CircleRenderContribution:Zy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Eu},CommonDrawItemInterceptorContribution:Yy,CommonRenderContribution:a_,Context2dFactory:Cd,ContributionProvider:Dm,ContributionRegistry:am,ContributionStore:Nm,CubicBezierCurve:zo,CurveContext:xl,get CurveTypeEnum(){return xo},CustomEvent:qa,CustomPath2D:Al,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:_g,DebugDrawItemInterceptorContribution:Gy,DefaultArcAllocate:zk,DefaultArcAttribute:Ul,DefaultArcRenderContribution:Nv,DefaultAreaAllocate:jk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:fy,DefaultAttribute:Nl,DefaultBaseBackgroundRenderContribution:Ff,DefaultBaseClipRenderAfterContribution:Jf,DefaultBaseClipRenderBeforeContribution:qf,DefaultBaseInteractiveRenderContribution:$f,DefaultBaseTextureRenderContribution:Hv,DefaultCanvasAllocate:yf,DefaultCanvasArc3DRender:Ub,DefaultCanvasArcRender:zb,DefaultCanvasAreaRender:ex,DefaultCanvasCircleRender:rx,DefaultCanvasGroupRender:my,DefaultCanvasImageRender:bx,DefaultCanvasLineRender:kx,DefaultCanvasPathRender:Px,DefaultCanvasPolygonRender:jx,DefaultCanvasPyramid3dRender:Gx,DefaultCanvasRect3dRender:Qx,DefaultCanvasRectRender:$x,DefaultCanvasSymbolRender:uS,DefaultCanvasTextRender:mS,DefaultCircleAllocate:Uk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Gv,DefaultConnectAttribute:Hl,DefaultDebugAttribute:jl,DefaultFillStyle:Ol,DefaultGlobal:vf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Yl,DefaultGraphicAllocate:Lk,DefaultGraphicMemoryManager:Jk,DefaultGraphicService:_m,DefaultGraphicUtil:kf,DefaultGroupAttribute:Gl,DefaultGroupBackgroundRenderContribution:$v,DefaultImageAttribute:ih,DefaultImageRenderContribution:ny,DefaultLayerService:Mm,DefaultLayout:Pl,DefaultLineAllocate:Wk,DefaultLineAttribute:Xl,DefaultMat4Allocate:xu,DefaultMatrixAllocate:bu,DefaultPathAllocate:Yk,DefaultPathAttribute:Kl,DefaultPickService:vA,DefaultPickStyle:Fl,DefaultPolygonAttribute:$l,DefaultRect3dAttribute:Jl,DefaultRectAllocate:Dk,DefaultRectAttribute:Zl,DefaultRectRenderContribution:Jv,DefaultRenderService:im,DefaultRichTextAttribute:eh,DefaultRichTextIconAttribute:sh,DefaultStarAttribute:ql,DefaultStrokeStyle:Ll,DefaultStyle:zl,DefaultSymbolAllocate:Kk,DefaultSymbolAttribute:Ql,DefaultSymbolClipRangeStrokeRenderContribution:ly,DefaultSymbolRenderContribution:oy,DefaultTextAllocate:qk,DefaultTextAttribute:th,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Rl,DefaultTransformUtil:Mf,DefaultWindow:Af,get Direction(){return bo},DirectionalLight:dA,DrawContribution:Hy,DrawItemInterceptor:Ny,DynamicLayerHandlerContribution:Rm,get Edge(){return ch},EditModule:Bk,EmptyContext2d:Tu,EnvContribution:vg,EventManager:Qa,EventSystem:io,EventTarget:to,FACTORY_STATE_SYMBOL:wf,FORMAT_ALL_TEXT_COMMAND:Ok,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Rk,Factory:Cm,FederatedEvent:Ya,FederatedMouseEvent:Xa,FederatedPointerEvent:Ka,FederatedWheelEvent:$a,FlexLayoutPlugin:sC,GLYPH_NUMBER_TYPE:nd,GRAPHIC_CLASS_SYMBOL:Mp,GRAPHIC_REGISTRY_SYMBOL:rf,GRAPHIC_UPDATE_TAG_KEY:pp,GROUP_NUMBER_TYPE:rd,Generator:Va,GlobalPickerService:Jm,Glyph:qp,GlyphRender:Dy,GradientParser:su,Graphic:Ep,GraphicCreator:yd,GraphicFactory:sf,GraphicPicker:$m,GraphicRender:Cy,GraphicService:vd,GraphicUtil:Em,Group:Qp,GroupRender:Ty,GroupRenderContribution:Jy,get GroupUpdateAABBBoundsMode(){return Jp},HtmlAttributePlugin:x_,get IContainPointMode(){return yo},IMAGE_NUMBER_TYPE:ad,Image:ig,ImageRender:Fy,ImageRenderContribution:Qy,IncrementalDrawContribution:by,InteractiveDrawItemInterceptorContribution:Xy,InteractivePickItemInterceptorContribution:yv,InteractiveSubRenderContribution:o_,LINE_NUMBER_TYPE:od,Layer:Am,LayerFactory:km,LayerService:Bm,Line:rg,LineRender:My,Linear:Go,LinearClosed:pl,Mat4Allocate:yu,MatrixAllocate:vu,get MeasureModeEnum(){return Tl},MiniappEntry:SA,MonotoneX:il,MonotoneY:sl,NOWORK_ANIMATE_ATTR:Cp,Node:Ga,NodeEntry:xA,OrthoCamera:pA,PATH_NUMBER_TYPE:ld,POLYGON_NUMBER_TYPE:hd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:cd,Path:lg,PathRender:wy,PathRenderContribution:t_,PerformanceRAF:gf,PickItemInterceptor:Qm,PickServiceInterceptor:tv,PickerRegistry:nm,PickerService:qm,PluginRegistry:rm,PluginService:Av,Polygon:dg,PolygonRender:Ey,PolygonRenderContribution:e_,Pyramid3d:cv,Pyramid3dRender:Ly,RECT3D_NUMBER_TYPE:ud,RECT_NUMBER_TYPE:dd,RICHTEXT_NUMBER_TYPE:pd,RUNTIME_INSTALLER_STATE_SYMBOL:CA,RafBasedSTO:Sh,ReactAttributePlugin:A_,Rect:fg,Rect3DRender:Py,Rect3d:sv,RectRender:By,RectRenderContribution:i_,ReflectSegContext:Uo,RenderSelector:zy,RenderService:Ym,RendererRegistry:sm,ResourceLoader:lh,RichText:Hg,RichTextEditPlugin:Ik,RichTextRender:Iy,STAR_NUMBER_TYPE:gd,get STATUS(){return wl},SVG_ATTRIBUTE_MAP:_d,SVG_ATTRIBUTE_MAP_KEYS:bd,SVG_PARSE_ATTRIBUTE_MAP:xd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Sd,SYMBOL_NUMBER_TYPE:fd,SegContext:No,ShadowPickServiceInterceptorContribution:mv,ShadowRoot:Ng,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:vv,SplitRectAfterRenderContribution:ty,SplitRectBeforeRenderContribution:Qv,Stage:xm,StageFactory:Sm,Star:av,StarRender:jy,StarRenderContribution:r_,StateDefinitionCompiler:$u,StateEngine:Qu,StaticLayerHandlerContribution:Pm,Step:ll,StepClosed:hl,Symbol:Wg,SymbolRender:Ry,SymbolRenderContribution:s_,TEXT_NUMBER_TYPE:md,Text:Zg,get TextDirection(){return Kc},TextMeasureContribution:Vm,TextRender:Oy,TextRenderContribution:n_,Theme:Dp,TransformUtil:wm,get UpdateTag(){return vo},VGlobal:yg,VWindow:bf,ViewTransform3dPlugin:tC,VirtualLayerHandlerContribution:Om,WILDCARD:"*",WindowHandlerContribution:xf,WrapText:tf,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Ou,addArcToBezierPath:To,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:rk,alignSubpath:QA,application:oh,applyTransformOnBezierCurves:ok,arc3dModule:Gb,arcModule:Nb,areaModule:nx,bezier:ko,bezierCurversToPath:lk,binarySplitPolygon:yk,bindArc3dRenderModule:Wb,bindArcRenderModule:jb,bindAreaRenderModule:sx,bindCircleRenderModule:ox,bindContributionProvider:Hm,bindContributionProviderNoSingletonScope:jm,bindGlyphRenderModule:dx,bindImageRenderModule:Sx,bindLineRenderModule:Tx,bindPathRenderModule:Ox,bindPolygonRenderModule:Ux,bindPyramid3dRenderModule:Xx,bindRect3dRenderModule:eS,bindRectRenderModule:Zx,bindRichtextRenderModule:aS,bindStarRenderModule:cS,bindSymbolRenderModule:gS,bindTextRenderModule:yS,boundStroke:Gc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Sl,calculateArcCornerRadius:Dv,calculateLineHeight:Ch,canvasAllocate:_f,centroidOfSubpath:ik,circleBounds:vh,circleModule:lx,clock:Za,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Nu,configureRuntimeApplicationForApp:WA,container:iA,cornerTangents:Lv,createApp:bA,createArc:Vp,createArc3d:hv,createArea:Yp,createBrowserApp:bA,createCanvasEventTransformer:function(t,e,i,s){return Ck(t.parentElement,e,i,s)},createCircle:$p,createColor:ru,createConicalGradient:Yu,createContributionProvider:zm,createEventTransformer:Ck,createGlyph:Zp,createGraphic:cf,createGroup:tg,createImage:sg,createLine:ag,createMat4:_u,createMiniappApp:function(t={}){return new SA(t)},createNodeApp:function(t={}){return new xA(t)},createPath:hg,createPolygon:ug,createPyramid3d:dv,createRect:mg,createRect3d:nv,createRectPath:Mv,createRichText:jg,createShadowRoot:Ug,createStage:function(t){return oA(),(new Sm).create(t)},createStar:ov,createSymbol:Gg,createText:Jg,createWrapText:ef,cubicCalc:Ro,cubicLength:Po,cubicPointAt:Oo,cubicSubdivide:JA,defaultArcAllocate:Hk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Uv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:Nk,defaultBaseBackgroundRenderContribution:zf,defaultBaseClipRenderAfterContribution:Qf,defaultBaseClipRenderBeforeContribution:Zf,defaultBaseTextureRenderContribution:jv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Kv,defaultCircleRenderContribution:Yv,defaultCircleTextureRenderContribution:Xv,defaultGraphicMemoryManager:Qk,defaultGroupBackgroundRenderContribution:qv,defaultImageBackgroundRenderContribution:ay,defaultImageRenderContribution:ry,defaultLineAllocate:Gk,defaultPathAllocate:Xk,defaultRectAllocate:Fk,defaultRectBackgroundRenderContribution:sy,defaultRectRenderContribution:ey,defaultRectTextureRenderContribution:iy,defaultStarBackgroundRenderContribution:gy,defaultStarTextureRenderContribution:py,defaultSymbolAllocate:$k,defaultSymbolBackgroundRenderContribution:uy,defaultSymbolClipRangeStrokeRenderContribution:cy,defaultSymbolRenderContribution:hy,defaultSymbolTextureRenderContribution:dy,defaultTextAllocate:Zk,diff:ZA,divideCubic:Fo,drawArc:Co,drawArcPath:Fv,drawAreaSegments:Xb,drawBackgroundImage:Kf,drawImageWithLayout:_x,drawIncrementalAreaSegments:Jb,drawIncrementalSegments:Zb,drawSegments:qb,enumCommandMap:lo,fillVisible:Bv,findBestMorphingRotation:nk,findConfigIndexByCursorIdx:wk,findCursorIdxByConfigIndex:Ek,findNextGraphic:Lf,flatten_simplify:qA,foreach:Of,foreachAsync:If,genBasisSegments:Zo,genBasisTypeSegments:qo,genLinearClosedSegments:gl,genLinearClosedTypeSegments:fl,genLinearSegments:Yo,genLinearTypeSegments:Xo,genMonotoneXSegments:rl,genMonotoneXTypeSegments:nl,genMonotoneYSegments:ol,genMonotoneYTypeSegments:al,genNumberType:Xc,genStepClosedSegments:ul,genStepSegments:cl,genStepTypeSegments:dl,getApplicationState:ah,getAttributeFromDefaultAttrList:xh,getBackgroundImage:jf,getConicGradientAt:Gu,getContributionStoreState:Lm,getCurrentEnv:function(){return mm()?"browser":"node"},getDefaultCharacterConfig:Mk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Yg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Au.allocate();return cu(o,o,[a[0],a[1],0]),n&&ou(o,o,n),s&&lu(o,o,s),cu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Ef,getGraphicClassState:wp,getGraphicRegistryState:af,getLegacyBindingContext:m_,getModelMatrix:vm,getRichTextBounds:fv,getRuntimeInstallerBindingContext:NA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:TA,getScaledStroke:nu,getTextBounds:gv,getTheme:zp,getThemeFromGroup:Hp,globalTheme:Fp,glyphModule:ux,graphicCreator:lf,graphicService:rA,graphicUtil:sA,identityMat4:au,imageModule:Ax,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:$A,installRuntimeDrawContributionsToApp:YA,installRuntimeGraphicRenderersToApp:GA,installRuntimePickersToApp:XA,interpolateColor:Ru,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Iu,interpolateGradientRadialColor:Lu,interpolatePureColorArray:Fu,interpolatePureColorArrayToStr:zu,intersect:Iv,isBrowserEnv:mm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){fm();const t=oh.global&&oh.global.env;return t?"node"===t:!gm},isSvg:Nc,isXML:Uc,layerService:aA,lineModule:Mx,lookAt:gu,mapToCanvasPointForCanvas:function(t){var e;if(Rd(t._canvasX)&&Rd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:du,mat4Allocate:Au,matrixAllocate:Su,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:pu,newThemeObj:Op,ortho:fu,parsePadding:gh,parseStroke:uh,parseSvgPath:mo,pathModule:Ix,pathToBezierCurves:ak,point:Ko,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:Vx,preLoadAllModule:f_,pyramid3dModule:Kx,quadCalc:Io,quadLength:Do,quadPointAt:Lo,rafBasedSto:Ah,rect3dModule:iS,rectFillVisible:Pv,rectModule:Jx,rectStrokeVisible:Ov,recursiveCallBinarySplit:_k,refreshRuntimeInstallerContributions:UA,registerArc3dGraphic:vb,registerArcGraphic:mb,registerAreaGraphic:yb,registerCircleGraphic:_b,registerDirectionalLight:uA,registerFlexLayoutPlugin:nC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:bb,registerGraphic:hf,registerGroupGraphic:xb,registerHtmlAttributePlugin:S_,registerImageGraphic:Sb,registerLineGraphic:Ab,registerOrthoCamera:gA,registerPathGraphic:kb,registerPolygonGraphic:Cb,registerPyramid3dGraphic:Tb,registerReactAttributePlugin:k_,registerRect3dGraphic:wb,registerRectGraphic:Mb,registerRichtextGraphic:Eb,registerShadowRootGraphic:Bb,registerStarGraphic:Pb,registerSymbolGraphic:Rb,registerTextGraphic:Ob,registerViewTransform3dPlugin:eC,registerWindowEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Ib,renderCommandList:wo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:vx,resolveBackgroundPosition:Gf,resolveBackgroundSizing:Nf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:fx,resolveImageRepeatMode:gx,resolveRenderableImageSize:Xf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:oS,rotateX:ou,rotateY:lu,rotateZ:hu,runFill:wv,runStroke:Ev,scaleMat4:uu,segments:Ao,shouldClipImageByLayout:yx,shouldUseMat4:ym,snapLength:Bo,splitArc:dk,splitArea:gk,splitCircle:uk,splitLine:fk,splitPath:xk,splitPolygon:bk,splitRect:ck,splitToGrids:hk,starModule:dS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Rv,symbolModule:fS,textAttributesToStyle:Kg,textDrawOffsetX:Yg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Xg,textModule:_S,transformMat4:mu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:nA,translate:cu,verticalLayout:$c,vglobal:b_,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oh.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)}))},wrapCanvas:Td,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.context2dFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Qc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Qc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class aC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:nu(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class oC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let lC=!1;function hC(t){lC||(lC=!0,t.bind(DS).toDynamicValue((()=>new oC(xS(t,xy)))).inSingletonScope(),t.bind(eA).toService(DS))}class cC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let dC=!1;function uC(t){dC||(dC=!0,t.bind(kS).toDynamicValue((()=>new cC(xS(t,xy)))).inSingletonScope(),t.bind(AS).toService(kS))}function pC(){if(pC.__loaded)return;pC.__loaded=!0;const t=m_();mb(),Nb({bind:t.bind}),bS?hC(t):uC(t)}pC.__loaded=!1;const gC=pC;class fC extends Fb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class mC extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ed,this.themeType="arc"}}let vC=!1;function yC(t){var e;vC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Sy))&&(vC=!0,t.bind(FS).toDynamicValue((()=>new mC(xS(t,Sy)))).inSingletonScope(),t.bind(eA).toService(FS))}function _C(){if(_C.__loaded)return;_C.__loaded=!0;const t=m_();vb(),uA(),gA(),Gb({bind:t.bind}),yC(t)}_C.__loaded=!1;const bC=_C;class xC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let SC=!1;function AC(t){SC||(SC=!0,t.bind(zS).toDynamicValue((()=>new xC(xS(t,Ay)))).inSingletonScope(),t.bind(eA).toService(zS))}class kC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let CC=!1;function TC(t){CC||(CC=!0,t.bind(CS).toDynamicValue((()=>new kC(xS(t,Ay)))).inSingletonScope(),t.bind(AS).toService(CS))}function MC(){if(MC.__loaded)return;MC.__loaded=!0;const t=m_();yb(),nx({bind:t.bind}),bS?AC(t):TC(t)}MC.__loaded=!1;const wC=MC;class EC{constructor(){this.type="glyph",this.numberType=nd}contains(t,e,i){if(!t.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}}class BC extends EC{constructor(t){super(),this.canvasRenderer=t}}let PC=!1;function RC(t){PC||(PC=!0,t.bind(JS).toDynamicValue((()=>new BC(xS(t,Dy)))).inSingletonScope(),t.bind(eA).toService(JS))}class OC extends EC{constructor(t){super(),this.canvasRenderer=t}}let IC=!1;function LC(t){IC||(IC=!0,t.bind(IS).toDynamicValue((()=>new OC(xS(t,Dy)))).inSingletonScope(),t.bind(AS).toService(IS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=m_();bb(),ux({bind:t.bind}),bS?RC(t):LC(t)}DC.__loaded=!1;const FC=DC;function zC(){zC.__loaded||(zC.__loaded=!0,xb())}zC.__loaded=!1;const HC=zC;class jC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=ad}}let NC=!1;function UC(t){NC||(NC=!0,t.bind(jS).toDynamicValue((()=>new jC(xS(t,Fy)))).inSingletonScope(),t.bind(eA).toService(jS))}class VC{constructor(){this.type="image",this.numberType=ad}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function GC(t){WC||(WC=!0,t.bind(MS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(AS).toService(MS))}function YC(){if(YC.__loaded)return;YC.__loaded=!0;const t=m_();Sb(),Ax({bind:t.bind}),bS?UC(t):GC(t)}YC.__loaded=!1;const XC=YC;class KC extends Fb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class $C extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let qC=!1;function ZC(t){qC||(qC=!0,t.bind(US).toDynamicValue((()=>new $C(xS(t,My)))).inSingletonScope(),t.bind(eA).toService(US))}class JC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let QC=!1;function tT(t){QC||(QC=!0,t.bind(wS).toDynamicValue((()=>new JC(xS(t,My)))).inSingletonScope(),t.bind(AS).toService(wS))}function eT(){if(eT.__loaded)return;eT.__loaded=!0;const t=m_();Ab(),Mx({bind:t.bind}),bS?ZC(t):tT(t)}eT.__loaded=!1;const iT=eT;class sT extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let nT=!1;function rT(t){nT||(nT=!0,t.bind(WS).toDynamicValue((()=>new sT(xS(t,wy)))).inSingletonScope(),t.bind(eA).toService(WS))}class aT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let oT=!1;function lT(t){oT||(oT=!0,t.bind(ES).toDynamicValue((()=>new aT(xS(t,wy)))).inSingletonScope(),t.bind(AS).toService(ES))}function hT(){if(hT.__loaded)return;hT.__loaded=!0;const t=m_();kb(),Ix({bind:t.bind}),bS?rT(t):lT(t)}hT.__loaded=!1;const cT=hT;class dT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let uT=!1;function pT(t){uT||(uT=!0,t.bind($S).toDynamicValue((()=>new dT(xS(t,Ey)))).inSingletonScope(),t.bind(eA).toService($S))}class gT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let fT=!1;function mT(t){fT||(fT=!0,t.bind(OS).toDynamicValue((()=>new gT(xS(t,Ey)))).inSingletonScope(),t.bind(AS).toService(OS))}function vT(){if(vT.__loaded)return;vT.__loaded=!0;const t=m_();Cb(),Vx({bind:t.bind}),bS?pT(t):mT(t)}vT.__loaded=!1;const yT=vT;class _T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=cd,this.themeType="polygon"}}let bT=!1;function xT(t){var e;bT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ly))&&(bT=!0,t.bind(qS).toDynamicValue((()=>new _T(xS(t,Ly)))).inSingletonScope(),t.bind(eA).toService(qS))}function ST(){if(ST.__loaded)return;ST.__loaded=!0;const t=m_();Tb(),uA(),gA(),Kx({bind:t.bind}),xT(t)}ST.__loaded=!1;const AT=ST,kT=new Ve;class CT{constructor(){this.type="rect",this.numberType=dd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:nu(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;kT.setValue(i.x1,i.y1,i.x2,i.y2),kT.expand(-r/2),h=!kT.containsPoint(e)}}return s.highPerformanceRestore(),h}}class TT extends CT{constructor(t){super(),this.canvasRenderer=t}}let MT=!1;function wT(t){MT||(MT=!0,t.bind(GS).toDynamicValue((()=>new TT(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(GS))}class ET extends CT{constructor(t){super(),this.canvasRenderer=t}}let BT=!1;function PT(t){BT||(BT=!0,t.bind(BS).toDynamicValue((()=>new ET(xS(t,By)))).inSingletonScope(),t.bind(AS).toService(BS))}function RT(){if(RT.__loaded)return;RT.__loaded=!0;const t=m_();Mb(),Jx({bind:t.bind}),bS?wT(t):PT(t)}RT.__loaded=!1;const OT=RT;class IT extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=ud,this.themeType="rect"}}let LT=!1;function DT(t){var e;LT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Py))&&(LT=!0,t.bind(YS).toDynamicValue((()=>new IT(xS(t,Py)))).inSingletonScope(),t.bind(eA).toService(YS))}function FT(){if(FT.__loaded)return;FT.__loaded=!0;const t=m_();wb(),iS({bind:t.bind}),DT(t)}FT.__loaded=!1;const zT=FT;class HT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let jT=!1;function NT(t){jT||(jT=!0,t.bind(ZS).toDynamicValue((()=>new HT(xS(t,Iy)))).inSingletonScope(),t.bind(eA).toService(ZS))}class UT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let VT=!1;function WT(t){VT||(VT=!0,t.bind(LS).toDynamicValue((()=>new UT(xS(t,Iy)))).inSingletonScope(),t.bind(AS).toService(LS))}function GT(){if(GT.__loaded)return;GT.__loaded=!0;const t=m_();Eb(),oS({bind:t.bind}),bS?NT(t):WT(t)}GT.__loaded=!1;const YT=GT;function XT(){XT.__loaded||(XT.__loaded=!0,Bb())}XT.__loaded=!1;const KT=XT;class $T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Au.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let qT=!1;function ZT(t){qT||(qT=!0,t.bind(XS).toDynamicValue((()=>new $T(xS(t,Ry)))).inSingletonScope(),t.bind(eA).toService(XS))}class JT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}}let QT=!1;function tM(t){QT||(QT=!0,t.bind(PS).toDynamicValue((()=>new JT(xS(t,Ry)))).inSingletonScope(),t.bind(AS).toService(PS))}function eM(){if(eM.__loaded)return;eM.__loaded=!0;const t=m_();Rb(),fS({bind:t.bind}),bS?ZT(t):tM(t)}eM.__loaded=!1;const iM=eM;class sM extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Xg(a,u,n),v=Yg(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&&Au.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let nM=!1;function rM(t){nM||(nM=!0,t.bind(KS).toDynamicValue((()=>new sM(xS(t,Oy)))).inSingletonScope(),t.bind(eA).toService(KS))}class aM{constructor(){this.type="text",this.numberType=md}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let oM=!1;function lM(t){oM||(oM=!0,t.bind(RS).toDynamicValue((()=>new aM)).inSingletonScope(),t.bind(AS).toService(RS))}function hM(){if(hM.__loaded)return;hM.__loaded=!0;const t=m_();Ob(),_S({bind:t.bind}),bS?rM(t):lM(t)}hM.__loaded=!1;const cM=hM;function dM(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),gM=(t,e)=>(d(mM.warnHandler)&&mM.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),fM=(t,e,i)=>{if(!d(mM.errorHandler))throw new Error(t);mM.errorHandler.call(null,t,e)},mM={silent:!1,warnHandler:!1,errorHandler:!1},vM=mm(),yM=vM&&globalThis?globalThis.document:void 0;function _M(t){return("desktop-browser"===t||"mobile-browser"===t)&&vM}function bM(t){return xM(t)||"mobile-browser"===t}function xM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let SM=0;function AM(){return SM>=9999999&&(SM=0),SM++}function kM(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function CM(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function TM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&TM(t,e)}))}const MM=t=>!u(t)&&!1!==t.visible;function wM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function EM(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 PM=["#ffffff","#000000"];function RM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return OM(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(...PM);for(const n of a)if(t!==n&&OM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function OM(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?IM(t,e)>s:"largeText"===i?IM(t,e)>3:IM(t,e)>4.5}function IM(t,e){const i=LM(t),s=LM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function LM(t){const e=ri(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 DM(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 FM(t,e){return[t[0]*e,t[1]*e]}function zM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function HM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const jM=cf,NM={arc:t=>jM("arc",t),circle:t=>jM("circle",t),group:t=>jM("group",t),image:t=>jM("image",t),line:t=>jM("line",t),path:t=>jM("path",t),polygon:t=>jM("polygon",t),rect:t=>jM("rect",t),richtext:t=>jM("richtext",t),symbol:t=>jM("symbol",t),text:t=>jM("text",t)},UM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 GM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(GM||(GM={}));const YM={[GM.selectedReverse]:{},[GM.selected]:{},[GM.hover]:{},[GM.hoverReverse]:{}},XM={container:"",width:30,height:30,style:{}},KM="scrollDrag",$M=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:gv,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function qM(t,e,i={}){if(!t)return{width:0,height:0};const s=gv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 ZM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function JM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function QM(t,e="type"){const i=ZM(t,e);return"rich"===i?NM.richtext(JM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),NM.text(t))}function tw(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 ew=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function iw(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 sw(t,e){const{dx:i,dy:s}=iw(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const nw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},rw={size:8,stroke:"#000",lineWidth:1,zIndex:1};function aw(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Ae(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Ee(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const ow=Math.sin(Math.PI/10);function lw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function hw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function cw(t){const e={};return TM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return FM(r,(s?-1:1)*(n?-1:1)*t/zM(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function fw(t,e,i){var s;if(hw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function mw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function _w(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function bw(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function xw(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 Sw(t,e){const i=xw(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 Aw(t,e){const i=kw(t),s=kw(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 kw(t,e={x:0,y:0}){return ae.distancePP(t,e)}function Cw(t){return k(t.x)&&k(t.y)}function Tw(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 Mw(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const ww=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function Bw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&Bw(t[i],e)}}var Pw;!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"}(Pw||(Pw={}));const Rw={};function Ow(t){switch(t){case Pw.Linear:case Pw.Log:case Pw.Pow:case Pw.Sqrt:case Pw.Symlog:case Pw.Time:return!0;default:return!1}}function Iw(t){return!!Rw[t]}function Lw(t){switch(t){case Pw.Ordinal:case Pw.Point:case Pw.Band:return!0;default:return!1}}function Dw(t){return t}Object.values(Pw).forEach((t=>{Rw[t]=!0}));const Fw=t=>-Math.log(-t),zw=t=>-Math.exp(-t),Hw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,jw=t=>10===t?Hw:t===Math.E?Math.exp:e=>Math.pow(t,e),Nw=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)),Vw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Ww(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 Gw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Yw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Xw(t,e,i,s){return 1===i&&(i=0),Yw(t,i,s)*(e/(1-i))}function Kw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function $w(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Zw{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=Kw(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=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Jw=Symbol("implicit");class Qw extends Zw{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=Jw}clone(){const t=(new Qw).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!==Jw)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return tE(t,e,r,n)}class iE extends Qw{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=Xw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:eE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new iE(!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:sE}=ai;function nE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=sE(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?sE(t,e):e instanceof si?sE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class rE extends Zw{constructor(t=Dw,e=Dw){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Dw,this._piecewise=Gw,this._interpolate=nE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?$w:Gw,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:Dw),this.rescale(i)):this._clamp!==Dw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const aE=Math.sqrt(50),oE=Math.sqrt(10),lE=Math.sqrt(2),hE=[1,2,5,10],cE=(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=gE(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?uE(0,-(e-1)/s,s):uE((e-1)/s,0,s)},dE=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return cE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return cE(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=uE(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=uE(t,e,l);return n&&r.reverse(),r})),gE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=hE[0];return i>=aE?s=hE[3]:i>=oE?s=hE[2]:i>=lE&&(s=hE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function fE(t,e,i){const s=(e-t)/Math.max(0,i);return gE(s)}function mE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=fE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function yE(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 _E=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),bE=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),xE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=pE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?_E(t,e,n):_E(t,e,qw(n)),h=_E(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),SE=vt(((t,e,i,s,n)=>mE(s(t),s(e),i).map((t=>qw(n(t))))));class AE extends rE{constructor(){super(...arguments),this.type=Pw.Linear}clone(){var t;const e=new AE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return dE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=pE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function CE(t){return e=>-t(-e)}function TE(t=Number.EPSILON){return e=>Math.max(e,t)}class ME extends rE{constructor(){super(Nw(10),jw(10)),this.type=Pw.Log,this._limit=TE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new ME).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=Nw(this._base),s=jw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Fw,this.untransformer=zw):(this._logs=i,this._pows=s,this._limit=TE(),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 Dw}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return bE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(ME,kE);class wE extends AE{constructor(){super(Uw(1),Vw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new wE).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=Vw(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return bE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(wE,kE);class EE{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[lt(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new EE).domain(this._domain).range(this._range).unknown(this._unknown)}}var BE,PE,RE;function OE(t){var e,i;const{type:s}=t;return s===PE.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BE||(BE={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(PE||(PE={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(RE||(RE={}));const IE={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},LE={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DE(t,e){var i;if(!t)return[];const s=VE(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?NE(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>jE(i)?zE(t,i,e):i)).filter(p)}))):i.map((i=>jE(i)?zE(t,i,e):i)).filter(p):[]}return[]}function FE(t,e){var i,s;return NE(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 zE(t,e,i){var s;const n=VE(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=IE[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=LE[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 si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`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 HE=(t,e)=>{if(e&&jE(t)){const i=zE(e,t);if(i)return i}return t};function jE(t){return t&&"palette"===t.type&&!!t.key}function NE(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function UE(t){return _(t)?{dataScheme:t}:t}function VE(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=OE(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 WE extends Qw{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!NE(this._range))return void super.range(this._range);const t=FE(this._range,this._domain);super.range(t)}}const GE={linear:AE,band:iE,point:class extends iE{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:Qw,threshold:EE,colorOrdinal:WE};function YE(t){const e=GE[t];return e?new e:null}function XE(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function KE(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function $E(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qE(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZE(t){return!!y(t)&&(!!t.endsWith("%")&&kM(t.substring(0,t.length-1)))}function JE(t){return!!g(t)&&("percent"in t||"offset"in t)}function QE(t,e,i,s=0){var n,r;return S(t)?t:ZE(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 tB(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]=QE(t[s],e.size,i)}))})),o}function eB(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function iB(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)||ZE(t)||d(t)||JE(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function sB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const nB=(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},rB=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function aB(t,e){return t&&e.key in t?t[e.key]:e.default}function oB(t){return t&&"token"===t.type&&!!t.key}const lB={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},hB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:lB,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},cB={name:"dark",colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},dB=(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]={}),dB(t[s],e.slice(1),i))};function uB(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=UE(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}vB._charts=mB.charts,vB._series=mB.series,vB._components=mB.components,vB._graphicComponents=mB.graphicComponents,vB._marks=mB.marks,vB._regions=mB.regions,vB._animations=mB.animations,vB._implements=mB.implements,vB._chartPlugin=mB.chartPlugin,vB._vChartPlugin=mB.vChartPlugin,vB._componentPlugin=mB.componentPlugin,vB.transforms=mB.transforms,vB.dataParser=mB.dataParser,vB._layout=mB.layout,vB._grammarTransforms=mB.grammarTransforms,vB._stageEventPlugins=mB.stageEventPlugins,vB.registerStageEventPlugin=(t,e)=>{vB._stageEventPlugins[t]=e},vB.getStageEventPlugin=t=>vB._stageEventPlugins[t],vB._interactionTriggers=mB.interactionTriggers,vB.registerInteractionTrigger=(t,e)=>{vB._interactionTriggers[t]=e},vB._composedEventMap=mB.composedEventMap,vB.registerComposedEvent=(t,e)=>{vB._composedEventMap[t]=e},vB._tooltipProcessors=mB.tooltipProcessors,vB.registerTooltipProcessor=(t,e)=>{vB._tooltipProcessors[t]=e},vB.createTooltipProcessor=(t,e)=>{const i=vB._tooltipProcessors[t];return i?new i(e):null},vB._runtimePluginInstallers=mB.runtimePluginInstallers,vB.registerRuntimePluginInstaller=(t,e)=>{vB._runtimePluginInstallers[t]=e},vB.getRuntimePluginInstaller=t=>vB._runtimePluginInstallers[t];const bB=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},xB=bB(),SB={[hB.name]:hB},AB=hB.name,kB=new Map(Object.keys(SB).map((t=>[t,SB[t]]))),CB=new Map,TB=new Map(Object.keys(SB).map((t=>[t,t===AB]))),MB=(t,e)=>{if(!t)return;const i=PB(e);kB.set(t,i),TB.set(t,!0)},wB=(t=AB)=>(TB.has(t)&&!TB.get(t)&&MB(t,kB.get(t)),kB.get(t)),EB=t=>kB.delete(t)&&CB.delete(t)&&TB.delete(t),BB=t=>!!y(t)&&kB.has(t),PB=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:AB;return yB({},wB(i),t)};class RB{static registerInstance(t){RB.instances.set(t.id,t)}static unregisterInstance(t){RB.instances.delete(t.id)}static getInstance(t){return RB.instances.get(t)}static instanceExist(t){return RB.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return RB.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}RB.instances=new Map;class OB{static registerTheme(t,e){MB(t,e)}static getTheme(t,e=!1){return wB(t)}static removeTheme(t){return EB(t)}static themeExist(t){return BB(t)}static getDefaultTheme(){return OB.themes.get(AB)}static setCurrentTheme(t){OB.themeExist(t)&&(OB._currentThemeName=t,RB.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return OB.getTheme(OB._currentThemeName,t)}static getCurrentThemeName(){return OB._currentThemeName}}function IB(t){return y(t)?OB.themeExist(t)?OB.getTheme(t):{}:g(t)?t:{}}OB.themes=kB,OB._currentThemeName=AB;const LB=["animationThreshold","colorScheme","name","padding"];function DB(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];LB.includes(n)?s[n]=r:m(r)?jE(r)?s[n]=HE(r,e):oB(r)?s[n]=aB(i,r):s[n]=DB(r,e,i):s[n]=r})),s}function FB(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]=FB(t[s],e)}return i}return _(t)?t.map((t=>FB(t,e))):t}function zB(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]=zB(t[s],e)}return i}return _(t)?t.map((t=>zB(t,e))):t}function HB(t,...e){return d(t)?t(...e):t}const jB=(t,e,i,s)=>((t,e,i)=>$M(t,e,i,{fontFamily:lB.fontFamily,fontSize:lB.fontSize}))(e,i,s).measure(t),NB="__VCHART",UB=500,VB=500,WB=`${NB}_MEASURE_CANVAS_ID`,GB=`${NB}_DEFAULT_DATA_INDEX`,YB=`${NB}_DEFAULT_DATA_KEY`,XB=`${NB}_DEFAULT_DATA_SERIES_FIELD`,KB=`${NB}_DEFAULT_SERIES_STYLE_NAME`,$B=`${NB}_STACK_KEY`,qB=`${NB}_STACK_START`,ZB=`${NB}_STACK_END`,JB=`${NB}_STACK_START_PERCENT`,QB=`${NB}_STACK_END_PERCENT`,tP=`${NB}_STACK_START_OffsetSilhouette`,eP=`${NB}_STACK_END_OffsetSilhouette`,iP=`${NB}_STACK_TOTAL`,sP=`${NB}_STACK_TOTAL_PERCENT`,nP=`${NB}_STACK_TOTAL_TOP`,rP=`${NB}_STACK_TOTAL_BOTTOM`,aP=`${NB}_MOSAIC_VALUE_START_PERCENT`,oP=`${NB}_MOSAIC_VALUE_END_PERCENT`,lP=`${NB}_MOSAIC_CAT_START_PERCENT`,hP=`${NB}_MOSAIC_CAT_END_PERCENT`,cP=`${NB}_SEGMENT_START`,dP=`${NB}_SEGMENT_END`,uP=`${NB}_KEY`,pP=`${NB}_MAP_LOOK_UP_KEY`;function gP(t,e){for(let i=0;it.key===e))}function mP(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 vP(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},SP(t,a,n[o],l,e,r))})),s?yP(n):n}function yP(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))):yP(t[e].nodes);return t}function _P(t,e){if("values"in t&&t.values.length){const i=bw(t.values,e),s=_w(t.values,QB);t.values.forEach((t=>{t[iP]=i,t[sP]=s}))}else for(const i in t.nodes)_P(t.nodes[i],e)}function bP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][ZB]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)xP(t.nodes[r],e,i,s,n)}function SP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[ZB]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),SP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const AP=(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]=CP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function TP(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function MP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return PP(t(r,i,s,n));if(TP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),PP(e)}return PP(t)}function wP(t={}){const e=Object.assign({},t);if(d(t.style)||TP(t.style)?e.style=(e,i,s,n)=>MP(t.style,e,i,s,n):P(t.style)||(e.style=PP(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||TP(t.state[e])?i[e]=(i,s,n,r)=>MP(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=PP(t.state[e]))})),e.state=i}return e}function EP(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e,s,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}function BP(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),PP(i)}function PP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const RP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},OP=t=>"line"===t||"area"===t,IP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return OP(i)?e:null==e?void 0:e[0]},LP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let DP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=vB.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(vB.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var FP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(FP||(FP={}));const zP=["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 HP,jP,NP;t.ChartEvent=void 0,(HP=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",HP.rendered="rendered",HP.renderFinished="renderFinished",HP.animationFinished="animationFinished",HP.regionSeriesDataFilterOver="regionSeriesDataFilterOver",HP.afterInitData="afterInitData",HP.afterInitEvent="afterInitEvent",HP.afterInitMark="afterInitMark",HP.rawDataUpdate="rawDataUpdate",HP.viewDataFilterOver="viewDataFilterOver",HP.viewDataUpdate="viewDataUpdate",HP.viewDataStatisticsUpdate="viewDataStatisticsUpdate",HP.markDeltaYUpdate="markDeltaYUpdate",HP.viewDataLabelUpdate="viewDataLabelUpdate",HP.scaleDomainUpdate="scaleDomainUpdate",HP.scaleRawDomainUpdate="scaleRawDomainUpdate",HP.scaleUpdate="scaleUpdate",HP.dataZoomChange="dataZoomChange",HP.drill="drill",HP.layoutStart="layoutStart",HP.layoutEnd="layoutEnd",HP.layoutRectUpdate="layoutRectUpdate",HP.playerPlay="playerPlay",HP.playerPause="playerPause",HP.playerEnd="playerEnd",HP.playerChange="playerChange",HP.playerForward="playerForward",HP.playerBackward="playerBackward",HP.scrollBarChange="scrollBarChange",HP.brushStart="brushStart",HP.brushChange="brushChange",HP.brushEnd="brushEnd",HP.brushClear="brushClear",HP.brushActive="brushActive",HP.legendSelectedDataChange="legendSelectedDataChange",HP.legendFilter="legendFilter",HP.legendItemClick="legendItemClick",HP.legendItemHover="legendItemHover",HP.legendItemUnHover="legendItemUnHover",HP.tooltipShow="tooltipShow",HP.tooltipHide="tooltipHide",HP.tooltipRelease="tooltipRelease",HP.afterResize="afterResize",HP.afterRender="afterRender",HP.afterLayout="afterLayout",HP.afterMarkLayoutEnd="afterMarkLayoutEnd",HP.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(jP||(jP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(NP||(NP={}));const UP=[NP.mark,NP.model,NP.chart,NP.vchart];class VP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(NP.vchart,[]),this._levelNodes.set(NP.chart,[]),this._levelNodes.set(NP.model,[]),this._levelNodes.set(NP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const WP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class GP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>IP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||jP.chart);o.get(t)||o.set(t,new VP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||jP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||jP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||jP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?UP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[jP.chart,jP.window,jP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&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 WP[a]&&(a=WP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?NP.model:NP.vchart:NP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=jP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==NP.model&&s!==NP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=NP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case jP.chart:return this._viewBubbles;case jP.window:return this._windowBubbles;case jP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case jP.chart:return this._viewListeners;case jP.window:return this._windowListeners;case jP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return zP.includes(t)||Object.values(FP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&vB.hasInteractionTrigger(e)}}function YP(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function XP(t,e,i){t.getParser(e)||t.registerParser(e,i)}const KP=new Map;let $P;function qP(){$P||($P=new Fa,XP($P,"geojson",Pa),XP($P,"topojson",Oa),YP($P,"simplify",Kr))}function ZP(t,e,i={type:"geojson",centroid:!0}){KP.has(t)&&gM(`map type of '${t}' already exists, will be overwritten.`),qP();const s=new za($P),n=H({},{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}),KP.set(t,s)}function JP(t){KP.has(t)?KP.delete(t):gM(`map type of '${t}' does not exists.`)}function QP(t,e=!1){let i=e;return t.latestData instanceof za&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const tR=(t,e)=>0===t.length?[]:1===t.length?QP(t[0],null==e?void 0:e.deep):t.map((t=>QP(t,null==e?void 0:e.deep)));function eR(e,i,s){YP(i=i instanceof Fa?i:e.dataSet,"copyDataView",tR);const n=new za(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function iR(t,e,i=[]){var s;if(t instanceof za)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new za(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return gM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return gM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),gM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function sR(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var nR,rR,aR,oR;t.TransformLevel=void 0,(nR=t.TransformLevel||(t.TransformLevel={}))[nR.copyDataView=-10]="copyDataView",nR[nR.treemapFilter=-8]="treemapFilter",nR[nR.treemapFlatten=-7]="treemapFlatten",nR[nR.dotObjFlat=-7]="dotObjFlat",nR[nR.linkDotInfo=-7]="linkDotInfo",nR[nR.sankeyLayout=-7]="sankeyLayout",nR[nR.dataZoomFilter=-6]="dataZoomFilter",nR[nR.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(rR||(rR={})),function(t){t.data="data",t.mark="mark"}(aR||(aR={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(oR||(oR={}));const lR=["line","area","trail"];function hR(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(uP,i?t.slice().sort(i):t.slice()),{keys:[uP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const cR=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function dR(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{dR(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function pR(t,e,i,s){const n=hR(t,(t=>i(t))),r=hR(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const gR=`${NB}_BuiltIn_CallBack_Disappear`;var fR;!function(t){t.render="render",t.disappear="disappear"}(fR||(fR={}));const mR=[0,0,0];class vR{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ol),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Ll),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Su.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&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(mu(mR,[e,i,s],this.modelMatrix),e=mR[0],i=mR[1],s=mR[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=ru(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:nu(this,a,this.dpr),r.strokeStyle=ru(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}vR.env="browser";class yR extends wu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=oh.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new vR(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 _R(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,kd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Cd,e.env));r||i.bind(kd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Cd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}yR.env="browser";const bR=_R(yR,vR);class xR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}xR.env="feishu";class SR extends wu{constructor(t){super(t)}init(){this._context=new xR(this,this._dpr)}release(...t){}}SR.env="feishu";const AR=_R(SR,xR);class kR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}kR.env="harmony";class CR extends wu{constructor(t){super(t)}init(){this._context=new kR(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}CR.env="harmony";const TR=_R(CR,kR);class MR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}MR.env="lynx";class wR extends wu{constructor(t){super(t)}init(){this._context=new MR(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}wR.env="lynx";const ER=_R(wR,MR);class BR extends vR{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}BR.env="node";class PR extends wu{constructor(t){super(t)}init(){this._context=new BR(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}PR.env="node";const RR=_R(PR,BR);class OR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(ru(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:nu(this,l,this.dpr)),r.setStrokeStyle(ru(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}OR.env="taro";class IR extends wu{constructor(t){super(t)}init(){this._context=new OR(this,this._dpr)}release(...t){}}IR.env="taro";const LR=_R(IR,OR);class DR extends xR{}DR.env="tt";class FR extends wu{constructor(t){super(t)}init(){this._context=new DR(this,this._dpr)}release(...t){}}FR.env="tt";const zR=_R(FR,DR);class HR extends vR{draw(){}createPattern(t,e){return null}}HR.env="wx";class jR extends wu{constructor(t){super(t)}init(){this._context=new HR(this,this._dpr)}release(...t){}}jR.env="wx";const NR=_R(jR,HR);class UR extends vA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=_f.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;nnew GR(xS(t,ky)))).inSingletonScope(),t.bind(eA).toService(HS))}class KR extends CT{constructor(t){super(),this.canvasRenderer=t}}let $R=!1;class qR extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=gd}}let ZR=!1;function JR(t){var e;ZR||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,jy))&&(ZR=!0,t.bind(tA).toDynamicValue((()=>new qR(xS(t,jy)))).inSingletonScope(),t.bind(eA).toService(tA))}const QR=Xc();Xc();class tO{constructor(){this.type="gif-image",this.numberType=QR}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let eO=!1;function iO(t){eO||(eO=!0,t.bind(NS).toDynamicValue((()=>new tO)).inSingletonScope(),t.bind(eA).toService(NS))}function sO(t){t.isBound(UR)||t.bind(UR).toDynamicValue((()=>new UR(SS(eA,t),xS(t,Hy),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(UR):t.bind(qm).toService(UR)}function nO(t){(function(t){WR||(WR=!0,t.bind(QS).toDynamicValue((()=>new VR)).inSingletonScope(),t.bind(eA).toService(QS),Hm(t.bind.bind(t),eA))})(t),hC(t),yC(t),AC(t),XR(t),RC(t),UC(t),ZC(t),function(t){$R||($R=!0,t.bind(VS).toDynamicValue((()=>new KR(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(VS))}(t),rT(t),pT(t),xT(t),wT(t),DT(t),NT(t),JR(t),ZT(t),rM(t),iO(t),sO(t)}class rO extends cA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${rO.idprefix}_${rO.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=oh.global,this.viewBox=new Ve,this.modelMatrix=new Ge(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(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:rO.GenerateCanvasId(),canvasControled:!0};this.canvas=new yR(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new yR({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function aO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rO))||t.bind(rO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,rO.env))||t.bind(xf).toService(rO).whenTargetNamed(rO.env)}rO.env="browser",rO.idprefix="visactor_window",rO.prefix_count=0;var oO=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 lO{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 hO(t,e=!1){const i=document.createElement("img");if(oh.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class cO extends hA{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 lO(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return hO(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return hO(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return oO(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function dO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,cO))||(t.bind(cO).toSelf().inSingletonScope(),t.bind(vg).toService(cO))}function uO(t=m_(),e=!0){uO.__loaded||(uO.__loaded=!0,dO(t),bR(t),aO(t),e&&nO(t))}uO.__loaded=!1;class pO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new SR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 SR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function gO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,pO))||t.bind(pO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,pO.env))||t.bind(xf).toService(pO).whenTargetNamed(pO.env)}pO.env="feishu";class fO extends vA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Tu(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}}let mO=!1;class vO extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let yO=!1;function _O(t){yO||(yO=!0,t.bind(TS).toDynamicValue((()=>new vO(xS(t,ky)))).inSingletonScope(),t.bind(AS).toService(TS))}function bO(t){(function(t){mO||(mO=!0,Hm(t.bind.bind(t),AS))})(t),function(t){t.isBound(fO)||t.bind(fO).toDynamicValue((()=>new fO(SS(AS,t),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(fO):t.bind(qm).toService(fO)}(t),uC(t),TC(t),_O(t),LC(t),GC(t),tT(t),mT(t),lT(t),PT(t),WT(t),tM(t),lM(t)}class xO{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class SO{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function AO(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function kO(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new xO(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function CO(t,e,i,s){const n=AO(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new SO(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function TO(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function MO(t,e=TO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class wO extends hA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=TO(i),n=null!==(e=t.dpr)&&void 0!==e?e:MO(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return MO(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function EO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,wO))||(t.bind(wO).toSelf().inSingletonScope(),t.bind(vg).toService(wO))}function BO(t=m_(),e=!0){BO.__loaded||(BO.__loaded=!0,EO(t),AR(t),gO(t),e&&bO(t))}BO.__loaded=!1;function PO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function RO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new CR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 CR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return PO(t,"target",s),PO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=RO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=RO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&OO(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),OO(t,"x",_),OO(t,"y",b),OO(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),OO(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),OO(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),OO(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),OO(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),OO(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function LO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,IO))||t.bind(IO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,IO.env))||t.bind(xf).toService(IO).whenTargetNamed(IO.env)}IO.env="harmony";const DO="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function FO(t){return"number"==typeof t&&Number.isFinite(t)}function zO(...t){for(let e=0;e({width:i,height:s})),new SO(t,l,n,i,s,e)}function VO(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=NO(e*s,i*s);if(t)return t}throw new Error(DO)}class WO extends hA{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=HO(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=HO(s),r=null!==(i=t.dpr)&&void 0!==i?i:jO(s),a=function(t,e){if(!FO(t)||!FO(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=UO(VO(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=UO(VO(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return jO(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=zO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=zO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function GO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,WO))||(t.bind(WO).toSelf().inSingletonScope(),t.bind(vg).toService(WO))}function YO(t=m_(),e=!0){YO.__loaded||(YO.__loaded=!0,GO(t),TR(t),LO(t),e&&bO(t))}YO.__loaded=!1;function XO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function KO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new wR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 wR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return XO(t,"target",s),XO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=KO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=KO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&$O(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),$O(t,"x",_),$O(t,"y",b),$O(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),$O(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),$O(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),$O(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),$O(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),$O(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function ZO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qO))||t.bind(qO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,qO.env))||t.bind(xf).toService(qO).whenTargetNamed(qO.env)}qO.env="lynx";function JO(t){return"number"==typeof t&&Number.isFinite(t)}function QO(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=eI(r),o=null!==(i=t.dpr)&&void 0!==i?i:iI(r,a),l=nI(t.width,t.height),h=rI(aI(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=eI(a),l=null!==(n=t.dpr)&&void 0!==n?n:iI(a,o),h=nI(t.width,t.height),c=Math.random().toString(),d=rI(aI(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return iI(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=QO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=QO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function lI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,oI))||(t.bind(oI).toSelf().inSingletonScope(),t.bind(vg).toService(oI))}function hI(t=m_(),e=!0){hI.__loaded||(hI.__loaded=!0,lI(t),ER(t),ZO(t),e&&bO(t))}hI.__loaded=!1;class cI extends cA{get container(){return null}constructor(t=oh.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new PR(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new PR({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function dI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cI))||t.bind(cI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,cI.env))||t.bind(xf).toService(cI).whenTargetNamed(cI.env)}cI.env="node";class uI extends hA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function pI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uI))||(t.bind(uI).toSelf().inSingletonScope(),t.bind(vg).toService(uI))}function gI(t=m_(),e=!0){gI.__loaded||(gI.__loaded=!0,pI(t),RR(t),dI(t))}gI.__loaded=!1;class fI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new IR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 IR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fI))||t.bind(fI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,fI.env))||t.bind(xf).toService(fI).whenTargetNamed(fI.env)}fI.env="taro";class vI extends hA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=CO(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=kO(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function yI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,vI))||(t.bind(vI).toSelf().inSingletonScope(),t.bind(vg).toService(vI))}function _I(t=m_(),e=!0){_I.__loaded||(_I.__loaded=!0,yI(t),LR(t),mI(t),e&&bO(t))}_I.__loaded=!1;class bI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new FR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 FR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function xI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,bI))||t.bind(bI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,bI.env))||t.bind(xf).toService(bI).whenTargetNamed(bI.env)}bI.env="tt";function SI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function AI(t,e=SI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class kI extends hA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=SI(i),n=null!==(e=t.dpr)&&void 0!==e?e:AI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return AI(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function CI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,kI))||(t.bind(kI).toSelf().inSingletonScope(),t.bind(vg).toService(kI))}function TI(t=m_(),e=!0){TI.__loaded||(TI.__loaded=!0,CI(t),zR(t),xI(t),e&&bO(t))}TI.__loaded=!1;class MI{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={}}}function wI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class EI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="wx",this.eventManager=new MI}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new jR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 jR({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return wI(t,"target",o),wI(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function BI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,EI))||t.bind(EI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,EI.env))||t.bind(xf).toService(EI).whenTargetNamed(EI.env)}EI.env="wx";function PI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function RI(t,e=PI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class OI extends hA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=PI(i),n=null!==(e=t.dpr)&&void 0!==e?e:RI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return RI(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function II(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,OI))||(t.bind(OI).toSelf().inSingletonScope(),t.bind(vg).toService(OI))}function LI(t=m_(),e=!0){LI.__loaded||(LI.__loaded=!0,II(t),NR(t),BI(t),e&&bO(t))}LI.__loaded=!1;var DI={},FI={},zI={};Object.defineProperty(zI,"__esModule",{value:!0}),zI.loop=zI.conditional=zI.parse=void 0;zI.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};zI.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};zI.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var HI={};Object.defineProperty(HI,"__esModule",{value:!0}),HI.readBits=HI.readArray=HI.readUnsigned=HI.readString=HI.peekBytes=HI.readBytes=HI.peekByte=HI.readByte=HI.buildStream=void 0;HI.buildStream=function(t){return{data:t,pos:0}};var jI=function(){return function(t){return t.data[t.pos++]}};HI.readByte=jI;HI.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var NI=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};HI.readBytes=NI;HI.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};HI.readString=function(t){return function(e){return Array.from(NI(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};HI.readUnsigned=function(t){return function(e){var i=NI(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};HI.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=NI(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=ZI(t),i=GI(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=ZI(this.attribute.gifImage),e=GI(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=oh.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=oh.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function tL(t){return new QI(t)}class eL extends bx{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=QR,this._renderContribitions=void 0,this.builtinContributions=[iL],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=zp(t).image;this._draw(t,n,!1,i)}}const iL=new class extends Jv{constructor(){super(...arguments),this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let sL=!1;function nL(t){sL||(sL=!0,t.bind(eL).toDynamicValue((()=>new eL(SS(Qy,t)))).inSingletonScope(),t.bind(Cy).toService(eL))}function rL(){lf.RegisterGraphicCreator("gif",tL)}function aL(){if(aL.__loaded)return;aL.__loaded=!0;const t=m_();rL(),nL(t),iO(t)}aL.__loaded=!1;const oL=aL,lL=[{register:mb,bindModule:Nb},{register:vb,bindModule:Gb},{register:yb,bindModule:nx},{register:_b,bindModule:lx},{register:bb,bindModule:ux},{register:xb},{register:Sb,bindModule:Ax},{register:Ab,bindModule:Mx},{register:kb,bindModule:Ix},{register:Cb,bindModule:Vx},{register:Tb,bindModule:Kx},{register:Mb,bindModule:Jx},{register:wb,bindModule:iS},{register:Eb,bindModule:oS},{register:Bb},{register:Pb,bindModule:dS},{register:Rb,bindModule:fS},{register:Ob,bindModule:_S},{register:Ib},{register:rL}];let hL=!1;const cL=[hC,yC,AC,XR,RC,UC,ZC,rT,pT,xT,wT,DT,NT,JR,ZT,rM,iO];function dL(t){return{getContributions:t}}function uL(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function pL(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=NA();i(a),s(a),n(a),UA(),uL(e,{envParams:r,force:!0})}function gL(t,e){pL(t,"browser",{bindEnv:dO,bindCanvasModules:bR,bindWindowContribution:aO},e)}function fL(t,e){pL(t,"node",{bindEnv:pI,bindCanvasModules:RR,bindWindowContribution:dI},e)}function mL(t){WA(t),function(){if(hL)return;const t=NA();hL=!0,lL.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),nL(t),UA()}(),YA(t),GA(t)}function vL(t){WA(t);const e=NA();cL.forEach((t=>t(e))),sO(e),XA(t,eA),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[])),r=VA();oh.pickerServiceFactory=()=>new UR(i,{},s,n),oh.global=r}(t)}function yL(t){WA(t);bO(NA()),XA(t,AS),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[]));oh.pickerServiceFactory=()=>new fO(i,s,n)}(t)}function _L(){if(_L.__loaded)return;_L.__loaded=!0;const t=m_();_b(),lx({bind:t.bind}),bS?XR(t):_O(t)}_L.__loaded=!1;const bL=_L;function xL(){if(xL.__loaded)return;xL.__loaded=!0;const t=m_();Pb(),dS({bind:t.bind}),JR(t)}xL.__loaded=!1;const SL=xL;function AL(){AL.__loaded||(AL.__loaded=!0,Ib())}AL.__loaded=!1;const kL=AL;class CL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,$_(this.target,i,_o.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class wL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class EL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class BL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const PL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class RL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){X_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){X_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class OL extends RL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=PL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r),this.determineUpdateFunction()}}class IL extends RL{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class LL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class DL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const FL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class zL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=FL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class HL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const jL=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class NL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(X_(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class UL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:jL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class VL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:jL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const WL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class GL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:WL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class YL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:WL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const XL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class KL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:XL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class $L extends NL{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:XL(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const qL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class ZL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class JL extends ZL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=qL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}}class QL extends ZL{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const tD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class eD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nD extends sD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class rD extends sD{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class aD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,$_(this.target,{text:n})}}class oD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lD extends oD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class hD extends oD{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class cD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&q_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),X_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class dD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class uD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const pD={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function gD(t,e){for(let i=0;ipD[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&M_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(X_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class mD{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new w_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function vD(t){return new mD(t)}class yD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;$_(this.target,{text:o})}}class _D extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(q_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),q_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),q_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),q_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;q_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:yD});const i=s._titleBottom.attribute.text;q_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:yD})}else q_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),q_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;q_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());q_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class bD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class xD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(q_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:yD}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:yD}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class SD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class AD extends rb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==AD.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class kD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class CD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==CD.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CD.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TD{static createTempCanvas(t,e,i){return b_.createCanvas({width:t,height:e,dpr:i||b_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=TD.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(TD.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class ED extends CD{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class OD extends CD{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=TD.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class ID extends AD{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=b_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=b_.createCanvas({width:i,height:s,dpr:b_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class LD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}$_(this.target,{textConfig:o})}}class DD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class FD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function ND(t,e){X_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class UD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,q_(this.target,m)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class VD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,q_(this.target,d)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class WD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,q_(this.target,p)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class GD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class YD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}}class XD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:VD,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class KD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:WD,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class $D extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class qD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class ZD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class JD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:qD,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class QD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:ZD,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class tF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),X_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ru(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ru(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class eF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=oh.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Al,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=oh.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Fo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Fo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function lF(t){var e,i;const s=null!==(e=m_().getAll(Cy))&&void 0!==e?e:[],n=aF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;oF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=rF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function hF(t,e){var i,s;const n=null!==(i=m_().getAll(e))&&void 0!==i?i:[],r=aF(t.registry.picker,"vrender:legacy-picker"),a=new Set;oF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=rF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const cF=gL,dF=fL,uF={taro:{installEnv:function(t,e){pL(t,"taro",{bindEnv:yI,bindCanvasModules:LR,bindWindowContribution:mI},e)},loadEnv:_I},feishu:{installEnv:function(t,e){pL(t,"feishu",{bindEnv:EO,bindCanvasModules:AR,bindWindowContribution:gO},e)},loadEnv:BO},tt:{installEnv:function(t,e){pL(t,"tt",{bindEnv:CI,bindCanvasModules:zR,bindWindowContribution:xI},e)},loadEnv:TI},wx:{installEnv:function(t,e){pL(t,"wx",{bindEnv:II,bindCanvasModules:NR,bindWindowContribution:BI},e)},loadEnv:LI},lynx:{installEnv:function(t,e){pL(t,"lynx",{bindEnv:lI,bindCanvasModules:ER,bindWindowContribution:ZO},e)},loadEnv:hI},harmony:{installEnv:function(t,e){pL(t,"harmony",{bindEnv:GO,bindCanvasModules:TR,bindWindowContribution:LO},e)},loadEnv:YO}},pF=[nC,eC,S_,k_,uA,gA],gF=[()=>{w_.registerBuiltInAnimate("increaseCount",aD),w_.registerBuiltInAnimate("fromTo",ab),w_.registerBuiltInAnimate("scaleIn",cD),w_.registerBuiltInAnimate("scaleOut",dD),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL),w_.registerBuiltInAnimate("fadeIn",EL),w_.registerBuiltInAnimate("fadeOut",BL),w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("moveIn",nD),w_.registerBuiltInAnimate("moveOut",rD),w_.registerBuiltInAnimate("rotateIn",lD),w_.registerBuiltInAnimate("rotateOut",hD),w_.registerBuiltInAnimate("update",fD),w_.registerBuiltInAnimate("state",uD),w_.registerBuiltInAnimate("labelItemAppear",_D),w_.registerBuiltInAnimate("labelItemDisappear",bD),w_.registerBuiltInAnimate("poptipAppear",xD),w_.registerBuiltInAnimate("poptipDisappear",SD),w_.registerBuiltInAnimate("inputText",yD),w_.registerBuiltInAnimate("inputRichText",LD),w_.registerBuiltInAnimate("outputRichText",DD),w_.registerBuiltInAnimate("slideRichText",zD),w_.registerBuiltInAnimate("slideOutRichText",FD),w_.registerBuiltInAnimate("slideIn",UD),w_.registerBuiltInAnimate("growIn",VD),w_.registerBuiltInAnimate("spinIn",WD),w_.registerBuiltInAnimate("moveScaleIn",XD),w_.registerBuiltInAnimate("moveRotateIn",KD),w_.registerBuiltInAnimate("strokeIn",GD),w_.registerBuiltInAnimate("slideOut",$D),w_.registerBuiltInAnimate("growOut",qD),w_.registerBuiltInAnimate("spinOut",ZD),w_.registerBuiltInAnimate("moveScaleOut",JD),w_.registerBuiltInAnimate("moveRotateOut",QD),w_.registerBuiltInAnimate("strokeOut",YD),w_.registerBuiltInAnimate("pulse",tF),w_.registerBuiltInAnimate("MotionPath",HD),w_.registerBuiltInAnimate("streamLight",eF),w_.registerBuiltInAnimate("dissolve",wD),w_.registerBuiltInAnimate("grayscale",RD),w_.registerBuiltInAnimate("distortion",ED),w_.registerBuiltInAnimate("particle",OD),w_.registerBuiltInAnimate("glitch",PD),w_.registerBuiltInAnimate("gaussianBlur",BD),w_.registerBuiltInAnimate("pixelation",ID)},fb],fF=[gC,bC,wC,bL,FC,oL,HC,XC,iT,cT,yT,AT,OT,zT,YT,KT,iM,cM,kL,SL];function mF(){pF.forEach((t=>t())),gF.forEach((t=>t()))}function vF(t,e){if(!nF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==b_?void 0:b_.env)?b_.envParams:void 0}(e);return void 0===i?fL(t):dF(t,i),mL(t),yL(t),gI(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}function yF(t,e,i){if(!nF(t,e))return t;const s=uF[e];return s.installEnv(t,i),mL(t),function(t){yL(t)}(t),s.loadEnv(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}const _F=Symbol.for("visactor.vrender.sharedAppRegistry");function bF(){var t;const e=globalThis,i=null!==(t=e[_F])&&void 0!==t?t:new Map;return e[_F]=i,i}function xF(t,e){const i=bF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function SF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=bF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function AF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=xF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(SF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>SF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=xF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&SF(t,i,s))}}}(t,s,r,o)}const kF=$A,CF=[];function TF(t){CF.forEach((({module:e,options:i})=>{kF(e,Object.assign(Object.assign({},i),{app:t}))}))}var MF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),lF(t),hF(t,eA),mF(),t):t}(bA(MF(t,["envParams"])),e);return TF(i),i}var EF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},DF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},FF=(t,e)=>{const i=LF(t),s=DF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},zF=(t,e)=>{const i=AF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,IF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},HF="poptipForText";class jF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(HF))&&this._dedupeStagePlugin(HF)}initView(){var e,i,s,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:u,autoPreventDefault:f,background:m}=this._option,v=FF(l,h);b_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=LF(i.mode),n=FF(i.mode,i.modeParams);return zF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=t.releaseAppRef,null===(e=this._option.runtimePluginInstallers)||void 0===e||e.forEach((e=>e(t.app)));try{this._stage=(_=t.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:p(a)?a:!p(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=tg({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(p(c)?c:bM(l))&&!1!==d&&vB.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,g(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=oR.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!_M(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:b_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>dR(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>dR(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{dR(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===oR.before;(e||i)&&(pM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=oR.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=oR.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),pM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=uR(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=pR(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=pR(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=hR(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=hR(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:gR,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{dR(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===rR.appear))?rR.appear:e.every((t=>t===rR.disappear))?rR.disappear:rR.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===jP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=RP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=RP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:IP(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===jP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===jP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===jP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===jP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===jP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{dR(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=uR(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return _M(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{b_.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{dR(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function NF(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:fM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const UF={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}},VF={poptip:H({},UF)};function WF(t){t.crosshair=Y(t.crosshair||{}).map((e=>uB({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function GF(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}=li(l,i.width,i.height);a=t,o=e}else if(h&&_M(e.mode)){let t;t=y(h)?b_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(xM(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}}const YF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function XF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function KF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function $F(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;YF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function qF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var ZF,JF,QF,tz,ez,iz;t.LayoutZIndex=void 0,(ZF=t.LayoutZIndex||(t.LayoutZIndex={}))[ZF.SeriesGroup=0]="SeriesGroup",ZF[ZF.Axis_Grid=50]="Axis_Grid",ZF[ZF.CrossHair_Grid=100]="CrossHair_Grid",ZF[ZF.Region=450]="Region",ZF[ZF.Mark=300]="Mark",ZF[ZF.Node=400]="Node",ZF[ZF.Axis=100]="Axis",ZF[ZF.MarkLine=500]="MarkLine",ZF[ZF.MarkArea=100]="MarkArea",ZF[ZF.MarkPoint=500]="MarkPoint",ZF[ZF.DataZoom=500]="DataZoom",ZF[ZF.ScrollBar=500]="ScrollBar",ZF[ZF.Player=500]="Player",ZF[ZF.Legend=500]="Legend",ZF[ZF.CrossHair=500]="CrossHair",ZF[ZF.Indicator=500]="Indicator",ZF[ZF.Title=500]="Title",ZF[ZF.Label=500]="Label",ZF[ZF.Brush=500]="Brush",ZF[ZF.CustomMark=500]="CustomMark",ZF[ZF.Interaction=700]="Interaction",t.LayoutLevel=void 0,(JF=t.LayoutLevel||(t.LayoutLevel={}))[JF.Indicator=10]="Indicator",JF[JF.Region=20]="Region",JF[JF.Axis=30]="Axis",JF[JF.DataZoom=40]="DataZoom",JF[JF.Player=40]="Player",JF[JF.ScrollBar=40]="ScrollBar",JF[JF.Legend=50]="Legend",JF[JF.Title=70]="Title",JF[JF.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(QF=t.AttributeLevel||(t.AttributeLevel={}))[QF.Default=0]="Default",QF[QF.Theme=1]="Theme",QF[QF.Chart=2]="Chart",QF[QF.Base_Series=3]="Base_Series",QF[QF.Series=4]="Series",QF[QF.Mark=5]="Mark",QF[QF.User_Chart=6]="User_Chart",QF[QF.User_Series=7]="User_Series",QF[QF.User_Mark=8]="User_Mark",QF[QF.User_SeriesStyle=9]="User_SeriesStyle",QF[QF.Built_In=99]="Built_In";class sz{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,H({},sz.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]))))}}sz.defaultMarkInfo={};class nz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class rz{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=>uB({},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 az extends nz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=rz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new sz,this._lastLayoutRect=null,this.id=AM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new DP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${NB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=vB.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class oz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=tB(iB(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QE(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QE(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QE(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QE(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QE(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QE(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QE(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QE(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QE(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(eB(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class lz extends az{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new oz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(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 hz extends rz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class cz extends lz{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=hz,this.modelType="region",this.specKey="region",this.type=cz.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function dz(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 uz(t,e,i){e?t.forEach((t=>{const e=X(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=X(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 pz(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 gz(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),pz(d,!0,p,l),s&&uz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function fz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=yz(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),pz(d,!1,p,o),s&&uz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function vz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=yz(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=yz(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"left",s),r.length&&gz(r,e,i,!0,"left",s),a.length&&fz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"top",s),r.length&&mz(r,e,i,!0,"top",s),a.length&&vz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"right",s),r.length&&gz(r,e,i,!0,"right",s),a.length&&fz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"bottom",s),r.length&&mz(r,e,i,!0,"bottom",s),a.length&&vz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=yz(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=yz(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:fM)("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}}}_z.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(tz||(tz={})),t.STATE_VALUE_ENUM=void 0,(ez=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",ez.STATE_HOVER="hover",ez.STATE_HOVER_REVERSE="hover_reverse",ez.STATE_DIMENSION_HOVER="dimension_hover",ez.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",ez.STATE_SELECTED="selected",ez.STATE_SELECTED_REVERSE="selected_reverse",ez.STATE_SANKEY_EMPHASIS="selected",ez.STATE_SANKEY_EMPHASIS_REVERSE="blur",ez.STATE_HIGHLIGHT="highlight",ez.STATE_BLUR="blur",ez.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(iz||(iz={}));const bz=["linear","radial","conical"],xz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Sz={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{Sz[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class Az extends nz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class kz extends Az{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,lR.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Sz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(NB)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(NB))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Ow(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class Cz extends nz{constructor(){super(...arguments),this.id=AM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=vB.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Tz extends Cz{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Mz=1e3,wz="quadInOut",Ez=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Bz=(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=Ru(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Pz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ak(t):[],n=ak(e);i&&s&&(i.fromTransform&&ok(s,i.fromTransform.clone().getInverse()),ok(s,i.toTransfrom));const[r,a]=rk(s,n);return t?nk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Oz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Iz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Oz.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Eu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Lz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Pz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Bz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):$_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Dz=(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=Rz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Iz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Lz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wz);return c.play(d),c};class Fz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Pz(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&&Bz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const zz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Ez.includes(t))(i)||(e[i]=t[i])})),e},Hz=(t,e,i)=>{const s=zz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=oh.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},jz=(t,e,i)=>{const s=[],n=i?null:zz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:zz(t.attribute);if("rect"===t.type)ck(t,e).forEach((t=>{s.push(oh.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)dk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)uk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=fk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(oh.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?bk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?gk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&xk(t,e).forEach((t=>{"path"in t?s.push(oh.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Hz(t,s,e),s},Uz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Vz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Uz(l.delay,n,a,o),d=Uz(l.duration,n,a,o),u=Uz(l.oneByOne,n,a,o),p=Uz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(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);Dz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Rz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Iz(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:_o.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Lz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mz,null!==(l=i.easing)&&void 0!==l?l:wz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:_o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Fz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Dz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},Wz=(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))))},Gz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},Yz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},Xz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];Yz(t,a,s)},Kz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));Yz(t,r,i)},$z=Symbol("statesClearedBeforeReInit");class qz extends Cz{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Tz(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=tg("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Al)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===tz.enter||t.context.diffState===tz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&Yz(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new kz(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&uB(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Iw(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=YE(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):bz.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Iw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},xz[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)bz.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return hR(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return vB.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[YB],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=hR(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===rR.appear))?rR.appear:t.every((t=>t===rR.disappear))?rR.disappear:t[0];return null!=e?e:rR.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{Gz(t),s.push(...t.getGraphics())})),e.forEach((t=>{Gz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Vz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=Wz(e,n),r=Wz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===rR.exit?rR.exit:i===rR.update?rR.update:rR.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===tz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===tz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=tz.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=tz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=tz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=rR.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=rR.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return cR(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=cR(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!bz.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!Iw(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,LP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=vB.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=vB.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===oR.before||(this._product||this._initProduct(),pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[$z],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?Xz(i,t,!0,a):Kz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[$z]=e:delete s[$z]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===tz.exit&&!e.isExiting)if(e.context.animationState===tz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===tz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=tg({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[$z]=t.currentStates.slice())}))}}var Zz;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(Zz||(Zz={}));class Jz extends qz{constructor(){super(...arguments),this.type=Jz.type,this._marks=[],this._diffState=tz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(gM("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?(gM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return dR(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===tz.update){const t=this.hasAnimation(),e=LP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=tz.update}render(){this._isCommited&&(pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}Jz.type="group";const Qz={measureText:jB};class tH{static instance(){return tH.instance_||(tH.instance_=new tH),tH.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 eH{constructor(){this.id=AM(),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))?gM("不要重复添加相同的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 iH extends eH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const sH=(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"},nH=(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 rH extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=Za.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Za.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||sH(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=nH(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=Za.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=nH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=sH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Za.now()-i>this.config.press.time&&nH(s[0],t){oh.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class oH extends aH{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 C=oh.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 T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class lH extends aH{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=oh.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 hH extends sb{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&M_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(X_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));$_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const cH={type:"fadeIn"};function dH(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 cH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}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"},state:{duration:300,easing:"linear"}},pH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},gH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},fH=()=>{vB.registerAnimation("scaleInOut",(()=>pH))},mH=()=>{vB.registerAnimation("fadeInOut",(()=>gH))},vH=(t,e)=>({appear:dH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:hH,duration:uH.update.duration,easing:uH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),yH=()=>{vB.registerAnimation("line",vH)},_H=()=>{w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL)},bH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class xH{constructor(t){this._markSet=new sz,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const SH={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class AH extends xH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},SH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}AH.type="element-highlight",AH.defaultOptions=SH;const kH=()=>{vB.registerInteractionTrigger(AH.type,AH)},CH={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class TH extends xH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},CH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),Xz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}TH.type="element-select",TH.defaultOptions=CH;const MH=()=>{vB.registerInteractionTrigger(TH.type,TH)};class wH extends eH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const EH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},BH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...BH(t))})),s},PH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(EH(t,r),!1)};class RH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>vB.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>vB.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>vB.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return vB.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>vB.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){vB.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}static getFunction(t){return t?tH.instance().getFunction(t):null}static getFunctionList(){return tH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=vB.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=vB.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,KP.get(e);var e}static registerSVG(t,e,i){const s=vB.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=vB.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){RB.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=AM(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=fR.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=$F(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?vB.getSeriesBuiltInTheme(e):vB.getComponentBuiltInTheme(e);i=i?uB({},s,i[e]):s}s===t.length-1&&p(i)&&(i=DB({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},Bw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=_M(v);if(S?uO(iA):"node"===v&&gI(iA),S&&f&&(this._container=y(f)?b_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=OB.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=vB.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===i.type&&A.push("scrollbar");const C=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new jF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new GP(this,this._compiler),this._event=new DP(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),RB.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=uB({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=FB(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;RH.getFunctionList()&&RH.getFunctionList().length&&(t=zB(t,RH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=vB.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=vB.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=vB.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return GF(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:UB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:VB})}_initDataSet(t){this._dataSet=t instanceof Fa?t:new Fa,XP(this._dataSet,"dataview",Ia),XP(this._dataSet,"array",s),YP(this._dataSet,"copyDataView",tR);for(const t in vB.transforms)YP(this._dataSet,t,vB.transforms[t]);for(const t in vB.dataParser)XP(this._dataSet,t,vB.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),XF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?rR.none:rR.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,RB.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{EH(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof za?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=iR(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?uB({},t[n][e.index],i):i):t[n]=s?uB({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?uB({},t[n][r],i):i)}else t.id===e&&(t[n]=s?uB({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=uB({},t.getSpec(),e));const r=t.updateSpec(e),a=XF(r),o=KF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=yB({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=IB(this._currentThemeName),this._currentTheme=o(a,l);else{const t=yB({},IB(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),IB(n),IB(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(VF.poptip,UF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!_M(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return IB(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!OB.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield NF(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(!_M(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(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}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)?b_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?sB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 gM("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?sB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(gM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tH.instance().getFunction(t)}registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}getFunctionList(){return tH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=vB.getChartPlugins();t.length>0&&(this._chartPlugin=new iH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=vB.getVChartPlugins();e.length>0&&(this._vChartPlugin=new wH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=fR.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=fR.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}RH.InstanceManager=RB,RH.ThemeManager=OB,RH.globalConfig={uniqueTooltip:!0},RH.Utils=Qz,RH.vglobal=b_;vB.registerRegion("region",cz),vB.registerLayout("base",_z),KT(),HC(),vB.registerMark(Jz.type,Jz),vB.registerStageEventPlugin("gesture",rH),kH(),MH(),MB(cB.name,cB);const OH="monotone",IH="linear",LH="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class DH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function FH(t,e){return e("component",t)}function zH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=vB.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const HH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},jH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},NH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},UH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=zH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},VH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const WH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function GH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=XH(UH(h,r,a,c),d,g),o.value=XH(UH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=UH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function YH(t,e,i,s,n,r,a){if(d(e)){GH(t,e(n,a),i,s,r,a)}else e&&GH(t,e,i,s,r,a)}const XH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class KH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{YH(a,t,e,i,s,n,r)})):d(t)?YH(a,t,e,i,s,n,r):t&&GH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:UH(r.visible,t,n),value:XH(UH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:UH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=UH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&WH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const $H={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},qH=(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=gP([],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 ZH(a,n,o)},ZH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{kM(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=>{kM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=$H[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},JH=(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=>{kM(t[e])||(t[e]=0)}))})),t},QH=`${NB}_HIERARCHY_DEPTH`,tj=`${NB}_HIERARCHY_ROOT`,ej=`${NB}_HIERARCHY_ROOT_INDEX`;function ij(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function sj(t,e,i){t&&(i.needDefaultSeriesField&&(t[XB]=i.defaultSeriesField),t[GB]=e,t[YB]=i.getKey(t,e,i))}function nj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function rj(t,e,i,s=0,n,r){void 0===r&&(r=e),sj(t,e,i),t[QH]=s,t[tj]=n||t[i.categoryField],t[ej]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>rj(e,s,i,t[QH]+1,t[tj],r)))}const aj={label:{name:"label",type:"text"}},oj=`${NB}_rect_x`,lj=`${NB}_rect_x1`,hj=`${NB}_rect_y`,cj=`${NB}_rect_y1`,dj={data:!0},uj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},pj=[...Object.keys(uH),"normal"];function gj(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 _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=uB({},o[e],a);return _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function fj(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),bj(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function mj(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function vj(t,e){var i;return null!==(i=null==t?void 0:t[GB])&&void 0!==i?i:e.context.graphicIndex}function yj(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 _j(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function bj(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),bj(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),bj(t[s],e,i))}function xj(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Sj extends rz{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=OE(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=vB.getSeriesMarkMap(o)?function(t,e,i){const s=vB.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=uB({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return uB({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=uB({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>uB({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Aj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(uj[e]||(t[e]=!0),t)),{}),kj={compileOnlyKeys:uj,dataRelatedKeys:Aj,seriesOnlyKeys:{tooltip:!0}},Cj={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Tj=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,Mj=(t,e,i)=>{const s=Tj(t),n=Tj(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function wj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class Ej extends az{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${NB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Sj,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=xj(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"invalidTravel",JH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=iR(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=eR(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=eR(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Tz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=ZH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){YP(this._dataSet,"dimensionStatistics",qH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new za(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&&gP(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){YP(this._dataSet,"dimensionStatistics",qH);const s=new za(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=gP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&gP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new za(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)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!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,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:bM(s)||xM(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=uB(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=uB(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=bH(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=bH(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=bH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:XB;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:KB,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,KB,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(vB.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new KH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,wj(i))}_getSpecUpdatePolicy(){return kj}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},dj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Mj(t[i],e[i],Cj)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Mj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?wj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&wj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof za||sR(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();xj(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:XB,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WE).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DE(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:XB}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,uB({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:YB}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==ZB&&t!==QB&&t!==qB&&t!==JB||(t=this.getStackValueField()),null!==(e=mP(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>kM(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:XB]}}function Bj(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Ow(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 Pj(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}}}Ej.mark=aj,Ej.transformerConstructor=Sj;class Rj extends Ej{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);Ow(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:`${NB}_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(ZB),this.setFieldX2(qB)):(this.setFieldY(ZB),this.setFieldY2(qB))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(QB),this.setFieldX2(JB)):(this.setFieldY(QB),this.setFieldY2(JB))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(eP),this.setFieldX2(tP)):(this.setFieldY(eP),this.setFieldY2(tP))}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)&&(Bj("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Oj(t){return"bottom"===t||"top"===t}function Ij(t){return"left"===t||"right"===t}function Lj(t){return"z"===t}function Dj(t,e){return qE(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Fj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function zj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Oj(t)?"linear":"band":Oj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Hj=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):["linear","log","symlog"].includes(e)?FH("axisLinear",i):{})&&void 0!==s?s:{},r=Oj(t)?FH("axisX",i):Ij(t)?FH("axisY",i):FH("axisZ",i);return uB({},FH("axis",i),n,r)};class jj{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:fM)("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:fM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Lw(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Oj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Nj extends jj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Uj=(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))},Vj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},Wj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Lw(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:Gj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,Yj=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class Xj extends jj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Uj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:jP.canvas}),callback:this.onMouseOut}),bM(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),bM(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Kj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Kj||(Kj={}));const $j={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qj={sampling:!0,samplingFactor:!0};class Zj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark($j.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:LH,curveType:IH,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===OH?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark($j.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:yj(this._spec,$j.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new za(this._option.dataSet,{name:`${NB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[$j.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,uB({},this._spec[$j.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Jj=Object.assign(Object.assign({},aj),$j),Qj=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>Qj(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},tN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class eN extends qz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return tN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(Iw(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Qj(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[YB]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const iN=new Uint32Array(33),sN=new Uint32Array(33);sN[0]=0,iN[0]=~sN[0];for(let t=1;t<=32;++t)sN[t]=sN[t-1]<<1|1,iN[t]=~sN[t];function nN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&iN[31&o]&sN[1+(31&l)])return!0}else{if(i[h]&iN[31&o])return!0;if(i[c]&sN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,iN[31&o]&sN[1+(31&l)]);else for(s(h,iN[31&o]),s(c,sN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,sN[31&a]|iN[1+(31&o)]);else for(n(l,sN[31&a]),n(h,iN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function rN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function aN(t,e,i=!1){return i?rN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function oN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=aN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=rN(t,r)),e.getRange(r)))}function lN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return lN(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return lN(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 lN(t,e,n,s,h,c)}return!1}const cN=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],dN=["top","inside-top","inside"];function uN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const pN={mode:"same-time",duration:300,easing:"linear"};function gN(t){return 3===t||4===t}function fN(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 mN=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 vN(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)}}class yN extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class _N extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const bN=(t,e)=>Math.ceil(t)>Math.floor(e),xN=([t,e],[i,s])=>s>t&&e>i;function SN(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const AN=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class kN extends Qp{constructor(t,e){super(t),this._skipRenderAttributes=AN,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{MN(t,e,i)})),e}function wN(t,e){e&&(null==t||t.onComplete.push(e))}function EN(t){t.forEach((t=>{t()}))}function BN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var PN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(GM.hover,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(TM(this,(t=>{P(t.states)||(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void TM(this,(t=>{P(t.states)||(t.removeState(GM.selectedReverse),t.removeState(GM.selected))}));P(e.states)||(e.addState(GM.selected,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[vN(g,f,c,d,a,o),vN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=NM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Al)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),EN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(pN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=MN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=MN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}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):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return QM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&bN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&bN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(SN([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!xN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(aN(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;TN(i,null==n?void 0:n.attribute),TN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{ON[t]=e};var LN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};DN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const FN=()=>{IN("line",DN),IN("area",DN)};var zN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}HN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const jN=()=>{IN("symbol",HN),IN("line-data",HN)};class NN extends eN{constructor(){super(...arguments),this.type=NN.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)===PE.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}NN.type="line";const UN=()=>{vB.registerMark(NN.type,NN),KT(),iT(),FN(),jN(),_H(),vB.registerGraphicComponent("line",ag)};class VN extends qz{constructor(){super(...arguments),this.type=VN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}VN.type="symbol";const WN=()=>{vB.registerMark(VN.type,VN),KT(),iM(),jN(),vB.registerGraphicComponent("symbol",Gg)};class GN extends Sj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function YN(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function XN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function KN(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 $N(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 qN(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 ZN(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 JN=t=>t.map(((t,e)=>({index:e,value:t}))),QN=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},tU=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=$M(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return JN(v)};class sU{constructor(t){this.id=AM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class nU extends sU{constructor(){super(nU.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Ow(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&YN(c)&&YN(d)))return;const u=XN(t,c),p=XN(e,d);if(!0===u.break&&!0===p.break)return;const{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(!$N(u,p))return}else if(0===_&&0===b){if(!$N(p,u))return}else if(y||A)if(y&&!A){if(!KN(u,p))return}else if(A&&!y){if(!KN(p,u))return}else{if(f===b)return;if(f>b){if(!qN(u,p))return}else if(!qN(p,u))return}else{if(0===f&&0===_){if(!ZN(u,p))return}else if(0===b&&0===g&&!ZN(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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){YP(e.getOption().dataSet,"tickAlign",iU);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}nU.pluginType="component",nU.type="AxisSyncPlugin";const rU={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function aU(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 oU(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 lU(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const hU=t=>"band"===t||"ordinal"===t||"point"===t;function cU(t,e){return{id:t,label:t,value:e,rawValue:t}}function dU(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class uU extends eH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const pU=`${NB}_ARC_TRANSFORM_VALUE`,gU=`${NB}_ARC_RATIO`,fU=`${NB}_ARC_START_ANGLE`,mU=`${NB}_ARC_END_ANGLE`,vU=`${NB}_ARC_K`,yU=`${NB}_ARC_MIDDLE_ANGLE`,_U=`${NB}_ARC_QUADRANT`,bU=`${NB}_ARC_RADIAN`,xU=-Math.PI/2,SU=3*Math.PI/2,AU=.6,kU=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},CU=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):"linear"===e?FH("axisLinear",i):{})&&void 0!==s?s:{},r=FH("angle"===t?"axisAngle":"axisRadius",i);return uB({},FH("axis",i),n,r)};function TU(t,e,i,s){switch(t){case r.cartesianBandAxis:return Hj(Dj(i,["z"]),"band",e);case r.cartesianLinearAxis:return Hj(Dj(i,["z"]),"linear",e);case r.cartesianLogAxis:return Hj(Dj(i,["z"]),"log",e);case r.cartesianSymlogAxis:return Hj(Dj(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return Hj(Dj(i),void 0,e);case r.polarBandAxis:return CU(i.orient,"band",e);case r.polarLinearAxis:return CU(i.orient,"linear",e);case r.polarAxis:return CU(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>Oj(t.orient)));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>Ij(t.orient)));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return MU(i,FH(t,e));default:return FH(t,e)}}const MU=(t,e)=>{var i;const s=uB({},e,e[Fj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class wU extends rz{getTheme(t,e){return TU(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({},iB(e)),{[s]:0}))}}class EU extends lz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=wU,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof qa||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:jP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new uU(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;EH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=BH(t),s=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}EH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var BU,PU;EU.transformerConstructor=wU,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(BU||(BU={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(PU||(PU={}));class RU extends qz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?EH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(EH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=vB.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(FP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}RU.type="component";const OU=()=>{vB.registerMark(RU.type,RU)};var IU,LU;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(IU||(IU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(LU||(LU={}));const DU={[LU.selectedReverse]:{},[LU.selected]:{},[LU.hover]:{},[LU.hoverReverse]:{}},FU=t=>t,zU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class HU extends EU{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?BU.circleAxis:BU.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?PU.circleAxisGrid:PU.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=gj(null===(h=vB.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&Tw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Ow(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Ow(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return Tw(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=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=Mw(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()})),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(Tw(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||zU[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=wP(s=t.domainLine)).startSymbol=wP(s.startSymbol),s.endSymbol=wP(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(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 PP(uB({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:PP(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return PP(uB({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:PP(t.tick.style)),t.tick.state&&(i.tick.state=EP(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 PP(uB({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:PP(t.subTick.style)),t.subTick.state&&(i.subTick.state=EP(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=rU[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:uB({},d,PP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:PP(h.style)}),h.state&&(i.title.state.shape=EP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:PP(o.style)}),o.state&&(i.title.state.background=EP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=EP(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=PP(t.background.style)),t.background.state&&(i.panel.state=EP(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:HB(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 PP(uB({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:PP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:HB(t.subGrid.alternateColor),style:PP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=zH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){XP(this._option.dataSet,"scale",FU);const i=this.registerTicksTransform();return new za(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===IU.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}HU.specKey="axes";const jU=()=>{OU(),vB.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},NU=[nU];class UU extends HU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{const e=this.getOrient();Oj(e)?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Ij(e)?dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Lj(e)&&dU(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=uB({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(uB({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Oj(this.getOrient()),n=t=>{var e;return(s?!Oj(t.getOrient()):Oj(t.getOrient()))&&Ow(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&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Dj(i,["z"]),Lj(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(!lU(e))return null;const{axisType:t,componentName:s}=zj(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=>Ij(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(!lU(t))return;const{axisType:s,componentName:n}=zj(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=vB.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Oj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Lj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(NU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Oj(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&&!Oj(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Lj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Ij(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Oj(this.getOrient())?t.fieldX:Lj(this.getOrient())?t.fieldZ:t.fieldY,Ow(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(FP.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(Oj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Oj(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return Tw(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]:Oj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Lj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();Tw(this._regions,(e=>{Oj(t)?dU(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Ij(t)?dU(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Lj(t)&&dU(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Oj(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=Oj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=uB(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Oj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return cU(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Ow(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}UU.type=r.cartesianAxis,UU.specKey="axes";class VU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=cU(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=>cU(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const WU=(t,e,i,s)=>{const n=eU(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},GU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,YU=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?JN([s[s.length-1]]):JN([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=WU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=KU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=WU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!GU(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?YU(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function qU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=$U(e,t,!1,!!n),o=$U(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class ZU extends kN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${IU.grid}-sub`:`${IU.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=$U(t,o,!1,!!a)}const u=NM.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=gw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=NM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}ZU.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class JU{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=zM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return FM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class QU extends nb{onBind(){var t;const e=vD(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;TN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class tV extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;TN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function eV(){HC(),iT(),YT(),cM(),w_.registerBuiltInAnimate("axisEnter",QU),w_.registerBuiltInAnimate("axisUpdate",tV)}HC(),cT();class iV extends ZU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},ZU.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=UM,endAngle:r=VM}=this.attribute;i=pw(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function sV(){HC(),iT(),yT(),iM()}function nV(){HC(),iT(),gC(),iM()}G(iV,JU),sV();class rV extends kN{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=NM.line;Y(i)[0].cornerRadius&&(t=NM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=NM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}rV.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}}},nV();class aV extends rV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function oV(){HC(),OT(),iM(),YT(),cM()}var lV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:Y(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+E,i=1===j?(t-e)/2+E+I/2:b[0]+E-(T/2+e/2-E)+I/2;if(V(i,"center"),A){const t=i-I/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-I-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,G=lV(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Al)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},hV.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}hV.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const cV=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(GM.hover,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.hoverReverse,!0)})),s):i},dV=(t,e,i)=>i?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),null):i,uV=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(GM.selected)?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.selectedReverse),t.removeState(GM.selected))})),null):s.name&&!P(s.states)?(s.addState(GM.selected,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.selectedReverse,!0)})),s):i},pV={type:"default",duration:300,easing:"linear"};class gV extends CN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cV(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=NM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),EN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(TM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=MN(this),{delay:a=0,duration:o=pV.duration,easing:l=pV.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};TN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=MN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(pV)}_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=NM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=IU.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=NM.group({x:0,y:0,pickable:!1});t.name=IU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=NM.group({x:0,y:0,pickable:!1});i.name=IU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=NM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=IU.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=YM;else{const t=this.data[s],e=H({},YM,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=NM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=IU.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=YM;else{const i=H({},YM,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=NM.group({x:0,y:0,pickable:!1});return r.name=`${IU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=QM(this._getLabelAttribute(t,e,n,i));if(a.name=IU.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=YM;else{const s=H({},YM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new hV(Object.assign({},e));i.name=IU.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/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 f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},nw.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},TM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=ZA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},TN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const fV={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&&fw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function mV(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function vV(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fV[n]||fV.parity;if(s.length>=3&&mw(s,r)){do{s=a(s,r)}while(s.length>=3&&mw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);fw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),vV(l,s,n,(t=>fw(t,l,r))),vV(h,s,o,(t=>fw(t,h,r)||!(!n||t===l)&&fw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function _V(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},SV(t,e.attribute.angle)),{angle:xV(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({},AV(t,e.attribute.angle)),{angle:xV(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function xV(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function SV(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=xV(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 AV(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=xV(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 kV(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=hw(h),m=lw(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function CV(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var TV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=NM.group({zIndex:999});e.name=IU.axisBreak,e.id=this._getNodeId(`${IU.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},rw,s),a=null!==(e=r.size)&&void 0!==e?e:rw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=NM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=IU.axisBreakSymbol;const h=NM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=IU.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=NM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=IU.background,n.id=this._getNodeId("background"),n.states=H({},DU,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new hV(Object.assign({},t));e.name=IU.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=TV(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},DU,l),symbol:H({},DU,l)});const d=new rV(c);d.name=IU.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=TV(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=HM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},DU,c.text),shape:H({},DU,c.shape),panel:H({},DU,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=TV(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=HM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return SV(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return AV(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=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),bV(i,t),!_V(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=hw(a),l=lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=CV(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=CV(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);kV(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&yV(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(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=NM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=IU.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=qM(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=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}MV.defaultAttributes=nw,G(MV,JU);const wV={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},EV={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}}},BV={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}}},PV={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}}};class RV extends UU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new iE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,XU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Xw(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{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(RV.type,RV,!1)},IV=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function LV(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,FV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function zV(t,e,i="count"){const s=FV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const HV=Math.sqrt(50),jV=Math.sqrt(10),NV=Math.sqrt(2);class UV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=oU(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=Oj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(DV),e.sort(DV),{domain:LV(t,e),scope:zV(t,e,i)}}(r,dM(t),this._spec.breaks[0].scopeType);e=dM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=oU(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=HV?10:n>=jV?5:n>=NV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}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=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function VV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function WV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Ow(t.type))return JN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return JN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=VV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=VV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=VV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=eU(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=eU(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?YV.greedy:YV.parity;for(;l.length>=3&&mw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;fw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),WV(t,l,a,(e=>fw(e,t,i))),WV(n,l,o,(e=>fw(e,n,i)||!(!a||e===t)&&fw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return JN(m)},YV={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&fw(i,t,e)||(i=t,0))))}},XV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class KV extends UU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Lj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Oj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=ZE(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=dM(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}KV.type=r.cartesianLinearAxis,KV.specKey="axes",KV.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(KV,UV);const $V=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(KV.type,KV)},qV=`${NB}_hide_`;function ZV(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const JV=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[qV]&&(ZV(t,!0),t[qV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[qV]=!0,ZV(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},QV=()=>{vB.registerGrammarTransform("symbolOverlap",{transform:JV,runType:"afterEncode"})},tW={min:$,max:K,average:xw,sum:bw};function eW(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function iW(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 sW(t,e,i,s){return iW(t,e,i,"min",s)}function nW(t,e,i,s){return iW(t,e,i,"max",s)}function rW(t,e,i,s){return iW(t,e,i,"average",s)}function aW(t,e,i,s){return iW(t,e,i,"sum",s)}const oW=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=eW;if("min"===n?l=sW:"max"===n?l=nW:"average"===n?l=rW:"sum"===n&&(l=aW),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[]},lW=()=>{vB.registerGrammarTransform("dataSampling",{transform:oW})};class hW extends Rj{constructor(){super(...arguments),this.type=PE.line,this.transformerConstructor=GN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),fj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}hW.type=PE.line,hW.mark=Jj,hW.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},hW.transformerConstructor=GN,G(hW,Zj);class cW{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{sR(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof za)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];gM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];gM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class dW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{CM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{gP(e,[{key:t,operations:Ow(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&&gP(e,[{key:i.field,operations:Ow(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?YE("colorOrdinal"):YE(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(CM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),CM(s.domain)?e.reRender=!0:V(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(!CM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Ow(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Ow(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;Ow(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(Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Ow(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class uW{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&Xz(t,i,!0,l):a&&Xz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&Xz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Kz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Kz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const pW={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},gW={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class fW extends nz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=AM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:UB,height:VB},this._viewRect={width:UB,height:VB},this._viewBox={x1:0,y1:0,x2:UB,y2:VB},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._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(gW).some((t=>!u(e[t])))},this._paddingSpec=iB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new DP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new cW(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new uW;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=vB.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(gj({},fj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=vB.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=vB.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof az)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 qz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof qz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&sR(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=GF(this._spec,this._option,{width:UB,height:VB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DE(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new dW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){$F(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DE(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=iB(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{$F(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);KF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),$F(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);KF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),$F(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(pW[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return pW[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!pW[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;pW[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];$F(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=tB(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(FP.AFTER_MARK_RENDER_END,e)};this._event.on(FP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:IP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(OP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===Kj.dimensionHover||s===Kj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Lw(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Lw(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const mW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},vW={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class yW{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},vW),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):dB(t,a,c.spec),dB(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(vB.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(vB.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=vB.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=vB.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=vB.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):HH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=HH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class _W extends yW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&uB(i,qF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class bW extends _W{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),WF(t)}}const xW=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=vP(t,!0);for(const e in o)for(const i in o[e].nodes)xP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)bP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&_P(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class AW{_beforeInit(){this._dataSet&&YP(this._dataSet,"stackSplit",xW)}_initStack(){this._stack=new SW(this),this._stack.init()}}const kW={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:Kj.dimensionHover};class CW extends xH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},kW,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=IP(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}CW.type="dimension-hover",CW.defaultOptions=kW;const TW=()=>{vB.registerInteractionTrigger(CW.type,CW)},MW=()=>{vB.registerComposedEvent(Kj.dimensionHover,Xj),vB.registerComposedEvent(Kj.dimensionClick,Nj)},wW=t=>t.fieldX[0],EW=t=>t.fieldY[0],BW=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},PW=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},RW=(t,e)=>t?e?wW:BW:e?EW:PW,OW=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=Yj(t,(t=>Oj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=Yj(t,(t=>Ij(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Lw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=IW(t,i,RW(e,Lw(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=IW(t,i,RW(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},IW=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:LW(t,s,i)},LW=(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=Wj(e,t,"cartesian",null!=i?i:Oj(t.getOrient())?wW:EW);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},DW=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Lw(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Ow(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=aU(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};zW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&FW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),FW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=zH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},zW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},HW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=jW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},jW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},NW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return DW(c,r,e),c.xField.cacheInfo?HW(c.xField):c.yField.cacheInfo?HW(c.yField):void 0},UW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],VW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&UW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(WW(s).every((t=>{var e;return!WH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},WW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},GW={dom:`${NB}_TOOLTIP_HANDLER_DOM`,canvas:`${NB}_TOOLTIP_HANDLER_CANVAS`},YW={key:"其他",value:"..."};var XW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(XW||(XW={}));class KW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=VW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},YW),t):YW;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&WH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class $W extends KW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Lw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const qW=()=>{vB.registerTooltipProcessor("dimension",$W)};class ZW extends KW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,yo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(IP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const JW=()=>{vB.registerTooltipProcessor("mark",ZW)};class QW extends KW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const tG=()=>{vB.registerTooltipProcessor("group",QW)};class eG extends fW{constructor(){super(...arguments),this.transformerConstructor=bW,this.type="line",this.seriesType=PE.line}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}eG.type="line",eG.seriesType=PE.line,eG.transformerConstructor=bW,G(eG,AW);const iG=[...tN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class sG extends eN{constructor(){super(...arguments),this.type=sG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return iG}_getIgnoreAttributes(){return[]}}sG.type="area";const nG=()=>{vB.registerMark(sG.type,sG),KT(),wC(),FN(),jN(),_H(),vB.registerGraphicComponent("area",Yp)};class rG extends KH{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 aG=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}}),oG=()=>{vB.registerAnimation("area",vH),yH(),fH()};class lG extends GN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=uB({},f.style,g.style),l.state=uB({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function hG(){HC(),OT()}function cG(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const dG={debounce:St,throttle:At};hG();let uG=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=cG(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:dG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(KM,{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",dG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(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]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};uG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class pG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=pG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(KM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new uG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}SG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class AG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,SG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new SG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,VF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class kG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class CG extends kG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class TG extends kG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function MG(t){t.isBound(AG)||(t.bind(AG).toSelf().inSingletonScope(),t.bind(o_).toService(AG)),t.isBound(CG)||(t.bind(CG).toSelf(),t.bind(Sv).toService(CG)),t.isBound(TG)||(t.bind(TG).toSelf(),t.bind(Sv).toService(TG))}class wG extends kN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}HC(),iT();class EG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HC(),OT();class BG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},BG.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})}}BG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},HC(),gC();class PG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}PG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},HC(),gC();class RG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},RG.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=UM,endAngle:s=VM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}RG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},HC(),cT();class OG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},OG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}OG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class IG{isInValidValue(t){const{startAngle:e=UM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=UM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return uw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function LG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=LG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var zG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=NM.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=NM.circle(t)}h.name=IU.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},DU,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=zG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=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:y,textAlign:"center"},l),state:{text:H({},DU,d.text),shape:H({},DU,d.shape),panel:H({},DU,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=LG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&DG(e,c,i)}else e.AABBBounds.width()>r&&DG(e,r,i)}else o>a.x&&h.x2>n.x2?(DG(e,n.x2-o,i),r&&FG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}HG.defaultAttributes=nw,G(HG,IG);const jG=(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=$M(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=dw(r,uw(s,r,e,n));return o=a,l=uw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return JN(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=jG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=UG(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 JN(c)},UG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&QN(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var VG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new YG(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):gN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=gN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=gN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=gN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?gN(t.quadrant)?"left":"right":gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.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*(gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),EN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}$G.defaultAttributes={pickable:!1};var qG,ZG,JG,QG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(tY,IG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(qG||(qG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(ZG||(ZG={})),function(t){t.dataZoomChange="dataZoomChange"}(JG||(JG={}));const eY="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",iY={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:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},sY={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}},nY=0,rY=1,aY=2,oY=3,lY=4,hY=5,cY=5,dY=999,uY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var pY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:aY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:aY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:nY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:hY},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:hY},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},sY.horizontal),{zIndex:hY}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},sY.horizontal),{zIndex:hY}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:hY},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:hY},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},sY.vertical),{zIndex:hY}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:hY},sY.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:rY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:lY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return qA(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=pY(c,["formatMethod"]),{formatMethod:g}=d,f=pY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:uY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:uY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:uY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:uY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:cY}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:cY}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new hV(e),s.name=i,t.add(s)),s}}const fY={debounce:St,throttle:At};class mY extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=qG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=qG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=qG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=cG();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===qG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===qG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===qG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===qG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(ZG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===qG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:fY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=cG();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=qG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}oV(),OT(),iM(),wC(),iT();let vY=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new gY(this._getRendererAttrs()),this._interaction=new mY(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(ZG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(ZG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(JG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(ZG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(JG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var yY,_Y,bY,xY;function SY(){HC(),oV(),fb()}vY.defaultAttributes=iY,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"}(yY||(yY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(_Y||(_Y={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(bY||(bY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xY||(xY={}));class AY extends kN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cV(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(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:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},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=NM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=NM.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=NM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),EN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=MN(this);this.markerAnimate("exit");const n=MN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function kY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function CY(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;TN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function TY(t,e,i,s){t&&(CY(t.startSymbol,e,i,s),kY(t).forEach((t=>CY(t,e,i,s))),CY(t.endSymbol,e,i,s))}function MY(t,e,i,s){t&&(CY(t.getTextShape(),e,i,s),CY(t.getBgRect(),e,i,s))}function wY(t,e,i,s){var n,r,a,o;t&&(TN(t,{fillOpacity:0,strokeOpacity:0},{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 EY(t,e,i,s){t&&(wY(t.startSymbol,e,i,s),kY(t).forEach((t=>wY(t,e,i,s))),wY(t.endSymbol,e,i,s))}function BY(t,e,i,s){t&&(wY(t.getTextShape(),e,i,s),wY(t.getBgRect(),e,i,s))}function PY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;CY(t.startSymbol,s,r,n);const h=kY(t);h.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),CY(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;CY(t.getTextShape(),e,l,n),CY(t.getBgRect(),e,l,n)}))}function RY(t,e,i,s,n){TY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function OY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function IY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function LY(t,e,i,s,n,r){var a;TY(t,n,s,r),CY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?MY(i,n,s,r):CY(i,n,s,r)}function DY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;CY(t.startSymbol,n,o,r);const u=kY(t);u.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),CY(e,n+o+l,h,r),CY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(CY(i.getTextShape(),n+o+l+h+c,d,r),CY(i.getBgRect(),n+o+l+c,d,r)):CY(i,n+o+l+c,d,r)}function FY(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?PY(t,e,s,r,a):"fadeIn"===i&&RY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?PY(t,e,s,n,a):"fadeIn"===i&&RY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){EY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function zY(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&&OY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&OY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function HY(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&&IY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&IY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function jY(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?LY(n,r,e,i,s,o):"callIn"===t&&DY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?LY(n,r,e,i,s,a):"callIn"===t&&DY(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;EY(t,n,s,r),wY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?BY(i,n,s,r):wY(i,n,s,r)}(n,r,e,t,i,s)}}const NY={type:"clipIn",duration:500,easing:"linear",delay:0},UY={type:"fadeIn",duration:500,easing:"linear",delay:0},VY={type:"callIn",duration:500,easing:"linear",delay:0},WY={type:"fadeOut",duration:500,easing:"linear",delay:0};class GY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new hV(Object.assign(Object.assign({},h),{state:{panel:H({},YM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},YM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},YM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},YM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class YY extends AY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=NY,this.defaultExitAnimation=WY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;sw(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(YY,GY);const XY=.001,KY={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:yY.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]}},$Y={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"}}},qY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:bY.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]}},ZY={interactive:!0,label:{position:_Y.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}},JY={interactive:!0,label:{autoRotate:!0,position:bY.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}},QY={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"}},tX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},eX={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 iX(){sX._animate=FY}SY(),sV(),fb();class sX extends YY{markerAnimate(t){sX._animate&&this._animationConfig&&sX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},sX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(wM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return EM(Math.abs(e),Math.PI/2,XY)||EM(Math.abs(e),3*Math.PI/2,XY)?BM(i,e,t):wM(e)?$Y.postiveXAxis[t]:$Y.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new rV({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",sX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(sX.defaultAttributes.label)}}function nX(){rX._animate=zY}sX.defaultAttributes=KY,SY(),yT(),fb();class rX extends AY{markerAnimate(t){rX._animate&&this._animationConfig&&rX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},tX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=NM.polygon(Object.assign({points:e},i));n.states=H({},YM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",rX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},YM,null==i?void 0:i.area)),this._updateMarkLabels(rX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}rX.defaultAttributes=ZY,G(rX,GY),SY(),nV(),fb();class aX extends YY{markerAnimate(t){aX._animate&&this._animationConfig&&aX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},aX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case bY.arcInnerStart:l=n;case bY.arcOuterStart:l=n;break;case bY.arcInnerEnd:l=r;case bY.arcOuterEnd:l=r;break;case bY.center:case bY.arcInnerMiddle:case bY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return QY[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new aV({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",aX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(aX.defaultAttributes.label)}}aX.defaultAttributes=qY,SY(),gC(),fb();class oX extends AY{markerAnimate(t){oX._animate&&this._animationConfig&&oX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},oX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case bY.center:h=(s+n)/2,c=(r+a)/2;break;case bY.arcInnerStart:h=s,c=r;break;case bY.arcOuterStart:h=n,c=r;break;case bY.arcInnerEnd:h=s,c=a;break;case bY.arcOuterEnd:h=n,c=a;break;case bY.arcInnerMiddle:h=s,c=(r+a)/2;break;case bY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},QY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=NM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},YM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",oX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},YM,null==o?void 0:o.area)),this._updateMarkLabels(oX.defaultAttributes.label)}isValidPoints(){return!0}}function lX(){hX._animate=jY}oX.defaultAttributes=JY,G(oX,GY),SY(),sV(),nV(),iM(),XC(),iT(),fb();class hX extends AY{markerAnimate(t){hX._animate&&this._animationConfig&&hX._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},hX.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=VY,this.defaultExitAnimation=WY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return EM(Math.abs(s),Math.PI/2,XY)||EM(Math.abs(s),3*Math.PI/2,XY)?BM(t,s,n):wM(s)?eX.postiveXAxis[n]:eX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=xY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},YM,null==p?void 0:p.textBackground),text:H({},YM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},YM,null==p?void 0:p.itemContent));const v=wM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=NM.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"text"===n?o=new hV(Object.assign(Object.assign({},i),{state:{panel:H({},YM,null==s?void 0:s.textBackground),text:H({},YM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=NM.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"image"===n?(o=NM.image(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},YM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=EM(c,0,XY)||EM(d,0,XY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=ew(e-u,t-d),o=ew(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(yX.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(yX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===yX.focus||"focus"===o){const s=a.hasState(mX.focus);a.toggleState(mX.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover,mX.focus],t),this._setLegendItemState(e,mX.selected,t)})):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover,mX.focus],t),this._setLegendItemState(e,mX.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(mX.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(mX.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(vX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[mX.selected,mX.selectedHover],t),this._setLegendItemState(a,mX.unSelected,t)):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t))}else this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover],t),this._setLegendItemState(e,mX.unSelected,t))}))}this._dispatchLegendEvent(vX.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,mX.selected),this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover])):(this._removeLegendItemState(e,[mX.selected,mX.selectedHover]),this._setLegendItemState(e,mX.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=pX,spaceRow:l=gX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=NM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=NM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,yX.item,t,M)):(M=NM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,yX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?mX.selected:mX.unSelected);const w=NM.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=NM.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,yX.itemShape,t,M,S.state),s.addState(e?mX.selected:mX.unSelected),w.add(s)}let I=0;if(d){const e=R(g,"size",10);E=NM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,yX.focus,t,M),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=QM(Object.assign(Object.assign({x:P/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,yX.itemLabel,t,M,A.state),D.addState(e?mX.selected:mX.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=QM(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,yX.itemValue,t,M,k.state),r.addState(e?mX.selected:mX.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-O-I),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.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 j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new uX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new uX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new uG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new uG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=pX,spaceRow:o=gX}=n,l=this._itemsContainer,{space:h=fX,defaultCurrent:c=1}=r,d=SX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=NM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=pX,spaceRow:a=gX}=s,o=this._itemsContainer,{space:l=fX,defaultCurrent:h=1}=n,c=SX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=NM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=NM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(mX.selected)?this._setLegendItemState(t,mX.selectedHover,e):this._setLegendItemState(t,mX.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===yX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(vX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(mX.unSelectedHover)||t.hasState(mX.selectedHover))&&(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(mX.unSelectedHover)&&!t.hasState(mX.selectedHover)||(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===yX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(vX.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!==yX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(vX.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!==yX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(mX.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},AX,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(mX.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var CX;function TX(t){return _(t)?t:[t,t]}function MX(t){return t?"ew-resize":"ns-resize"}kX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:pX,spaceRow:gX,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:fX,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"}(CX||(CX={})),bX();class wX extends kN{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:H({},wX.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=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(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?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:TX(d)[0],endValue:TX(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=NM.group({x:0,y:0});f.name=CX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=NM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=CX.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=NM.group({x:g?v:0,y:g?0:v});f.add(y);const _=NM.group({x:0,y:0});let b;if(_.name=CX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=NM.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=CX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=NM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=CX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=TX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(v.name=CX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=CX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(i.name=CX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=CX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=NM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=CX.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":MX(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=NM.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=CX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return NM.symbol(t)}_renderHandlerText(t,e){return NM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":MX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=NM.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=NM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===CX.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===CX.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===CX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===CX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}wX.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}}},xX(),bX();class EX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 BX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}EX.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"}}},xX(),bX(),cT();class PX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PX.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=NM.group({x:0,y:0});this._innerView.add(x);const S=new wX({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:BX(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 C=NM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);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))}}PX.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)"}},HC(),cM(),YT();let RX=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},XM),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,O-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},XM),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GO&&(G=O),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(I)||p(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(I)||p(M.align)){const t=M.align?M.align:I,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};RX.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 OX={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"}}};HC(),cM(),YT();let IX=class extends kN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(OX,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=QM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=qM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&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 LX extends Wg{constructor(t){super(t)}}var DX,FX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(DX||(DX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(FX||(FX={}));class zX extends kN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},zX.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"},zX.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"},zX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.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 LX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new LX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new LX(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(DX.OnPlay)},this.pause=()=>{this._dispatchEvent(DX.OnPause)},this.forward=()=>{this._dispatchEvent(DX.OnForward)},this.backward=()=>{this._dispatchEvent(DX.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()}}zX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},zX.defaultAttributes={[FX.Start]:{},[FX.Pause]:{},[FX.Backward]:{},[FX.Forward]:{}};const HX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},jX=[200,10];var NX,UX;!function(t){t.Default="default",t.Reverse="reverse"}(NX||(NX={})),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"}(UX||(UX={}));const VX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),WX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),GX=t=>"top"===t||"bottom"===t;class YX extends kN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YX.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(GX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:jX[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:jX[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 wX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=GX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new zX(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=GX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:jX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(GX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(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:GX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:GX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function XX(){bX(),HC(),iM()}YX.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({},HX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},HX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},HX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},HX),{key:"backward",position:"start"})}},XX();class KX extends YX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},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:NX.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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(VX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||WX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===NX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(UX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(UX.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(UX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.change),this.dispatchCustomEvent(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var $X,qX=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())}))};XX();class ZX extends YX{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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change))},this.play=()=>qX(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(UX.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.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(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}($X||($X={}));const JX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},QX=5;const tK={debounce:St,throttle:At};HC(),yT();let eK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=JX.updateTrigger,endTrigger:i=JX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:tK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=JX.trigger,resetTrigger:i=JX.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent($X.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent($X.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=QX}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent($X.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent($X.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent($X.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=QX}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=JX.updateTrigger,endTrigger:s=JX.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=NM.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};eK.defaultAttributes=JX;const iK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},sK=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}},nK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},rK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];HC(),OT(),iM(),cM(),YT();let aK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},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=oi(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",H({symbolType:"circle"},u.shape,{visible:MM(u)&&MM(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:MM(u)&&MM(u.value)},sK(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:MM(u)&&MM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:MM(u)&&MM(u.value)},sK(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},XM),u.value),visible:MM(u)&&MM(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=MM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=MM(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]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!MM(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)+(MM(n.key)?r+n.key.spacing:0)+(MM(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&&(tw(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:MM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),tw(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(MM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(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(MM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},sK(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},sK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},XM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(MM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},sK(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},sK(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=>rK.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)&&MM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=MM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=$M(d),y=$M(u);let _=0;if(MM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(MM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return iK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return iK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};aK.defaultAttributes=nK;class oK extends KV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{Oj(this.getOrient())?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=uB({},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 za(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Tz(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.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=>cU(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=>cU(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}oK.type=r.cartesianTimeAxis,oK.specKey="axes",oK.builtInTheme={axis:EV,axisX:BV,axisY:PV};class lK extends KV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new ME}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}lK.type=r.cartesianLogAxis,lK.specKey="axes",lK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(lK,UV);class hK extends KV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new wE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}hK.type=r.cartesianSymlogAxis,hK.specKey="axes",hK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(hK,UV);class cK extends Rj{constructor(){super(...arguments),this.type=PE.area,this.transformerConstructor=lG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(cK.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===OH?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XE(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XE(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[ZB]},"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(gj(null===(e=vB.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),fj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),fj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new rG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}cK.type=PE.area,cK.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},cK.mark=aG,cK.transformerConstructor=lG,G(cK,Zj);class dK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(t)}}class uK extends fW{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="area",this.seriesType=PE.area}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}uK.type="area",uK.seriesType=PE.area,uK.transformerConstructor=dK,G(uK,AW);function pK(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 gK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:pK(t,e)}),fK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:pK(t,e)}),mK={type:"fadeIn"},vK={type:"growCenterIn"};function yK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mK;case"scaleIn":return vK;default:return gK(t)}}class _K extends qz{constructor(){super(...arguments),this.type=_K.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}_K.type="rect";const bK=()=>{KT(),OT(),IN("rect",WG),vB.registerMark(_K.type,_K),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),vB.registerGraphicComponent("rect",mg)},xK=Object.assign(Object.assign({},aj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function SK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=nB(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[oj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):XE(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[lj]):XE(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=XE(this._dataToPosX(t),e,i),n=XE(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[hj]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XE(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[cj]):XE(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=XE(this._dataToPosY(t),e,i),n=XE(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),CK)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},TK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:yj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(TK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}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(YP(this._option.dataSet,"addVChartProperty",NH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};YP(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new za(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new Tz(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_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=cj,s=hj,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=lj,s=oj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=vP(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)SK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=XE(this[r](t),l,i),u=XE(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!KE(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[qB],n=e[ZB],r=e[JB],d=e[QB];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?hj:oj],i=e[a?cj:lj];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[qB]:s,[ZB]:o}),c?{[JB]:u,[QB]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(mg(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>XE(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>XE(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Pj(this);this._barMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),fj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=nB(this._spec.barWidth,a)),l&&(c=Math.max(c,nB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,nB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=nB(null!==(l=i[r-1])&&void 0!==l?l:X(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 _=Ow(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}TK.type=PE.bar,TK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},TK.mark=xK,TK.transformerConstructor=kK;const MK=()=>{lW(),bK(),vB.registerAnimation("bar",((t,e)=>({appear:yK(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),OV(),$V(),vB.registerSeries(TK.type,TK)};class wK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(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 EK extends fW{constructor(){super(...arguments),this.transformerConstructor=wK,this.type="bar",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}EK.type="bar",EK.seriesType=PE.bar,EK.transformerConstructor=wK,G(EK,AW);const BK=[10,20],PK=Pw.Linear,RK="circle",OK=Pw.Ordinal,IK=["circle","square","triangle","diamond","star"],LK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},DK=Object.assign(Object.assign({},aj),{point:{name:"point",type:"symbol"}});class FK extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const zK={sizeField:!0};class HK extends Rj{constructor(){super(...arguments),this.type=PE.scatter,this.transformerConstructor=FK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),zK)})}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=`${NB}_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=`${NB}_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:PK,defaultRange:BK},"size")}getShapeAttribute(t,e){return u(e)?RK:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:OK,defaultRange:IK},"shape")}initMark(){this._symbolMark=this._createMark(HK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,HK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Pj(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(gj(null===(i=vB.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),fj("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:RK},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}HK.type=PE.scatter,HK.mark=DK,HK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},HK.transformerConstructor=FK;const jK=()=>{WN(),vB.registerAnimation("scatter",((t,e)=>Object.assign({appear:LK(0,e)},pH))),OV(),$V(),vB.registerSeries(HK.type,HK)};class NK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class UK extends fW{constructor(){super(...arguments),this.transformerConstructor=NK,this.type="scatter",this.seriesType=PE.scatter}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}UK.type="scatter",UK.seriesType=PE.scatter,UK.transformerConstructor=NK,G(UK,AW);class VK extends Ej{constructor(){super(...arguments),this.type=PE.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=`${NB}_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 WK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[GB]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[pP]=a||r})),s};class GK extends KH{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 YK extends qz{constructor(){super(...arguments),this.type=YK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}YK.type="path";const XK=()=>{vB.registerMark(YK.type,YK),KT(),cT(),vB.registerGraphicComponent("path",hg)},KK=Object.assign(Object.assign({},aj),{area:{name:"area",type:"path"}});class $K{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ua(i,e):ja[i]?(Ha[i]||(Ha[i]=Ua(i,ja[i])),Ha[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class qK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class ZK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function JK(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:qK}:bM(e)||xM(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:ZK}:null}const QK={debounce:St,throttle:At};class t${constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=bM(this._renderMode)||xM(this._renderMode),JK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return JK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,QK[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,QK[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){JK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:NP.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:NP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=QK[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=QK[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:NP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp)}))}}class e$ extends EU{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${NB}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=uB(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new $K(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===PE.map||e.type===PE.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),Tw(this._regions,(t=>{var e;if(t.type===PE.map||t.type===PE.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==PE.map&&e.type!==PE.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[pP],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}e$.type=r.geoCoordinate,G(e$,t$);const i$=()=>{vB.registerComponent(e$.type,e$)};class s$ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class n$ extends VK{constructor(){super(...arguments),this.type=PE.map,this.transformerConstructor=s$,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 !`),KP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),YP(this._dataSet,"copyDataView",tR),YP(this._dataSet,"map",WK),YP(this._dataSet,"lookup",jH);const s=KP.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new za(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:pP,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new Tz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(n$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:yj(this._spec,n$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:XB])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:XB]):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(gj(null===(t=vB.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),fj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new GK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[GB]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[GB],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return GB}getActiveMarks(){return[this._pathMark]}}n$.type=PE.map,n$.mark=KK,n$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},n$.transformerConstructor=s$;const r$=`${NB}_waterfall_default_seriesField`,a$=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[nP]=!0:delete t[nP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=o$([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}=l$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=o$(r,t,s,o,u,c,e,i),o.push(s)})),o};function o$(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}=l$(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===r$)&&(t[r$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function l$(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?gM("total.collectCountField error"):n=e[a].start;o<0?gM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const h$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},c$={type:"fadeIn"},d$={type:"growCenterIn"};function u$(t,e){switch(e){case"fadeIn":return c$;case"scaleIn":return d$;default:return gK(t,!1)}}class p$ extends qz{constructor(){super(...arguments),this.type=p$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return ag(t)}}p$.type="rule";const g$=()=>{vB.registerMark(p$.type,p$),KT(),iT(),vB.registerGraphicComponent("line",ag)},f$=Object.assign(Object.assign({},xK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),m$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:v$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function v$(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)=>v$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y${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 za(e instanceof Fa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),YP(e,"dimensionTree",m$),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 _$ extends kK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const b$={rect:T$,symbol:k$,arc:w$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=k$(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:E$,line:B$,area:B$,rect3d:T$,arc3d:w$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function x$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=b$[t])&&void 0!==i?i:b$.point;return e.series.type===PE.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=A$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:P$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function S$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==PE.sankey){const{formatFunc:t,args:n}=zH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function A$(t){return d(t)?e=>t(e.data):t}function k$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=A$(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:C$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function C$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function T$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=A$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:M$(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function M$(t){const e=[{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"]}}];return e}function w$(t){var e;const{labelSpec:i}=t,s=null!==(e=A$(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 E$(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=S$(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),Jg(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 B$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[XB]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function P$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const R$={calculationMode:!0};class O$ extends TK{constructor(){super(...arguments),this.type=PE.waterfall,this.transformerConstructor=_$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&_P(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),R$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y$(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=r$)}getSeriesKeys(){return this._seriesField===r$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),YP(this._dataSet,"waterfallFillTotal",h$),YP(this._dataSet,"waterfall",a$),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=eR(this.getViewData(),this._dataSet,{name:`${NB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Tz(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:qB,endAs:ZB,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Pj(this);this._barMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),fj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(O$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return E$(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?XE(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):XE(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&KE([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}O$.type=PE.waterfall,O$.mark=f$,O$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},O$.transformerConstructor=_$;const I$=()=>{g$(),bK(),vB.registerAnimation("waterfall",((t,e)=>({appear:u$(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(O$.type,O$)},L$=`${NB}_BOX_PLOT_OUTLIER_VALUE`;var D$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(D$||(D$={}));const F$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[L$]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class z$ extends KH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return this.series.getOutliersField();if(t===D$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case D$.MIN:return this.series.getMinField();case D$.MAX:return this.series.getMaxField();case D$.MEDIAN:return this.series.getMedianField();case D$.Q1:return this.series.getQ1Field();case D$.Q3:return this.series.getQ3Field();case D$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return e[L$];if(t===D$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case D$.MIN:return e[this.series.getMinField()];case D$.MAX:return e[this.series.getMaxField()];case D$.MEDIAN:return e[this.series.getMedianField()];case D$.Q1:return e[this.series.getQ1Field()];case D$.Q3:return e[this.series.getQ3Field()];case D$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[L$])}getDefaultContentList(t){return[{key:this.getContentKey(D$.OUTLIER),value:this.getContentValue(D$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(D$.MAX),value:this.getContentValue(D$.MAX)},{key:this.getContentKey(D$.Q3),value:this.getContentValue(D$.Q3)},{key:this.getContentKey(D$.MEDIAN),value:this.getContentValue(D$.MEDIAN)},{key:this.getContentKey(D$.Q1),value:this.getContentValue(D$.Q1)},{key:this.getContentKey(D$.MIN),value:this.getContentValue(D$.MIN)},{key:this.getContentKey(D$.SERIES_FIELD),value:this.getContentValue(D$.SERIES_FIELD)}]}}const H$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class j$ extends qz{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==tz.enter&&t.context.diffState!==tz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{H$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Zp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=vB.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const N$=()=>{vB.registerGraphicComponent("glyph",Zp),KT(),FC()},U$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],V$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class W$ extends j${constructor(){super(...arguments),this.type=W$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=U$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=V$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}W$.type="boxPlot";const G$=Object.assign(Object.assign({},aj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),Y$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},X$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},K$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),$$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=K$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=K$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=K$(t,"box").attribute.width,i=K$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=K$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=K$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=K$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=K$(t,"box").attribute.height,i=K$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},q$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=K$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=K$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=K$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=K$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=K$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=K$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=K$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=K$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=K$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class Z$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return Y$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class J$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return X$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class Q$ extends Z${computeAttribute(){return Y$(q$)(this.target,this.params,this.params.options)}}class tq extends J${computeAttribute(){return X$(q$)(this.target,this.params,this.params.options)}}class eq extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const iq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class sq extends Rj{constructor(){super(...arguments),this.type=PE.boxPlot,this.transformerConstructor=eq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),iq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(sq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(sq.mark.outlier,{key:GB,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}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=>XE(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XE(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XE(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XE(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XE(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"foldOutlierData",F$),YP(this._dataSet,"addVChartProperty",NH);const t=new za(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${NB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._outlierData=new Tz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=nB(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,nB(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,nB(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=nB(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Ow(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Pj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=vB.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(fj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(gj(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(gj(null===(a=vB.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new z$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}sq.type=PE.boxPlot,sq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},sq.mark=G$,sq.transformerConstructor=eq;const nq=()=>{N$(),iT(),OT(),vB.registerGraphicComponent("line",(t=>ag(t))),vB.registerGraphicComponent("rect",(t=>mg(t))),vB.registerMark(W$.type,W$),WN(),fH(),OV(),$V(),w_.registerBuiltInAnimate("boxplotScaleIn",Z$),w_.registerBuiltInAnimate("boxplotScaleOut",J$),w_.registerBuiltInAnimate("barBoxplotScaleIn",Q$),w_.registerBuiltInAnimate("barBoxplotScaleOut",tq),vB.registerSeries(sq.type,sq)};class rq extends qz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=rq.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?jg(t):Jg(t)}}rq.type="text";const aq=()=>{vB.registerMark(rq.type,rq),KT(),cM(),YT(),vB.registerGraphicComponent("text",Jg),vB.registerGraphicComponent("richtext",jg)};class oq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const lq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),hq={type:"fadeIn"},cq=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function dq(t,e){return"fadeIn"===e?hq:lq(t)}const uq=Object.assign(Object.assign({},xK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class pq extends kK{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 gq extends TK{constructor(){super(...arguments),this.type=PE.rangeColumn,this._barMarkType="rect",this._barName=PE.bar,this.transformerConstructor=pq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(gq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,gq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(gq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(gq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Pj(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(gj(null===(i=vB.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),fj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(gj(null===(n=vB.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),fj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new oq(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)}}gq.type=PE.rangeColumn,gq.mark=uq,gq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},gq.transformerConstructor=pq;const fq=()=>{bK(),aq(),vB.registerAnimation("rangeColumn",((t,e)=>({appear:dq(t,e),enter:lq(t),exit:cq(t),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(gq.type,gq)};var mq,vq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(mq||(mq={})),function(t){t.middle="middle",t.start="start",t.end="end"}(vq||(vq={}));class yq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const _q=Object.assign({},aG);class bq extends cK{constructor(){super(...arguments),this.type=PE.rangeArea}initMark(){this._areaMark=this._createMark(bq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new yq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}bq.type=PE.rangeArea,bq.mark=_q;class xq extends Ej{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=AU,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Ow(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:[]};Ow(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)&&Bj(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Sq(t){return kM(t)?Number.parseFloat(t):0}const Aq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&kq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[pU],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[pU]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},kq=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===Sq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Sq(i[e])),0)));function Cq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const Tq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Cq(t,!0,rR.appear)}),Mq={type:"fadeIn"},wq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Cq(t,!0,rR.enter)}),Eq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Cq(t,!0,rR.exit)});function Bq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Mq;case"growRadius":return Tq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Tq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Pq extends qz{constructor(t,e){super(t,e),this.type=Rq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[yU])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Rq extends Pq{constructor(){super(...arguments),this.type=Rq.type}}Rq.type="arc";const Oq=()=>{KT(),gC(),IN("arc",XG),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),vB.registerGraphicComponent("arc",Vp),vB.registerMark(Rq.type,Rq)},Iq=Object.assign(Object.assign({},aj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Lq extends Sj{_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=uB({},this._theme,i,t);const n=(t,e)=>uB({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Dq=`${NB}_LABEL_VISIBLE`,Fq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},zq={outerRadius:!0};class Hq extends xq{constructor(){super(...arguments),this.transformerConstructor=Lq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:QE(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:QE(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=xU,this._endAngle=SU,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[yU];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;YP(this._dataSet,"pie",Aq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:fU,asEndAngle:mU,asRatio:gU,asMiddleAngle:yU,asRadian:bU,asQuadrant:_U,asK:vU,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Hq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ew(fU)(t)}endAngleScale(t){return Ew(mU)(t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$E(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$E(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ew(Dq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),zq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Fq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[yU];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===rR.appear)return this._startAngle;if(i===rR.disappear)return this._endAngle;const r=[rR.disappear,rR.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[GB];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=gj(null===(i=vB.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Hq.transformerConstructor=Lq,Hq.mark=Iq,Hq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class jq extends Hq{constructor(){super(...arguments),this.type=PE.pie}}jq.type=PE.pie;const Nq=()=>{Oq(),vB.registerAnimation("pie",((t,e)=>({appear:Bq(t,e),enter:wq(t),exit:Eq(t),disappear:{duration:uH.disappear.duration}}))),vB.registerAnimation("emptyCircle",((t,e)=>({appear:Bq(t,e)}))),vB.registerSeries(jq.type,jq)};function Uq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const Vq=t=>({type:Uq(t.growField),options:{overall:!0}}),Wq={type:"fadeIn"},Gq=t=>({type:Uq(t.growField)}),Yq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function Xq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Wq;case"growAngle":return Vq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return Vq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const Kq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class $q extends xq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Kq)})}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(ZB),this.setInnerRadiusField(qB)}setValueFieldToPercent(){this.setRadiusField(QB),this.setInnerRadiusField(JB)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const qq=Object.assign(Object.assign({},aj),{rose:{name:"rose",type:"arc"}});class Zq extends Sj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class Jq extends HU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=vB.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=xU,this._endAngle=SU,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QE(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QE(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:aU(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Ow(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>cU(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=AU,e=0;const i=this.getChart().getSpec();return Tw(this.getRegions(),(s=>{const n=s;if(r=n.type,[PE.rose,PE.radar,PE.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(uB({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(uB({},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)}}Jq.type=r.polarAxis,Jq.specKey="axes";const Qq={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},tZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class eZ extends Jq{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}eZ.type=r.polarLinearAxis,eZ.specKey="axes",eZ.builtInTheme={axis:EV,axisLinear:XV,axisAngle:tZ,axisRadius:Qq},G(eZ,UV);const iZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(eZ.type,eZ)};class sZ extends Jq{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new iE}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,NG),t}transformScaleDomain(){}}sZ.type=r.polarBandAxis,sZ.specKey="axes",sZ.builtInTheme={axis:EV,axisBand:wV,axisAngle:tZ,axisRadius:Qq},G(sZ,VU);const nZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(sZ.type,sZ)};class rZ extends $q{constructor(){super(...arguments),this.type=PE.rose,this.transformerConstructor=Zq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(rZ.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,rZ.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XE(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XE(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(gj(null===(i=vB.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),fj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}rZ.type=PE.rose,rZ.mark=qq,rZ.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},rZ.transformerConstructor=Zq;const aZ=()=>{vB.registerSeries(rZ.type,rZ),Oq(),vB.registerAnimation("rose",((t,e)=>({appear:Xq(t,e),enter:Gq(t),exit:Yq(t),disappear:{duration:uH.disappear.duration}}))),nZ(),iZ()};class oZ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,vw(this._fromAngle,this._toAngle)&&vw(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lZ extends hH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!Cw(t)&&!Cw(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const hZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function cZ(t,e,i){return"fadeIn"===e?hZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function dZ(t,e,i){return"fadeIn"===e?hZ(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 uZ=(t,e)=>({custom:oH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),pZ=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}});class gZ extends $q{constructor(){super(...arguments),this.type=PE.radar,this.transformerConstructor=GN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(gZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:IH,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):xU},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(gj(null===(s=vB.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),fj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=vB.getAnimationInKey(e);t.setAnimationConfig(gj(null==i?void 0:i(n,r),fj(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}}}gZ.type=PE.radar,gZ.mark=pZ,gZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},gZ.transformerConstructor=GN,G(gZ,Zj);const fZ=()=>{vB.registerSeries(gZ.type,gZ),nG(),UN(),WN(),vB.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:cZ(t,e,"in"),enter:cZ(t,e,"in"),exit:cZ(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{channel:["points","center"],custom:lZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),vB.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:oZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing}]}))),vB.registerAnimation("radarGroup",((t,e)=>({appear:uZ(t,"in"),disappear:{duration:uH.disappear.duration}}))),gC(),nZ(),iZ()};class mZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const vZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(NB)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[GB]:r,[YB]:`${s}_${e}`})),r++}))})),n},yZ={fill:"#bbb",fillOpacity:.2},_Z=Object.assign(Object.assign({},aj),{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"}}),bZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},xZ={grid:{background:!0}};class SZ extends Rj{constructor(){super(...arguments),this.type=PE.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)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),bZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),xZ)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),YP(this._option.dataSet,"objFlat",vZ),YP(this._option.dataSet,"copyDataView",tR),XP(this._option.dataSet,"dataview",Ia),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(uB(yZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(SZ.mark.group),this._containerMark=this._createMark(SZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(SZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(SZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(SZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(SZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(SZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(SZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}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 WE).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:XB}}initTooltip(){this._tooltipHelper=new mZ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}SZ.type=PE.dot,SZ.mark=_Z,SZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class AZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const kZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),CZ=(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 TZ extends Rj{constructor(){super(...arguments),this.type=PE.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),YP(this._option.dataSet,"linkDotInfo",CZ),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(TZ.mark.group),this._containerMark=this._createMark(TZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(TZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(TZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new AZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}TZ.type=PE.link,TZ.mark=kZ,TZ.builtInTheme={link:{arrow:{style:{size:10}}}};const MZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"}}),wZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class EZ extends xq{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()?qB:cP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?ZB:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),wZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):xU;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):SU,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=XE(this.angleAxisHelper.dataToPosition([t[qB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XE(this.angleAxisHelper.dataToPosition([t[ZB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?XE(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(EZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[mg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const OZ=()=>{vB.registerAnimation("circularProgress",((t,e)=>({appear:RZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:uH.disappear.duration}})))};class IZ extends Sj{constructor(){super(...arguments),this._supportStack=!0}}const LZ={cornerRadius:!0,roundCap:!0};class DZ extends EZ{constructor(){super(...arguments),this.type=PE.circularProgress,this.transformerConstructor=IZ,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()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),LZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(DZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:yj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(DZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?qB:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?ZB: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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}DZ.type=PE.circularProgress,DZ.mark=BZ,DZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},DZ.transformerConstructor=IZ;const FZ=()=>{vB.registerSeries(DZ.type,DZ),Oq(),OZ(),mH(),nZ(),iZ()};function zZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const HZ={type:"fadeIn"};function jZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?HZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:zZ(t)}))(t)}class NZ extends KH{enableByType(t){return"dimension"!==t}}const UZ=Object.assign(Object.assign({},aj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),VZ={bandWidth:!0,cornerRadius:!0,clamp:!0},WZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class GZ extends Rj{constructor(){super(...arguments),this.type=PE.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),VZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),WZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(GZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return XE(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(GZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new NZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}GZ.type=PE.linearProgress,GZ.mark=UZ,GZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const YZ=()=>{bK(),vB.registerAnimation("linearProgress",((t,e)=>({appear:jZ(t,e),enter:jZ(t),disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(GZ.type,GZ)},XZ=[0],KZ=[20,40],$Z=[200,500],qZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},ZZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class JZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const QZ=`${NB}_WORD_CLOUD_TEXT`,tJ=Object.assign(Object.assign({},aj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),eJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class iJ extends Ej{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=KZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:$Z,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:XZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?QZ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:qZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||_M(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:XZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!ZZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new JZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(iJ.mark.word,{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(iJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(gj(vB.getAnimationInKey("wordCloud")(n,s),fj("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 WE).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:XB])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new AE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new AE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[GB])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:YB,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:b_.createCanvas.bind(b_),getTextBounds:gv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:sg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}iJ.mark=tJ,iJ.builtInTheme={wordCloud:eJ};function sJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||uH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=nJ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},rJ=(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=rJ(t.children,e,t,n))})),s},aJ=(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=aJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},oJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):oJ(t.children,e,i)))})),e};function lJ(t,e){let i,s;if(dJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function dJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function fJ(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 mJ(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 vJ(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 yJ(t){return{_:t,next:null,prev:null}}function _J(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];fJ(n,s,r);let a,o,l,h,c,d,u,p=yJ(s),g=yJ(n),f=yJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=nJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:AJ.defaultOpionts.nodeSort;rJ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)rJ([o],bJ(h)),aJ([o],xJ(this._getPadding,.5,a)),rJ([o],SJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);rJ([o],bJ(AJ.defaultOpionts.setRadius)),aJ([o],xJ(Ot,1,a)),c&&aJ([o],xJ(this._getPadding,o.radius/t,a)),rJ([o],SJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}AJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const kJ=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=kJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function CJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){kJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function TJ(t){return t.depth}function MJ(t,e){return e-1-t.endDepth}const wJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),EJ=(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},BJ={left:TJ,right:MJ,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:TJ,end:MJ},PJ=bt(0,1);class RJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>wJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>wJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},RJ.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):BJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return CJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[EJ(s[t.source]),EJ(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*PJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(wJ),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(wJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];OJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),IJ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},LJ.defaultOpionts,t):Object.assign({},LJ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(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]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(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-(_(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=nJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function DJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:OJ,slice:DJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?DJ:OJ)(t,e,i,s,n)}};class HJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},HJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?FJ(this.options.aspectRatio):null!==(e=zJ[this.options.splitType])&&void 0!==e?e:zJ.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=nJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function jJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=jJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=NJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function KJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*$J({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},ZJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||VJ,s=e.lossFunction||UJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:qJ(f),arcs:f})}))},JJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:QJ,triangle:QJ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function QJ(){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 tQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const eQ=t=>JJ[t]?JJ[t]():JJ.circle(),iQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function sQ(t){return d(t)?t:function(){return t}}class nQ{constructor(t){var e,i;switch(this.options=H({},nQ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=eQ(this.options.shape),this.getText=null!==(e=sQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=sQ(this.options.fontWeight),this.getTextFontSize=sQ(this.options.fontSize),this.getTextFontStyle=sQ(this.options.fontStyle),this.getTextFontFamily=sQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>iQ(10,50);break;case"random-light":this.getTextColor=()=>iQ(50,90);break;default:this.getTextColor=sQ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class aQ extends nQ{constructor(t){var e;super(H({},aQ.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<=aQ.defaultOptions.minFontSize&&(this.options.minFontSize=aQ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=rQ[this.options.spiral])&&void 0!==e?e:rQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=sQ(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}=tQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(hQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}cQ(p,this._size)&&(p=dQ(p,this._size))}else if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||lQ(p,i))&&(!i||!oQ(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 oQ(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 lQ(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,cQ=(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 dQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},pQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},gQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},fQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=tQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=eQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)gQ(n,pQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)gQ(n,pQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=pQ({x:l,y:h},o,-Math.PI/2,5),e=pQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);gQ(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=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 M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(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(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Ot=t=>0,It=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ie(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{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}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,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 Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{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 Xe(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 Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={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 Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(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=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(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=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(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 ni(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=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{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`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(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}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(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 ni(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:Ke});function oi(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 li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(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 di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(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 Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{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 Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal: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?Ci[8+bi/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 C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=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")+_i(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 wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Fi(){return new zi}function zi(){this.reset()}zi.prototype={constructor:zi,reset:function(){this.s=this.t=0},add:function(t){ji(Hi,t,this.t),ji(this,Hi.s,this.s),this.s?this.t+=Hi.t:this.s=Hi.t},valueOf:function(){return this.s}};var Hi=new zi;function ji(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Ni=1e-6,Ui=Math.PI,Vi=Ui/2,Wi=Ui/4,Gi=2*Ui,Yi=180/Ui,Xi=Ui/180,Ki=Math.abs,$i=Math.atan,qi=Math.atan2,Zi=Math.cos,Ji=Math.exp,Qi=Math.log,ts=Math.pow,es=Math.sin,is=Math.sign||function(t){return t>0?1:t<0?-1:0},ss=Math.sqrt,ns=Math.tan;function rs(t){return t>1?0:t<-1?Ui:Math.acos(t)}function as(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function os(){}function ls(t,e){t&&cs.hasOwnProperty(t.type)&&cs[t.type](t,e)}var hs={Feature:function(t,e){ls(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sUi?t+Math.round(-t/Gi)*Gi:t,e]}function As(t,e,i){return(t%=Gi)?e||i?xs(Cs(t),Ts(e,i)):Cs(t):e||i?Ts(e,i):Ss}function ks(t){return function(e,i){return[(e+=t)>Ui?e-Gi:e<-Ui?e+Gi:e,i]}}function Cs(t){var e=ks(t);return e.invert=ks(-t),e}function Ts(t,e){var i=Zi(t),s=es(t),n=Zi(e),r=es(e);function a(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*i+o*s;return[qi(l*n-c*r,o*i-h*s),as(c*n+l*r)]}return a.invert=function(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*n-l*r;return[qi(l*n+h*r,o*i+c*s),as(c*i-o*s)]},a}function Ms(t,e){(e=fs(e))[0]-=t,bs(e);var i=rs(-e[1]);return((-e[2]<0?-i:i)+Gi-Ni)%Gi}function ws(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:os,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Es(t,e){return Ki(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 Rs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function zs(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 Hs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ws(),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=zs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=es(s),r=[es(i),-Zi(i),0],a=0,o=0;Ls.reset(),1===n?s=Vi+Ni:-1===n&&(s=-Vi-Ni);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ui,M=f*x;if(Ls.add(qi(M*k*es(C),m*S+M*Zi(C))),a+=T?A+k*Gi:A,T^p>=i^_>=i){var w=vs(fs(u),fs(y));bs(w);var E=vs(r,w);bs(E);var B=(T^A>=0?-1:1)*as(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Ni||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(js))}return u}}function js(t){return t.length>1}function Ns(t,e){return((t=t.x)[0]<0?t[1]-Vi-Ni:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-Ni:Vi-e[1])}1===(Os=Fs).length&&(Is=Os,Os=function(t,e){return Fs(Is(t),e)});var Us=Hs((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?Ui:-Ui,l=Ki(r-i);Ki(l-Ui)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ui&&(Ki(i-n)Ni?$i((es(e)*(r=Zi(s))*es(i)-es(s)*(n=Zi(e))*es(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*Vi,s.point(-Ui,n),s.point(0,n),s.point(Ui,n),s.point(Ui,0),s.point(Ui,-n),s.point(0,-n),s.point(-Ui,-n),s.point(-Ui,0),s.point(-Ui,n);else if(Ki(t[0]-e[0])>Ni){var r=t[0]0,n=Ki(e)>Ni;function r(t,i){return Zi(t)*Zi(i)>e}function a(t,i,s){var n=[1,0,0],r=vs(fs(t),fs(i)),a=ms(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=vs(n,r),u=_s(n,h);ys(u,_s(r,c));var p=d,g=ms(u,p),f=ms(p,p),m=g*g-f*(ms(u,u)-1);if(!(m<0)){var v=ss(m),y=_s(p,(-g-v)/f);if(ys(y,u),y=gs(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Ki(y[0]-b)Ui^(b<=y[0]&&y[0]<=x)){var T=_s(p,(-g+v)/f);return ys(T,u),[y,gs(T)]}}}function o(e,i){var n=s?t:Ui-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Hs(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?Ui:-Ui),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Es(e,p)||Es(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&&Es(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=Zi(e),o=es(e),l=s*i;null==n?(n=e+s*Gi,r=e-l/2):(n=Ms(a,n),r=Ms(a,r),(s>0?nr)&&(n+=s*Gi));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 Ki(s[0]-t)0?0:3:Ki(s[0]-i)0?2:1:Ki(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=ws(),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=zs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ps(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(Gs,Math.min(Ws,g)),f=Math.max(Gs,Math.min(Ws,f))],b=[r=Math.max(Gs,Math.min(Ws,r)),a=Math.max(Gs,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&&(_.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 Xs(t){return t}var Ks,$s,qs,Zs,Js=Fi(),Qs=Fi(),tn={point:os,lineStart:os,lineEnd:os,polygonStart:function(){tn.lineStart=en,tn.lineEnd=rn},polygonEnd:function(){tn.lineStart=tn.lineEnd=tn.point=os,Js.add(Ki(Qs)),Qs.reset()},result:function(){var t=Js/2;return Js.reset(),t}};function en(){tn.point=sn}function sn(t,e){tn.point=nn,Ks=qs=t,$s=Zs=e}function nn(t,e){Qs.add(Zs*t-qs*e),qs=t,Zs=e}function rn(){nn(Ks,$s)}var an=tn,on=1/0,ln=on,hn=-on,cn=hn;var dn,un,pn,gn,fn={point:function(t,e){thn&&(hn=t);ecn&&(cn=e)},lineStart:os,lineEnd:os,polygonStart:os,polygonEnd:os,result:function(){var t=[[on,ln],[hn,cn]];return hn=cn=-(ln=on=1/0),t}},mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn=0,Cn={point:Tn,lineStart:Mn,lineEnd:Bn,polygonStart:function(){Cn.lineStart=Pn,Cn.lineEnd=Rn},polygonEnd:function(){Cn.point=Tn,Cn.lineStart=Mn,Cn.lineEnd=Bn},result:function(){var t=kn?[Sn/kn,An/kn]:xn?[_n/xn,bn/xn]:yn?[mn/yn,vn/yn]:[NaN,NaN];return mn=vn=yn=_n=bn=xn=Sn=An=kn=0,t}};function Tn(t,e){mn+=t,vn+=e,++yn}function Mn(){Cn.point=wn}function wn(t,e){Cn.point=En,Tn(pn=t,gn=e)}function En(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Tn(pn=t,gn=e)}function Bn(){Cn.point=Tn}function Pn(){Cn.point=On}function Rn(){In(dn,un)}function On(t,e){Cn.point=In,Tn(dn=pn=t,un=gn=e)}function In(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Sn+=(n=gn*t-pn*e)*(pn+t),An+=n*(gn+e),kn+=3*n,Tn(pn=t,gn=e)}var Ln=Cn;function Dn(t){this._context=t}Dn.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,Gi)}},result:os};var Fn,zn,Hn,jn,Nn,Un=Fi(),Vn={point:os,lineStart:function(){Vn.point=Wn},lineEnd:function(){Fn&&Gn(zn,Hn),Vn.point=os},polygonStart:function(){Fn=!0},polygonEnd:function(){Fn=null},result:function(){var t=+Un;return Un.reset(),t}};function Wn(t,e){Vn.point=Gn,zn=jn=t,Hn=Nn=e}function Gn(t,e){jn-=t,Nn-=e,Un.add(ss(jn*jn+Nn*Nn)),jn=t,Nn=e}var Yn=Vn;function Xn(){this._string=[]}function Kn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $n(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ps(t,i(s))),s.result()}return r.area=function(t){return ps(t,i(an)),an.result()},r.measure=function(t){return ps(t,i(Yn)),Yn.result()},r.bounds=function(t){return ps(t,i(fn)),fn.result()},r.centroid=function(t){return ps(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Xs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Xn):new Dn(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 qn(t){return function(e){var i=new Zn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Zn(){}function Jn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ps(i,t.stream(fn)),e(fn.result()),null!=s&&t.clipExtent(s),t}function Qn(t,e,i){return Jn(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 tr(t,e,i){return Qn(t,[[0,0],e],i)}function er(t,e,i){return Jn(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 ir(t,e,i){return Jn(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)}Xn.prototype={_radius:4.5,_circle:Kn(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=Kn(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}},Zn.prototype={constructor:Zn,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 sr=16,nr=Zi(30*Xi);function rr(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=ss(b*b+x*x+S*S),k=as(S/=A),C=Ki(Ki(S)-1)e||Ki((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Xi:0,E()):[m*Yi,v*Yi,y*Yi]},M.angle=function(t){return arguments.length?(_=t%360*Xi,E()):_*Yi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=rr(o,T=t*t),B()):ss(T)},M.fitExtent=function(t,e){return Qn(M,t,e)},M.fitSize=function(t,e){return tr(M,t,e)},M.fitWidth=function(t,e){return er(M,t,e)},M.fitHeight=function(t,e){return ir(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function dr(t){var e=0,i=Ui/3,s=cr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Xi,i=t[1]*Xi):[e*Yi,i*Yi]},n}function ur(t,e){var i=es(t),s=(i+es(e))/2;if(Ki(s)2?t[2]*Xi:0),e.invert=function(e){return(e=t.invert(e[0]*Xi,e[1]*Xi))[0]*=Yi,e[1]*=Yi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===_r?[[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 xr(t){return ns((Vi+t)/2)}function Sr(t,e){var i=Zi(t),s=t===e?es(t):Qi(i/Zi(e))/Qi(xr(e)/xr(t)),n=i*ts(xr(t),s)/s;if(!s)return _r;function r(t,e){n>0?e<-Vi+Ni&&(e=-Vi+Ni):e>Vi-Ni&&(e=Vi-Ni);var i=n/ts(xr(e),s);return[i*es(s*t),n-i*Zi(s*t)]}return r.invert=function(t,e){var i=n-e,r=is(s)*ss(t*t+i*i),a=qi(t,Ki(i))*is(i);return i*s<0&&(a-=Ui*is(t)*is(i)),[a/s,2*$i(ts(n/r,1/s))-Vi]},r}function Ar(t,e){return[t,e]}function kr(t,e){var i=Zi(t),s=t===e?es(t):(i-Zi(e))/(e-t),n=i/s+t;if(Ki(s)Ni&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Or.invert=mr(as),Ir.invert=mr((function(t){return 2*$i(t)})),Lr.invert=function(t,e){return[-e,2*$i(Ji(t))-Vi]};var zr={exports:{}},Hr=function(t,e){this.p1=t,this.p2=e};Hr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Hr.prototype.run=function(){return this.p2[0]-this.p1[0]},Hr.prototype.slope=function(){return this.rise()/this.run()},Hr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Hr.prototype.isVertical=function(){return!isFinite(this.slope())},Hr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Hr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Hr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Hr.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)},Hr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var jr=Hr,Nr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new jr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Nr(t.slice(0,s),e),o=Nr(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},Ur=Nr;!function(t){var e=Ur;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Xr,e),{tolerance:s}=i;return Vr(t,s)};var $r;!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"}($r||($r={}));const qr=(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a},Zr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return Jr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return Jr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},ta=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",O=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var ea={},ia={};function sa(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function na(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ra(t,e){var i=t+"",s=i.length;return s9999?"+"+ra(e,6):ra(e,4))+"-"+ra(t.getUTCMonth()+1,2)+"-"+ra(t.getUTCDate(),2)+(r?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"."+ra(r,3)+"Z":n?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"Z":s||i?"T"+ra(i,2)+":"+ra(s,2)+"Z":"")}function oa(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 ia;if(h)return h=!1,ea;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=$r.DSV;const s=Wr(ca,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return oa(n).parse(t)},ua=(t,e={},i)=>(i.type=$r.DSV,la(t)),pa=(t,e={},i)=>(i.type=$r.DSV,ha(t));function ga(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return fa(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 fa(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return va(t);default:throw new Error("unknown GeoJSON type")}}function fa(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=ma(t.properties),e.geometry=va(t.geometry),e}function ma(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]=ma(s):e[i]=s})),e):e}function va(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return va(t)})),e):(e.coordinates=ya(t.coordinates),e)}function ya(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return ya(t)}))}function _a(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 ba(t){for(var e,i,s=_a(t),n=0,r=1;r0}function xa(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=ga(t));var r=[];switch(t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,s)})),t;case"FeatureCollection":return xa(t,(function(t){xa(ka(t,s),(function(t){r.push(t)}))})),di(r)}return ka(t,s)}function ka(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,e)})),t;case"LineString":return Ca(_a(t),e),t;case"Polygon":return Ta(_a(t),e),t;case"MultiLineString":return _a(t).forEach((function(t){Ca(t,e)})),t;case"MultiPolygon":return _a(t).forEach((function(t){Ta(t,e)})),t;case"Point":case"MultiPoint":return t}}function Ca(t,e){ba(t)===e&&t.reverse()}function Ta(t,e){ba(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Pa=(t,e={},i)=>{i.type=$r.GEO;const s=Wr(Ea,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Aa(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=wa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=wa.bounds(t);t.bbox=e}})),t.features=l,t},Ra={},Oa=(t,e,i)=>{i.type=$r.GEO;const s=Wr(Ea,Ra,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 Fr(a,t)}))}:Fr(a,o));var a,o;return Pa(r,s,i)},Ia=(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 La=0;function Da(t="dataset"){return La>1e8&&(La=0),t+"_"+La++}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:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class za{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof za||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Zr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}$n();const Ha={},ja={albers:gr,albersusa:function(){var t,e,i,s,n,r,a=gr(),o=pr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=pr().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)}},Na=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ua(t,e){return function i(){const s=e();return s.type=t,s.path=$n().projection(s),s.copy=s.copy||function(){const t=i();return Na.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ga 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=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Za.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Ja(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(Ja(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,Ja(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Ja(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 $a))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Za.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Qa(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ka,this.rootWheelEvent=new $a,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const so=Nt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,fo;function mo(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;tfo){let t,e=uo;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 wo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Fo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Ho(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new jo(i,n),new jo(n,s)]}class jo extends Eo{constructor(t,e){super(),this.type=xo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p1.x):t===bo.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class No{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new jo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===bo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===bo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Uo extends No{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?bo.ROW:bo.COLUMN;return"monotoneY"===t?new Uo(t,s):new No(t,s)}class Go{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,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Xo(new Go(n,s),t),n}function Xo(t,e){return Vo(t,e,1)}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 $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&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 qo(t,e){return Vo(t,e,2)}function Zo(t,e={}){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 qo(new $o(n,s),t),n}function Jo(t){return t<0?-1:1}function Qo(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(Jo(r)+Jo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function tl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function el(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 il{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:el(this,this._t0,tl(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,el(this,tl(this,e=Qo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:el(this,this._t0,e=Qo(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 sl extends il{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function nl(t,e){return Vo(t,e,2)}function rl(t,e={}){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 nl(new il(n,s),t),n}function al(t,e){return Vo(t,e,2)}function ol(t,e={}){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 al(new sl(n,s),t),n}let ll=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class hl extends ll{lineEnd(){this.context.closePath()}}function cl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new ll(r,e,n),t),r}function dl(t,e){return Vo(t,e,1)}function ul(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new hl(r,e,n),t),r}class pl extends Go{lineEnd(){this.context.closePath()}}function gl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return fl(new pl(n,s),t),n}function fl(t,e){return Vo(t,e,1)}function ml(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function vl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Yo(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const yl=vl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const _l=vl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class bl extends Eo{constructor(t,e,i){super(),this.type=xo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Lo(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p2.x):t===bo.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Lo(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new bl(i,a,r),new bl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class xl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new jo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new bl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Sl(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return Zo(t,i);case"monotoneX":return rl(t,i);case"monotoneY":return ol(t,i);case"step":return cl(t,.5,i);case"stepClosed":return ul(t,.5,i);case"stepBefore":return cl(t,0,i);case"stepAfter":return cl(t,1,i);case"catmullRom":return yl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return _l(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return gl(t,i)}}class Al extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.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([lo.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([lo.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([lo.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([lo.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([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new xl(this);wo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];To(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.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=mo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Sl(e,i);"x"===s?this.direction=bo.ROW:"y"===s?this.direction=bo.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[lo.M]=this.moveToTransform,t[lo.L]=this.lineToTransform,t[lo.Q]=this.quadraticCurveToTransform,t[lo.C]=this.bezierCurveToTransform,t[lo.AT]=this.arcToTransform,t[lo.E]=this.ellipseTransform,t[lo.R]=this.rectTransform,t[lo.A]=this.arcTransform,t[lo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),wo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===bo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===bo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),$l=Object.assign(Object.assign({},Nl),{points:[],cornerRadius:0,closePath:!0}),ql=Object.assign(Object.assign({},Nl),{width:100,height:100,spikes:5,thickness:.5}),Zl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Ql=Object.assign(Object.assign({},Nl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),th=Object.assign(Object.assign(Object.assign({},Nl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),eh=Object.assign(Object.assign(Object.assign({},Nl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ih=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Nl),{fill:!0,cornerRadius:0,cornerType:"round"}),sh=Object.assign(Object.assign({},ih),{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});class nh{}const rh=Symbol.for("@visactor/vrender-core/application-state");function ah(){const t=globalThis;return t[rh]||(t[rh]={application:new nh}),t[rh]}const oh=ah().application;class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?oh.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):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?oh.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"},lh.cache.set(t,s),s.dataPromise=oh.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oh.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oh.global.loadBlob(t):"json"===e&&(i.dataPromise=oh.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=oh.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{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 Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Ph=new class extends Th{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Ih(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{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 Ih(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ih(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{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 Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Gh=new class extends Th{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(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 Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+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(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{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 Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{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 ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{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 sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{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 rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(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 dc=new class extends Th{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 cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(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 pc=new class extends Th{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 uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(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 fc=new class extends Th{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 gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(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 vc=new class extends Th{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 mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(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 Ac=new class extends Th{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 Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{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)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),wo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(wo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}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 Ec=[wh,Eh,Ph,Oh,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{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 Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ic(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ic(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ic(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 Rc(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 Rc(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 Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;eqc.set(t,!0)));const Zc=new Map;function Jc(t){if(qc.has(t))return!0;if(Zc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Qc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Zc.set(t,!0)));const td=Xc(),ed=Xc(),id=Xc(),sd=Xc(),nd=Xc(),rd=Xc(),ad=Xc(),od=Xc(),ld=Xc(),hd=Xc(),cd=Xc(),dd=Xc(),ud=Xc(),pd=Xc(),gd=Xc(),fd=Xc(),md=Xc(),vd=Symbol.for("GraphicService"),yd=Symbol.for("GraphicCreator"),_d={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},bd=Object.keys(_d),xd={"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"},Sd=Object.keys(xd),Ad={duration:200,easing:"cubicOut"},kd=Symbol.for("CanvasFactory"),Cd=Symbol.for("Context2dFactory");function Td(t){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.canvasFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Md=1e-4,wd=Math.sqrt(3),Ed=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Rd(t){return"number"==typeof t&&Number.isFinite(t)}const Od=[0,0],Id=[0,0],Ld=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Fd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function zd(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 Hd(t){return(t%=Ut)<0&&(t+=Ut),t}function jd(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+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Vd(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(Bd(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 Yd=[-1,-1,-1],Xd=[-1,-1];function Kd(){const t=Xd[0];Xd[0]=Xd[1],Xd[1]=t}function $d(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(Bd(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,Ed):Math.pow(i,Ed),s=s<0?-Math.pow(-s,Ed):Math.pow(s,Ed);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+wd*Math.sin(e)))/(3*a),h=(-o+i*(s-wd*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,Yd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Kd(),p=zd(e,s,r,o,Xd[0]),u>1&&(g=zd(e,s,r,o,Xd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Yd);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=Fd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Yd[0]=-l,Yd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Yd[0]+t&&a<=Yd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Yd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Jd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function Qd(t,e){let i=Jd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Jd(i-n)):e&&i1&&(i||(h+=Oe(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;tu[0]=S,tu[1]=A,Qd(tu,Boolean(a[6])),S=tu[0],A=tu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case lo.M:u=m,p=v,c=u,d=p;break;case lo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case lo.C:if(i){if(Nd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(jd(c,d,m,v,y,_,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case lo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Ud(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Zd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case lo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case lo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class su{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(su.IsGradientStr(t))try{const e=iu(t)[0];if(e){if("linear"===e.type)return su.ParseLinear(e);if("radial"===e.type)return su.ParseRadial(e);if("conic"===e.type)return su.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:su.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:su.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function au(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ou(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];return 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}function lu(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];return 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}function hu(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];return 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,t}function cu(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 du(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 uu(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function pu(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 gu(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];return Math.abs(g-b)0&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Cu),function(t,e,i){return eu(t,0,!1,e,i)}(this.path.commandList,Cu.x,Cu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Cu);const i=nu(this,this.lineWidth,this.dpr);return function(t,e,i,s){return eu(t,e,!0,i,s)}(this.path.commandList,i,Cu.x,Cu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ku,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}const Mu={WIDTH:500,HEIGHT:500,DPR:1};class wu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Mu.WIDTH,height:n=Mu.HEIGHT,dpr:r=Mu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Eu;wu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Eu||(Eu={}));class Bu{static Get(t,e=Eu.Color1,i=[0,0,0,1]){if(e===Eu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Eu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Pu(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ru(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ou(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ou(t,e,i,s,n)}function Ou(t,e,i,s,n){if(!t||!e)return t&&Pu(t)||e&&Pu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Eu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Eu.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:Pu(a)})))});return o?Ru(r,l,i,s,n):Ru(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 Iu(s,n,i);if("radial"===s.gradient)return Lu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Pu(Fu(r,a,i),s)}function Iu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(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]}function zu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const Hu=[0,0,0,0],ju=[0,0,0,0];function Nu(t,e,i){return Bu.Get(t,Eu.Color255,Hu),Bu.Get(e,Eu.Color255,ju),`rgba(${Math.round(Hu[0]+(ju[0]-Hu[0])*i)},${Math.round(Hu[1]+(ju[1]-Hu[1])*i)},${Math.round(Hu[2]+(ju[2]-Hu[2])*i)},${Hu[3]+(ju[3]-Hu[3])*i})`}class Uu{static GetCanvas(){try{return Uu.canvas||(Uu.canvas=oh.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 Vu extends Ye{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Gu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;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),Ru(o.color,l.color,h,!1)}function Yu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Uu.GetCanvas(),d=Uu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Ku(t){return null==t?void 0:t}class $u{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Ku(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Xu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Ku(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function qu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Zu(t){if(!qu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Zu(t[i])})),e}function Ju(t,e){var i;const s=null!==(i=Zu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];qu(n)&&qu(i)?s[t]=Ju(n,i):s[t]=Zu(i)})),s}class Qu{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Zu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];qu(r)&&qu(n)?t[i]=Ju(r,n):!qu(r)&&qu(a)&&qu(n)?t[i]=Ju(a,n):t[i]=Zu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?tp.PAINT|tp.BOUNDS|tp.PICK:tp.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?tp.PAINT|tp.BOUNDS:tp.PAINT}};class sp{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Ad;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:_o.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:_o.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:_o.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const np=new $u;function rp(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,ap(t),!0)}function ap(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=np.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function op(t){if(t)return t.parentScope&&op(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&ap(t),t}function lp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function hp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function cp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,hp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),lp(null!=e?e:t.ownerStage))}const dp=new Ve,up=new Ge,pp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],gp=["x","y"],fp=["scaleX","scaleY"],mp=["angle"],vp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),yp=new re,_p=[],bp=tp.PAINT|tp.SHAPE|tp.BOUNDS|tp.TRANSFORM|tp.LAYOUT;function xp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Sp(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Sp(s):s})),i}function Ap(t,e){return t===e||!!(xp(t)||xp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function kp(t,e){var i;const s=null!==(i=Sp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];xp(n)&&xp(i)?s[t]=kp(n,i):s[t]=Sp(i)})),s}const Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Tp extends Ga{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,hp(this.stage,this),lp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&op(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(op(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new $u).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Sp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&xp(n)&&xp(s)?e[t]=kp(n,s):e[t]=Sp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Sp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Ap(a,o)||(s.set(n,{prev:a,next:o}),t[n]=Sp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ip[t];return n?n(e,i):null!==(s=ep[t])&&void 0!==s?s:tp.PAINT}(e,i,s):null!==(n=ep[e])&&void 0!==n?n:tp.PAINT;return r&tp.PICK&&(r|=tp.BOUNDS),r===tp.PAINT&&this.needUpdateTag(e)&&(r=tp.SHAPE|tp.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&bp)!==bp?(t&tp.SHAPE?this.addUpdateShapeAndBoundsTag():t&tp.BOUNDS&&this.addUpdateBoundTag(),t&tp.PAINT&&this.addUpdatePaintTag(),t&tp.TRANSFORM&&this.addUpdatePositionTag(),t&tp.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=tp.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&vo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Ep.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];dp.clear();const n=[];s.forEach((t=>{const e=(new Al).fromString(t.d),i={};Sd.forEach((e=>{t[e]&&(i[xd[e]]=t[e])})),n.push({path:e,attribute:i}),dp.union(e.bounds)}));const r=dp.width(),a=dp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Ep.userSymbolMap[t]=l,l}const i=(new Al).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Ep.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return wo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&vo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&vo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&vo.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&vo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=vo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===yo.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===_o.STATE||null!=i&&i>=_o.ANIMATE_BIND&&i<=_o.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===_o.STATE||null!=o&&o>=_o.ANIMATE_BIND&&o<=_o.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Ap(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:_p,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ad}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:_p,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Sp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:_o.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:_p,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:_p,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,scaleX:i=Rl.scaleX,scaleY:s=Rl.scaleY,angle:n=Rl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(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,!0),oh.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Rl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=up.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=oh.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Al).fromString(t):this.pathProxy=new Al,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:oh.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new qa(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ga.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:_o.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:_o.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||oh.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Tu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Tp.userSymbolMap={};const Mp=Symbol.for("@visactor/vrender-core/graphic-class");function wp(){var t;const e=globalThis;return null!==(t=e[Mp])&&void 0!==t||(e[Mp]={Graphic:Tp}),e[Mp]}const Ep=wp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!vp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Lp=Op();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Rp.forEach((t=>{this._defaultTheme[t]=Object.create(Lp[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Rp.forEach((s=>{const n=Object.create(Lp[s]);t&&t[s]&&Ip(n,t[s]),i[s]&&Ip(n,i[s]),e[s]&&Ip(n,e[s]),this.combinedTheme[s]=n})),e.common&&Rp.forEach((t=>{Ip(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 Fp=new Dp;function zp(t,e){return t.glyphHost?zp(t.glyphHost):e?(t.isContainer,e):Hp(t)||t.attachedThemeGraphic&&zp(t.attachedThemeGraphic)||Fp.getTheme()}function Hp(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)):Fp.getTheme()}return null}const jp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Np=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...pp];class Up extends Ep{constructor(t){super(t),this.type="arc",this.numberType=td}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return zp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Np)}needUpdateTag(t){return super.needUpdateTag(t,Np)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const Wp=["segments","points","curveType","curveTension",...pp];class Gp extends Ep{constructor(t){super(t),this.type="area",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return zp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Al;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Gp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gp.NOWORK_ANIMATE_ATTR}}function Yp(t){return new Gp(t)}Gp.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Xp=["radius","startAngle","endAngle",...pp];class Kp extends Ep{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return zp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Xp)}needUpdateTag(t){return super.needUpdateTag(t,Xp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Al,s.arc(0,0,r,a,o),s}clone(){return new Kp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kp.NOWORK_ANIMATE_ATTR}}function $p(t){return new Kp(t)}Kp.NOWORK_ANIMATE_ATTR=Cp;class qp extends Ep{constructor(t){super(t),this.type="glyph",this.numberType=nd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return zp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new qp(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return qp.NOWORK_ANIMATE_ATTR}}function Zp(t){return new qp(t)}var Jp;qp.NOWORK_ANIMATE_ATTR=Cp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Jp||(Jp={}));let Qp=class t extends Ep{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rd,this._childUpdateTag=vo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(rp(this.sharedStateScope,t),cp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===yo.GLOBAL){const i=new re(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&vo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,dx:i=Rl.dx,dy:s=Rl.dy,scaleX:n=Rl.scaleX,scaleY:r=Rl.scaleY,angle:a=Rl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return zp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=vo.CLEAR_BOUNDS,this._childUpdateTag&=vo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&vo.UPDATE_BOUNDS||(this._childUpdateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&vo.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=oh.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&rp(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return ap({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Cp;const eg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...pp];class ig extends Ep{constructor(t){super(t),this.type="image",this.numberType=ad,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return zp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ih[t]}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}clone(){return new ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ig.NOWORK_ANIMATE_ATTR}}function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Cp);const ng=["segments","points","curveType","curveTension",...pp];let rg=class t extends Ep{constructor(t={}){super(t),this.type="line",this.numberType=od}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=bh(i,s,e))}getGraphicTheme(){return zp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,ng)}needUpdateTag(t){return super.needUpdateTag(t,ng)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Al;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ag(t){return new rg(t)}rg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const og=["path","customPath",...pp];class lg extends Ep{constructor(t){super(t),this.type="path",this.numberType=ld}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Al?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Al?this.cache:t.path)}getGraphicTheme(){return zp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Al).fromString(t.path):t.customPath&&(this.cache=new Al,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,og)}needUpdateTag(t){return super.needUpdateTag(t,og)}toCustomPath(){return(new Al).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new lg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lg.NOWORK_ANIMATE_ATTR}}function hg(t){return new lg(t)}lg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const cg=["points","cornerRadius",...pp];class dg extends Ep{constructor(t){super(t),this.type="polygon",this.numberType=hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return zp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,cg)}needUpdateTag(t){return super.needUpdateTag(t,cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Al,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Cp;const pg=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}},gg=["width","x1","y1","height","cornerRadius",...pp];class fg extends Ep{constructor(t){super(t),this.type="rect",this.numberType=dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return zp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,gg)}needUpdateTag(t){return super.needUpdateTag(t,gg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=pg(e);return t=new Al,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fg.NOWORK_ANIMATE_ATTR}}function mg(t){return new fg(t)}fg.NOWORK_ANIMATE_ATTR=Cp;const vg=Symbol.for("EnvContribution"),yg=Symbol.for("VGlobal"),_g="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",bg={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"}},xg=!0,Sg=!1,Ag=/\w|\(|\)|-/,kg=/[.?!,;:/,。?!、;:]/,Cg=/\S/,Tg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=oh.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=wg(t,a)),a}function wg(t,e,i=!1){let s=e;for(;Ag.test(t[s-1])&&Ag.test(t[s])||kg.test(t[s]);)if(s--,s<=0)return i?Eg(t,e):e;return s}function Eg(t,e){let i=e;for(;Ag.test(t[i+1])&&Ag.test(t[i])||kg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=oh.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Pg{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=bg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Rg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Og{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Rg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Mg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Ig extends ig{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(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=ih.width,height:e=ih.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 Lg{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 Ig?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Cg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Ig)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sg;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,Tg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ru(t,s,{AABBBounds:i}):s,Tg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Ig)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Ig?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=bg[this.direction]}store(t){if(t instanceof Ig){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 Lg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Ig?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character,t.ascentDescentMode),new Og(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Fg=!1;try{Fg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Fg=!1}const zg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...pp];class Hg extends Ep{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=pd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return zp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1)))}static splitText(t){if(Fg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Hg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),oh.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Hg.AllSingleCharacter(y)&&(y=Hg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Pg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Hg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Hg.NOWORK_ANIMATE_ATTR}}function jg(t){return new Hg(t)}Hg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);class Ng extends Qp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ug(t){return new Ng(t)}const Vg=["symbolType","size",...pp];let Wg=class t extends Ep{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=fd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return zp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Gc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Al).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Al).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Gg(t){return new Wg(t)}function Yg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Xg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Kg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);class $g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Tl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=md}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return zp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Zg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=oh.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Gc(n,o/Math.abs(r+a),!0,l),i.union(n)}return oh.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new $g(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new $g(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Yg(y,a),e=this.cache.verticalList.length*v,i=Xg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>$c(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Kc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Yg(y,a),A=x.verticalList.length*v,k=Xg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=qg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=qg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Zg.baselineMapAlign}getAlignMapBaseline(){return Zg.alignMapBaseline}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),Zg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Zg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Qg=["heightLimit","lineClamp"];class tf extends Zg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new $g(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 uf extends df{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let pf=0;class gf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=oh.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++pf,t),this.tryRunAnimationFrameNextFrame(),pf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class ff{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var mf=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 vf extends ff{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new uf(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return mf(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class yf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Td(Object.assign({nativeCanvas:oh.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Td(Object.assign({nativeCanvas:oh.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const _f=new yf,bf=Symbol.for("VWindow"),xf=Symbol.for("WindowHandlerContribution");function Sf(t){const e=oh.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Af extends ff{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(t=oh.global,e=Sf){super(),this.handlerFactory=e,this.hooks={onChange:new uf(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class kf{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=oh.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=_f.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=oh.windowFactory)||void 0===s?void 0:s.call(oh))&&void 0!==n?n:new Af(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var Cf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Cf||(Cf={}));const Tf=new Ge;class Mf{constructor(){this.matrix=new Ge}init(t){return this.mode=Cf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Cf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}scale(t,e,i){return this.mode===Cf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Cf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Tf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}translate(t,e){return this.mode===Cf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Cf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const wf=Symbol.for("@visactor/vrender-core/factory-state");function Ef(){const t=globalThis;return t[wf]||(t[wf]={pluginClasses:{}}),t[wf]}class Bf{constructor(){this.global=oh.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Pf=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 Rf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Of(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Ff{constructor(){this.time=So.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(jf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=zp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Kf(t,e,i,s)}}const zf=new Ff,Hf=new Set(["top","center","bottom"]);function jf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Nf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Uf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Uf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Nf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Gf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Hf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Yf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Xf(t){if(!t)return null;const e=Yf(t.naturalWidth,t.videoWidth,t.width),i=Yf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Kf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Xf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Gf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=_f.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),_f.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class $f{constructor(t){this.subRenderContribitions=t,this.time=So.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)}))}}class qf{constructor(){this.time=So.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Zf=new qf;class Jf{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Qf=new Jf,tm={getContributions:()=>[]};class em{constructor(t=[],e=tm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Of(e,Nl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:oh.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:tm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Su.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lf(e,i,Nl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Su.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),Su.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||function(){const t=oh.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class sm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class nm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class am{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const om={getContributions:()=>[]};class lm{constructor(t=om,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new rm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class hm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class cm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=oh.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=oh.global.getRequestAnimationFrame();this.rafId=t((()=>{oh.global.devicePixelRatio!==this.dpr&&(this.dpr=oh.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=oh.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class dm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oh.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const um=new Ve;class pm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&vo.UPDATE_PAINT)||s._updateTag&vo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(um.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(um,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let gm;function fm(){if(null==gm)try{const t=document.createElement("canvas"),e=t.getContext("2d");gm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),gm&&(gm=!!document.createElement)}catch(t){gm=!1}}function mm(){fm();const t=oh.global&&oh.global.env;return t?"browser"===t:gm}function vm(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(au(t),cu(t,t,[n+o,r+l,a+h]),cu(t,t,[y[0],y[1],y[2]]),ou(t,t,g),lu(t,t,p),cu(t,t,[-y[0],-y[1],y[2]]),uu(t,t,[c,d,u]),f){const i=Au.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]}cu(i,i,[s[0],s[1],0]),hu(i,i,f),cu(i,i,[-s[0],-s[1],0]),pu(t,t,i)}}function ym(t){const{alpha:e,beta:i}=t.attribute;return e||i}class _m{constructor(t=lf){this.creator=t,this.hooks={onAttributeUpdate:new uf(["graphic"]),onSetStage:new uf(["graphic","stage"]),onRemove:new uf(["graphic"]),onRelease:new uf(["graphic"]),onAddIncremental:new uf(["graphic","group","stage"]),onClearIncremental:new uf(["graphic","group","stage"]),beforeUpdateAABBBounds:new uf(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uf(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uf(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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=Xg(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=Yg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Gc(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;Gc(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&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const bm="white";class xm extends Qp{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:bm}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new uf(["stage"]),afterRender:new uf(["stage"]),afterClearScreen:new uf(["stage"]),afterClearRect:new uf(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:oh.global,!this.global.env&&mm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:oh.windowFactory)&&void 0!==n?n:()=>new Af(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=oh.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=oh.renderServiceFactory)||void 0===h?void 0:h.call(oh))&&void 0!==c?c:oh.renderService)&&void 0!==d?d:new im,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=oh.pluginServiceFactory)||void 0===p?void 0:p.call(oh))&&void 0!==g?g:oh.pluginService)&&void 0!==f?f:new lm,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:oh.layerService)&&void 0!==v?v:new Mm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:oh.graphicService)&&void 0!==b?b:new _m,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:bm,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,ap(s)),cp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new io(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=Cm.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=Cm.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Cm.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new hm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new cm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new dm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new pm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Cm.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Cm.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Cm.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return ap({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class Sm{constructor(t=xm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Am extends Qp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oh.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=>{oh.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)))}}class km{constructor(t=Am){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let Cm=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Tm(t){const e=oh.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}Cm._pluginClasses=Ef().pluginClasses;class Mm{static GenerateLayerId(){return`${Mm.idprefix}_${Mm.prefix_count++}`}constructor(t=oh.global,e=new km,i=Tm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Mm.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)}}Mm.idprefix="visactor_layer",Mm.prefix_count=0;const wm=Symbol.for("TransformUtil"),Em=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Pm=Symbol.for("StaticLayerHandlerContribution"),Rm=Symbol.for("DynamicLayerHandlerContribution"),Om=Symbol.for("VirtualLayerHandlerContribution"),Im=Symbol.for("@visactor/vrender-core/contribution-store-state");function Lm(){const t=globalThis;return t[Im]||(t[Im]={store:new Map}),t[Im]}const Dm=Symbol("ContributionProvider");class Fm{constructor(t,e){this.serviceIdentifier=t,this.container=e,Nm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function zm(t,e){return new Fm(t,e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).inSingletonScope().whenTargetNamed(e)}function jm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).whenTargetNamed(e)}class Nm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}Nm.store=Lm().store;class Um{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=th.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=wg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Um{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Gm({bind:t}){t(yg).toDynamicValue((({container:t})=>new vf(zm(vg,t)))).inSingletonScope(),t(bf).to(Af),t(Em).toDynamicValue((({container:t})=>new kf(zm(Vm,t)))).inSingletonScope(),t(wm).to(Mf).inSingletonScope(),t(Bm).to(Mm).inSingletonScope()}const Ym=Symbol.for("RenderService"),Xm=Symbol.for("BeforeRenderConstribution");function Km({bind:t}){t(Ym).to(im)}const $m=Symbol.for("GraphicPicker"),qm=Symbol.for("PickerService"),Zm=Symbol.for("BoundsPicker"),Jm=Symbol.for("GlobalPickerService"),Qm=Symbol.for("PickItemInterceptor"),tv=Symbol.for("PickServiceInterceptor"),ev=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ed,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},iv=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class sv extends fg{constructor(t){super(t),this.type="rect3d",this.numberType=ud}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return zp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,rv)}needUpdateTag(t){return super.needUpdateTag(t,rv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Al,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new av(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return av.NOWORK_ANIMATE_ATTR}}function ov(t){return new av(t)}av.NOWORK_ANIMATE_ATTR=Cp;class lv extends Up{constructor(t){super(t),this.type="arc3d",this.numberType=ed}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return lv.NOWORK_ANIMATE_ATTR}}function hv(t){return new lv(t)}lv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);class cv extends dg{constructor(t){super(t),this.type="pyramid3d",this.numberType=cd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return cv.NOWORK_ANIMATE_ATTR}}function dv(t){return new cv(t)}let uv,pv;function gv(t){return uv||(uv=cf("text",{})),uv.initAttributes(t),uv.AABBBounds}function fv(t){return pv||(pv=cf("richtext",{})),pv.setAttributes(t),pv.AABBBounds}cv.NOWORK_ANIMATE_ATTR=Cp;class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class vv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=zp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Su.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class _v{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=ev(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function bv({bind:t,isBound:e}){e(qm)||(t(Jm).toSelf(),t(qm).toService(Jm)),t(_v).toSelf().inSingletonScope(),t(Qm).toService(_v),t(vv).toSelf().inSingletonScope(),t(Qm).toService(vv),t(yv).toSelf().inSingletonScope(),t(Qm).toService(yv),Hm(t,Qm),t(mv).toSelf().inSingletonScope(),t(tv).toService(mv),Hm(t,tv)}function xv({bind:t}){t(vd).to(_m),t(yd).toConstantValue(lf)}const Sv=Symbol.for("AutoEnablePlugins"),Av=Symbol.for("PluginService");class kv{constructor(){this.type="static",this.offscreen=!1,this.global=oh.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Td({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()}}function Cv(t){(function({bind:t}){Hm(t,vg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),Hm(t,Vm)}({bind:t.bind}),function({bind:t}){t(kv).toSelf(),t(Pm).toService(kv)}({bind:t.bind})}const Tv=Ht/2;function Mv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Tv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Tv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Tv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Tv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function wv(t,e){return!(!t&&!e)}function Ev(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Pv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Rv(t,e){return t*e>0}function Ov(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Iv(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*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Fv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=Lv(g,f,u,p,n,t,Number(c)),l=Lv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=Lv(S,A,b,x,r,-n,Number(c)),l=Lv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const zv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Hv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=_f.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])),_f.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,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=_f.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Gg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:zv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=_f.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),_f.free(l),c}_f.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const jv=new Hv;class Nv{constructor(){this.time=So.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:nu(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Fv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Uv=new Nv,Vv=jv,Wv=zf;class Gv{constructor(){this.time=So.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Yv=new Gv,Xv=jv,Kv=zf;class $v extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(jf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const qv=new $v;function Zv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Jv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:nu(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Mv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class Qv{constructor(){this.time=So.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;Zv(p)&&(u.doStroke=!1)}}class ty{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Zv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Mv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ey=new Jv,iy=jv,sy=zf;class ny extends Jv{constructor(){super(...arguments),this.time=So.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)}}const ry=new ny,ay=zf;class oy{constructor(){this.time=So.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class ly{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const hy=new oy,cy=new ly,dy=jv,uy=zf,py=jv,gy=zf;class fy extends Hv{constructor(){super(...arguments),this.time=So.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:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class my{constructor(t){this.groupRenderContribitions=t,this.numberType=rd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:zp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Pv(p,m,g,f,c),w=Ov(p,v,g,f),E=wv(c,u),B=Ev(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Mv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===So.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===So.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=oh.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=zp(t,null==s?void 0:s.theme).group,i=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(i,p||i,n),a.modelMatrix=i,Au.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Au.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var vy,yy=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"}(vy||(vy={}));class _y extends em{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=vy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uf([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return yy(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:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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 yy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return yy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>yy(this,void 0,void 0,(function*(){if(2!==t.count)yield If(t,Nl.zIndex,((i,s)=>{if(this.status===vy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return yy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return yy(this,void 0,void 0,(function*(){this.rendering&&(this.status=vy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=vy.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 yy(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:()=>yy(this,void 0,void 0,(function*(){yield If(t,Nl.zIndex,(t=>yy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const by=Symbol.for("IncrementalDrawContribution"),xy=Symbol.for("ArcRender"),Sy=Symbol.for("Arc3dRender"),Ay=Symbol.for("AreaRender"),ky=Symbol.for("CircleRender"),Cy=Symbol.for("GraphicRender"),Ty=Symbol.for("GroupRender"),My=Symbol.for("LineRender"),wy=Symbol.for("PathRender"),Ey=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Py=Symbol.for("Rect3DRender"),Ry=Symbol.for("SymbolRender"),Oy=Symbol.for("TextRender"),Iy=Symbol.for("RichTextRender"),Ly=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Fy=Symbol.for("ImageRender"),zy=Symbol.for("RenderSelector"),Hy=Symbol.for("DrawContribution"),jy=Symbol.for("StarRender"),Ny=Symbol.for("DrawItemInterceptor"),Uy=new Ve,Vy=new Ve;class Wy{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){Uy.copy(s.dirtyBounds),Vy.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,Su.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Uy),s.backupDirtyBounds.copy(Vy)),!0}}class Gy{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}}class Yy{constructor(){this.order=1,this.interceptors=[new Wy,new Ky,new Xy,new Gy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Au.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const $y=Symbol.for("ArcRenderContribution"),qy=Symbol.for("AreaRenderContribution"),Zy=Symbol.for("CircleRenderContribution"),Jy=Symbol.for("GroupRenderContribution"),Qy=Symbol.for("ImageRenderContribution"),t_=Symbol.for("PathRenderContribution"),e_=Symbol.for("PolygonRenderContribution"),i_=Symbol.for("RectRenderContribution"),s_=Symbol.for("SymbolRenderContribution"),n_=Symbol.for("TextRenderContribution"),r_=Symbol.for("StarRenderContribution"),a_=Symbol.for("CommonRenderContribution"),o_=Symbol.for("InteractiveSubRenderContribution");function l_(t){!function({bind:t}){t(Ff).toSelf().inSingletonScope(),t(Hv).toSelf().inSingletonScope(),t(Hy).to(em),t(by).to(_y),t(Ty).toDynamicValue((({container:t})=>new my(zm(Jy,t)))).inSingletonScope(),t(Cy).toService(Ty),Hm(t,Jy),Hm(t,o_),t($f).toDynamicValue((({container:t})=>new $f(zm(o_,t)))).inSingletonScope(),Hm(t,Cy),t(Yy).toSelf().inSingletonScope(),t(Ny).toService(Yy),Hm(t,Ny)}({bind:t.bind})}class h_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class c_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new h_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function d_(){return new c_}const u_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const p_=function(){const t=globalThis;return t[u_]||(t[u_]={legacyBindingContext:d_(),preloaded:!1}),t[u_]}(),g_=p_.legacyBindingContext;function f_(){p_.preloaded||(p_.preloaded=!0,Gm({bind:g_.bind}),xv({bind:g_.bind}),Km({bind:g_.bind}),bv({bind:g_.bind,isBound:g_.isBound}),function({bind:t}){t(Av).to(lm),jm(t,Sv)}({bind:g_.bind}),Cv(g_),l_(g_))}function m_(){return g_}function v_(t){f_();const[e]=g_.getAll(t);return e}function y_(t,e){return f_(),g_.getNamed(t,e)}function __(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const b_=__((()=>v_(yg)));oh.global=b_;class x_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?oh.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:oh.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Kg("text"===t.type&&t.attribute?t.attribute:zp(t).text)}getTransformOfText(t){const e=zp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=oh.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));oh.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===oh.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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&&oh.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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"===oh.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 S_=()=>{Cm.registerPlugin("HtmlAttributePlugin",x_)};class A_ extends x_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?oh.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&oh.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const k_=()=>{Cm.registerPlugin("ReactAttributePlugin",A_)};class C_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return C_.instance||(C_.instance=new C_),C_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function T_(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function M_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:w_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=T_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:w_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=T_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const O=i*x+B;O>0&&E.wait(O);let I=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(E,e,p,L);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=T_(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:w_.builtInAnimateMap[r],m=t.custom?t.customType:T_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{M_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}w_.builtInAnimateMap={};const E_="appear",B_="disappear",P_="update",R_="highlight",O_="unhighlight";class I_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class L_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyHighlightState(t,e){this.applyState([R_],[{name:R_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([O_],[{name:O_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new L_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new I_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class F_{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-F_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*F_.bounceIn(2*t):.5*F_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){F_[t]=e}}function z_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}F_.quadIn=F_.getPowIn(2),F_.quadOut=F_.getPowOut(2),F_.quadInOut=F_.getPowInOut(2),F_.cubicIn=F_.getPowIn(3),F_.cubicOut=F_.getPowOut(3),F_.cubicInOut=F_.getPowInOut(3),F_.quartIn=F_.getPowIn(4),F_.quartOut=F_.getPowOut(4),F_.quartInOut=F_.getPowInOut(4),F_.quintIn=F_.getPowIn(5),F_.quintOut=F_.getPowOut(5),F_.quintInOut=F_.getPowInOut(5),F_.backIn=F_.getBackIn(1.7),F_.backOut=F_.getBackOut(1.7),F_.backInOut=F_.getBackInOut(1.7),F_.elasticIn=F_.getElasticIn(1,.3),F_.elasticOut=F_.getElasticOut(1,.3),F_.elasticInOut=F_.getElasticInOut(1,.3*1.5),F_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),F_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},F_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)F_[`flicker${t}`]=e=>z_(e,t);for(let t=2;t<10;t++)F_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function H_(t,e,i){return t+(e-t)*i}const j_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=H_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=H_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=H_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=H_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=H_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=H_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=H_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=H_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=H_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ru(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?zu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ru(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?zu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=H_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=H_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=H_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=H_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=H_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=H_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=H_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function N_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:_o.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=F_[s])&&void 0!==n?n:F_.linear:F_.linear,"wait"===t&&(this.onUpdate=Z_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=Z_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Bu.Get(i,Eu.Color255),r=Bu.Get(s,Eu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(j_["fill"===e?"fillPure":"strokePure"])}else j_[e]?t.push(j_[e]):t.push(N_)}else j_[e]?t.push(j_[e]):t.push(N_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tb extends Q_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();$_(this.target,t,_o.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class eb extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ib=new eb;ib.isGlobal=!0;class sb extends Q_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class nb extends sb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class rb extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class ab extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){$_(this.target,this.from,_o.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ob(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class cb{constructor(t=Va.GenAutoIncrementId(),e=ib,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(hb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new Q_(El.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tb(El.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new ab(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(hb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&$_(this.target,this._startProps,_o.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const db=new gf;class ub{constructor(){this.released=!1}tick(t,e){db.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class pb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===wl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=wl.INITIAL,oh.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),oh.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new ub;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==wl.INITIAL&&(this.status=wl.PAUSE,!0)}resume(){return this.status!==wl.INITIAL&&(this.status=wl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=wl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===wl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===wl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,oh.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function fb(){G(Ep,D_),G(Ep,gb)}function mb(){hf("arc",Vp)}function vb(){hf("arc3d",hv)}function yb(){hf("area",Yp)}function _b(){hf("circle",$p)}function bb(){hf("glyph",Zp)}function xb(){hf("group",tg)}function Sb(){hf("image",sg)}function Ab(){hf("line",ag)}function kb(){hf("path",hg)}function Cb(){hf("polygon",ug)}function Tb(){hf("pyramid3d",dv)}function Mb(){hf("rect",mg)}function wb(){hf("rect3d",nv)}function Eb(){hf("richtext",jg)}function Bb(){hf("shadowRoot",Ug)}function Pb(){hf("star",ov)}function Rb(){hf("symbol",Gg)}function Ob(){hf("text",Jg)}function Ib(){hf("wrapText",ef)}function Lb(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Fb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Zf),e(Qf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===So.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===So.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=zp(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=Bv(d,u,h),_=Rv(d,g),b=wv(h),x=Ev(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return wo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Rv(o,c),g=wv(n,r),f=Ev(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||ym(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Au.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Au.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class zb extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=td,this.builtinContributions=[Uv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=Lv(v,y,f,m,n,t,Number(u)),o=Lv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=Lv(C,T,A,k,r,-n,Number(u)),o=Lv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Gu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const Hb=new WeakSet;function jb({bind:t}){Lb(Hb,t)||(t(zb).toDynamicValue((({container:t})=>new zb(zm($y,t)))).inSingletonScope(),t(xy).toService(zb),t(Cy).toService(xy),t($y).toService($f),Hm(t,$y))}const Nb=jb;class Ub extends Fb{constructor(){super(...arguments),this.numberType=ed}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Eu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Lb(Vb,t)||(t(Ub).toDynamicValue((()=>new Ub)).inSingletonScope(),t(Sy).toService(Ub),t(Cy).toService(Sy))}const Gb=Wb;function Yb(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 Xb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?bo.ROW:bo.COLUMN,Number.isFinite(c)||(o=bo.COLUMN),Number.isFinite(d)||(o=bo.ROW);const u=i*(o===bo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Yb(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),Yb(t,l,1,s),o=!1):o=!0}t.closePath()}function $b(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function qb(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=$b(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Yb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=bo.ROW:"y"===s?u=bo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Jb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Qb=new fy,tx=zf;class ex extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Qb,tx],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=zp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,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=Sl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Sl(e,E,{curveTension:b}),n=Sl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=bo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?bo.ROW:null==y.y1?bo.COLUMN:Number.isFinite(S+A)?S>A?bo.ROW:bo.COLUMN:bo.ROW,Xb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),qb(t,i[0]?e.top:e.bottom,l,x===bo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ix=new WeakSet;function sx({bind:t}){Lb(ix,t)||(t(ex).toDynamicValue((({container:t})=>new ex(zm(qy,t)))).inSingletonScope(),t(Ay).toService(ex),t(Cy).toService(Ay),t(qy).toService($f),Hm(t,qy))}const nx=sx;class rx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[Yv,Kv,Xv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const ax=new WeakSet;function ox({bind:t}){Lb(ax,t)||(t(rx).toDynamicValue((({container:t})=>new rx(zm(Zy,t)))).inSingletonScope(),t(ky).toService(rx),t(Cy).toService(ky),t(Zy).toService($f),Hm(t,Zy))}const lx=ox;class hx{constructor(){this.numberType=nd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=zp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const cx=new WeakSet;function dx({bind:t}){Lb(cx,t)||(t(hx).toDynamicValue((()=>new hx)).inSingletonScope(),t(Dy).toService(hx),t(Cy).toService(Dy))}const ux=dx,px=["","repeat-x","repeat-y","repeat"];function gx(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?px[i]:"no-repeat"}function fx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=gx(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const mx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function vx(t){return{backgroundMode:mx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function yx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=fx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function _x(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=fx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?vx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Kf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class bx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ad,this.builtinContributions=[ry,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Mv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),_x(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=yx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,T,!1,k,!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&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=zp(t).image;this._draw(t,a,!1,i)}}const xx=new WeakSet;function Sx({bind:t}){Lb(xx,t)||(t(Fy).toDynamicValue((({container:t})=>new bx(zm(Qy,t)))).inSingletonScope(),t(Cy).toService(Fy),t(Qy).toService($f),Hm(t,Qy))}const Ax=Sx;class kx extends Fb{constructor(){super(...arguments),this.numberType=od}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();qb(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Sl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const Cx=new WeakSet;function Tx({bind:t}){Lb(Cx,t)||(t(kx).toDynamicValue((()=>new kx)).inSingletonScope(),t(My).toService(kx),t(Cy).toService(My))}const Mx=Tx,Ex=jv,Bx=zf;class Px extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ld,this.builtinContributions=[Bx,Ex],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:zp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)wo(t.pathShape.commandList,e,i,s,1,1,f);else{wo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Rx=new WeakSet;function Ox({bind:t}){Lb(Rx,t)||(t(Px).toDynamicValue((({container:t})=>new Px(zm(t_,t)))).inSingletonScope(),t(wy).toService(Px),t(Cy).toService(wy),t(t_).toService($f),Hm(t,t_))}const Ix=Ox;function Lx(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Lx(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lx(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Fx(h,y,_,d,u),A=Fx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=Dx(k,C),M=Fx(h,Dx(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const Nx=new WeakSet;function Ux({bind:t}){Lb(Nx,t)||(t(Ey).toDynamicValue((({container:t})=>new jx(zm(e_,t)))).inSingletonScope(),t(Cy).toService(Ey),t(e_).toService($f),Hm(t,e_))}const Vx=Ux;class Wx extends Fb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Eu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Gx extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=cd}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=zp(t).polygon;this._draw(t,s,!1,i)}}const Yx=new WeakSet;function Xx({bind:t}){Lb(Yx,t)||(t(Gx).toDynamicValue((()=>new Gx)).inSingletonScope(),t(Ly).toService(Gx),t(Cy).toService(Ly))}const Kx=Xx;class $x extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=dd,this.builtinContributions=[ey,sy,iy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Pv(g,f,T,M,h),E=Ov(g,v,T,M,C),B=wv(h,c),P=Ev(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Mv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const qx=new WeakSet;function Zx({bind:t}){Lb(qx,t)||(t($x).toDynamicValue((({container:t})=>new $x(zm(i_,t)))).inSingletonScope(),t(By).toService($x),t(Cy).toService(By),t(ty).toSelf(),t(Qv).toSelf(),t(i_).toService(ty),t(i_).toService(Qv),t(i_).toService($f),Hm(t,i_))}const Jx=Zx;class Qx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=ud}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=zp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Pv(v,y,A,k,d),M=Ov(v,b,A,k,S),w=wv(d),E=Ev(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=zp(t).rect;this._draw(t,s,!1,i)}}const tS=new WeakSet;function eS({bind:t}){Lb(tS,t)||(t(Qx).toDynamicValue((()=>new Qx)).inSingletonScope(),t(Py).toService(Qx),t(Cy).toService(Py))}const iS=eS;const sS=new class extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=gv(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 i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),O?Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,O?(Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),D()}};class nS extends Fb{constructor(){super(),this.numberType=pd,this.builtinContributions=[sS],this.init()}drawShape(t,e,i,s,n){const r=zp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=zp(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(),Mv(e,i-t,s-n,v,y,f,!0)),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=zp(t).richtext;this._draw(t,s,!1,i)}}const rS=new WeakSet;function aS({bind:t}){Lb(rS,t)||(t(nS).toDynamicValue((()=>new nS)).inSingletonScope(),t(Iy).toService(nS),t(Cy).toService(Iy))}const oS=aS;class lS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[gy,py],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const hS=new WeakSet;function cS({bind:t}){Lb(hS,t)||(t(lS).toDynamicValue((({container:t})=>new lS(zm(r_,t)))).inSingletonScope(),t(jy).toService(lS),t(Cy).toService(jy),Hm(t,r_))}const dS=cS;class uS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[hy,uy,dy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:zp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const pS=new WeakSet;function gS({bind:t}){Lb(pS,t)||(t(uS).toDynamicValue((({container:t})=>new uS(zm(s_,t)))).inSingletonScope(),t(Ry).toService(uS),t(Cy).toService(Ry),t(s_).toService($f),Hm(t,s_))}const fS=gS;class mS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[sS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=zp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Su.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Su.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Yg(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const vS=new WeakSet;function yS({bind:t}){Lb(vS,t)||(t(Oy).toDynamicValue((({container:t})=>new mS(zm(n_,t)))).inSingletonScope(),t(Cy).toService(Oy),t(n_).toService($f),Hm(t,n_))}const _S=yS,bS=mm();function xS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function SS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const AS=Symbol.for("MathPickerContribution"),kS=Symbol.for("MathArcPicker"),CS=Symbol.for("MathAreaPicker"),TS=Symbol.for("MathCirclePicker"),MS=Symbol.for("MathImagePicker"),wS=Symbol.for("MathLinePicker"),ES=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),PS=Symbol.for("MathSymbolPicker"),RS=Symbol.for("MathTextPicker"),OS=Symbol.for("MathPolygonPicker"),IS=Symbol.for("MathGlyphPicker"),LS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),FS=Symbol.for("CanvasArc3dPicker"),zS=Symbol.for("CanvasAreaPicker"),HS=Symbol.for("CanvasCirclePicker"),jS=Symbol.for("CanvasImagePicker"),NS=Symbol.for("CanvasGifImagePicker"),US=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),GS=Symbol.for("CanvasRectPicker"),YS=Symbol.for("CanvasRect3dPicker"),XS=Symbol.for("CanvasSymbolPicker"),KS=Symbol.for("CanvasTextPicker"),$S=Symbol.for("CanvasPolygonPicker"),qS=Symbol.for("CanvasPyramid3dPicker"),ZS=Symbol.for("CanvasRichTextPicker"),JS=Symbol.for("CanvasGlyphPicker"),QS=Symbol.for("CanvasGroupPicker"),tA=Symbol.for("CanvasStarPicker"),eA=Symbol.for("CanvasPickerContribution"),iA=m_(),sA=__((()=>v_(Em))),nA=__((()=>v_(wm))),rA=__((()=>v_(vd))),aA=__((()=>v_(Bm)));function oA(){oh.global=b_,oh.graphicUtil=sA,oh.transformUtil=nA,oh.graphicService=rA,oh.layerService=aA,oh.canvasFactory=t=>y_(kd,t),oh.context2dFactory=t=>y_(Cd,t),oh.windowFactory=()=>new Af(oh.global),oh.windowHandlerFactory=t=>function(t){const e=y_(xf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),oh.renderServiceFactory=()=>v_(Ym),oh.renderService=__((()=>v_(Ym))),oh.pluginServiceFactory=()=>v_(Av),oh.pluginService=__((()=>v_(Av))),oh.pickerServiceFactory=()=>v_(qm),oh.layerHandlerFactory=t=>v_("static"===t?Pm:"dynamic"===t?Rm:Om),oh.incrementalDrawContributionFactory=()=>v_(by)}oA();var lA=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 hA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return lA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class cA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class dA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Eu.Color1),this.ambient=i;const s=$t(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=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Bu.Get(e,Eu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const uA=()=>{Cm.registerPlugin("DirectionalLight",dA)};class pA{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=Au.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Au.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return gu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return fu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return mu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;mu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const gA=()=>{Cm.registerPlugin("OrthoCamera",pA)},fA={getContributions:()=>[]},mA={getContributions:()=>[]};class vA{constructor(t=fA,e=mA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:fA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:mA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=zp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=zp(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&&Au.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Su.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class yA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new sm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new nm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new am,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new rm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new Sm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new km,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new sf}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new im(new em([],(t=this.registry.contribution,e=Ny,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class _A{constructor(t={}){this.context=new yA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function bA(t={}){return new _A(t)}class xA extends _A{}class SA extends _A{}class AA extends ex{constructor(){super(...arguments),this.numberType=id}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=zp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=wv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=zp(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=Bv(u,p,c),y=Rv(u,g),_=wv(c),b=Ev(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{};function DA(){MA.preloaded||(MA.preloaded=!0,Gm({bind:wA.bind}),xv({bind:wA.bind}),Km({bind:wA.bind}),bv({bind:wA.bind,isBound:wA.isBound}),Cv(wA),l_(wA))}function FA(t,e){const i=NA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function zA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function HA(t,e){let i=PA.get(t);i||(i=new Map,PA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function jA(t,e,i){const s=HA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function NA(){return DA(),wA}function UA(){Nm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=MA.runtimeGlobal)&&void 0!==t||(MA.runtimeGlobal=new vf(zm(vg,wA))),MA.runtimeGlobal}function WA(t){const e=NA(),i=VA();oh.global=i,oh.canvasFactory=t=>e.getNamed(kd,t),oh.context2dFactory=t=>e.getNamed(Cd,t),oh.windowHandlerFactory=t=>FA(xf,t),oh.windowFactory=()=>new Af(i,(t=>FA(xf,t))),oh.pluginServiceFactory=()=>new lm(zm(Sv,e),{pluginRegistry:t.context.registry.plugin}),oh.incrementalDrawContributionFactory=()=>new _y([],new kA,new AA(zm(qy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,Ny))}function GA(t){var e;const i=NA();UA();const s=i.getAll(Cy),n=HA(t.registry.renderer,EA);jA(t.registry.renderer,EA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),zA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,EA)}function YA(t){var e;const i=NA();UA();const s=i.getAll(Ny),n=null!==(e=RA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,Ny,e)})),n.clear(),RA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(Ny));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(Ny,e),r.add(e)),n.add(e)}))}function XA(t,e){var i;const s=NA();UA();const n=s.getAll(e),r=HA(t.registry.picker,BA);jA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),zA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function KA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=OA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,LA,t.isBound,t.rebind),function(t,e){let i=OA.get(t);i||(i=new WeakSet,OA.set(t,i)),i.add(e)}(t,e))}function $A(t,{app:e,legacy:i=!0,targets:s}={}){KA(NA(),t),i&&(f_(),KA(m_(),t)),UA(),e&&function(t,e){const i=null!=e?e:IA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&YA(t),s&&GA(t),r.forEach((e=>{XA(t,e)}))}(e,s)}function qA(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function ZA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function JA(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 QA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ok(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=pg(t.attribute),n=hk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=hk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=hk(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{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(;n{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 _k(l,e,h),h},fk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return pk(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 pk(t,e)}return[]};const mk=t=>t.map((t=>({x:t.x,y:t.y}))),vk=(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]},yk=t=>{const e=new Ue;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 vk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return vk(t,{x:e.x1,y:n},{x:e.x2,y:n})},_k=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=yk(t);_k(n[0],s,i),_k(n[1],e-s,i)}},bk=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:mk(i)}];const s=[];return _k(i,e,s),s},xk=(t,e)=>{const i=ak(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;rObject.assign({},t))):[]}function Ak(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:Sk(t.touches),configurable:!0},changedTouches:{value:Sk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function kk(t,e){try{return t[e]}catch(t){return}}function Ck(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Ak(t),l=kk(t,"target"),h=kk(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Tk=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Ek(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:wk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Tk(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=wk(i,this.selectionStartCursorIdx),a=wk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=Mk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Ek(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),oh.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),oh.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Pk{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=wk(i,Math.ceil(t)),n=wk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=wk(i.attribute.textConfig,a),h=wk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Rk,[this.formatTextCommandCb]),this.commandCbs.set(Ok,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(oh.global.isMacOS()&&t.metaKey&&"c"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return oh.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(oh.global.isMacOS()&&t.metaKey&&"a"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},Mk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=jg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:fv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||mg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},Mk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=tg({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Ik.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=ag({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=tg({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=fv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=fv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(mg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:fv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Qk=new Jk;class tC{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const eC=()=>{Cm.registerPlugin("ViewTransform3dPlugin",tC)},iC=new Ve;class sC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=zp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nC=()=>{Cm.registerPlugin("FlexLayoutPlugin",sC)};var rC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:rh,ARC3D_NUMBER_TYPE:ed,ARC_NUMBER_TYPE:td,AREA_NUMBER_TYPE:id,AbstractGraphicRender:class{},get AnimateMode(){return Ml},get AnimateStatus(){return Bl},get AnimateStepType(){return El},AppContext:yA,Application:nh,Arc:Up,Arc3d:lv,Arc3dRender:Sy,ArcRender:xy,ArcRenderContribution:$y,Area:Gp,AreaRender:Ay,AreaRenderContribution:qy,get AttributeUpdateType(){return _o},AutoEnablePlugins:Sv,Base3dRender:Wx,BaseCanvas:wu,BaseEnvContribution:hA,BaseRender:Fb,get BaseRenderContributionTime(){return So},BaseWindowHandlerContribution:cA,Basis:$o,BeforeRenderConstribution:Xm,BoundsContext:no,BoundsPicker:Zm,BrowserEntry:_A,CIRCLE_NUMBER_TYPE:sd,CONTRIBUTION_STORE_STATE_SYMBOL:Im,Canvas3DDrawItemInterceptor:Ky,Canvas3DPickItemInterceptor:_v,CanvasFactory:kd,CanvasTextLayout:$g,Circle:Kp,CircleRender:ky,CircleRenderContribution:Zy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Eu},CommonDrawItemInterceptorContribution:Yy,CommonRenderContribution:a_,Context2dFactory:Cd,ContributionProvider:Dm,ContributionRegistry:am,ContributionStore:Nm,CubicBezierCurve:zo,CurveContext:xl,get CurveTypeEnum(){return xo},CustomEvent:qa,CustomPath2D:Al,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:_g,DebugDrawItemInterceptorContribution:Gy,DefaultArcAllocate:zk,DefaultArcAttribute:Ul,DefaultArcRenderContribution:Nv,DefaultAreaAllocate:jk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:fy,DefaultAttribute:Nl,DefaultBaseBackgroundRenderContribution:Ff,DefaultBaseClipRenderAfterContribution:Jf,DefaultBaseClipRenderBeforeContribution:qf,DefaultBaseInteractiveRenderContribution:$f,DefaultBaseTextureRenderContribution:Hv,DefaultCanvasAllocate:yf,DefaultCanvasArc3DRender:Ub,DefaultCanvasArcRender:zb,DefaultCanvasAreaRender:ex,DefaultCanvasCircleRender:rx,DefaultCanvasGroupRender:my,DefaultCanvasImageRender:bx,DefaultCanvasLineRender:kx,DefaultCanvasPathRender:Px,DefaultCanvasPolygonRender:jx,DefaultCanvasPyramid3dRender:Gx,DefaultCanvasRect3dRender:Qx,DefaultCanvasRectRender:$x,DefaultCanvasSymbolRender:uS,DefaultCanvasTextRender:mS,DefaultCircleAllocate:Uk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Gv,DefaultConnectAttribute:Hl,DefaultDebugAttribute:jl,DefaultFillStyle:Ol,DefaultGlobal:vf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Yl,DefaultGraphicAllocate:Lk,DefaultGraphicMemoryManager:Jk,DefaultGraphicService:_m,DefaultGraphicUtil:kf,DefaultGroupAttribute:Gl,DefaultGroupBackgroundRenderContribution:$v,DefaultImageAttribute:ih,DefaultImageRenderContribution:ny,DefaultLayerService:Mm,DefaultLayout:Pl,DefaultLineAllocate:Wk,DefaultLineAttribute:Xl,DefaultMat4Allocate:xu,DefaultMatrixAllocate:bu,DefaultPathAllocate:Yk,DefaultPathAttribute:Kl,DefaultPickService:vA,DefaultPickStyle:Fl,DefaultPolygonAttribute:$l,DefaultRect3dAttribute:Jl,DefaultRectAllocate:Dk,DefaultRectAttribute:Zl,DefaultRectRenderContribution:Jv,DefaultRenderService:im,DefaultRichTextAttribute:eh,DefaultRichTextIconAttribute:sh,DefaultStarAttribute:ql,DefaultStrokeStyle:Ll,DefaultStyle:zl,DefaultSymbolAllocate:Kk,DefaultSymbolAttribute:Ql,DefaultSymbolClipRangeStrokeRenderContribution:ly,DefaultSymbolRenderContribution:oy,DefaultTextAllocate:qk,DefaultTextAttribute:th,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Rl,DefaultTransformUtil:Mf,DefaultWindow:Af,get Direction(){return bo},DirectionalLight:dA,DrawContribution:Hy,DrawItemInterceptor:Ny,DynamicLayerHandlerContribution:Rm,get Edge(){return ch},EditModule:Bk,EmptyContext2d:Tu,EnvContribution:vg,EventManager:Qa,EventSystem:io,EventTarget:to,FACTORY_STATE_SYMBOL:wf,FORMAT_ALL_TEXT_COMMAND:Ok,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Rk,Factory:Cm,FederatedEvent:Ya,FederatedMouseEvent:Xa,FederatedPointerEvent:Ka,FederatedWheelEvent:$a,FlexLayoutPlugin:sC,GLYPH_NUMBER_TYPE:nd,GRAPHIC_CLASS_SYMBOL:Mp,GRAPHIC_REGISTRY_SYMBOL:rf,GRAPHIC_UPDATE_TAG_KEY:pp,GROUP_NUMBER_TYPE:rd,Generator:Va,GlobalPickerService:Jm,Glyph:qp,GlyphRender:Dy,GradientParser:su,Graphic:Ep,GraphicCreator:yd,GraphicFactory:sf,GraphicPicker:$m,GraphicRender:Cy,GraphicService:vd,GraphicUtil:Em,Group:Qp,GroupRender:Ty,GroupRenderContribution:Jy,get GroupUpdateAABBBoundsMode(){return Jp},HtmlAttributePlugin:x_,get IContainPointMode(){return yo},IMAGE_NUMBER_TYPE:ad,Image:ig,ImageRender:Fy,ImageRenderContribution:Qy,IncrementalDrawContribution:by,InteractiveDrawItemInterceptorContribution:Xy,InteractivePickItemInterceptorContribution:yv,InteractiveSubRenderContribution:o_,LINE_NUMBER_TYPE:od,Layer:Am,LayerFactory:km,LayerService:Bm,Line:rg,LineRender:My,Linear:Go,LinearClosed:pl,Mat4Allocate:yu,MatrixAllocate:vu,get MeasureModeEnum(){return Tl},MiniappEntry:SA,MonotoneX:il,MonotoneY:sl,NOWORK_ANIMATE_ATTR:Cp,Node:Ga,NodeEntry:xA,OrthoCamera:pA,PATH_NUMBER_TYPE:ld,POLYGON_NUMBER_TYPE:hd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:cd,Path:lg,PathRender:wy,PathRenderContribution:t_,PerformanceRAF:gf,PickItemInterceptor:Qm,PickServiceInterceptor:tv,PickerRegistry:nm,PickerService:qm,PluginRegistry:rm,PluginService:Av,Polygon:dg,PolygonRender:Ey,PolygonRenderContribution:e_,Pyramid3d:cv,Pyramid3dRender:Ly,RECT3D_NUMBER_TYPE:ud,RECT_NUMBER_TYPE:dd,RICHTEXT_NUMBER_TYPE:pd,RUNTIME_INSTALLER_STATE_SYMBOL:CA,RafBasedSTO:Sh,ReactAttributePlugin:A_,Rect:fg,Rect3DRender:Py,Rect3d:sv,RectRender:By,RectRenderContribution:i_,ReflectSegContext:Uo,RenderSelector:zy,RenderService:Ym,RendererRegistry:sm,ResourceLoader:lh,RichText:Hg,RichTextEditPlugin:Ik,RichTextRender:Iy,STAR_NUMBER_TYPE:gd,get STATUS(){return wl},SVG_ATTRIBUTE_MAP:_d,SVG_ATTRIBUTE_MAP_KEYS:bd,SVG_PARSE_ATTRIBUTE_MAP:xd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Sd,SYMBOL_NUMBER_TYPE:fd,SegContext:No,ShadowPickServiceInterceptorContribution:mv,ShadowRoot:Ng,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:vv,SplitRectAfterRenderContribution:ty,SplitRectBeforeRenderContribution:Qv,Stage:xm,StageFactory:Sm,Star:av,StarRender:jy,StarRenderContribution:r_,StateDefinitionCompiler:$u,StateEngine:Qu,StaticLayerHandlerContribution:Pm,Step:ll,StepClosed:hl,Symbol:Wg,SymbolRender:Ry,SymbolRenderContribution:s_,TEXT_NUMBER_TYPE:md,Text:Zg,get TextDirection(){return Kc},TextMeasureContribution:Vm,TextRender:Oy,TextRenderContribution:n_,Theme:Dp,TransformUtil:wm,get UpdateTag(){return vo},VGlobal:yg,VWindow:bf,ViewTransform3dPlugin:tC,VirtualLayerHandlerContribution:Om,WILDCARD:"*",WindowHandlerContribution:xf,WrapText:tf,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Ou,addArcToBezierPath:To,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:rk,alignSubpath:QA,application:oh,applyTransformOnBezierCurves:ok,arc3dModule:Gb,arcModule:Nb,areaModule:nx,bezier:ko,bezierCurversToPath:lk,binarySplitPolygon:yk,bindArc3dRenderModule:Wb,bindArcRenderModule:jb,bindAreaRenderModule:sx,bindCircleRenderModule:ox,bindContributionProvider:Hm,bindContributionProviderNoSingletonScope:jm,bindGlyphRenderModule:dx,bindImageRenderModule:Sx,bindLineRenderModule:Tx,bindPathRenderModule:Ox,bindPolygonRenderModule:Ux,bindPyramid3dRenderModule:Xx,bindRect3dRenderModule:eS,bindRectRenderModule:Zx,bindRichtextRenderModule:aS,bindStarRenderModule:cS,bindSymbolRenderModule:gS,bindTextRenderModule:yS,boundStroke:Gc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Sl,calculateArcCornerRadius:Dv,calculateLineHeight:Ch,canvasAllocate:_f,centroidOfSubpath:ik,circleBounds:vh,circleModule:lx,clock:Za,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Nu,configureRuntimeApplicationForApp:WA,container:iA,cornerTangents:Lv,createApp:bA,createArc:Vp,createArc3d:hv,createArea:Yp,createBrowserApp:bA,createCanvasEventTransformer:function(t,e,i,s){return Ck(t.parentElement,e,i,s)},createCircle:$p,createColor:ru,createConicalGradient:Yu,createContributionProvider:zm,createEventTransformer:Ck,createGlyph:Zp,createGraphic:cf,createGroup:tg,createImage:sg,createLine:ag,createMat4:_u,createMiniappApp:function(t={}){return new SA(t)},createNodeApp:function(t={}){return new xA(t)},createPath:hg,createPolygon:ug,createPyramid3d:dv,createRect:mg,createRect3d:nv,createRectPath:Mv,createRichText:jg,createShadowRoot:Ug,createStage:function(t){return oA(),(new Sm).create(t)},createStar:ov,createSymbol:Gg,createText:Jg,createWrapText:ef,cubicCalc:Ro,cubicLength:Po,cubicPointAt:Oo,cubicSubdivide:JA,defaultArcAllocate:Hk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Uv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:Nk,defaultBaseBackgroundRenderContribution:zf,defaultBaseClipRenderAfterContribution:Qf,defaultBaseClipRenderBeforeContribution:Zf,defaultBaseTextureRenderContribution:jv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Kv,defaultCircleRenderContribution:Yv,defaultCircleTextureRenderContribution:Xv,defaultGraphicMemoryManager:Qk,defaultGroupBackgroundRenderContribution:qv,defaultImageBackgroundRenderContribution:ay,defaultImageRenderContribution:ry,defaultLineAllocate:Gk,defaultPathAllocate:Xk,defaultRectAllocate:Fk,defaultRectBackgroundRenderContribution:sy,defaultRectRenderContribution:ey,defaultRectTextureRenderContribution:iy,defaultStarBackgroundRenderContribution:gy,defaultStarTextureRenderContribution:py,defaultSymbolAllocate:$k,defaultSymbolBackgroundRenderContribution:uy,defaultSymbolClipRangeStrokeRenderContribution:cy,defaultSymbolRenderContribution:hy,defaultSymbolTextureRenderContribution:dy,defaultTextAllocate:Zk,diff:ZA,divideCubic:Fo,drawArc:Co,drawArcPath:Fv,drawAreaSegments:Xb,drawBackgroundImage:Kf,drawImageWithLayout:_x,drawIncrementalAreaSegments:Jb,drawIncrementalSegments:Zb,drawSegments:qb,enumCommandMap:lo,fillVisible:Bv,findBestMorphingRotation:nk,findConfigIndexByCursorIdx:wk,findCursorIdxByConfigIndex:Ek,findNextGraphic:Lf,flatten_simplify:qA,foreach:Of,foreachAsync:If,genBasisSegments:Zo,genBasisTypeSegments:qo,genLinearClosedSegments:gl,genLinearClosedTypeSegments:fl,genLinearSegments:Yo,genLinearTypeSegments:Xo,genMonotoneXSegments:rl,genMonotoneXTypeSegments:nl,genMonotoneYSegments:ol,genMonotoneYTypeSegments:al,genNumberType:Xc,genStepClosedSegments:ul,genStepSegments:cl,genStepTypeSegments:dl,getApplicationState:ah,getAttributeFromDefaultAttrList:xh,getBackgroundImage:jf,getConicGradientAt:Gu,getContributionStoreState:Lm,getCurrentEnv:function(){return mm()?"browser":"node"},getDefaultCharacterConfig:Mk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Yg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Au.allocate();return cu(o,o,[a[0],a[1],0]),n&&ou(o,o,n),s&&lu(o,o,s),cu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Ef,getGraphicClassState:wp,getGraphicRegistryState:af,getLegacyBindingContext:m_,getModelMatrix:vm,getRichTextBounds:fv,getRuntimeInstallerBindingContext:NA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:TA,getScaledStroke:nu,getTextBounds:gv,getTheme:zp,getThemeFromGroup:Hp,globalTheme:Fp,glyphModule:ux,graphicCreator:lf,graphicService:rA,graphicUtil:sA,identityMat4:au,imageModule:Ax,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:$A,installRuntimeDrawContributionsToApp:YA,installRuntimeGraphicRenderersToApp:GA,installRuntimePickersToApp:XA,interpolateColor:Ru,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Iu,interpolateGradientRadialColor:Lu,interpolatePureColorArray:Fu,interpolatePureColorArrayToStr:zu,intersect:Iv,isBrowserEnv:mm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){fm();const t=oh.global&&oh.global.env;return t?"node"===t:!gm},isSvg:Nc,isXML:Uc,layerService:aA,lineModule:Mx,lookAt:gu,mapToCanvasPointForCanvas:function(t){var e;if(Rd(t._canvasX)&&Rd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:du,mat4Allocate:Au,matrixAllocate:Su,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:pu,newThemeObj:Op,ortho:fu,parsePadding:gh,parseStroke:uh,parseSvgPath:mo,pathModule:Ix,pathToBezierCurves:ak,point:Ko,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:Vx,preLoadAllModule:f_,pyramid3dModule:Kx,quadCalc:Io,quadLength:Do,quadPointAt:Lo,rafBasedSto:Ah,rect3dModule:iS,rectFillVisible:Pv,rectModule:Jx,rectStrokeVisible:Ov,recursiveCallBinarySplit:_k,refreshRuntimeInstallerContributions:UA,registerArc3dGraphic:vb,registerArcGraphic:mb,registerAreaGraphic:yb,registerCircleGraphic:_b,registerDirectionalLight:uA,registerFlexLayoutPlugin:nC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:bb,registerGraphic:hf,registerGroupGraphic:xb,registerHtmlAttributePlugin:S_,registerImageGraphic:Sb,registerLineGraphic:Ab,registerOrthoCamera:gA,registerPathGraphic:kb,registerPolygonGraphic:Cb,registerPyramid3dGraphic:Tb,registerReactAttributePlugin:k_,registerRect3dGraphic:wb,registerRectGraphic:Mb,registerRichtextGraphic:Eb,registerShadowRootGraphic:Bb,registerStarGraphic:Pb,registerSymbolGraphic:Rb,registerTextGraphic:Ob,registerViewTransform3dPlugin:eC,registerWindowEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Ib,renderCommandList:wo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:vx,resolveBackgroundPosition:Gf,resolveBackgroundSizing:Nf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:fx,resolveImageRepeatMode:gx,resolveRenderableImageSize:Xf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:oS,rotateX:ou,rotateY:lu,rotateZ:hu,runFill:wv,runStroke:Ev,scaleMat4:uu,segments:Ao,shouldClipImageByLayout:yx,shouldUseMat4:ym,snapLength:Bo,splitArc:dk,splitArea:gk,splitCircle:uk,splitLine:fk,splitPath:xk,splitPolygon:bk,splitRect:ck,splitToGrids:hk,starModule:dS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Rv,symbolModule:fS,textAttributesToStyle:Kg,textDrawOffsetX:Yg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Xg,textModule:_S,transformMat4:mu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:nA,translate:cu,verticalLayout:$c,vglobal:b_,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oh.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)}))},wrapCanvas:Td,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.context2dFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Qc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Qc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class aC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:nu(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class oC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let lC=!1;function hC(t){lC||(lC=!0,t.bind(DS).toDynamicValue((()=>new oC(xS(t,xy)))).inSingletonScope(),t.bind(eA).toService(DS))}class cC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let dC=!1;function uC(t){dC||(dC=!0,t.bind(kS).toDynamicValue((()=>new cC(xS(t,xy)))).inSingletonScope(),t.bind(AS).toService(kS))}function pC(){if(pC.__loaded)return;pC.__loaded=!0;const t=m_();mb(),Nb({bind:t.bind}),bS?hC(t):uC(t)}pC.__loaded=!1;const gC=pC;class fC extends Fb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class mC extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ed,this.themeType="arc"}}let vC=!1;function yC(t){var e;vC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Sy))&&(vC=!0,t.bind(FS).toDynamicValue((()=>new mC(xS(t,Sy)))).inSingletonScope(),t.bind(eA).toService(FS))}function _C(){if(_C.__loaded)return;_C.__loaded=!0;const t=m_();vb(),uA(),gA(),Gb({bind:t.bind}),yC(t)}_C.__loaded=!1;const bC=_C;class xC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let SC=!1;function AC(t){SC||(SC=!0,t.bind(zS).toDynamicValue((()=>new xC(xS(t,Ay)))).inSingletonScope(),t.bind(eA).toService(zS))}class kC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let CC=!1;function TC(t){CC||(CC=!0,t.bind(CS).toDynamicValue((()=>new kC(xS(t,Ay)))).inSingletonScope(),t.bind(AS).toService(CS))}function MC(){if(MC.__loaded)return;MC.__loaded=!0;const t=m_();yb(),nx({bind:t.bind}),bS?AC(t):TC(t)}MC.__loaded=!1;const wC=MC;class EC{constructor(){this.type="glyph",this.numberType=nd}contains(t,e,i){if(!t.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}}class BC extends EC{constructor(t){super(),this.canvasRenderer=t}}let PC=!1;function RC(t){PC||(PC=!0,t.bind(JS).toDynamicValue((()=>new BC(xS(t,Dy)))).inSingletonScope(),t.bind(eA).toService(JS))}class OC extends EC{constructor(t){super(),this.canvasRenderer=t}}let IC=!1;function LC(t){IC||(IC=!0,t.bind(IS).toDynamicValue((()=>new OC(xS(t,Dy)))).inSingletonScope(),t.bind(AS).toService(IS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=m_();bb(),ux({bind:t.bind}),bS?RC(t):LC(t)}DC.__loaded=!1;const FC=DC;function zC(){zC.__loaded||(zC.__loaded=!0,xb())}zC.__loaded=!1;const HC=zC;class jC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=ad}}let NC=!1;function UC(t){NC||(NC=!0,t.bind(jS).toDynamicValue((()=>new jC(xS(t,Fy)))).inSingletonScope(),t.bind(eA).toService(jS))}class VC{constructor(){this.type="image",this.numberType=ad}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function GC(t){WC||(WC=!0,t.bind(MS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(AS).toService(MS))}function YC(){if(YC.__loaded)return;YC.__loaded=!0;const t=m_();Sb(),Ax({bind:t.bind}),bS?UC(t):GC(t)}YC.__loaded=!1;const XC=YC;class KC extends Fb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class $C extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let qC=!1;function ZC(t){qC||(qC=!0,t.bind(US).toDynamicValue((()=>new $C(xS(t,My)))).inSingletonScope(),t.bind(eA).toService(US))}class JC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let QC=!1;function tT(t){QC||(QC=!0,t.bind(wS).toDynamicValue((()=>new JC(xS(t,My)))).inSingletonScope(),t.bind(AS).toService(wS))}function eT(){if(eT.__loaded)return;eT.__loaded=!0;const t=m_();Ab(),Mx({bind:t.bind}),bS?ZC(t):tT(t)}eT.__loaded=!1;const iT=eT;class sT extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let nT=!1;function rT(t){nT||(nT=!0,t.bind(WS).toDynamicValue((()=>new sT(xS(t,wy)))).inSingletonScope(),t.bind(eA).toService(WS))}class aT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let oT=!1;function lT(t){oT||(oT=!0,t.bind(ES).toDynamicValue((()=>new aT(xS(t,wy)))).inSingletonScope(),t.bind(AS).toService(ES))}function hT(){if(hT.__loaded)return;hT.__loaded=!0;const t=m_();kb(),Ix({bind:t.bind}),bS?rT(t):lT(t)}hT.__loaded=!1;const cT=hT;class dT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let uT=!1;function pT(t){uT||(uT=!0,t.bind($S).toDynamicValue((()=>new dT(xS(t,Ey)))).inSingletonScope(),t.bind(eA).toService($S))}class gT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let fT=!1;function mT(t){fT||(fT=!0,t.bind(OS).toDynamicValue((()=>new gT(xS(t,Ey)))).inSingletonScope(),t.bind(AS).toService(OS))}function vT(){if(vT.__loaded)return;vT.__loaded=!0;const t=m_();Cb(),Vx({bind:t.bind}),bS?pT(t):mT(t)}vT.__loaded=!1;const yT=vT;class _T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=cd,this.themeType="polygon"}}let bT=!1;function xT(t){var e;bT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ly))&&(bT=!0,t.bind(qS).toDynamicValue((()=>new _T(xS(t,Ly)))).inSingletonScope(),t.bind(eA).toService(qS))}function ST(){if(ST.__loaded)return;ST.__loaded=!0;const t=m_();Tb(),uA(),gA(),Kx({bind:t.bind}),xT(t)}ST.__loaded=!1;const AT=ST,kT=new Ve;class CT{constructor(){this.type="rect",this.numberType=dd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:nu(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;kT.setValue(i.x1,i.y1,i.x2,i.y2),kT.expand(-r/2),h=!kT.containsPoint(e)}}return s.highPerformanceRestore(),h}}class TT extends CT{constructor(t){super(),this.canvasRenderer=t}}let MT=!1;function wT(t){MT||(MT=!0,t.bind(GS).toDynamicValue((()=>new TT(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(GS))}class ET extends CT{constructor(t){super(),this.canvasRenderer=t}}let BT=!1;function PT(t){BT||(BT=!0,t.bind(BS).toDynamicValue((()=>new ET(xS(t,By)))).inSingletonScope(),t.bind(AS).toService(BS))}function RT(){if(RT.__loaded)return;RT.__loaded=!0;const t=m_();Mb(),Jx({bind:t.bind}),bS?wT(t):PT(t)}RT.__loaded=!1;const OT=RT;class IT extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=ud,this.themeType="rect"}}let LT=!1;function DT(t){var e;LT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Py))&&(LT=!0,t.bind(YS).toDynamicValue((()=>new IT(xS(t,Py)))).inSingletonScope(),t.bind(eA).toService(YS))}function FT(){if(FT.__loaded)return;FT.__loaded=!0;const t=m_();wb(),iS({bind:t.bind}),DT(t)}FT.__loaded=!1;const zT=FT;class HT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let jT=!1;function NT(t){jT||(jT=!0,t.bind(ZS).toDynamicValue((()=>new HT(xS(t,Iy)))).inSingletonScope(),t.bind(eA).toService(ZS))}class UT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let VT=!1;function WT(t){VT||(VT=!0,t.bind(LS).toDynamicValue((()=>new UT(xS(t,Iy)))).inSingletonScope(),t.bind(AS).toService(LS))}function GT(){if(GT.__loaded)return;GT.__loaded=!0;const t=m_();Eb(),oS({bind:t.bind}),bS?NT(t):WT(t)}GT.__loaded=!1;const YT=GT;function XT(){XT.__loaded||(XT.__loaded=!0,Bb())}XT.__loaded=!1;const KT=XT;class $T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Au.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let qT=!1;function ZT(t){qT||(qT=!0,t.bind(XS).toDynamicValue((()=>new $T(xS(t,Ry)))).inSingletonScope(),t.bind(eA).toService(XS))}class JT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}}let QT=!1;function tM(t){QT||(QT=!0,t.bind(PS).toDynamicValue((()=>new JT(xS(t,Ry)))).inSingletonScope(),t.bind(AS).toService(PS))}function eM(){if(eM.__loaded)return;eM.__loaded=!0;const t=m_();Rb(),fS({bind:t.bind}),bS?ZT(t):tM(t)}eM.__loaded=!1;const iM=eM;class sM extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Xg(a,u,n),v=Yg(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&&Au.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let nM=!1;function rM(t){nM||(nM=!0,t.bind(KS).toDynamicValue((()=>new sM(xS(t,Oy)))).inSingletonScope(),t.bind(eA).toService(KS))}class aM{constructor(){this.type="text",this.numberType=md}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let oM=!1;function lM(t){oM||(oM=!0,t.bind(RS).toDynamicValue((()=>new aM)).inSingletonScope(),t.bind(AS).toService(RS))}function hM(){if(hM.__loaded)return;hM.__loaded=!0;const t=m_();Ob(),_S({bind:t.bind}),bS?rM(t):lM(t)}hM.__loaded=!1;const cM=hM;function dM(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),gM=(t,e)=>(d(mM.warnHandler)&&mM.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),fM=(t,e,i)=>{if(!d(mM.errorHandler))throw new Error(t);mM.errorHandler.call(null,t,e)},mM={silent:!1,warnHandler:!1,errorHandler:!1},vM=mm(),yM=vM&&globalThis?globalThis.document:void 0;function _M(t){return("desktop-browser"===t||"mobile-browser"===t)&&vM}function bM(t){return xM(t)||"mobile-browser"===t}function xM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let SM=0;function AM(){return SM>=9999999&&(SM=0),SM++}function kM(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function CM(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function TM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&TM(t,e)}))}const MM=t=>!u(t)&&!1!==t.visible;function wM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function EM(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 PM=["#ffffff","#000000"];function RM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return OM(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(...PM);for(const n of a)if(t!==n&&OM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function OM(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?IM(t,e)>s:"largeText"===i?IM(t,e)>3:IM(t,e)>4.5}function IM(t,e){const i=LM(t),s=LM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function LM(t){const e=ri(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 DM(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 FM(t,e){return[t[0]*e,t[1]*e]}function zM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function HM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const jM=cf,NM={arc:t=>jM("arc",t),circle:t=>jM("circle",t),group:t=>jM("group",t),image:t=>jM("image",t),line:t=>jM("line",t),path:t=>jM("path",t),polygon:t=>jM("polygon",t),rect:t=>jM("rect",t),richtext:t=>jM("richtext",t),symbol:t=>jM("symbol",t),text:t=>jM("text",t)},UM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 GM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(GM||(GM={}));const YM={[GM.selectedReverse]:{},[GM.selected]:{},[GM.hover]:{},[GM.hoverReverse]:{}},XM={container:"",width:30,height:30,style:{}},KM="scrollDrag",$M=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:gv,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function qM(t,e,i={}){if(!t)return{width:0,height:0};const s=gv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 ZM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function JM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function QM(t,e="type"){const i=ZM(t,e);return"rich"===i?NM.richtext(JM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),NM.text(t))}function tw(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 ew=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function iw(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 sw(t,e){const{dx:i,dy:s}=iw(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const nw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},rw={size:8,stroke:"#000",lineWidth:1,zIndex:1};function aw(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Ae(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Ee(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const ow=Math.sin(Math.PI/10);function lw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function hw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function cw(t){const e={};return TM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return FM(r,(s?-1:1)*(n?-1:1)*t/zM(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function fw(t,e,i){var s;if(hw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function mw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function _w(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function bw(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function xw(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 Sw(t,e){const i=xw(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 Aw(t,e){const i=kw(t),s=kw(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 kw(t,e={x:0,y:0}){return ae.distancePP(t,e)}function Cw(t){return k(t.x)&&k(t.y)}function Tw(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 Mw(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const ww=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function Bw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&Bw(t[i],e)}}var Pw;!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"}(Pw||(Pw={}));const Rw={};function Ow(t){switch(t){case Pw.Linear:case Pw.Log:case Pw.Pow:case Pw.Sqrt:case Pw.Symlog:case Pw.Time:return!0;default:return!1}}function Iw(t){return!!Rw[t]}function Lw(t){switch(t){case Pw.Ordinal:case Pw.Point:case Pw.Band:return!0;default:return!1}}function Dw(t){return t}Object.values(Pw).forEach((t=>{Rw[t]=!0}));const Fw=t=>-Math.log(-t),zw=t=>-Math.exp(-t),Hw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,jw=t=>10===t?Hw:t===Math.E?Math.exp:e=>Math.pow(t,e),Nw=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)),Vw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Ww(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 Gw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Yw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Xw(t,e,i,s){return 1===i&&(i=0),Yw(t,i,s)*(e/(1-i))}function Kw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function $w(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Zw{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=Kw(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=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Jw=Symbol("implicit");class Qw extends Zw{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=Jw}clone(){const t=(new Qw).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!==Jw)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return tE(t,e,r,n)}class iE extends Qw{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=Xw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:eE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new iE(!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:sE}=ai;function nE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=sE(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?sE(t,e):e instanceof si?sE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class rE extends Zw{constructor(t=Dw,e=Dw){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Dw,this._piecewise=Gw,this._interpolate=nE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?$w:Gw,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:Dw),this.rescale(i)):this._clamp!==Dw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const aE=Math.sqrt(50),oE=Math.sqrt(10),lE=Math.sqrt(2),hE=[1,2,5,10],cE=(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=gE(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?uE(0,-(e-1)/s,s):uE((e-1)/s,0,s)},dE=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return cE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return cE(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=uE(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=uE(t,e,l);return n&&r.reverse(),r})),gE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=hE[0];return i>=aE?s=hE[3]:i>=oE?s=hE[2]:i>=lE&&(s=hE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function fE(t,e,i){const s=(e-t)/Math.max(0,i);return gE(s)}function mE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=fE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function yE(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 _E=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),bE=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),xE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=pE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?_E(t,e,n):_E(t,e,qw(n)),h=_E(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),SE=vt(((t,e,i,s,n)=>mE(s(t),s(e),i).map((t=>qw(n(t))))));class AE extends rE{constructor(){super(...arguments),this.type=Pw.Linear}clone(){var t;const e=new AE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return dE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=pE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function CE(t){return e=>-t(-e)}function TE(t=Number.EPSILON){return e=>Math.max(e,t)}class ME extends rE{constructor(){super(Nw(10),jw(10)),this.type=Pw.Log,this._limit=TE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new ME).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=Nw(this._base),s=jw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Fw,this.untransformer=zw):(this._logs=i,this._pows=s,this._limit=TE(),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 Dw}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return bE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(ME,kE);class wE extends AE{constructor(){super(Uw(1),Vw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new wE).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=Vw(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return bE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(wE,kE);class EE{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[lt(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new EE).domain(this._domain).range(this._range).unknown(this._unknown)}}var BE,PE,RE;function OE(t){var e,i;const{type:s}=t;return s===PE.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BE||(BE={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(PE||(PE={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(RE||(RE={}));const IE={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},LE={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DE(t,e){var i;if(!t)return[];const s=VE(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?NE(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>jE(i)?zE(t,i,e):i)).filter(p)}))):i.map((i=>jE(i)?zE(t,i,e):i)).filter(p):[]}return[]}function FE(t,e){var i,s;return NE(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 zE(t,e,i){var s;const n=VE(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=IE[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=LE[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 si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`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 HE=(t,e)=>{if(e&&jE(t)){const i=zE(e,t);if(i)return i}return t};function jE(t){return t&&"palette"===t.type&&!!t.key}function NE(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function UE(t){return _(t)?{dataScheme:t}:t}function VE(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=OE(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 WE extends Qw{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!NE(this._range))return void super.range(this._range);const t=FE(this._range,this._domain);super.range(t)}}const GE={linear:AE,band:iE,point:class extends iE{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:Qw,threshold:EE,colorOrdinal:WE};function YE(t){const e=GE[t];return e?new e:null}function XE(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function KE(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function $E(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qE(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZE(t){return!!y(t)&&(!!t.endsWith("%")&&kM(t.substring(0,t.length-1)))}function JE(t){return!!g(t)&&("percent"in t||"offset"in t)}function QE(t,e,i,s=0){var n,r;return S(t)?t:ZE(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 tB(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]=QE(t[s],e.size,i)}))})),o}function eB(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function iB(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)||ZE(t)||d(t)||JE(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function sB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const nB=(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},rB=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function aB(t,e){return t&&e.key in t?t[e.key]:e.default}function oB(t){return t&&"token"===t.type&&!!t.key}const lB={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},hB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:lB,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},cB={name:"dark",colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},dB=(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]={}),dB(t[s],e.slice(1),i))};function uB(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=UE(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}vB._charts=mB.charts,vB._series=mB.series,vB._components=mB.components,vB._graphicComponents=mB.graphicComponents,vB._marks=mB.marks,vB._regions=mB.regions,vB._animations=mB.animations,vB._implements=mB.implements,vB._chartPlugin=mB.chartPlugin,vB._vChartPlugin=mB.vChartPlugin,vB._componentPlugin=mB.componentPlugin,vB.transforms=mB.transforms,vB.dataParser=mB.dataParser,vB._layout=mB.layout,vB._grammarTransforms=mB.grammarTransforms,vB._stageEventPlugins=mB.stageEventPlugins,vB.registerStageEventPlugin=(t,e)=>{vB._stageEventPlugins[t]=e},vB.getStageEventPlugin=t=>vB._stageEventPlugins[t],vB._interactionTriggers=mB.interactionTriggers,vB.registerInteractionTrigger=(t,e)=>{vB._interactionTriggers[t]=e},vB._composedEventMap=mB.composedEventMap,vB.registerComposedEvent=(t,e)=>{vB._composedEventMap[t]=e},vB._tooltipProcessors=mB.tooltipProcessors,vB.registerTooltipProcessor=(t,e)=>{vB._tooltipProcessors[t]=e},vB.createTooltipProcessor=(t,e)=>{const i=vB._tooltipProcessors[t];return i?new i(e):null},vB._runtimePluginInstallers=mB.runtimePluginInstallers,vB.registerRuntimePluginInstaller=(t,e)=>{vB._runtimePluginInstallers[t]=e},vB.getRuntimePluginInstaller=t=>vB._runtimePluginInstallers[t];const bB=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}},conversionArrow:{line:{style:{stroke:"black"}},symbol:{style:{fill:"black"}},text:{style:{fontSize:12,fill:"#606773"}}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},xB=bB(),SB={[hB.name]:hB},AB=hB.name,kB=new Map(Object.keys(SB).map((t=>[t,SB[t]]))),CB=new Map,TB=new Map(Object.keys(SB).map((t=>[t,t===AB]))),MB=(t,e)=>{if(!t)return;const i=PB(e);kB.set(t,i),TB.set(t,!0)},wB=(t=AB)=>(TB.has(t)&&!TB.get(t)&&MB(t,kB.get(t)),kB.get(t)),EB=t=>kB.delete(t)&&CB.delete(t)&&TB.delete(t),BB=t=>!!y(t)&&kB.has(t),PB=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:AB;return yB({},wB(i),t)};class RB{static registerInstance(t){RB.instances.set(t.id,t)}static unregisterInstance(t){RB.instances.delete(t.id)}static getInstance(t){return RB.instances.get(t)}static instanceExist(t){return RB.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return RB.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}RB.instances=new Map;class OB{static registerTheme(t,e){MB(t,e)}static getTheme(t,e=!1){return wB(t)}static removeTheme(t){return EB(t)}static themeExist(t){return BB(t)}static getDefaultTheme(){return OB.themes.get(AB)}static setCurrentTheme(t){OB.themeExist(t)&&(OB._currentThemeName=t,RB.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return OB.getTheme(OB._currentThemeName,t)}static getCurrentThemeName(){return OB._currentThemeName}}function IB(t){return y(t)?OB.themeExist(t)?OB.getTheme(t):{}:g(t)?t:{}}OB.themes=kB,OB._currentThemeName=AB;const LB=["animationThreshold","colorScheme","name","padding"];function DB(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];LB.includes(n)?s[n]=r:m(r)?jE(r)?s[n]=HE(r,e):oB(r)?s[n]=aB(i,r):s[n]=DB(r,e,i):s[n]=r})),s}function FB(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]=FB(t[s],e)}return i}return _(t)?t.map((t=>FB(t,e))):t}function zB(t,e){var i;if(!t)return t;if(y(t))return null!==(i=e.getFunction(t))&&void 0!==i?i:t;if(m(t)){const i={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=zB(t[s],e));return i}return _(t)?t.map((t=>zB(t,e))):t}function HB(t,...e){return d(t)?t(...e):t}const jB=(t,e,i,s)=>((t,e,i)=>$M(t,e,i,{fontFamily:lB.fontFamily,fontSize:lB.fontSize}))(e,i,s).measure(t),NB="__VCHART",UB=500,VB=500,WB=`${NB}_MEASURE_CANVAS_ID`,GB=`${NB}_DEFAULT_DATA_INDEX`,YB=`${NB}_DEFAULT_DATA_KEY`,XB=`${NB}_DEFAULT_DATA_SERIES_FIELD`,KB=`${NB}_DEFAULT_SERIES_STYLE_NAME`,$B=`${NB}_STACK_KEY`,qB=`${NB}_STACK_START`,ZB=`${NB}_STACK_END`,JB=`${NB}_STACK_START_PERCENT`,QB=`${NB}_STACK_END_PERCENT`,tP=`${NB}_STACK_START_OffsetSilhouette`,eP=`${NB}_STACK_END_OffsetSilhouette`,iP=`${NB}_STACK_TOTAL`,sP=`${NB}_STACK_TOTAL_PERCENT`,nP=`${NB}_STACK_TOTAL_TOP`,rP=`${NB}_STACK_TOTAL_BOTTOM`,aP=`${NB}_MOSAIC_VALUE_START_PERCENT`,oP=`${NB}_MOSAIC_VALUE_END_PERCENT`,lP=`${NB}_MOSAIC_CAT_START_PERCENT`,hP=`${NB}_MOSAIC_CAT_END_PERCENT`,cP=`${NB}_SEGMENT_START`,dP=`${NB}_SEGMENT_END`,uP=`${NB}_KEY`,pP=`${NB}_MAP_LOOK_UP_KEY`;function gP(t,e){for(let i=0;it.key===e))}function mP(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 vP(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},SP(t,a,n[o],l,e,r))})),s?yP(n):n}function yP(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))):yP(t[e].nodes);return t}function _P(t,e){if("values"in t&&t.values.length){const i=bw(t.values,e),s=_w(t.values,QB);t.values.forEach((t=>{t[iP]=i,t[sP]=s}))}else for(const i in t.nodes)_P(t.nodes[i],e)}function bP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][ZB]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)xP(t.nodes[r],e,i,s,n)}function SP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[ZB]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),SP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const AP=(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]=CP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function TP(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function MP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return PP(t(r,i,s,n));if(TP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),PP(e)}return PP(t)}function wP(t={}){const e=Object.assign({},t);if(d(t.style)||TP(t.style)?e.style=(e,i,s,n)=>MP(t.style,e,i,s,n):P(t.style)||(e.style=PP(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||TP(t.state[e])?i[e]=(i,s,n,r)=>MP(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=PP(t.state[e]))})),e.state=i}return e}function EP(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e,s,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}function BP(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),PP(i)}function PP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const RP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},OP=t=>"line"===t||"area"===t,IP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return OP(i)?e:null==e?void 0:e[0]},LP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let DP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=vB.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(vB.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var FP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(FP||(FP={}));const zP=["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 HP,jP,NP;t.ChartEvent=void 0,(HP=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",HP.rendered="rendered",HP.renderFinished="renderFinished",HP.animationFinished="animationFinished",HP.regionSeriesDataFilterOver="regionSeriesDataFilterOver",HP.afterInitData="afterInitData",HP.afterInitEvent="afterInitEvent",HP.afterInitMark="afterInitMark",HP.rawDataUpdate="rawDataUpdate",HP.viewDataFilterOver="viewDataFilterOver",HP.viewDataUpdate="viewDataUpdate",HP.viewDataStatisticsUpdate="viewDataStatisticsUpdate",HP.markDeltaYUpdate="markDeltaYUpdate",HP.viewDataLabelUpdate="viewDataLabelUpdate",HP.scaleDomainUpdate="scaleDomainUpdate",HP.scaleRawDomainUpdate="scaleRawDomainUpdate",HP.scaleUpdate="scaleUpdate",HP.dataZoomChange="dataZoomChange",HP.drill="drill",HP.layoutStart="layoutStart",HP.layoutEnd="layoutEnd",HP.layoutRectUpdate="layoutRectUpdate",HP.playerPlay="playerPlay",HP.playerPause="playerPause",HP.playerEnd="playerEnd",HP.playerChange="playerChange",HP.playerForward="playerForward",HP.playerBackward="playerBackward",HP.scrollBarChange="scrollBarChange",HP.brushStart="brushStart",HP.brushChange="brushChange",HP.brushEnd="brushEnd",HP.brushClear="brushClear",HP.brushActive="brushActive",HP.legendSelectedDataChange="legendSelectedDataChange",HP.legendFilter="legendFilter",HP.legendItemClick="legendItemClick",HP.legendItemHover="legendItemHover",HP.legendItemUnHover="legendItemUnHover",HP.tooltipShow="tooltipShow",HP.tooltipHide="tooltipHide",HP.tooltipRelease="tooltipRelease",HP.afterResize="afterResize",HP.afterRender="afterRender",HP.afterLayout="afterLayout",HP.afterMarkLayoutEnd="afterMarkLayoutEnd",HP.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(jP||(jP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(NP||(NP={}));const UP=[NP.mark,NP.model,NP.chart,NP.vchart];class VP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(NP.vchart,[]),this._levelNodes.set(NP.chart,[]),this._levelNodes.set(NP.model,[]),this._levelNodes.set(NP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const WP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class GP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>IP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||jP.chart);o.get(t)||o.set(t,new VP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||jP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||jP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||jP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?UP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[jP.chart,jP.window,jP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&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 WP[a]&&(a=WP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?NP.model:NP.vchart:NP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=jP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==NP.model&&s!==NP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=NP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case jP.chart:return this._viewBubbles;case jP.window:return this._windowBubbles;case jP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case jP.chart:return this._viewListeners;case jP.window:return this._windowListeners;case jP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return zP.includes(t)||Object.values(FP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&vB.hasInteractionTrigger(e)}}function YP(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function XP(t,e,i){t.getParser(e)||t.registerParser(e,i)}const KP=new Map;let $P;function qP(){$P||($P=new Fa,XP($P,"geojson",Pa),XP($P,"topojson",Oa),YP($P,"simplify",Kr))}function ZP(t,e,i={type:"geojson",centroid:!0}){KP.has(t)&&gM(`map type of '${t}' already exists, will be overwritten.`),qP();const s=new za($P),n=H({},{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}),KP.set(t,s)}function JP(t){KP.has(t)?KP.delete(t):gM(`map type of '${t}' does not exists.`)}function QP(t,e=!1){let i=e;return t.latestData instanceof za&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const tR=(t,e)=>0===t.length?[]:1===t.length?QP(t[0],null==e?void 0:e.deep):t.map((t=>QP(t,null==e?void 0:e.deep)));function eR(e,i,s){YP(i=i instanceof Fa?i:e.dataSet,"copyDataView",tR);const n=new za(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function iR(t,e,i=[]){var s;if(t instanceof za)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new za(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return gM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return gM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),gM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function sR(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var nR,rR,aR,oR;t.TransformLevel=void 0,(nR=t.TransformLevel||(t.TransformLevel={}))[nR.copyDataView=-10]="copyDataView",nR[nR.treemapFilter=-8]="treemapFilter",nR[nR.treemapFlatten=-7]="treemapFlatten",nR[nR.dotObjFlat=-7]="dotObjFlat",nR[nR.linkDotInfo=-7]="linkDotInfo",nR[nR.sankeyLayout=-7]="sankeyLayout",nR[nR.dataZoomFilter=-6]="dataZoomFilter",nR[nR.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(rR||(rR={})),function(t){t.data="data",t.mark="mark"}(aR||(aR={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(oR||(oR={}));const lR=["line","area","trail"];function hR(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(uP,i?t.slice().sort(i):t.slice()),{keys:[uP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const cR=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function dR(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{dR(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function pR(t,e,i,s){const n=hR(t,(t=>i(t))),r=hR(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const gR=`${NB}_BuiltIn_CallBack_Disappear`;var fR;!function(t){t.render="render",t.disappear="disappear"}(fR||(fR={}));const mR=[0,0,0];class vR{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ol),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Ll),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Su.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&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(mu(mR,[e,i,s],this.modelMatrix),e=mR[0],i=mR[1],s=mR[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=ru(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:nu(this,a,this.dpr),r.strokeStyle=ru(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}vR.env="browser";class yR extends wu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=oh.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new vR(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 _R(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,kd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Cd,e.env));r||i.bind(kd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Cd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}yR.env="browser";const bR=_R(yR,vR);class xR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}xR.env="feishu";class SR extends wu{constructor(t){super(t)}init(){this._context=new xR(this,this._dpr)}release(...t){}}SR.env="feishu";const AR=_R(SR,xR);class kR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}kR.env="harmony";class CR extends wu{constructor(t){super(t)}init(){this._context=new kR(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}CR.env="harmony";const TR=_R(CR,kR);class MR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}MR.env="lynx";class wR extends wu{constructor(t){super(t)}init(){this._context=new MR(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}wR.env="lynx";const ER=_R(wR,MR);class BR extends vR{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}BR.env="node";class PR extends wu{constructor(t){super(t)}init(){this._context=new BR(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}PR.env="node";const RR=_R(PR,BR);class OR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(ru(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:nu(this,l,this.dpr)),r.setStrokeStyle(ru(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}OR.env="taro";class IR extends wu{constructor(t){super(t)}init(){this._context=new OR(this,this._dpr)}release(...t){}}IR.env="taro";const LR=_R(IR,OR);class DR extends xR{}DR.env="tt";class FR extends wu{constructor(t){super(t)}init(){this._context=new DR(this,this._dpr)}release(...t){}}FR.env="tt";const zR=_R(FR,DR);class HR extends vR{draw(){}createPattern(t,e){return null}}HR.env="wx";class jR extends wu{constructor(t){super(t)}init(){this._context=new HR(this,this._dpr)}release(...t){}}jR.env="wx";const NR=_R(jR,HR);class UR extends vA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=_f.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;nnew GR(xS(t,ky)))).inSingletonScope(),t.bind(eA).toService(HS))}class KR extends CT{constructor(t){super(),this.canvasRenderer=t}}let $R=!1;class qR extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=gd}}let ZR=!1;function JR(t){var e;ZR||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,jy))&&(ZR=!0,t.bind(tA).toDynamicValue((()=>new qR(xS(t,jy)))).inSingletonScope(),t.bind(eA).toService(tA))}const QR=Xc();Xc();class tO{constructor(){this.type="gif-image",this.numberType=QR}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let eO=!1;function iO(t){eO||(eO=!0,t.bind(NS).toDynamicValue((()=>new tO)).inSingletonScope(),t.bind(eA).toService(NS))}function sO(t){t.isBound(UR)||t.bind(UR).toDynamicValue((()=>new UR(SS(eA,t),xS(t,Hy),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(UR):t.bind(qm).toService(UR)}function nO(t){(function(t){WR||(WR=!0,t.bind(QS).toDynamicValue((()=>new VR)).inSingletonScope(),t.bind(eA).toService(QS),Hm(t.bind.bind(t),eA))})(t),hC(t),yC(t),AC(t),XR(t),RC(t),UC(t),ZC(t),function(t){$R||($R=!0,t.bind(VS).toDynamicValue((()=>new KR(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(VS))}(t),rT(t),pT(t),xT(t),wT(t),DT(t),NT(t),JR(t),ZT(t),rM(t),iO(t),sO(t)}class rO extends cA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${rO.idprefix}_${rO.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=oh.global,this.viewBox=new Ve,this.modelMatrix=new Ge(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(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:rO.GenerateCanvasId(),canvasControled:!0};this.canvas=new yR(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new yR({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function aO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rO))||t.bind(rO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,rO.env))||t.bind(xf).toService(rO).whenTargetNamed(rO.env)}rO.env="browser",rO.idprefix="visactor_window",rO.prefix_count=0;var oO=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 lO{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 hO(t,e=!1){const i=document.createElement("img");if(oh.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class cO extends hA{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 lO(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return hO(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return hO(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return oO(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function dO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,cO))||(t.bind(cO).toSelf().inSingletonScope(),t.bind(vg).toService(cO))}function uO(t=m_(),e=!0){uO.__loaded||(uO.__loaded=!0,dO(t),bR(t),aO(t),e&&nO(t))}uO.__loaded=!1;class pO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new SR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 SR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function gO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,pO))||t.bind(pO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,pO.env))||t.bind(xf).toService(pO).whenTargetNamed(pO.env)}pO.env="feishu";class fO extends vA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Tu(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}}let mO=!1;class vO extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let yO=!1;function _O(t){yO||(yO=!0,t.bind(TS).toDynamicValue((()=>new vO(xS(t,ky)))).inSingletonScope(),t.bind(AS).toService(TS))}function bO(t){(function(t){mO||(mO=!0,Hm(t.bind.bind(t),AS))})(t),function(t){t.isBound(fO)||t.bind(fO).toDynamicValue((()=>new fO(SS(AS,t),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(fO):t.bind(qm).toService(fO)}(t),uC(t),TC(t),_O(t),LC(t),GC(t),tT(t),mT(t),lT(t),PT(t),WT(t),tM(t),lM(t)}class xO{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class SO{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function AO(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function kO(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new xO(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function CO(t,e,i,s){const n=AO(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new SO(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function TO(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function MO(t,e=TO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class wO extends hA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=TO(i),n=null!==(e=t.dpr)&&void 0!==e?e:MO(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return MO(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function EO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,wO))||(t.bind(wO).toSelf().inSingletonScope(),t.bind(vg).toService(wO))}function BO(t=m_(),e=!0){BO.__loaded||(BO.__loaded=!0,EO(t),AR(t),gO(t),e&&bO(t))}BO.__loaded=!1;function PO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function RO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new CR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 CR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return PO(t,"target",s),PO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=RO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=RO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&OO(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),OO(t,"x",_),OO(t,"y",b),OO(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),OO(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),OO(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),OO(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),OO(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),OO(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function LO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,IO))||t.bind(IO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,IO.env))||t.bind(xf).toService(IO).whenTargetNamed(IO.env)}IO.env="harmony";const DO="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function FO(t){return"number"==typeof t&&Number.isFinite(t)}function zO(...t){for(let e=0;e({width:i,height:s})),new SO(t,l,n,i,s,e)}function VO(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=NO(e*s,i*s);if(t)return t}throw new Error(DO)}class WO extends hA{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=HO(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=HO(s),r=null!==(i=t.dpr)&&void 0!==i?i:jO(s),a=function(t,e){if(!FO(t)||!FO(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=UO(VO(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=UO(VO(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return jO(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=zO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=zO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function GO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,WO))||(t.bind(WO).toSelf().inSingletonScope(),t.bind(vg).toService(WO))}function YO(t=m_(),e=!0){YO.__loaded||(YO.__loaded=!0,GO(t),TR(t),LO(t),e&&bO(t))}YO.__loaded=!1;function XO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function KO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new wR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 wR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return XO(t,"target",s),XO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=KO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=KO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&$O(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),$O(t,"x",_),$O(t,"y",b),$O(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),$O(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),$O(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),$O(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),$O(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),$O(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function ZO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qO))||t.bind(qO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,qO.env))||t.bind(xf).toService(qO).whenTargetNamed(qO.env)}qO.env="lynx";function JO(t){return"number"==typeof t&&Number.isFinite(t)}function QO(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=eI(r),o=null!==(i=t.dpr)&&void 0!==i?i:iI(r,a),l=nI(t.width,t.height),h=rI(aI(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=eI(a),l=null!==(n=t.dpr)&&void 0!==n?n:iI(a,o),h=nI(t.width,t.height),c=Math.random().toString(),d=rI(aI(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return iI(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=QO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=QO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function lI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,oI))||(t.bind(oI).toSelf().inSingletonScope(),t.bind(vg).toService(oI))}function hI(t=m_(),e=!0){hI.__loaded||(hI.__loaded=!0,lI(t),ER(t),ZO(t),e&&bO(t))}hI.__loaded=!1;class cI extends cA{get container(){return null}constructor(t=oh.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new PR(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new PR({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function dI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cI))||t.bind(cI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,cI.env))||t.bind(xf).toService(cI).whenTargetNamed(cI.env)}cI.env="node";class uI extends hA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function pI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uI))||(t.bind(uI).toSelf().inSingletonScope(),t.bind(vg).toService(uI))}function gI(t=m_(),e=!0){gI.__loaded||(gI.__loaded=!0,pI(t),RR(t),dI(t))}gI.__loaded=!1;class fI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new IR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 IR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fI))||t.bind(fI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,fI.env))||t.bind(xf).toService(fI).whenTargetNamed(fI.env)}fI.env="taro";class vI extends hA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=CO(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=kO(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function yI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,vI))||(t.bind(vI).toSelf().inSingletonScope(),t.bind(vg).toService(vI))}function _I(t=m_(),e=!0){_I.__loaded||(_I.__loaded=!0,yI(t),LR(t),mI(t),e&&bO(t))}_I.__loaded=!1;class bI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new FR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 FR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function xI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,bI))||t.bind(bI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,bI.env))||t.bind(xf).toService(bI).whenTargetNamed(bI.env)}bI.env="tt";function SI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function AI(t,e=SI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class kI extends hA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=SI(i),n=null!==(e=t.dpr)&&void 0!==e?e:AI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return AI(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function CI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,kI))||(t.bind(kI).toSelf().inSingletonScope(),t.bind(vg).toService(kI))}function TI(t=m_(),e=!0){TI.__loaded||(TI.__loaded=!0,CI(t),zR(t),xI(t),e&&bO(t))}TI.__loaded=!1;class MI{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={}}}function wI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class EI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="wx",this.eventManager=new MI}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new jR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 jR({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return wI(t,"target",o),wI(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function BI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,EI))||t.bind(EI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,EI.env))||t.bind(xf).toService(EI).whenTargetNamed(EI.env)}EI.env="wx";function PI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function RI(t,e=PI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class OI extends hA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=PI(i),n=null!==(e=t.dpr)&&void 0!==e?e:RI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return RI(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function II(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,OI))||(t.bind(OI).toSelf().inSingletonScope(),t.bind(vg).toService(OI))}function LI(t=m_(),e=!0){LI.__loaded||(LI.__loaded=!0,II(t),NR(t),BI(t),e&&bO(t))}LI.__loaded=!1;var DI={},FI={},zI={};Object.defineProperty(zI,"__esModule",{value:!0}),zI.loop=zI.conditional=zI.parse=void 0;zI.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};zI.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};zI.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var HI={};Object.defineProperty(HI,"__esModule",{value:!0}),HI.readBits=HI.readArray=HI.readUnsigned=HI.readString=HI.peekBytes=HI.readBytes=HI.peekByte=HI.readByte=HI.buildStream=void 0;HI.buildStream=function(t){return{data:t,pos:0}};var jI=function(){return function(t){return t.data[t.pos++]}};HI.readByte=jI;HI.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var NI=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};HI.readBytes=NI;HI.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};HI.readString=function(t){return function(e){return Array.from(NI(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};HI.readUnsigned=function(t){return function(e){var i=NI(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};HI.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=NI(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=ZI(t),i=GI(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=ZI(this.attribute.gifImage),e=GI(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=oh.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=oh.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function tL(t){return new QI(t)}class eL extends bx{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=QR,this._renderContribitions=void 0,this.builtinContributions=[iL],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=zp(t).image;this._draw(t,n,!1,i)}}const iL=new class extends Jv{constructor(){super(...arguments),this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let sL=!1;function nL(t){sL||(sL=!0,t.bind(eL).toDynamicValue((()=>new eL(SS(Qy,t)))).inSingletonScope(),t.bind(Cy).toService(eL))}function rL(){lf.RegisterGraphicCreator("gif",tL)}function aL(){if(aL.__loaded)return;aL.__loaded=!0;const t=m_();rL(),nL(t),iO(t)}aL.__loaded=!1;const oL=aL,lL=[{register:mb,bindModule:Nb},{register:vb,bindModule:Gb},{register:yb,bindModule:nx},{register:_b,bindModule:lx},{register:bb,bindModule:ux},{register:xb},{register:Sb,bindModule:Ax},{register:Ab,bindModule:Mx},{register:kb,bindModule:Ix},{register:Cb,bindModule:Vx},{register:Tb,bindModule:Kx},{register:Mb,bindModule:Jx},{register:wb,bindModule:iS},{register:Eb,bindModule:oS},{register:Bb},{register:Pb,bindModule:dS},{register:Rb,bindModule:fS},{register:Ob,bindModule:_S},{register:Ib},{register:rL}];let hL=!1;const cL=[hC,yC,AC,XR,RC,UC,ZC,rT,pT,xT,wT,DT,NT,JR,ZT,rM,iO];function dL(t){return{getContributions:t}}function uL(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function pL(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=NA();i(a),s(a),n(a),UA(),uL(e,{envParams:r,force:!0})}function gL(t,e){pL(t,"browser",{bindEnv:dO,bindCanvasModules:bR,bindWindowContribution:aO},e)}function fL(t,e){pL(t,"node",{bindEnv:pI,bindCanvasModules:RR,bindWindowContribution:dI},e)}function mL(t){WA(t),function(){if(hL)return;const t=NA();hL=!0,lL.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),nL(t),UA()}(),YA(t),GA(t)}function vL(t){WA(t);const e=NA();cL.forEach((t=>t(e))),sO(e),XA(t,eA),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[])),r=VA();oh.pickerServiceFactory=()=>new UR(i,{},s,n),oh.global=r}(t)}function yL(t){WA(t);bO(NA()),XA(t,AS),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[]));oh.pickerServiceFactory=()=>new fO(i,s,n)}(t)}function _L(){if(_L.__loaded)return;_L.__loaded=!0;const t=m_();_b(),lx({bind:t.bind}),bS?XR(t):_O(t)}_L.__loaded=!1;const bL=_L;function xL(){if(xL.__loaded)return;xL.__loaded=!0;const t=m_();Pb(),dS({bind:t.bind}),JR(t)}xL.__loaded=!1;const SL=xL;function AL(){AL.__loaded||(AL.__loaded=!0,Ib())}AL.__loaded=!1;const kL=AL;class CL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,$_(this.target,i,_o.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class wL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class EL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class BL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const PL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class RL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){X_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){X_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class OL extends RL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=PL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r),this.determineUpdateFunction()}}class IL extends RL{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class LL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class DL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const FL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class zL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=FL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class HL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const jL=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class NL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(X_(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class UL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:jL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class VL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:jL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const WL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class GL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:WL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class YL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:WL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const XL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class KL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:XL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class $L extends NL{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:XL(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const qL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class ZL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class JL extends ZL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=qL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}}class QL extends ZL{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const tD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class eD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nD extends sD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class rD extends sD{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class aD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,$_(this.target,{text:n})}}class oD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lD extends oD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class hD extends oD{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class cD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&q_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),X_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class dD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class uD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const pD={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function gD(t,e){for(let i=0;ipD[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&M_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(X_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class mD{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new w_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function vD(t){return new mD(t)}class yD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;$_(this.target,{text:o})}}class _D extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(q_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),q_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),q_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),q_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;q_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:yD});const i=s._titleBottom.attribute.text;q_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:yD})}else q_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),q_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;q_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());q_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class bD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class xD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(q_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:yD}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:yD}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class SD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class AD extends rb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==AD.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class kD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class CD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==CD.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CD.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TD{static createTempCanvas(t,e,i){return b_.createCanvas({width:t,height:e,dpr:i||b_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=TD.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(TD.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class ED extends CD{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class OD extends CD{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=TD.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class ID extends AD{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=b_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=b_.createCanvas({width:i,height:s,dpr:b_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class LD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}$_(this.target,{textConfig:o})}}class DD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class FD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function ND(t,e){X_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class UD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,q_(this.target,m)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class VD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,q_(this.target,d)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class WD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,q_(this.target,p)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class GD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class YD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}}class XD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:VD,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class KD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:WD,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class $D extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class qD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class ZD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class JD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:qD,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class QD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:ZD,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class tF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),X_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ru(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ru(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class eF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=oh.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Al,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=oh.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Fo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Fo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function lF(t){var e,i;const s=null!==(e=m_().getAll(Cy))&&void 0!==e?e:[],n=aF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;oF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=rF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function hF(t,e){var i,s;const n=null!==(i=m_().getAll(e))&&void 0!==i?i:[],r=aF(t.registry.picker,"vrender:legacy-picker"),a=new Set;oF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=rF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const cF=gL,dF=fL,uF={taro:{installEnv:function(t,e){pL(t,"taro",{bindEnv:yI,bindCanvasModules:LR,bindWindowContribution:mI},e)},loadEnv:_I},feishu:{installEnv:function(t,e){pL(t,"feishu",{bindEnv:EO,bindCanvasModules:AR,bindWindowContribution:gO},e)},loadEnv:BO},tt:{installEnv:function(t,e){pL(t,"tt",{bindEnv:CI,bindCanvasModules:zR,bindWindowContribution:xI},e)},loadEnv:TI},wx:{installEnv:function(t,e){pL(t,"wx",{bindEnv:II,bindCanvasModules:NR,bindWindowContribution:BI},e)},loadEnv:LI},lynx:{installEnv:function(t,e){pL(t,"lynx",{bindEnv:lI,bindCanvasModules:ER,bindWindowContribution:ZO},e)},loadEnv:hI},harmony:{installEnv:function(t,e){pL(t,"harmony",{bindEnv:GO,bindCanvasModules:TR,bindWindowContribution:LO},e)},loadEnv:YO}},pF=[nC,eC,S_,k_,uA,gA],gF=[()=>{w_.registerBuiltInAnimate("increaseCount",aD),w_.registerBuiltInAnimate("fromTo",ab),w_.registerBuiltInAnimate("scaleIn",cD),w_.registerBuiltInAnimate("scaleOut",dD),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL),w_.registerBuiltInAnimate("fadeIn",EL),w_.registerBuiltInAnimate("fadeOut",BL),w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("moveIn",nD),w_.registerBuiltInAnimate("moveOut",rD),w_.registerBuiltInAnimate("rotateIn",lD),w_.registerBuiltInAnimate("rotateOut",hD),w_.registerBuiltInAnimate("update",fD),w_.registerBuiltInAnimate("state",uD),w_.registerBuiltInAnimate("labelItemAppear",_D),w_.registerBuiltInAnimate("labelItemDisappear",bD),w_.registerBuiltInAnimate("poptipAppear",xD),w_.registerBuiltInAnimate("poptipDisappear",SD),w_.registerBuiltInAnimate("inputText",yD),w_.registerBuiltInAnimate("inputRichText",LD),w_.registerBuiltInAnimate("outputRichText",DD),w_.registerBuiltInAnimate("slideRichText",zD),w_.registerBuiltInAnimate("slideOutRichText",FD),w_.registerBuiltInAnimate("slideIn",UD),w_.registerBuiltInAnimate("growIn",VD),w_.registerBuiltInAnimate("spinIn",WD),w_.registerBuiltInAnimate("moveScaleIn",XD),w_.registerBuiltInAnimate("moveRotateIn",KD),w_.registerBuiltInAnimate("strokeIn",GD),w_.registerBuiltInAnimate("slideOut",$D),w_.registerBuiltInAnimate("growOut",qD),w_.registerBuiltInAnimate("spinOut",ZD),w_.registerBuiltInAnimate("moveScaleOut",JD),w_.registerBuiltInAnimate("moveRotateOut",QD),w_.registerBuiltInAnimate("strokeOut",YD),w_.registerBuiltInAnimate("pulse",tF),w_.registerBuiltInAnimate("MotionPath",HD),w_.registerBuiltInAnimate("streamLight",eF),w_.registerBuiltInAnimate("dissolve",wD),w_.registerBuiltInAnimate("grayscale",RD),w_.registerBuiltInAnimate("distortion",ED),w_.registerBuiltInAnimate("particle",OD),w_.registerBuiltInAnimate("glitch",PD),w_.registerBuiltInAnimate("gaussianBlur",BD),w_.registerBuiltInAnimate("pixelation",ID)},fb],fF=[gC,bC,wC,bL,FC,oL,HC,XC,iT,cT,yT,AT,OT,zT,YT,KT,iM,cM,kL,SL];function mF(){pF.forEach((t=>t())),gF.forEach((t=>t()))}function vF(t,e){if(!nF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==b_?void 0:b_.env)?b_.envParams:void 0}(e);return void 0===i?fL(t):dF(t,i),mL(t),yL(t),gI(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}function yF(t,e,i){if(!nF(t,e))return t;const s=uF[e];return s.installEnv(t,i),mL(t),function(t){yL(t)}(t),s.loadEnv(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}const _F=Symbol.for("visactor.vrender.sharedAppRegistry");function bF(){var t;const e=globalThis,i=null!==(t=e[_F])&&void 0!==t?t:new Map;return e[_F]=i,i}function xF(t,e){const i=bF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function SF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=bF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function AF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=xF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(SF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>SF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=xF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&SF(t,i,s))}}}(t,s,r,o)}const kF=$A,CF=[];function TF(t){CF.forEach((({module:e,options:i})=>{kF(e,Object.assign(Object.assign({},i),{app:t}))}))}var MF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),lF(t),hF(t,eA),mF(),t):t}(bA(MF(t,["envParams"])),e);return TF(i),i}var EF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},DF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},FF=(t,e)=>{const i=LF(t),s=DF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},zF=(t,e)=>{const i=AF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,IF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},HF="poptipForText";class jF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(HF))&&this._dedupeStagePlugin(HF)}initView(){var e,i,s,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:u,autoPreventDefault:f,background:m}=this._option,v=FF(l,h);b_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=LF(i.mode),n=FF(i.mode,i.modeParams);return zF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=t.releaseAppRef,null===(e=this._option.runtimePluginInstallers)||void 0===e||e.forEach((e=>e(t.app)));try{this._stage=(_=t.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:p(a)?a:!p(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=tg({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(p(c)?c:bM(l))&&!1!==d&&vB.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,g(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=oR.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!_M(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:b_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>dR(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>dR(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{dR(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===oR.before;(e||i)&&(pM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=oR.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=oR.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),pM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=uR(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=pR(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=pR(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=hR(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=hR(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:gR,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{dR(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===rR.appear))?rR.appear:e.every((t=>t===rR.disappear))?rR.disappear:rR.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===jP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=RP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=RP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:IP(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===jP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===jP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===jP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===jP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===jP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{dR(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=uR(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return _M(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{b_.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{dR(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function NF(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:fM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const UF={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}},VF={poptip:H({},UF)};function WF(t){t.crosshair=Y(t.crosshair||{}).map((e=>uB({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function GF(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}=li(l,i.width,i.height);a=t,o=e}else if(h&&_M(e.mode)){let t;t=y(h)?b_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(xM(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}}const YF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function XF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function KF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function $F(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;YF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function qF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var ZF,JF,QF,tz,ez,iz;t.LayoutZIndex=void 0,(ZF=t.LayoutZIndex||(t.LayoutZIndex={}))[ZF.SeriesGroup=0]="SeriesGroup",ZF[ZF.Axis_Grid=50]="Axis_Grid",ZF[ZF.CrossHair_Grid=100]="CrossHair_Grid",ZF[ZF.Region=450]="Region",ZF[ZF.Mark=300]="Mark",ZF[ZF.Node=400]="Node",ZF[ZF.Axis=100]="Axis",ZF[ZF.MarkLine=500]="MarkLine",ZF[ZF.MarkArea=100]="MarkArea",ZF[ZF.MarkPoint=500]="MarkPoint",ZF[ZF.DataZoom=500]="DataZoom",ZF[ZF.ScrollBar=500]="ScrollBar",ZF[ZF.Player=500]="Player",ZF[ZF.Legend=500]="Legend",ZF[ZF.CrossHair=500]="CrossHair",ZF[ZF.Indicator=500]="Indicator",ZF[ZF.Title=500]="Title",ZF[ZF.Label=500]="Label",ZF[ZF.Brush=500]="Brush",ZF[ZF.CustomMark=500]="CustomMark",ZF[ZF.Interaction=700]="Interaction",t.LayoutLevel=void 0,(JF=t.LayoutLevel||(t.LayoutLevel={}))[JF.Indicator=10]="Indicator",JF[JF.Region=20]="Region",JF[JF.Axis=30]="Axis",JF[JF.DataZoom=40]="DataZoom",JF[JF.Player=40]="Player",JF[JF.ScrollBar=40]="ScrollBar",JF[JF.Legend=50]="Legend",JF[JF.Title=70]="Title",JF[JF.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(QF=t.AttributeLevel||(t.AttributeLevel={}))[QF.Default=0]="Default",QF[QF.Theme=1]="Theme",QF[QF.Chart=2]="Chart",QF[QF.Base_Series=3]="Base_Series",QF[QF.Series=4]="Series",QF[QF.Mark=5]="Mark",QF[QF.User_Chart=6]="User_Chart",QF[QF.User_Series=7]="User_Series",QF[QF.User_Mark=8]="User_Mark",QF[QF.User_SeriesStyle=9]="User_SeriesStyle",QF[QF.Built_In=99]="Built_In";class sz{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,H({},sz.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]))))}}sz.defaultMarkInfo={};class nz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class rz{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=>uB({},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 az extends nz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=rz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new sz,this._lastLayoutRect=null,this.id=AM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new DP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${NB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=vB.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class oz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=tB(iB(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QE(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QE(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QE(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QE(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QE(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QE(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QE(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QE(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QE(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(eB(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class lz extends az{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new oz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(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 hz extends rz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class cz extends lz{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=hz,this.modelType="region",this.specKey="region",this.type=cz.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function dz(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 uz(t,e,i){e?t.forEach((t=>{const e=X(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=X(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 pz(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 gz(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),pz(d,!0,p,l),s&&uz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function fz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=yz(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),pz(d,!1,p,o),s&&uz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function vz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=yz(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=yz(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"left",s),r.length&&gz(r,e,i,!0,"left",s),a.length&&fz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"top",s),r.length&&mz(r,e,i,!0,"top",s),a.length&&vz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"right",s),r.length&&gz(r,e,i,!0,"right",s),a.length&&fz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"bottom",s),r.length&&mz(r,e,i,!0,"bottom",s),a.length&&vz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=yz(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=yz(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:fM)("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}}}_z.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(tz||(tz={})),t.STATE_VALUE_ENUM=void 0,(ez=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",ez.STATE_HOVER="hover",ez.STATE_HOVER_REVERSE="hover_reverse",ez.STATE_DIMENSION_HOVER="dimension_hover",ez.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",ez.STATE_SELECTED="selected",ez.STATE_SELECTED_REVERSE="selected_reverse",ez.STATE_SANKEY_EMPHASIS="selected",ez.STATE_SANKEY_EMPHASIS_REVERSE="blur",ez.STATE_HIGHLIGHT="highlight",ez.STATE_BLUR="blur",ez.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(iz||(iz={}));const bz=["linear","radial","conical"],xz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Sz={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{Sz[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class Az extends nz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class kz extends Az{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,lR.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Sz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(NB)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(NB))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Ow(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class Cz extends nz{constructor(){super(...arguments),this.id=AM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=vB.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Tz extends Cz{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Mz=1e3,wz="quadInOut",Ez=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Bz=(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=Ru(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Pz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ak(t):[],n=ak(e);i&&s&&(i.fromTransform&&ok(s,i.fromTransform.clone().getInverse()),ok(s,i.toTransfrom));const[r,a]=rk(s,n);return t?nk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Oz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Iz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Oz.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Eu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Lz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Pz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Bz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):$_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Dz=(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=Rz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Iz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Lz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wz);return c.play(d),c};class Fz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Pz(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&&Bz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const zz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Ez.includes(t))(i)||(e[i]=t[i])})),e},Hz=(t,e,i)=>{const s=zz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=oh.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},jz=(t,e,i)=>{const s=[],n=i?null:zz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:zz(t.attribute);if("rect"===t.type)ck(t,e).forEach((t=>{s.push(oh.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)dk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)uk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=fk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(oh.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?bk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?gk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&xk(t,e).forEach((t=>{"path"in t?s.push(oh.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Hz(t,s,e),s},Uz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Vz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Uz(l.delay,n,a,o),d=Uz(l.duration,n,a,o),u=Uz(l.oneByOne,n,a,o),p=Uz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(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);Dz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Rz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Iz(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:_o.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Lz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mz,null!==(l=i.easing)&&void 0!==l?l:wz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:_o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Fz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Dz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},Wz=(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))))},Gz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},Yz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},Xz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];Yz(t,a,s)},Kz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));Yz(t,r,i)},$z=Symbol("statesClearedBeforeReInit");class qz extends Cz{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Tz(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=tg("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Al)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===tz.enter||t.context.diffState===tz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&Yz(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new kz(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&uB(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Iw(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=YE(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):bz.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Iw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},xz[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)bz.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return hR(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return vB.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[YB],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=hR(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===rR.appear))?rR.appear:t.every((t=>t===rR.disappear))?rR.disappear:t[0];return null!=e?e:rR.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{Gz(t),s.push(...t.getGraphics())})),e.forEach((t=>{Gz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Vz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=Wz(e,n),r=Wz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===rR.exit?rR.exit:i===rR.update?rR.update:rR.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===tz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===tz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=tz.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=tz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=tz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=rR.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=rR.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return cR(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=cR(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!bz.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!Iw(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,LP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=vB.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=vB.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===oR.before||(this._product||this._initProduct(),pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[$z],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?Xz(i,t,!0,a):Kz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[$z]=e:delete s[$z]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===tz.exit&&!e.isExiting)if(e.context.animationState===tz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===tz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=tg({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[$z]=t.currentStates.slice())}))}}var Zz;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(Zz||(Zz={}));class Jz extends qz{constructor(){super(...arguments),this.type=Jz.type,this._marks=[],this._diffState=tz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(gM("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?(gM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return dR(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===tz.update){const t=this.hasAnimation(),e=LP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=tz.update}render(){this._isCommited&&(pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}Jz.type="group";const Qz={measureText:jB};class tH{static instance(){return tH.instance_||(tH.instance_=new tH),tH.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 eH{constructor(){this.id=AM(),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))?gM("不要重复添加相同的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 iH extends eH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const sH=(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"},nH=(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 rH extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=Za.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Za.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||sH(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=nH(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=Za.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=nH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=sH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Za.now()-i>this.config.press.time&&nH(s[0],t){oh.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class oH extends aH{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 C=oh.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 T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class lH extends aH{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=oh.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 hH extends sb{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&M_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(X_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));$_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const cH={type:"fadeIn"};function dH(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 cH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}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"},state:{duration:300,easing:"linear"}},pH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},gH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},fH=()=>{vB.registerAnimation("scaleInOut",(()=>pH))},mH=()=>{vB.registerAnimation("fadeInOut",(()=>gH))},vH=(t,e)=>({appear:dH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:hH,duration:uH.update.duration,easing:uH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),yH=()=>{vB.registerAnimation("line",vH)},_H=()=>{w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL)},bH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class xH{constructor(t){this._markSet=new sz,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const SH={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class AH extends xH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},SH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}AH.type="element-highlight",AH.defaultOptions=SH;const kH=()=>{vB.registerInteractionTrigger(AH.type,AH)},CH={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class TH extends xH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},CH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),Xz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}TH.type="element-select",TH.defaultOptions=CH;const MH=()=>{vB.registerInteractionTrigger(TH.type,TH)};class wH extends eH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const EH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},BH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...BH(t))})),s},PH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(EH(t,r),!1)};class RH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>vB.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>vB.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>vB.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return vB.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>vB.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){vB.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}static getFunction(t){return t?tH.instance().getFunction(t):null}static getFunctionList(){return tH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=vB.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=vB.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,KP.get(e);var e}static registerSVG(t,e,i){const s=vB.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=vB.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){RB.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=AM(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=fR.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=$F(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{var n;if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?vB.getSeriesBuiltInTheme(e):vB.getComponentBuiltInTheme(e);i=i?uB({},s,i[e]):s}s===t.length-1&&p(i)&&(i=DB({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e],(null===(n=this.getFunctionList())||void 0===n?void 0:n.length)&&(i=zB(i,this)))})),this._cachedProcessedTheme[e]=i,i},Bw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=_M(v);if(S?uO(iA):"node"===v&&gI(iA),S&&f&&(this._container=y(f)?b_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=OB.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=vB.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===i.type&&A.push("scrollbar");const C=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new jF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new GP(this,this._compiler),this._event=new DP(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),RB.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=uB({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=FB(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;RH.getFunctionList()&&RH.getFunctionList().length&&(t=zB(t,RH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=vB.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=vB.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=vB.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return GF(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:UB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:VB})}_initDataSet(t){this._dataSet=t instanceof Fa?t:new Fa,XP(this._dataSet,"dataview",Ia),XP(this._dataSet,"array",s),YP(this._dataSet,"copyDataView",tR);for(const t in vB.transforms)YP(this._dataSet,t,vB.transforms[t]);for(const t in vB.dataParser)XP(this._dataSet,t,vB.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),XF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?rR.none:rR.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,RB.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{EH(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof za?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=iR(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?uB({},t[n][e.index],i):i):t[n]=s?uB({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?uB({},t[n][r],i):i)}else t.id===e&&(t[n]=s?uB({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=uB({},t.getSpec(),e));const r=t.updateSpec(e),a=XF(r),o=KF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=yB({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=IB(this._currentThemeName),this._currentTheme=o(a,l);else{const t=yB({},IB(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),IB(n),IB(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(VF.poptip,UF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!_M(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return IB(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!OB.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield NF(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(!_M(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(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}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)?b_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?sB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 gM("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?sB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(gM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tH.instance().getFunction(t)}registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}getFunctionList(){return tH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=vB.getChartPlugins();t.length>0&&(this._chartPlugin=new iH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=vB.getVChartPlugins();e.length>0&&(this._vChartPlugin=new wH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=fR.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=fR.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}RH.InstanceManager=RB,RH.ThemeManager=OB,RH.globalConfig={uniqueTooltip:!0},RH.Utils=Qz,RH.vglobal=b_;vB.registerRegion("region",cz),vB.registerLayout("base",_z),KT(),HC(),vB.registerMark(Jz.type,Jz),vB.registerStageEventPlugin("gesture",rH),kH(),MH(),MB(cB.name,cB);const OH="monotone",IH="linear",LH="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class DH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function FH(t,e){return e("component",t)}function zH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=vB.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const HH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},jH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},NH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},UH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=zH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},VH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const WH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function GH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=XH(UH(h,r,a,c),d,g),o.value=XH(UH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=UH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function YH(t,e,i,s,n,r,a){if(d(e)){GH(t,e(n,a),i,s,r,a)}else e&&GH(t,e,i,s,r,a)}const XH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class KH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{YH(a,t,e,i,s,n,r)})):d(t)?YH(a,t,e,i,s,n,r):t&&GH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:UH(r.visible,t,n),value:XH(UH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:UH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=UH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&WH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const $H={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},qH=(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=gP([],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 ZH(a,n,o)},ZH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{kM(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=>{kM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=$H[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},JH=(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=>{kM(t[e])||(t[e]=0)}))})),t},QH=`${NB}_HIERARCHY_DEPTH`,tj=`${NB}_HIERARCHY_ROOT`,ej=`${NB}_HIERARCHY_ROOT_INDEX`;function ij(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function sj(t,e,i){t&&(i.needDefaultSeriesField&&(t[XB]=i.defaultSeriesField),t[GB]=e,t[YB]=i.getKey(t,e,i))}function nj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function rj(t,e,i,s=0,n,r){void 0===r&&(r=e),sj(t,e,i),t[QH]=s,t[tj]=n||t[i.categoryField],t[ej]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>rj(e,s,i,t[QH]+1,t[tj],r)))}const aj={label:{name:"label",type:"text"}},oj=`${NB}_rect_x`,lj=`${NB}_rect_x1`,hj=`${NB}_rect_y`,cj=`${NB}_rect_y1`,dj={data:!0},uj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},pj=[...Object.keys(uH),"normal"];function gj(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 _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=uB({},o[e],a);return _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function fj(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),bj(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function mj(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function vj(t,e){var i;return null!==(i=null==t?void 0:t[GB])&&void 0!==i?i:e.context.graphicIndex}function yj(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 _j(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function bj(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),bj(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),bj(t[s],e,i))}function xj(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Sj extends rz{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=OE(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=vB.getSeriesMarkMap(o)?function(t,e,i){const s=vB.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=uB({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return uB({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=uB({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>uB({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Aj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(uj[e]||(t[e]=!0),t)),{}),kj={compileOnlyKeys:uj,dataRelatedKeys:Aj,seriesOnlyKeys:{tooltip:!0}},Cj={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Tj=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,Mj=(t,e,i)=>{const s=Tj(t),n=Tj(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function wj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class Ej extends az{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${NB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Sj,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=xj(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"invalidTravel",JH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=iR(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=eR(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=eR(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Tz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=ZH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){YP(this._dataSet,"dimensionStatistics",qH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new za(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&&gP(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){YP(this._dataSet,"dimensionStatistics",qH);const s=new za(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=gP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&gP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new za(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)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!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,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:bM(s)||xM(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=uB(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=uB(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=bH(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=bH(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=bH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:XB;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:KB,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,KB,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(vB.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new KH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,wj(i))}_getSpecUpdatePolicy(){return kj}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},dj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Mj(t[i],e[i],Cj)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Mj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?wj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&wj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof za||sR(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();xj(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:XB,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WE).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DE(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:XB}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,uB({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:YB}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==ZB&&t!==QB&&t!==qB&&t!==JB||(t=this.getStackValueField()),null!==(e=mP(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>kM(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:XB]}}function Bj(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Ow(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 Pj(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}}}Ej.mark=aj,Ej.transformerConstructor=Sj;class Rj extends Ej{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);Ow(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:`${NB}_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(ZB),this.setFieldX2(qB)):(this.setFieldY(ZB),this.setFieldY2(qB))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(QB),this.setFieldX2(JB)):(this.setFieldY(QB),this.setFieldY2(JB))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(eP),this.setFieldX2(tP)):(this.setFieldY(eP),this.setFieldY2(tP))}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)&&(Bj("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Oj(t){return"bottom"===t||"top"===t}function Ij(t){return"left"===t||"right"===t}function Lj(t){return"z"===t}function Dj(t,e){return qE(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Fj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function zj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Oj(t)?"linear":"band":Oj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Hj=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):["linear","log","symlog"].includes(e)?FH("axisLinear",i):{})&&void 0!==s?s:{},r=Oj(t)?FH("axisX",i):Ij(t)?FH("axisY",i):FH("axisZ",i);return uB({},FH("axis",i),n,r)};class jj{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:fM)("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:fM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Lw(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Oj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Nj extends jj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Uj=(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))},Vj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},Wj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Lw(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:Gj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,Yj=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class Xj extends jj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Uj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:jP.canvas}),callback:this.onMouseOut}),bM(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),bM(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Kj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Kj||(Kj={}));const $j={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qj={sampling:!0,samplingFactor:!0};class Zj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark($j.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:LH,curveType:IH,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===OH?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark($j.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:yj(this._spec,$j.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new za(this._option.dataSet,{name:`${NB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[$j.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,uB({},this._spec[$j.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Jj=Object.assign(Object.assign({},aj),$j),Qj=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>Qj(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},tN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class eN extends qz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return tN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(Iw(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Qj(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[YB]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const iN=new Uint32Array(33),sN=new Uint32Array(33);sN[0]=0,iN[0]=~sN[0];for(let t=1;t<=32;++t)sN[t]=sN[t-1]<<1|1,iN[t]=~sN[t];function nN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&iN[31&o]&sN[1+(31&l)])return!0}else{if(i[h]&iN[31&o])return!0;if(i[c]&sN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,iN[31&o]&sN[1+(31&l)]);else for(s(h,iN[31&o]),s(c,sN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,sN[31&a]|iN[1+(31&o)]);else for(n(l,sN[31&a]),n(h,iN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function rN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function aN(t,e,i=!1){return i?rN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function oN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=aN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=rN(t,r)),e.getRange(r)))}function lN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return lN(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return lN(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 lN(t,e,n,s,h,c)}return!1}const cN=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],dN=["top","inside-top","inside"];function uN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const pN={mode:"same-time",duration:300,easing:"linear"};function gN(t){return 3===t||4===t}function fN(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 mN=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 vN(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)}}class yN extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class _N extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const bN=(t,e)=>Math.ceil(t)>Math.floor(e),xN=([t,e],[i,s])=>s>t&&e>i;function SN(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const AN=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class kN extends Qp{constructor(t,e){super(t),this._skipRenderAttributes=AN,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{MN(t,e,i)})),e}function wN(t,e){e&&(null==t||t.onComplete.push(e))}function EN(t){t.forEach((t=>{t()}))}function BN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var PN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(GM.hover,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(TM(this,(t=>{P(t.states)||(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void TM(this,(t=>{P(t.states)||(t.removeState(GM.selectedReverse),t.removeState(GM.selected))}));P(e.states)||(e.addState(GM.selected,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[vN(g,f,c,d,a,o),vN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=NM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Al)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),EN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(pN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=MN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=MN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}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):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return QM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&bN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&bN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(SN([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!xN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(aN(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;TN(i,null==n?void 0:n.attribute),TN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{ON[t]=e};var LN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};DN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const FN=()=>{IN("line",DN),IN("area",DN)};var zN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}HN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const jN=()=>{IN("symbol",HN),IN("line-data",HN)};class NN extends eN{constructor(){super(...arguments),this.type=NN.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)===PE.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}NN.type="line";const UN=()=>{vB.registerMark(NN.type,NN),KT(),iT(),FN(),jN(),_H(),vB.registerGraphicComponent("line",ag)};class VN extends qz{constructor(){super(...arguments),this.type=VN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}VN.type="symbol";const WN=()=>{vB.registerMark(VN.type,VN),KT(),iM(),jN(),vB.registerGraphicComponent("symbol",Gg)};class GN extends Sj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function YN(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function XN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function KN(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 $N(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 qN(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 ZN(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 JN=t=>t.map(((t,e)=>({index:e,value:t}))),QN=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},tU=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=$M(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return JN(v)};class sU{constructor(t){this.id=AM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class nU extends sU{constructor(){super(nU.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Ow(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&YN(c)&&YN(d)))return;const u=XN(t,c),p=XN(e,d);if(!0===u.break&&!0===p.break)return;const{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(!$N(u,p))return}else if(0===_&&0===b){if(!$N(p,u))return}else if(y||A)if(y&&!A){if(!KN(u,p))return}else if(A&&!y){if(!KN(p,u))return}else{if(f===b)return;if(f>b){if(!qN(u,p))return}else if(!qN(p,u))return}else{if(0===f&&0===_){if(!ZN(u,p))return}else if(0===b&&0===g&&!ZN(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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){YP(e.getOption().dataSet,"tickAlign",iU);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}nU.pluginType="component",nU.type="AxisSyncPlugin";const rU={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function aU(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 oU(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 lU(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const hU=t=>"band"===t||"ordinal"===t||"point"===t;function cU(t,e){return{id:t,label:t,value:e,rawValue:t}}function dU(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class uU extends eH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const pU=`${NB}_ARC_TRANSFORM_VALUE`,gU=`${NB}_ARC_RATIO`,fU=`${NB}_ARC_START_ANGLE`,mU=`${NB}_ARC_END_ANGLE`,vU=`${NB}_ARC_K`,yU=`${NB}_ARC_MIDDLE_ANGLE`,_U=`${NB}_ARC_QUADRANT`,bU=`${NB}_ARC_RADIAN`,xU=-Math.PI/2,SU=3*Math.PI/2,AU=.6,kU=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},CU=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):"linear"===e?FH("axisLinear",i):{})&&void 0!==s?s:{},r=FH("angle"===t?"axisAngle":"axisRadius",i);return uB({},FH("axis",i),n,r)};function TU(t,e,i,s){switch(t){case r.cartesianBandAxis:return Hj(Dj(i,["z"]),"band",e);case r.cartesianLinearAxis:return Hj(Dj(i,["z"]),"linear",e);case r.cartesianLogAxis:return Hj(Dj(i,["z"]),"log",e);case r.cartesianSymlogAxis:return Hj(Dj(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return Hj(Dj(i),void 0,e);case r.polarBandAxis:return CU(i.orient,"band",e);case r.polarLinearAxis:return CU(i.orient,"linear",e);case r.polarAxis:return CU(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>Oj(t.orient)));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>Ij(t.orient)));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return MU(i,FH(t,e));default:return FH(t,e)}}const MU=(t,e)=>{var i;const s=uB({},e,e[Fj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class wU extends rz{getTheme(t,e){return TU(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({},iB(e)),{[s]:0}))}}class EU extends lz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=wU,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof qa||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:jP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new uU(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;EH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=BH(t),s=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}EH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var BU,PU;EU.transformerConstructor=wU,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(BU||(BU={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(PU||(PU={}));class RU extends qz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?EH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(EH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?(this._component.setAttributes(i),this._product&&this._component.parent!==this._product&&this._product.appendChild(this._component)):(this._component=vB.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(FP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}RU.type="component";const OU=()=>{vB.registerMark(RU.type,RU)};var IU,LU;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(IU||(IU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(LU||(LU={}));const DU={[LU.selectedReverse]:{},[LU.selected]:{},[LU.hover]:{},[LU.hoverReverse]:{}},FU=t=>t,zU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class HU extends EU{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?BU.circleAxis:BU.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?PU.circleAxisGrid:PU.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=gj(null===(h=vB.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&Tw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Ow(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Ow(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return Tw(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=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=Mw(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()})),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(Tw(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||zU[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=wP(s=t.domainLine)).startSymbol=wP(s.startSymbol),s.endSymbol=wP(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(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 PP(uB({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:PP(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return PP(uB({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:PP(t.tick.style)),t.tick.state&&(i.tick.state=EP(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 PP(uB({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:PP(t.subTick.style)),t.subTick.state&&(i.subTick.state=EP(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=rU[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:uB({},d,PP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:PP(h.style)}),h.state&&(i.title.state.shape=EP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:PP(o.style)}),o.state&&(i.title.state.background=EP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=EP(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=PP(t.background.style)),t.background.state&&(i.panel.state=EP(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:HB(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 PP(uB({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:PP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:HB(t.subGrid.alternateColor),style:PP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=zH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){XP(this._option.dataSet,"scale",FU);const i=this.registerTicksTransform();return new za(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===IU.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}HU.specKey="axes";const jU=()=>{OU(),vB.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},NU=[nU];class UU extends HU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{const e=this.getOrient();Oj(e)?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Ij(e)?dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Lj(e)&&dU(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._clearContinuousBarBandwidthCache=()=>{this._continuousBarBandwidthCache=void 0},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=uB({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(uB({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Oj(this.getOrient()),n=t=>{var e;return(s?!Oj(t.getOrient()):Oj(t.getOrient()))&&Ow(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&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Dj(i,["z"]),Lj(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(!lU(e))return null;const{axisType:t,componentName:s}=zj(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=>Ij(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(!lU(t))return;const{axisType:s,componentName:n}=zj(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=vB.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Oj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Lj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(NU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Oj(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&&!Oj(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Lj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Ij(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Oj(this.getOrient())?t.fieldX:Lj(this.getOrient())?t.fieldZ:t.fieldY,Ow(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getBandwidth:(t=0)=>this._getContinuousBarBandwidth(t),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}_getContinuousBarBandwidth(t=0){if(0!==t||!Ow(this._scale.type))return;const e=this._scales[0],i=e.domain(),s=e.range(),n=+(null==i?void 0:i[0]),r=+(null==i?void 0:i[i.length-1]),a=+(null==s?void 0:s[0]),o=+(null==s?void 0:s[s.length-1]);if(!(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(a)&&Number.isFinite(o)&&n!==r))return;const l=this._continuousBarBandwidthCache;if(l&&l.scale===e&&l.domainStart===n&&l.domainEnd===r&&l.rangeStart===a&&l.rangeEnd===o)return l.bandWidth;const h=new Set,c=this.getOrient();Tw(this._regions,(t=>{var e,i,s,n;if(t.type!==PE.bar)return;const r=t,a=Oj(c)&&"vertical"===r.direction?r.fieldX[0]:Ij(c)&&"horizontal"===r.direction?r.fieldY[0]:void 0,o=a?null===(n=null===(s=null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.latestData)||void 0===s?void 0:s[a])||void 0===n?void 0:n.values:void 0;null==o||o.forEach((t=>{const e=+t;Number.isFinite(e)&&h.add(e)}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const d=Array.from(h).sort(((t,e)=>t-e));if(d.length<2)return;let u=1/0,p=d[0];for(let t=1;t0&&i{if(t===this._axisMark&&!1===this._isLayout&&(Oj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Oj(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return Tw(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]:Oj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Lj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();Tw(this._regions,(e=>{Oj(t)?dU(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Ij(t)?dU(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Lj(t)&&dU(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Oj(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=Oj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=uB(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Oj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return cU(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Ow(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),Tw(this._regions,(t=>{var e,i;null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i||i.target.addListener("change",this._clearContinuousBarBandwidthCache)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}UU.type=r.cartesianAxis,UU.specKey="axes";class VU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=cU(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=>cU(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const WU=(t,e,i,s)=>{const n=eU(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},GU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,YU=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?JN([s[s.length-1]]):JN([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=WU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=KU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=WU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!GU(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?YU(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function qU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=$U(e,t,!1,!!n),o=$U(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class ZU extends kN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${IU.grid}-sub`:`${IU.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=$U(t,o,!1,!!a)}const u=NM.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=gw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=NM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}ZU.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class JU{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=zM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return FM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class QU extends nb{onBind(){var t;const e=vD(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;TN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class tV extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;TN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function eV(){HC(),iT(),YT(),cM(),w_.registerBuiltInAnimate("axisEnter",QU),w_.registerBuiltInAnimate("axisUpdate",tV)}HC(),cT();class iV extends ZU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},ZU.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=UM,endAngle:r=VM}=this.attribute;i=pw(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function sV(){HC(),iT(),yT(),iM()}function nV(){HC(),iT(),gC(),iM()}G(iV,JU),sV();class rV extends kN{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=NM.line;Y(i)[0].cornerRadius&&(t=NM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=NM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}rV.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}}},nV();class aV extends rV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function oV(){HC(),OT(),iM(),YT(),cM()}var lV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:Y(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+E,i=1===j?(t-e)/2+E+I/2:b[0]+E-(T/2+e/2-E)+I/2;if(V(i,"center"),A){const t=i-I/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-I-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,G=lV(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Al)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},hV.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}hV.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const cV=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(GM.hover,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.hoverReverse,!0)})),s):i},dV=(t,e,i)=>i?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),null):i,uV=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(GM.selected)?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.selectedReverse),t.removeState(GM.selected))})),null):s.name&&!P(s.states)?(s.addState(GM.selected,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.selectedReverse,!0)})),s):i},pV={type:"default",duration:300,easing:"linear"};class gV extends CN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cV(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=NM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),EN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(TM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=MN(this),{delay:a=0,duration:o=pV.duration,easing:l=pV.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};TN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=MN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(pV)}_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=NM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=IU.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=NM.group({x:0,y:0,pickable:!1});t.name=IU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=NM.group({x:0,y:0,pickable:!1});i.name=IU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=NM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=IU.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=YM;else{const t=this.data[s],e=H({},YM,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=NM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=IU.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=YM;else{const i=H({},YM,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=NM.group({x:0,y:0,pickable:!1});return r.name=`${IU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=QM(this._getLabelAttribute(t,e,n,i));if(a.name=IU.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=YM;else{const s=H({},YM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new hV(Object.assign({},e));i.name=IU.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/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 f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},nw.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},TM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=ZA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},TN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const fV={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&&fw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function mV(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function vV(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fV[n]||fV.parity;if(s.length>=3&&mw(s,r)){do{s=a(s,r)}while(s.length>=3&&mw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);fw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),vV(l,s,n,(t=>fw(t,l,r))),vV(h,s,o,(t=>fw(t,h,r)||!(!n||t===l)&&fw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function _V(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},SV(t,e.attribute.angle)),{angle:xV(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({},AV(t,e.attribute.angle)),{angle:xV(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function xV(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function SV(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=xV(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 AV(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=xV(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 kV(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=hw(h),m=lw(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function CV(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var TV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=NM.group({zIndex:999});e.name=IU.axisBreak,e.id=this._getNodeId(`${IU.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},rw,s),a=null!==(e=r.size)&&void 0!==e?e:rw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=NM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=IU.axisBreakSymbol;const h=NM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=IU.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=NM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=IU.background,n.id=this._getNodeId("background"),n.states=H({},DU,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new hV(Object.assign({},t));e.name=IU.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=TV(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},DU,l),symbol:H({},DU,l)});const d=new rV(c);d.name=IU.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=TV(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=HM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},DU,c.text),shape:H({},DU,c.shape),panel:H({},DU,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=TV(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=HM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return SV(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return AV(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=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),bV(i,t),!_V(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=hw(a),l=lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=CV(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=CV(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);kV(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&yV(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(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=NM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=IU.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=qM(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=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}MV.defaultAttributes=nw,G(MV,JU);const wV={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},EV={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}}},BV={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}}},PV={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}}};class RV extends UU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new iE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,XU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Xw(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{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(RV.type,RV,!1)},IV=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function LV(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,FV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function zV(t,e,i="count"){const s=FV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const HV=Math.sqrt(50),jV=Math.sqrt(10),NV=Math.sqrt(2);class UV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=oU(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=Oj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(DV),e.sort(DV),{domain:LV(t,e),scope:zV(t,e,i)}}(r,dM(t),this._spec.breaks[0].scopeType);e=dM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=oU(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=HV?10:n>=jV?5:n>=NV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}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=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function VV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function WV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Ow(t.type))return JN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return JN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=VV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=VV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=VV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=eU(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=eU(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?YV.greedy:YV.parity;for(;l.length>=3&&mw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;fw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),WV(t,l,a,(e=>fw(e,t,i))),WV(n,l,o,(e=>fw(e,n,i)||!(!a||e===t)&&fw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return JN(m)},YV={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&fw(i,t,e)||(i=t,0))))}},XV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class KV extends UU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Lj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Oj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=ZE(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=dM(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}KV.type=r.cartesianLinearAxis,KV.specKey="axes",KV.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(KV,UV);const $V=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(KV.type,KV)},qV=`${NB}_hide_`;function ZV(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const JV=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[qV]&&(ZV(t,!0),t[qV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[qV]=!0,ZV(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},QV=()=>{vB.registerGrammarTransform("symbolOverlap",{transform:JV,runType:"afterEncode"})},tW={min:$,max:K,average:xw,sum:bw};function eW(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function iW(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 sW(t,e,i,s){return iW(t,e,i,"min",s)}function nW(t,e,i,s){return iW(t,e,i,"max",s)}function rW(t,e,i,s){return iW(t,e,i,"average",s)}function aW(t,e,i,s){return iW(t,e,i,"sum",s)}const oW=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=eW;if("min"===n?l=sW:"max"===n?l=nW:"average"===n?l=rW:"sum"===n&&(l=aW),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[]},lW=()=>{vB.registerGrammarTransform("dataSampling",{transform:oW})};class hW extends Rj{constructor(){super(...arguments),this.type=PE.line,this.transformerConstructor=GN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),fj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}hW.type=PE.line,hW.mark=Jj,hW.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},hW.transformerConstructor=GN,G(hW,Zj);class cW{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{sR(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof za)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];gM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];gM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class dW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{CM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{gP(e,[{key:t,operations:Ow(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&&gP(e,[{key:i.field,operations:Ow(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?YE("colorOrdinal"):YE(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(CM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),CM(s.domain)?e.reRender=!0:V(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(!CM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Ow(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Ow(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;Ow(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(Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Ow(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class uW{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&Xz(t,i,!0,l):a&&Xz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&Xz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Kz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Kz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const pW={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},gW={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class fW extends nz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=AM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:UB,height:VB},this._viewRect={width:UB,height:VB},this._viewBox={x1:0,y1:0,x2:UB,y2:VB},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._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(gW).some((t=>!u(e[t])))},this._paddingSpec=iB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new DP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new cW(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new uW;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=vB.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(gj({},fj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=vB.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=vB.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof az)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 qz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof qz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&sR(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=GF(this._spec,this._option,{width:UB,height:VB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DE(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new dW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){$F(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DE(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=iB(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{$F(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);KF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),$F(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);KF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),$F(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(pW[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return pW[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!pW[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;pW[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];$F(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=tB(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(FP.AFTER_MARK_RENDER_END,e)};this._event.on(FP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:IP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(OP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===Kj.dimensionHover||s===Kj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Lw(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Lw(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const mW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},vW={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class yW{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},vW),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):dB(t,a,c.spec),dB(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(vB.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(vB.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=vB.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=vB.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=vB.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):HH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=HH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class _W extends yW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&uB(i,qF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class bW extends _W{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),WF(t)}}const xW=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=vP(t,!0);for(const e in o)for(const i in o[e].nodes)xP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)bP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&_P(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class AW{_beforeInit(){this._dataSet&&YP(this._dataSet,"stackSplit",xW)}_initStack(){this._stack=new SW(this),this._stack.init()}}const kW={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:Kj.dimensionHover};class CW extends xH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},kW,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=IP(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}CW.type="dimension-hover",CW.defaultOptions=kW;const TW=()=>{vB.registerInteractionTrigger(CW.type,CW)},MW=()=>{vB.registerComposedEvent(Kj.dimensionHover,Xj),vB.registerComposedEvent(Kj.dimensionClick,Nj)},wW=t=>t.fieldX[0],EW=t=>t.fieldY[0],BW=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},PW=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},RW=(t,e)=>t?e?wW:BW:e?EW:PW,OW=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=Yj(t,(t=>Oj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=Yj(t,(t=>Ij(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Lw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=IW(t,i,RW(e,Lw(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=IW(t,i,RW(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},IW=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:LW(t,s,i)},LW=(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=Wj(e,t,"cartesian",null!=i?i:Oj(t.getOrient())?wW:EW);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},DW=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Lw(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Ow(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=aU(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};zW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&FW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),FW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=zH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},zW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},HW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=jW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},jW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},NW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return DW(c,r,e),c.xField.cacheInfo?HW(c.xField):c.yField.cacheInfo?HW(c.yField):void 0},UW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],VW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&UW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(WW(s).every((t=>{var e;return!WH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},WW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},GW={dom:`${NB}_TOOLTIP_HANDLER_DOM`,canvas:`${NB}_TOOLTIP_HANDLER_CANVAS`},YW={key:"其他",value:"..."};var XW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(XW||(XW={}));class KW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=VW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},YW),t):YW;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&WH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class $W extends KW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Lw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const qW=()=>{vB.registerTooltipProcessor("dimension",$W)};class ZW extends KW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,yo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(IP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const JW=()=>{vB.registerTooltipProcessor("mark",ZW)};class QW extends KW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const tG=()=>{vB.registerTooltipProcessor("group",QW)};class eG extends fW{constructor(){super(...arguments),this.transformerConstructor=bW,this.type="line",this.seriesType=PE.line}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}eG.type="line",eG.seriesType=PE.line,eG.transformerConstructor=bW,G(eG,AW);const iG=[...tN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class sG extends eN{constructor(){super(...arguments),this.type=sG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return iG}_getIgnoreAttributes(){return[]}}sG.type="area";const nG=()=>{vB.registerMark(sG.type,sG),KT(),wC(),FN(),jN(),_H(),vB.registerGraphicComponent("area",Yp)};class rG extends KH{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 aG=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}}),oG=()=>{vB.registerAnimation("area",vH),yH(),fH()};class lG extends GN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=uB({},f.style,g.style),l.state=uB({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function hG(){HC(),OT()}function cG(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const dG={debounce:St,throttle:At};hG();let uG=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=cG(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:dG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(KM,{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",dG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(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]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};uG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class pG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=pG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(KM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new uG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}SG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class AG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,SG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new SG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,VF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class kG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class CG extends kG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class TG extends kG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function MG(t){t.isBound(AG)||(t.bind(AG).toSelf().inSingletonScope(),t.bind(o_).toService(AG)),t.isBound(CG)||(t.bind(CG).toSelf(),t.bind(Sv).toService(CG)),t.isBound(TG)||(t.bind(TG).toSelf(),t.bind(Sv).toService(TG))}class wG extends kN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}HC(),iT();class EG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HC(),OT();class BG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},BG.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})}}BG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},HC(),gC();class PG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}PG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},HC(),gC();class RG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},RG.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=UM,endAngle:s=VM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}RG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},HC(),cT();class OG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},OG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}OG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class IG{isInValidValue(t){const{startAngle:e=UM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=UM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return uw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function LG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=LG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var zG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=NM.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=NM.circle(t)}h.name=IU.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},DU,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=zG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=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:y,textAlign:"center"},l),state:{text:H({},DU,d.text),shape:H({},DU,d.shape),panel:H({},DU,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=LG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&DG(e,c,i)}else e.AABBBounds.width()>r&&DG(e,r,i)}else o>a.x&&h.x2>n.x2?(DG(e,n.x2-o,i),r&&FG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}HG.defaultAttributes=nw,G(HG,IG);const jG=(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=$M(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=dw(r,uw(s,r,e,n));return o=a,l=uw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return JN(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=jG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=UG(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 JN(c)},UG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&QN(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var VG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new YG(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):gN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=gN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=gN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=gN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?gN(t.quadrant)?"left":"right":gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.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*(gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),EN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}$G.defaultAttributes={pickable:!1};var qG,ZG,JG,QG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(tY,IG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(qG||(qG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(ZG||(ZG={})),function(t){t.dataZoomChange="dataZoomChange"}(JG||(JG={}));const eY="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",iY={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:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},sY={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}},nY=0,rY=1,aY=2,oY=3,lY=4,hY=5,cY=5,dY=999,uY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var pY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:aY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:aY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:nY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:hY},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:hY},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},sY.horizontal),{zIndex:hY}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},sY.horizontal),{zIndex:hY}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:hY},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:hY},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},sY.vertical),{zIndex:hY}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:hY},sY.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:rY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:lY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return qA(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=pY(c,["formatMethod"]),{formatMethod:g}=d,f=pY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:uY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:uY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:uY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:uY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:cY}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:cY}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new hV(e),s.name=i,t.add(s)),s}}const fY={debounce:St,throttle:At};class mY extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=qG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=qG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=qG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=cG();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===qG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===qG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===qG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===qG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(ZG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===qG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:fY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=cG();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=qG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}oV(),OT(),iM(),wC(),iT();let vY=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new gY(this._getRendererAttrs()),this._interaction=new mY(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(ZG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(ZG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(JG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(ZG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(JG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var yY,_Y,bY,xY;function SY(){HC(),oV(),fb()}vY.defaultAttributes=iY,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"}(yY||(yY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(_Y||(_Y={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(bY||(bY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xY||(xY={}));class AY extends kN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cV(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(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:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},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=NM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=NM.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=NM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),EN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=MN(this);this.markerAnimate("exit");const n=MN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function kY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function CY(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;TN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function TY(t,e,i,s){t&&(CY(t.startSymbol,e,i,s),kY(t).forEach((t=>CY(t,e,i,s))),CY(t.endSymbol,e,i,s))}function MY(t,e,i,s){t&&(CY(t.getTextShape(),e,i,s),CY(t.getBgRect(),e,i,s))}function wY(t,e,i,s){var n,r,a,o;t&&(TN(t,{fillOpacity:0,strokeOpacity:0},{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 EY(t,e,i,s){t&&(wY(t.startSymbol,e,i,s),kY(t).forEach((t=>wY(t,e,i,s))),wY(t.endSymbol,e,i,s))}function BY(t,e,i,s){t&&(wY(t.getTextShape(),e,i,s),wY(t.getBgRect(),e,i,s))}function PY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;CY(t.startSymbol,s,r,n);const h=kY(t);h.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),CY(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;CY(t.getTextShape(),e,l,n),CY(t.getBgRect(),e,l,n)}))}function RY(t,e,i,s,n){TY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function OY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function IY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function LY(t,e,i,s,n,r){var a;TY(t,n,s,r),CY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?MY(i,n,s,r):CY(i,n,s,r)}function DY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;CY(t.startSymbol,n,o,r);const u=kY(t);u.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),CY(e,n+o+l,h,r),CY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(CY(i.getTextShape(),n+o+l+h+c,d,r),CY(i.getBgRect(),n+o+l+c,d,r)):CY(i,n+o+l+c,d,r)}function FY(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?PY(t,e,s,r,a):"fadeIn"===i&&RY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?PY(t,e,s,n,a):"fadeIn"===i&&RY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){EY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function zY(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&&OY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&OY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function HY(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&&IY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&IY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function jY(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?LY(n,r,e,i,s,o):"callIn"===t&&DY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?LY(n,r,e,i,s,a):"callIn"===t&&DY(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;EY(t,n,s,r),wY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?BY(i,n,s,r):wY(i,n,s,r)}(n,r,e,t,i,s)}}const NY={type:"clipIn",duration:500,easing:"linear",delay:0},UY={type:"fadeIn",duration:500,easing:"linear",delay:0},VY={type:"callIn",duration:500,easing:"linear",delay:0},WY={type:"fadeOut",duration:500,easing:"linear",delay:0};class GY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new hV(Object.assign(Object.assign({},h),{state:{panel:H({},YM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},YM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},YM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},YM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class YY extends AY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=NY,this.defaultExitAnimation=WY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;sw(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(YY,GY);const XY=.001,KY={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:yY.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]}},$Y={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"}}},qY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:bY.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]}},ZY={interactive:!0,label:{position:_Y.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}},JY={interactive:!0,label:{autoRotate:!0,position:bY.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}},QY={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"}},tX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},eX={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 iX(){sX._animate=FY}SY(),sV(),fb();class sX extends YY{markerAnimate(t){sX._animate&&this._animationConfig&&sX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},sX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(wM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return EM(Math.abs(e),Math.PI/2,XY)||EM(Math.abs(e),3*Math.PI/2,XY)?BM(i,e,t):wM(e)?$Y.postiveXAxis[t]:$Y.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new rV({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",sX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(sX.defaultAttributes.label)}}function nX(){rX._animate=zY}sX.defaultAttributes=KY,SY(),yT(),fb();class rX extends AY{markerAnimate(t){rX._animate&&this._animationConfig&&rX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},tX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=NM.polygon(Object.assign({points:e},i));n.states=H({},YM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",rX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},YM,null==i?void 0:i.area)),this._updateMarkLabels(rX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}rX.defaultAttributes=ZY,G(rX,GY),SY(),nV(),fb();class aX extends YY{markerAnimate(t){aX._animate&&this._animationConfig&&aX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},aX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case bY.arcInnerStart:l=n;case bY.arcOuterStart:l=n;break;case bY.arcInnerEnd:l=r;case bY.arcOuterEnd:l=r;break;case bY.center:case bY.arcInnerMiddle:case bY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return QY[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new aV({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",aX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(aX.defaultAttributes.label)}}aX.defaultAttributes=qY,SY(),gC(),fb();class oX extends AY{markerAnimate(t){oX._animate&&this._animationConfig&&oX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},oX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case bY.center:h=(s+n)/2,c=(r+a)/2;break;case bY.arcInnerStart:h=s,c=r;break;case bY.arcOuterStart:h=n,c=r;break;case bY.arcInnerEnd:h=s,c=a;break;case bY.arcOuterEnd:h=n,c=a;break;case bY.arcInnerMiddle:h=s,c=(r+a)/2;break;case bY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},QY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=NM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},YM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",oX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},YM,null==o?void 0:o.area)),this._updateMarkLabels(oX.defaultAttributes.label)}isValidPoints(){return!0}}function lX(){hX._animate=jY}oX.defaultAttributes=JY,G(oX,GY),SY(),sV(),nV(),iM(),XC(),iT(),fb();class hX extends AY{markerAnimate(t){hX._animate&&this._animationConfig&&hX._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},hX.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=VY,this.defaultExitAnimation=WY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return EM(Math.abs(s),Math.PI/2,XY)||EM(Math.abs(s),3*Math.PI/2,XY)?BM(t,s,n):wM(s)?eX.postiveXAxis[n]:eX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=xY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},YM,null==p?void 0:p.textBackground),text:H({},YM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},YM,null==p?void 0:p.itemContent));const v=wM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=NM.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"text"===n?o=new hV(Object.assign(Object.assign({},i),{state:{panel:H({},YM,null==s?void 0:s.textBackground),text:H({},YM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=NM.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"image"===n?(o=NM.image(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},YM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=EM(c,0,XY)||EM(d,0,XY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=ew(e-u,t-d),o=ew(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(yX.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(yX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===yX.focus||"focus"===o){const s=a.hasState(mX.focus);a.toggleState(mX.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover,mX.focus],t),this._setLegendItemState(e,mX.selected,t)})):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover,mX.focus],t),this._setLegendItemState(e,mX.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(mX.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(mX.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(vX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[mX.selected,mX.selectedHover],t),this._setLegendItemState(a,mX.unSelected,t)):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t))}else this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover],t),this._setLegendItemState(e,mX.unSelected,t))}))}this._dispatchLegendEvent(vX.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,mX.selected),this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover])):(this._removeLegendItemState(e,[mX.selected,mX.selectedHover]),this._setLegendItemState(e,mX.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=pX,spaceRow:l=gX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=NM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=NM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,yX.item,t,M)):(M=NM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,yX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?mX.selected:mX.unSelected);const w=NM.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=NM.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,yX.itemShape,t,M,S.state),s.addState(e?mX.selected:mX.unSelected),w.add(s)}let I=0;if(d){const e=R(g,"size",10);E=NM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,yX.focus,t,M),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=QM(Object.assign(Object.assign({x:P/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,yX.itemLabel,t,M,A.state),D.addState(e?mX.selected:mX.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=QM(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,yX.itemValue,t,M,k.state),r.addState(e?mX.selected:mX.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-O-I),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.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 j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new uX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new uX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new uG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new uG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=pX,spaceRow:o=gX}=n,l=this._itemsContainer,{space:h=fX,defaultCurrent:c=1}=r,d=SX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=NM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=pX,spaceRow:a=gX}=s,o=this._itemsContainer,{space:l=fX,defaultCurrent:h=1}=n,c=SX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=NM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=NM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(mX.selected)?this._setLegendItemState(t,mX.selectedHover,e):this._setLegendItemState(t,mX.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===yX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(vX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(mX.unSelectedHover)||t.hasState(mX.selectedHover))&&(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(mX.unSelectedHover)&&!t.hasState(mX.selectedHover)||(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===yX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(vX.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!==yX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(vX.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!==yX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(mX.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},AX,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(mX.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var CX;function TX(t){return _(t)?t:[t,t]}function MX(t){return t?"ew-resize":"ns-resize"}kX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:pX,spaceRow:gX,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:fX,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"}(CX||(CX={})),bX();class wX extends kN{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:H({},wX.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=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(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?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:TX(d)[0],endValue:TX(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=NM.group({x:0,y:0});f.name=CX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=NM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=CX.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=NM.group({x:g?v:0,y:g?0:v});f.add(y);const _=NM.group({x:0,y:0});let b;if(_.name=CX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=NM.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=CX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=NM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=CX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=TX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(v.name=CX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=CX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(i.name=CX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=CX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=NM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=CX.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":MX(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=NM.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=CX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return NM.symbol(t)}_renderHandlerText(t,e){return NM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":MX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=NM.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=NM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===CX.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===CX.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===CX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===CX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}wX.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}}},xX(),bX();class EX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 BX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}EX.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"}}},xX(),bX(),cT();class PX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PX.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=NM.group({x:0,y:0});this._innerView.add(x);const S=new wX({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:BX(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 C=NM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);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))}}PX.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)"}},HC(),cM(),YT();let RX=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},XM),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,O-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},XM),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GO&&(G=O),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(I)||p(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(I)||p(M.align)){const t=M.align?M.align:I,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};RX.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 OX={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"}}};HC(),cM(),YT();let IX=class extends kN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(OX,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=QM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=qM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&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 LX extends Wg{constructor(t){super(t)}}var DX,FX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(DX||(DX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(FX||(FX={}));class zX extends kN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},zX.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"},zX.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"},zX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.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 LX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new LX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new LX(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(DX.OnPlay)},this.pause=()=>{this._dispatchEvent(DX.OnPause)},this.forward=()=>{this._dispatchEvent(DX.OnForward)},this.backward=()=>{this._dispatchEvent(DX.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()}}zX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},zX.defaultAttributes={[FX.Start]:{},[FX.Pause]:{},[FX.Backward]:{},[FX.Forward]:{}};const HX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},jX=[200,10];var NX,UX;!function(t){t.Default="default",t.Reverse="reverse"}(NX||(NX={})),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"}(UX||(UX={}));const VX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),WX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),GX=t=>"top"===t||"bottom"===t;class YX extends kN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YX.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(GX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:jX[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:jX[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 wX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=GX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new zX(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=GX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:jX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(GX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(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:GX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:GX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function XX(){bX(),HC(),iM()}YX.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({},HX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},HX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},HX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},HX),{key:"backward",position:"start"})}},XX();class KX extends YX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},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:NX.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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(VX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||WX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===NX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(UX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(UX.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(UX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.change),this.dispatchCustomEvent(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var $X,qX=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())}))};XX();class ZX extends YX{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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change))},this.play=()=>qX(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(UX.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.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(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}($X||($X={}));const JX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},QX=5;const tK={debounce:St,throttle:At};HC(),yT();let eK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=JX.updateTrigger,endTrigger:i=JX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:tK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=JX.trigger,resetTrigger:i=JX.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent($X.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent($X.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=QX}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent($X.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent($X.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent($X.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=QX}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=JX.updateTrigger,endTrigger:s=JX.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=NM.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};eK.defaultAttributes=JX;const iK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},sK=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}},nK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},rK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];HC(),OT(),iM(),cM(),YT();let aK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},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=oi(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",H({symbolType:"circle"},u.shape,{visible:MM(u)&&MM(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:MM(u)&&MM(u.value)},sK(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:MM(u)&&MM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:MM(u)&&MM(u.value)},sK(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},XM),u.value),visible:MM(u)&&MM(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=MM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=MM(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]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!MM(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)+(MM(n.key)?r+n.key.spacing:0)+(MM(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&&(tw(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:MM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),tw(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(MM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(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(MM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},sK(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},sK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},XM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(MM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},sK(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},sK(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=>rK.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)&&MM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=MM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=$M(d),y=$M(u);let _=0;if(MM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(MM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return iK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return iK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};aK.defaultAttributes=nK;class oK extends KV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{Oj(this.getOrient())?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=uB({},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 za(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Tz(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.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=>cU(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=>cU(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}oK.type=r.cartesianTimeAxis,oK.specKey="axes",oK.builtInTheme={axis:EV,axisX:BV,axisY:PV};class lK extends KV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new ME}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}lK.type=r.cartesianLogAxis,lK.specKey="axes",lK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(lK,UV);class hK extends KV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new wE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}hK.type=r.cartesianSymlogAxis,hK.specKey="axes",hK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(hK,UV);class cK extends Rj{constructor(){super(...arguments),this.type=PE.area,this.transformerConstructor=lG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(cK.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===OH?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XE(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XE(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[ZB]},"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(gj(null===(e=vB.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),fj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),fj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new rG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}cK.type=PE.area,cK.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},cK.mark=aG,cK.transformerConstructor=lG,G(cK,Zj);class dK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(t)}}class uK extends fW{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="area",this.seriesType=PE.area}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}uK.type="area",uK.seriesType=PE.area,uK.transformerConstructor=dK,G(uK,AW);function pK(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 gK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:pK(t,e)}),fK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:pK(t,e)}),mK={type:"fadeIn"},vK={type:"growCenterIn"};function yK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mK;case"scaleIn":return vK;default:return gK(t)}}class _K extends qz{constructor(){super(...arguments),this.type=_K.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}_K.type="rect";const bK=()=>{KT(),OT(),IN("rect",WG),vB.registerMark(_K.type,_K),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),vB.registerGraphicComponent("rect",mg)},xK=Object.assign(Object.assign({},aj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function SK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=nB(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[oj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):XE(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[lj]):XE(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=XE(this._dataToPosX(t),e,i),n=XE(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[hj]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XE(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[cj]):XE(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=XE(this._dataToPosY(t),e,i),n=XE(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),CK)})}getStatisticFields(){var t;const e=super.getStatisticFields(),i="horizontal"===this.direction?this.getYAxisHelper():this.getXAxisHelper(),s="horizontal"===this.direction?this._fieldY:this._fieldX,n=null===(t=null==i?void 0:i.getScale)||void 0===t?void 0:t.call(i,0);return n&&Ow(n.type)&&s.forEach((t=>{const i=e.find((e=>e.key===t));i?i.operations.includes("values")||i.operations.push("values"):e.push({key:t,operations:["values"]})})),e}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},TK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:yj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(TK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}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(YP(this._option.dataSet,"addVChartProperty",NH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};YP(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new za(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new Tz(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_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=cj,s=hj,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=lj,s=oj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=vP(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)SK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=XE(this[r](t),l,i),u=XE(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!KE(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[qB],n=e[ZB],r=e[JB],d=e[QB];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?hj:oj],i=e[a?cj:lj];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[qB]:s,[ZB]:o}),c?{[JB]:u,[QB]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(mg(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>XE(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>XE(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Pj(this);this._barMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),fj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i;const s=this._groups?this._groups.fields.length:1,n=u(e)?s:Math.min(s,e),r=p(this._spec.barWidth)&&n===s,a=r&&"number"==typeof this._spec.barWidth&&"string"!=typeof this._spec.barMinWidth&&"string"!=typeof this._spec.barMaxWidth||null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,n-1),o=null!=a?a:6,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=!t.isContinuous||u(a)||r?o:.5*o;return r&&(c=nB(this._spec.barWidth,o)),l&&(c=Math.max(c,nB(this._spec.barMinWidth,o))),h&&(c=Math.min(c,nB(this._spec.barMaxWidth,o))),c}_getPosition(t,e,i,s){var n,r,a,o,l,h;let c,d,g;"horizontal"===t?(c=this.getYAxisHelper(),d="height",g="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(c=this.getXAxisHelper(),d="width",g="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const f=c.getScale(0),m=this._groups?this._groups.fields.length:1,v=u(i)?m:Math.min(m,i),y=null!==(r=null===(n=c.getBandwidth)||void 0===n?void 0:n.call(c,v-1))&&void 0!==r?r:6,_=v===m?this._barMark.getAttribute(d,e):y;if(v>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 h=t[r],d=null!==(o=null===(a=c.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=nB(null!==(l=i[r-1])&&void 0!==l?l:X(i),y),g=d.indexOf(e[h]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return f.scale(e[t[0]])+(null!==(h=c.getBandwidth(0))&&void 0!==h?h:y)/2-s/2+n}const b=Ow(f.type||"band");return g(e,v)+.5*(y-_)+(b?-y/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}TK.type=PE.bar,TK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},TK.mark=xK,TK.transformerConstructor=kK;const MK=()=>{lW(),bK(),vB.registerAnimation("bar",((t,e)=>({appear:yK(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),OV(),$V(),vB.registerSeries(TK.type,TK)};class wK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(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 EK extends fW{constructor(){super(...arguments),this.transformerConstructor=wK,this.type="bar",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}EK.type="bar",EK.seriesType=PE.bar,EK.transformerConstructor=wK,G(EK,AW);const BK=[10,20],PK=Pw.Linear,RK="circle",OK=Pw.Ordinal,IK=["circle","square","triangle","diamond","star"],LK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},DK=Object.assign(Object.assign({},aj),{point:{name:"point",type:"symbol"}});class FK extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const zK={sizeField:!0};class HK extends Rj{constructor(){super(...arguments),this.type=PE.scatter,this.transformerConstructor=FK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),zK)})}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=`${NB}_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=`${NB}_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:PK,defaultRange:BK},"size")}getShapeAttribute(t,e){return u(e)?RK:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:OK,defaultRange:IK},"shape")}initMark(){this._symbolMark=this._createMark(HK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,HK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Pj(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(gj(null===(i=vB.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),fj("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:RK},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}HK.type=PE.scatter,HK.mark=DK,HK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},HK.transformerConstructor=FK;const jK=()=>{WN(),vB.registerAnimation("scatter",((t,e)=>Object.assign({appear:LK(0,e)},pH))),OV(),$V(),vB.registerSeries(HK.type,HK)};class NK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class UK extends fW{constructor(){super(...arguments),this.transformerConstructor=NK,this.type="scatter",this.seriesType=PE.scatter}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}UK.type="scatter",UK.seriesType=PE.scatter,UK.transformerConstructor=NK,G(UK,AW);class VK extends Ej{constructor(){super(...arguments),this.type=PE.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=`${NB}_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 WK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[GB]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[pP]=a||r})),s};class GK extends KH{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 YK extends qz{constructor(){super(...arguments),this.type=YK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}YK.type="path";const XK=()=>{vB.registerMark(YK.type,YK),KT(),cT(),vB.registerGraphicComponent("path",hg)},KK=Object.assign(Object.assign({},aj),{area:{name:"area",type:"path"}});class $K{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ua(i,e):ja[i]?(Ha[i]||(Ha[i]=Ua(i,ja[i])),Ha[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class qK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class ZK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function JK(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:qK}:bM(e)||xM(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:ZK}:null}const QK={debounce:St,throttle:At};class t${constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=bM(this._renderMode)||xM(this._renderMode),JK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return JK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,QK[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,QK[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){JK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:NP.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:NP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=QK[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=QK[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:NP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp)}))}}class e$ extends EU{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${NB}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=uB(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new $K(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===PE.map||e.type===PE.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),Tw(this._regions,(t=>{var e;if(t.type===PE.map||t.type===PE.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==PE.map&&e.type!==PE.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[pP],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}e$.type=r.geoCoordinate,G(e$,t$);const i$=()=>{vB.registerComponent(e$.type,e$)};class s$ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class n$ extends VK{constructor(){super(...arguments),this.type=PE.map,this.transformerConstructor=s$,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 !`),KP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),YP(this._dataSet,"copyDataView",tR),YP(this._dataSet,"map",WK),YP(this._dataSet,"lookup",jH);const s=KP.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new za(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:pP,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new Tz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(n$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:yj(this._spec,n$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:XB])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:XB]):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(gj(null===(t=vB.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),fj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new GK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[GB]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[GB],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return GB}getActiveMarks(){return[this._pathMark]}}n$.type=PE.map,n$.mark=KK,n$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},n$.transformerConstructor=s$;const r$=`${NB}_waterfall_default_seriesField`,a$=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[nP]=!0:delete t[nP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=o$([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}=l$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=o$(r,t,s,o,u,c,e,i),o.push(s)})),o};function o$(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}=l$(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===r$)&&(t[r$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function l$(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?gM("total.collectCountField error"):n=e[a].start;o<0?gM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const h$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},c$={type:"fadeIn"},d$={type:"growCenterIn"};function u$(t,e){switch(e){case"fadeIn":return c$;case"scaleIn":return d$;default:return gK(t,!1)}}class p$ extends qz{constructor(){super(...arguments),this.type=p$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return ag(t)}}p$.type="rule";const g$=()=>{vB.registerMark(p$.type,p$),KT(),iT(),vB.registerGraphicComponent("line",ag)},f$=Object.assign(Object.assign({},xK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),m$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:v$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function v$(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)=>v$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y${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 za(e instanceof Fa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),YP(e,"dimensionTree",m$),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 _$ extends kK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const b$={rect:T$,symbol:k$,arc:w$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=k$(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:E$,line:B$,area:B$,rect3d:T$,arc3d:w$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function x$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=b$[t])&&void 0!==i?i:b$.point;return e.series.type===PE.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=A$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:P$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function S$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==PE.sankey){const{formatFunc:t,args:n}=zH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function A$(t){return d(t)?e=>t(e.data):t}function k$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=A$(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:C$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function C$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function T$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=A$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:M$(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function M$(t){const e=[{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"]}}];return e}function w$(t){var e;const{labelSpec:i}=t,s=null!==(e=A$(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 E$(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=S$(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),Jg(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 B$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[XB]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function P$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const R$={calculationMode:!0};class O$ extends TK{constructor(){super(...arguments),this.type=PE.waterfall,this.transformerConstructor=_$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&_P(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),R$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y$(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=r$)}getSeriesKeys(){return this._seriesField===r$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),YP(this._dataSet,"waterfallFillTotal",h$),YP(this._dataSet,"waterfall",a$),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=eR(this.getViewData(),this._dataSet,{name:`${NB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Tz(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:qB,endAs:ZB,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Pj(this);this._barMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),fj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(O$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return E$(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?XE(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):XE(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&KE([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}O$.type=PE.waterfall,O$.mark=f$,O$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},O$.transformerConstructor=_$;const I$=()=>{g$(),bK(),vB.registerAnimation("waterfall",((t,e)=>({appear:u$(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(O$.type,O$)},L$=`${NB}_BOX_PLOT_OUTLIER_VALUE`;var D$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(D$||(D$={}));const F$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[L$]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class z$ extends KH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return this.series.getOutliersField();if(t===D$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case D$.MIN:return this.series.getMinField();case D$.MAX:return this.series.getMaxField();case D$.MEDIAN:return this.series.getMedianField();case D$.Q1:return this.series.getQ1Field();case D$.Q3:return this.series.getQ3Field();case D$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return e[L$];if(t===D$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case D$.MIN:return e[this.series.getMinField()];case D$.MAX:return e[this.series.getMaxField()];case D$.MEDIAN:return e[this.series.getMedianField()];case D$.Q1:return e[this.series.getQ1Field()];case D$.Q3:return e[this.series.getQ3Field()];case D$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[L$])}getDefaultContentList(t){return[{key:this.getContentKey(D$.OUTLIER),value:this.getContentValue(D$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(D$.MAX),value:this.getContentValue(D$.MAX)},{key:this.getContentKey(D$.Q3),value:this.getContentValue(D$.Q3)},{key:this.getContentKey(D$.MEDIAN),value:this.getContentValue(D$.MEDIAN)},{key:this.getContentKey(D$.Q1),value:this.getContentValue(D$.Q1)},{key:this.getContentKey(D$.MIN),value:this.getContentValue(D$.MIN)},{key:this.getContentKey(D$.SERIES_FIELD),value:this.getContentValue(D$.SERIES_FIELD)}]}}const H$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class j$ extends qz{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==tz.enter&&t.context.diffState!==tz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{H$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Zp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=vB.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const N$=()=>{vB.registerGraphicComponent("glyph",Zp),KT(),FC()},U$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],V$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class W$ extends j${constructor(){super(...arguments),this.type=W$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=U$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=V$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}W$.type="boxPlot";const G$=Object.assign(Object.assign({},aj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),Y$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},X$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},K$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),$$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=K$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=K$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=K$(t,"box").attribute.width,i=K$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=K$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=K$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=K$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=K$(t,"box").attribute.height,i=K$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},q$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=K$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=K$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=K$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=K$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=K$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=K$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=K$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=K$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=K$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class Z$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return Y$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class J$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return X$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class Q$ extends Z${computeAttribute(){return Y$(q$)(this.target,this.params,this.params.options)}}class tq extends J${computeAttribute(){return X$(q$)(this.target,this.params,this.params.options)}}class eq extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const iq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class sq extends Rj{constructor(){super(...arguments),this.type=PE.boxPlot,this.transformerConstructor=eq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),iq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(sq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(sq.mark.outlier,{key:GB,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}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=>XE(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XE(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XE(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XE(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XE(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"foldOutlierData",F$),YP(this._dataSet,"addVChartProperty",NH);const t=new za(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${NB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._outlierData=new Tz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=nB(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,nB(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,nB(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=nB(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Ow(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Pj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=vB.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(fj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(gj(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(gj(null===(a=vB.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new z$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}sq.type=PE.boxPlot,sq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},sq.mark=G$,sq.transformerConstructor=eq;const nq=()=>{N$(),iT(),OT(),vB.registerGraphicComponent("line",(t=>ag(t))),vB.registerGraphicComponent("rect",(t=>mg(t))),vB.registerMark(W$.type,W$),WN(),fH(),OV(),$V(),w_.registerBuiltInAnimate("boxplotScaleIn",Z$),w_.registerBuiltInAnimate("boxplotScaleOut",J$),w_.registerBuiltInAnimate("barBoxplotScaleIn",Q$),w_.registerBuiltInAnimate("barBoxplotScaleOut",tq),vB.registerSeries(sq.type,sq)};class rq extends qz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=rq.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?jg(t):Jg(t)}}rq.type="text";const aq=()=>{vB.registerMark(rq.type,rq),KT(),cM(),YT(),vB.registerGraphicComponent("text",Jg),vB.registerGraphicComponent("richtext",jg)};class oq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const lq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),hq={type:"fadeIn"},cq=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function dq(t,e){return"fadeIn"===e?hq:lq(t)}const uq=Object.assign(Object.assign({},xK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class pq extends kK{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 gq extends TK{constructor(){super(...arguments),this.type=PE.rangeColumn,this._barMarkType="rect",this._barName=PE.bar,this.transformerConstructor=pq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(gq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,gq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(gq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(gq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Pj(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(gj(null===(i=vB.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),fj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(gj(null===(n=vB.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),fj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new oq(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)}}gq.type=PE.rangeColumn,gq.mark=uq,gq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},gq.transformerConstructor=pq;const fq=()=>{bK(),aq(),vB.registerAnimation("rangeColumn",((t,e)=>({appear:dq(t,e),enter:lq(t),exit:cq(t),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(gq.type,gq)};var mq,vq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(mq||(mq={})),function(t){t.middle="middle",t.start="start",t.end="end"}(vq||(vq={}));class yq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const _q=Object.assign({},aG);class bq extends cK{constructor(){super(...arguments),this.type=PE.rangeArea}initMark(){this._areaMark=this._createMark(bq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new yq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}bq.type=PE.rangeArea,bq.mark=_q;class xq extends Ej{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=AU,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Ow(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:[]};Ow(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)&&Bj(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Sq(t){return kM(t)?Number.parseFloat(t):0}const Aq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&kq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[pU],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[pU]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},kq=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===Sq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Sq(i[e])),0)));function Cq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const Tq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Cq(t,!0,rR.appear)}),Mq={type:"fadeIn"},wq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Cq(t,!0,rR.enter)}),Eq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Cq(t,!0,rR.exit)});function Bq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Mq;case"growRadius":return Tq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Tq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Pq extends qz{constructor(t,e){super(t,e),this.type=Rq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[yU])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Rq extends Pq{constructor(){super(...arguments),this.type=Rq.type}}Rq.type="arc";const Oq=()=>{KT(),gC(),IN("arc",XG),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),vB.registerGraphicComponent("arc",Vp),vB.registerMark(Rq.type,Rq)},Iq=Object.assign(Object.assign({},aj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Lq extends Sj{_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=uB({},this._theme,i,t);const n=(t,e)=>uB({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Dq=`${NB}_LABEL_VISIBLE`,Fq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},zq={outerRadius:!0};class Hq extends xq{constructor(){super(...arguments),this.transformerConstructor=Lq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:QE(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:QE(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=xU,this._endAngle=SU,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[yU];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;YP(this._dataSet,"pie",Aq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:fU,asEndAngle:mU,asRatio:gU,asMiddleAngle:yU,asRadian:bU,asQuadrant:_U,asK:vU,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Hq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ew(fU)(t)}endAngleScale(t){return Ew(mU)(t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$E(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$E(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ew(Dq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),zq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Fq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[yU];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===rR.appear)return this._startAngle;if(i===rR.disappear)return this._endAngle;const r=[rR.disappear,rR.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[GB];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=gj(null===(i=vB.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Hq.transformerConstructor=Lq,Hq.mark=Iq,Hq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class jq extends Hq{constructor(){super(...arguments),this.type=PE.pie}}jq.type=PE.pie;const Nq=()=>{Oq(),vB.registerAnimation("pie",((t,e)=>({appear:Bq(t,e),enter:wq(t),exit:Eq(t),disappear:{duration:uH.disappear.duration}}))),vB.registerAnimation("emptyCircle",((t,e)=>({appear:Bq(t,e)}))),vB.registerSeries(jq.type,jq)};function Uq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const Vq=t=>({type:Uq(t.growField),options:{overall:!0}}),Wq={type:"fadeIn"},Gq=t=>({type:Uq(t.growField)}),Yq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function Xq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Wq;case"growAngle":return Vq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return Vq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const Kq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class $q extends xq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Kq)})}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(ZB),this.setInnerRadiusField(qB)}setValueFieldToPercent(){this.setRadiusField(QB),this.setInnerRadiusField(JB)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const qq=Object.assign(Object.assign({},aj),{rose:{name:"rose",type:"arc"}});class Zq extends Sj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class Jq extends HU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=vB.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=xU,this._endAngle=SU,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QE(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QE(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:aU(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Ow(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>cU(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=AU,e=0;const i=this.getChart().getSpec();return Tw(this.getRegions(),(s=>{const n=s;if(r=n.type,[PE.rose,PE.radar,PE.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(uB({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(uB({},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)}}Jq.type=r.polarAxis,Jq.specKey="axes";const Qq={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},tZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class eZ extends Jq{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}eZ.type=r.polarLinearAxis,eZ.specKey="axes",eZ.builtInTheme={axis:EV,axisLinear:XV,axisAngle:tZ,axisRadius:Qq},G(eZ,UV);const iZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(eZ.type,eZ)};class sZ extends Jq{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new iE}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,NG),t}transformScaleDomain(){}}sZ.type=r.polarBandAxis,sZ.specKey="axes",sZ.builtInTheme={axis:EV,axisBand:wV,axisAngle:tZ,axisRadius:Qq},G(sZ,VU);const nZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(sZ.type,sZ)};class rZ extends $q{constructor(){super(...arguments),this.type=PE.rose,this.transformerConstructor=Zq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(rZ.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,rZ.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XE(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XE(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(gj(null===(i=vB.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),fj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}rZ.type=PE.rose,rZ.mark=qq,rZ.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},rZ.transformerConstructor=Zq;const aZ=()=>{vB.registerSeries(rZ.type,rZ),Oq(),vB.registerAnimation("rose",((t,e)=>({appear:Xq(t,e),enter:Gq(t),exit:Yq(t),disappear:{duration:uH.disappear.duration}}))),nZ(),iZ()};class oZ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,vw(this._fromAngle,this._toAngle)&&vw(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lZ extends hH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!Cw(t)&&!Cw(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const hZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function cZ(t,e,i){return"fadeIn"===e?hZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function dZ(t,e,i){return"fadeIn"===e?hZ(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 uZ=(t,e)=>({custom:oH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),pZ=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}});class gZ extends $q{constructor(){super(...arguments),this.type=PE.radar,this.transformerConstructor=GN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(gZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:IH,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):xU},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(gj(null===(s=vB.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),fj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=vB.getAnimationInKey(e);t.setAnimationConfig(gj(null==i?void 0:i(n,r),fj(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}}}gZ.type=PE.radar,gZ.mark=pZ,gZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},gZ.transformerConstructor=GN,G(gZ,Zj);const fZ=()=>{vB.registerSeries(gZ.type,gZ),nG(),UN(),WN(),vB.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:cZ(t,e,"in"),enter:cZ(t,e,"in"),exit:cZ(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{channel:["points","center"],custom:lZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),vB.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:oZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing}]}))),vB.registerAnimation("radarGroup",((t,e)=>({appear:uZ(t,"in"),disappear:{duration:uH.disappear.duration}}))),gC(),nZ(),iZ()};class mZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const vZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(NB)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[GB]:r,[YB]:`${s}_${e}`})),r++}))})),n},yZ={fill:"#bbb",fillOpacity:.2},_Z=Object.assign(Object.assign({},aj),{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"}}),bZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},xZ={grid:{background:!0}};class SZ extends Rj{constructor(){super(...arguments),this.type=PE.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)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),bZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),xZ)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),YP(this._option.dataSet,"objFlat",vZ),YP(this._option.dataSet,"copyDataView",tR),XP(this._option.dataSet,"dataview",Ia),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(uB(yZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(SZ.mark.group),this._containerMark=this._createMark(SZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(SZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(SZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(SZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(SZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(SZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(SZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}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 WE).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:XB}}initTooltip(){this._tooltipHelper=new mZ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}SZ.type=PE.dot,SZ.mark=_Z,SZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class AZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const kZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),CZ=(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 TZ extends Rj{constructor(){super(...arguments),this.type=PE.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),YP(this._option.dataSet,"linkDotInfo",CZ),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(TZ.mark.group),this._containerMark=this._createMark(TZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(TZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(TZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new AZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}TZ.type=PE.link,TZ.mark=kZ,TZ.builtInTheme={link:{arrow:{style:{size:10}}}};const MZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"}}),wZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class EZ extends xq{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()?qB:cP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?ZB:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),wZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):xU;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):SU,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=XE(this.angleAxisHelper.dataToPosition([t[qB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XE(this.angleAxisHelper.dataToPosition([t[ZB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?XE(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(EZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[mg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const OZ=()=>{vB.registerAnimation("circularProgress",((t,e)=>({appear:RZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:uH.disappear.duration}})))};class IZ extends Sj{constructor(){super(...arguments),this._supportStack=!0}}const LZ={cornerRadius:!0,roundCap:!0};class DZ extends EZ{constructor(){super(...arguments),this.type=PE.circularProgress,this.transformerConstructor=IZ,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()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),LZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(DZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:yj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(DZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?qB:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?ZB: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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}DZ.type=PE.circularProgress,DZ.mark=BZ,DZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},DZ.transformerConstructor=IZ;const FZ=()=>{vB.registerSeries(DZ.type,DZ),Oq(),OZ(),mH(),nZ(),iZ()};function zZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const HZ={type:"fadeIn"};function jZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?HZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:zZ(t)}))(t)}class NZ extends KH{enableByType(t){return"dimension"!==t}}const UZ=Object.assign(Object.assign({},aj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),VZ={bandWidth:!0,cornerRadius:!0,clamp:!0},WZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class GZ extends Rj{constructor(){super(...arguments),this.type=PE.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),VZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),WZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(GZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return XE(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(GZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new NZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}GZ.type=PE.linearProgress,GZ.mark=UZ,GZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const YZ=()=>{bK(),vB.registerAnimation("linearProgress",((t,e)=>({appear:jZ(t,e),enter:jZ(t),disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(GZ.type,GZ)},XZ=[0],KZ=[20,40],$Z=[200,500],qZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},ZZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class JZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const QZ=`${NB}_WORD_CLOUD_TEXT`,tJ=Object.assign(Object.assign({},aj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),eJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class iJ extends Ej{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=KZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:$Z,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:XZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?QZ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:qZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||_M(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:XZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!ZZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new JZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(iJ.mark.word,{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(iJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(gj(vB.getAnimationInKey("wordCloud")(n,s),fj("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 WE).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:XB])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new AE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new AE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[GB])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:YB,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:b_.createCanvas.bind(b_),getTextBounds:gv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:sg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}iJ.mark=tJ,iJ.builtInTheme={wordCloud:eJ};function sJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||uH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=nJ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},rJ=(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=rJ(t.children,e,t,n))})),s},aJ=(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=aJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},oJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):oJ(t.children,e,i)))})),e};function lJ(t,e){let i,s;if(dJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function dJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function fJ(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 mJ(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 vJ(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 yJ(t){return{_:t,next:null,prev:null}}function _J(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];fJ(n,s,r);let a,o,l,h,c,d,u,p=yJ(s),g=yJ(n),f=yJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=nJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:AJ.defaultOpionts.nodeSort;rJ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)rJ([o],bJ(h)),aJ([o],xJ(this._getPadding,.5,a)),rJ([o],SJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);rJ([o],bJ(AJ.defaultOpionts.setRadius)),aJ([o],xJ(Ot,1,a)),c&&aJ([o],xJ(this._getPadding,o.radius/t,a)),rJ([o],SJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}AJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const kJ=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=kJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function CJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){kJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function TJ(t){return t.depth}function MJ(t,e){return e-1-t.endDepth}const wJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),EJ=(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},BJ={left:TJ,right:MJ,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:TJ,end:MJ},PJ=bt(0,1);class RJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>wJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>wJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},RJ.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):BJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return CJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[EJ(s[t.source]),EJ(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*PJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(wJ),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(wJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];OJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),IJ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},LJ.defaultOpionts,t):Object.assign({},LJ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(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]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(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-(_(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=nJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function DJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:OJ,slice:DJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?DJ:OJ)(t,e,i,s,n)}};class HJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},HJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?FJ(this.options.aspectRatio):null!==(e=zJ[this.options.splitType])&&void 0!==e?e:zJ.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=nJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function jJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=jJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=NJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function KJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*$J({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},ZJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||VJ,s=e.lossFunction||UJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:qJ(f),arcs:f})}))},JJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:QJ,triangle:QJ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function QJ(){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 tQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const eQ=t=>JJ[t]?JJ[t]():JJ.circle(),iQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function sQ(t){return d(t)?t:function(){return t}}class nQ{constructor(t){var e,i;switch(this.options=H({},nQ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=eQ(this.options.shape),this.getText=null!==(e=sQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=sQ(this.options.fontWeight),this.getTextFontSize=sQ(this.options.fontSize),this.getTextFontStyle=sQ(this.options.fontStyle),this.getTextFontFamily=sQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>iQ(10,50);break;case"random-light":this.getTextColor=()=>iQ(50,90);break;default:this.getTextColor=sQ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class aQ extends nQ{constructor(t){var e;super(H({},aQ.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<=aQ.defaultOptions.minFontSize&&(this.options.minFontSize=aQ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=rQ[this.options.spiral])&&void 0!==e?e:rQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=sQ(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}=tQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(hQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}cQ(p,this._size)&&(p=dQ(p,this._size))}else if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||lQ(p,i))&&(!i||!oQ(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 oQ(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 lQ(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,cQ=(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 dQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},pQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},gQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},fQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=tQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=eQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)gQ(n,pQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)gQ(n,pQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=pQ({x:l,y:h},o,-Math.PI/2,5),e=pQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);gQ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let mQ=class t extends nQ{constructor(e){super(H({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),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 C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[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(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?uQ(t,o,l.width,l.height,h):"geometric"===t.type&&fQ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=tQ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};mQ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vQ extends nQ{constructor(t){super(H({},vQ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vQ.defaultOptions={enlarge:!1};const _Q={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bQ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xQ(t.fontFamily):"sans-serif",d=t.fontStyle?xQ(t.fontStyle):"normal",u=t.fontWeight?xQ(t.fontWeight):"normal",p=t.rotate?xQ(t.rotate):0,g=xQ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?xQ(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},_Q),t.as):_Q,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?xQ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=AQ(kQ(t,l),w);M=i=>e(t(i))}let E=aQ;"fast"===t.layoutType?E=vQ:"grid"===t.layoutType&&(E=mQ);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},xQ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],SQ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),AQ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SQ(t[0]),n=SQ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SQ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},kQ=(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 CQ(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{vB.registerGrammarTransform("wordcloud",{transform:bQ}),aq(),vB.registerAnimation("wordCloud",((t,e)=>({appear:sJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:uH.disappear.duration}}))),vB.registerSeries(TQ.type,TQ)},wQ=t=>d(t)?t():t,EQ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=wQ(e.valueField),v=null!==(i=wQ(e.heightVisual))&&void 0!==i&&i,y=null===(s=wQ(e.isCone))||void 0===s||s,_=wQ(e.range),b=a.reduce(((t,e)=>{const i=Number.parseFloat(e[m]);return k(i)?Math.max(t,i):t}),-1/0),x=null!==(n=null==_?void 0:_.min)&&void 0!==n?n:0,S=null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b,A=t=>k(t)&&k(x)&&k(S)?x===S?t{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0,S=A(n);p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=S),d&&(t[d]=e===a.length-1?y?0:t[c]:A(_)),u&&(t[u]=0===e?1:A(r)),g&&(t[g]=n)})),a},BQ=(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},PQ=`${NB}_FUNNEL_TRANSFORM_RATIO`,RQ=`${NB}_FUNNEL_REACH_RATIO`,OQ=`${NB}_FUNNEL_HEIGHT_RATIO`,IQ=`${NB}_FUNNEL_VALUE_RATIO`,LQ=`${NB}_FUNNEL_LAST_VALUE_RATIO`,DQ=`${NB}_FUNNEL_NEXT_VALUE_RATIO`,FQ=`${NB}_FUNNEL_LAST_VALUE`,zQ=`${NB}_FUNNEL_CURRENT_VALUE`,HQ=`${NB}_FUNNEL_NEXT_VALUE`,jQ=`${NB}_FUNNEL_TRANSFORM_LEVEL`;class NQ extends KH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[RQ])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class UQ extends qz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VQ extends UQ{constructor(){super(...arguments),this.type=VQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VQ.type="polygon";const WQ=()=>{vB.registerMark(VQ.type,VQ),KT(),yT(),w_.registerBuiltInAnimate("growPointsOut",VL),vB.registerGraphicComponent("polygon",ug)},GQ=Object.assign(Object.assign({},aj),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YQ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class XQ extends Ej{constructor(){super(...arguments),this.type=PE.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"funnel",EQ),YP(this._dataSet,"funnelTransform",BQ);const t=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new Tz(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:zQ,asTransformRatio:PQ,asReachRatio:RQ,asHeightRatio:OQ,asValueRatio:IQ,asNextValueRatio:DQ,asLastValueRatio:LQ,asLastValue:FQ,asNextValue:HQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:jQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},XQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:yj(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},XQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(XQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(XQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new NQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&uM(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&uM(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ew(RQ).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(gj(null===(s=vB.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),fj("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("fadeInOut")(),fj(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("funnel")({},o),fj(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(gj(null===(a=vB.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),fj("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[LQ])/2:this._getSecondaryAxisLength(t[IQ])/2,n=this._getSecondaryAxisLength(t[IQ])/2):(s=this._getSecondaryAxisLength(t[IQ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[DQ])/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[jQ])}_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[YB]===t[YB]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{WQ(),aq(),g$(),vB.registerSeries(XQ.type,XQ),vB.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},gH))),vB.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:lH,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),mH()},$Q=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},qQ=t=>{const e=t.filter((t=>t.context.diffState===tz.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},ZQ=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},JQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),QQ=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},t0=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),e0=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},i0=(t,e={})=>{if(!t)return[];const i=[];return oJ(t,i,e),i},s0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new LJ(i).layout(t,{width:s,height:n})};class n0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var r0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(r0||(r0={}));const a0=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===r0.DrillDown){return Y(AP(t,n,s,"children"))}if(i.type===r0.DrillUp){const e=kP(t,n,s,"children");if(e)return Y(e)}return t};class o0{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=JK(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;YP(t,"drillFilter",a0),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:r0.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:r0.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:r0.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:r0.DrillUp},model:this}),r}}const l0=Object.assign(Object.assign({},aj),{sunburst:{name:"sunburst",type:"arc"}}),h0=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:QH,operations:["max","min","values"]}),t.push({key:tj,operations:["values"]}),t),c0={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class d0 extends xq{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),YP(this._dataSet,"sunburstLayout",s0),YP(this._dataSet,"flatten",i0),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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(d0.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(d0.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new n0(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(gj(null===(e=vB.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}d0.type=PE.sunburst,d0.mark=l0,d0.builtInTheme={sunburst:c0},G(d0,o0);const u0=()=>{vB.registerSeries(d0.type,d0),Oq(),aq(),mH(),vB.registerAnimation("sunburst",((t,e)=>({appear:e0(0,e),enter:JQ(t),exit:t0(t),disappear:{duration:uH.disappear.duration}})))},p0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new AJ(i).layout(t,{width:s,height:n})};class g0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const f0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},m0=Object.assign(Object.assign({},aj),{circlePacking:{name:"circlePacking",type:"arc"}});class v0 extends Rj{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},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),YP(this._dataSet,"circlePackingLayout",p0),YP(this._dataSet,"flatten",i0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return h0(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new g0(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}v0.type=PE.circlePacking,v0.mark=m0,v0.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(v0,o0);const y0=()=>{vB.registerSeries(v0.type,v0),Oq(),aq(),fH(),vB.registerAnimation("circlePacking",((t,e)=>({appear:f0(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:uH.disappear.duration}})))},_0=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&_0(t,e.children,i)}))},b0=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},x0=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=S0(n,i),a=new RJ(i),o=[];return o.push(a.layout(r,s)),o},S0=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},A0=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:[]},k0=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 C0 extends KH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const T0=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),M0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:T0(t),w0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class E0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class B0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const P0=(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`},R0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class O0 extends j${constructor(){super(...arguments),this.type=O0.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?R0:P0,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}O0.type="linkPath";const I0=Object.assign(Object.assign({},aj),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class L0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const D0=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&Kz(t,e),Xz(t,e,s,n)};class F0 extends Rj{constructor(){super(...arguments),this.type=PE.sankey,this.transformerConstructor=L0,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=IP(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=IP(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):r.target===i.key?(s.includes(r.source)||s.push(r.source),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=IP(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),D0(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation())):(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=IP(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=IP(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=IP(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=IP(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=IP(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s},!0,this._hasLinkStateAnimation())}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value},!0,this._hasLinkStateAnimation());Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(IP(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=IP(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=IP(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation());const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a},!0,this._hasLinkStateAnimation())}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value},!0,this._hasLinkStateAnimation());Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}_hasStateAnimation(t){var e;return xj(this)&&!!(null===(e=null==t?void 0:t.hasAnimationByState)||void 0===e?void 0:e.call(t,"state"))}_hasLinkStateAnimation(){return this._hasStateAnimation(this._linkMark)}_hasNodeStateAnimation(){return this._hasStateAnimation(this._nodeMark)}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){YP(this._dataSet,"sankeyLayout",x0),YP(this._dataSet,"sankeyFormat",b0),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;YP(s,"sankeyNodes",A0),YP(s,"flatten",i0);const n=new za(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.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),n.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._nodesSeriesData=n,YP(s,"sankeyLinks",k0);const r=new za(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(F0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(F0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=zH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),fj("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),fj("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:NP.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(IP(e).key)?Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasNodeStateAnimation()):Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasNodeStateAnimation())}))}initTooltip(){this._tooltipHelper=new C0(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new WE;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return _0(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}F0.type=PE.sankey,F0.transformerConstructor=L0,F0.mark=I0,F0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const z0=()=>{bK(),N$(),cT(),vB.registerGraphicComponent("path",(t=>hg(t))),vB.registerMark(O0.type,O0),aq(),vB.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:M0(t,e)},gH))),vB.registerAnimation("sankeyLinkPath",((t,e)=>({appear:w0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:uH.disappear.duration}}))),w_.registerBuiltInAnimate("linkPathGrowOut",B0),w_.registerBuiltInAnimate("linkPathGrowIn",E0),mH(),vB.registerSeries(F0.type,F0)},H0=(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=i0(n);return i=qH([{latestData:r}],e),i};class j0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const N0=Object.assign(Object.assign({},aj),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),U0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class V0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const W0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new HJ(i).layout(t,s),n=[];return oJ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[tj,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class G0 extends Rj{constructor(){super(...arguments),this.type=PE.treemap,this.transformerConstructor=V0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,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:tj),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),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:YB},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),YP(this._dataSet,"treemap",W0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=H0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){YP(this._dataSet,"hierarchyDimensionStatistics",H0),YP(this._dataSet,"flatten",i0);const i=new za(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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(G0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(G0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("treemap"))||void 0===e?void 0:e(),fj(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 j0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(FP.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(FP.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}G0.type=PE.treemap,G0.mark=N0,G0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},G0.transformerConstructor=V0,G(G0,o0),G(G0,t$);const Y0=()=>{vB.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),vB.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),bK(),aq(),vB.registerAnimation("treemap",((t,e)=>({appear:U0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(G0.type,G0)},X0=Object.assign(Object.assign({},MZ),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),K0=Object.assign(Object.assign({},aj),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),$0={type:"fadeIn"};function q0(t,e){return"fadeIn"===e?$0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class Z0 extends Sj{constructor(){super(...arguments),this._supportStack=!1}}class J0 extends KH{enableByType(t){return"dimension"!==t}}const Q0="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",t1={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:Q0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Q0,fill:"#ddd"}}};class e1 extends EZ{constructor(){super(...arguments),this.type=PE.gaugePointer,this.transformerConstructor=Z0,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(e1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},e1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(e1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new J0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}e1.type=PE.gaugePointer,e1.mark=K0,e1.builtInTheme={gaugePointer:t1},e1.transformerConstructor=Z0;const i1=()=>{vB.registerSeries(e1.type,e1),XK(),bK(),vB.registerAnimation("gaugePointer",((t,e)=>{const i=q0(t,e);return{appear:i,enter:i,disappear:{duration:uH.disappear.duration}}})),nZ(),iZ()};class s1 extends Sj{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class n1 extends EZ{constructor(){super(...arguments),this.type=PE.gauge,this.transformerConstructor=s1,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();YP(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[dP]=t[this._angleField[0]],t[cP]=e>0?i[e-1][dP]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(n1.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(n1.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[cP])?this.angleAxisHelper.dataToPosition([t[cP]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[dP]])}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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}n1.type=PE.gauge,n1.mark=X0,n1.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},n1.transformerConstructor=s1;class r1 extends qz{constructor(){super(...arguments),this.type=r1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Gg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}r1.type="cell";function a1(t){return!1===t?{}:{type:"fadeIn"}}class o1 extends KH{enableByType(t){return"dimension"!==t}}const l1=Object.assign(Object.assign({},aj),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class h1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const c1={valueField:!0};class d1 extends Rj{constructor(){super(...arguments),this.type=PE.heatmap,this.transformerConstructor=h1}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),c1)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(d1.mark.cell,{isSeriesMark:!0},{morph:yj(this._spec,d1.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(d1.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Pj(this);this._cellMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),fj("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 o1(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}d1.type=PE.heatmap,d1.mark=l1,d1.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},d1.transformerConstructor=h1;const u1=()=>{aq(),vB.registerMark(r1.type,r1),vB.registerGraphicComponent("symbol",Gg),KT(),iM(),jN(),vB.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},gH),{appear:a1(e)}))),OV(),$V(),vB.registerSeries(d1.type,d1)},p1=Object.assign(Object.assign({},aj),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),g1=`${NB}_CORRELATION_X`,f1=`${NB}_CORRELATION_Y`,m1=`${NB}_CORRELATION_SIZE`,v1=t=>d(t)?t():t,y1=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=v1(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=v1(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=v1(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(v1(e.outerRadius),f),y=v1(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(v1(e.field)),A=c.map(x),[k,C]=It(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=v1(e.radiusField),w=v1(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?It(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),O=Math.max(p,g),I=_1(R,O,c.length),L=[],D=(O-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),b1({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>O?a=R: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},b1=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,S1=(t,e)=>{if(!t||!_(t))return[];const i=x1(e.keyword),s=x1(e.categoryField),n=t[0].latestData[0];return{[s]:i,[GB]:null==n?void 0:n[GB],[XB]:null==n?void 0:n[XB]}};class A1 extends j${constructor(){super(...arguments),this.type=A1.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}A1.type="ripple";const k1=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class C1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class T1 extends xq{constructor(){super(...arguments),this.type=PE.correlation,this.transformerConstructor=C1,this._viewBox=new Ue}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(){if(super.initData(),!this._data)return;YP(this._dataSet,"correlation",y1);const t=new Fa;XP(t,"dataview",Ia),YP(t,"correlationCenter",S1);const e=new za(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return 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 Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(T1.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:GB});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(T1.mark.ripplePoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(T1.mark.centerPoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[g1],y:t=>t[f1],size:t=>t[m1],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),fj("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}T1.type=PE.correlation,T1.mark=p1,T1.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},T1.transformerConstructor=C1;const M1=()=>{WN(),N$(),iM(),vB.registerMark(A1.type,A1),vB.registerGraphicComponent("symbol",(t=>Gg(t))),vB.registerSeries(T1.type,T1),vB.registerAnimation("correlation",((t,e)=>Object.assign({appear:k1(0,e)},pH)))},w1=Object.assign(Object.assign({},aj),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class E1 extends j${constructor(){super(...arguments),this.type=E1.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}E1.type="liquid";const B1=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class P1 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class R1 extends Ej{constructor(){super(...arguments),this.type=PE.liquid,this.transformerConstructor=GN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=mg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Gg({x:s,y:n,size:r,symbolType:B1(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=iB(this._spec.outlineMargin),this._paddingSpec=iB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(R1.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(R1.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(R1.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(R1.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new P1(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),fj("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),fj("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=RM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}R1.type=PE.liquid,R1.mark=w1,R1.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},R1.transformerConstructor=GN;const O1=t=>Y(t).join(",");class I1 extends KH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]])}}const L1=Object.assign(Object.assign({},aj),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class D1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const F1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?ZJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class z1 extends Ej{constructor(){super(...arguments),this.type=PE.venn,this.transformerConstructor=D1,this._viewBox=new Ue}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:YB)}initData(){var t;super.initData(),YP(this._dataSet,"venn",F1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(z1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(z1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new I1(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:O1(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return O1(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[O1(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(O1(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}}z1.type=PE.venn,z1.mark=L1,z1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},z1.transformerConstructor=D1;class H1 extends TK{constructor(){super(...arguments),this.type=PE.mosaic,this.transformerConstructor=kK}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(oP),this.setFieldX2(aP)),this.setFieldY(hP),this.setFieldY2(lP)):(t&&(this.setFieldY(oP),this.setFieldY2(aP)),this.setFieldX(hP),this.setFieldX2(lP)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}H1.type=PE.mosaic,H1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},H1.transformerConstructor=kK;class j1 extends yW{_isValidSeries(t){return t===PE.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class N1 extends fW{constructor(){super(...arguments),this.transformerConstructor=j1,this.type="map",this.seriesType=PE.map}}N1.type="map",N1.seriesType=PE.map,N1.transformerConstructor=j1;class U1 extends yW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class V1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=oU(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,uB({},s,l)),n&&Object.assign(o,uB({},n,o))}}class W1 extends U1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class G1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class Y1 extends fW{constructor(){super(...arguments),this.transformerConstructor=G1}}Y1.transformerConstructor=G1;class X1 extends Y1{constructor(){super(...arguments),this.transformerConstructor=G1,this.type="pie",this.seriesType=PE.pie}}X1.type="pie",X1.seriesType=PE.pie,X1.transformerConstructor=G1;class K1 extends W1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:AU,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:AU,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>uB({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const $1=(t,e)=>{if(!t)return null;const i=Yj(t,(t=>"angle"===t.getOrient()),e),s=Yj(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Lw(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=Aw({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=kw(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=Wj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Lw(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=Aw({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=kw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=Wj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class q1 extends fW{constructor(){super(...arguments),this.transformerConstructor=K1,this.type="rose",this.seriesType=PE.rose}_setModelOption(){this._modelOption.getDimensionInfo=$1}}q1.type="rose",q1.seriesType=PE.rose,q1.transformerConstructor=K1,G(q1,AW);class Z1 extends W1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=uB({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}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=>uB({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class J1 extends fW{constructor(){super(...arguments),this.transformerConstructor=Z1,this.type="radar",this.seriesType=PE.radar}_setModelOption(){this._modelOption.getDimensionInfo=$1}}J1.type="radar",J1.seriesType=PE.radar,J1.transformerConstructor=Z1,G(J1,AW);class Q1 extends yW{_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")&&uB(e,qF(this.type,t))})),this._transformAxisSpec(t)}}class t2 extends fW{constructor(){super(...arguments),this.transformerConstructor=Q1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=OW(t,e,i))&&void 0!==s?s:[],...null!==(n=$1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}t2.type="common",t2.transformerConstructor=Q1,G(t2,AW);class e2 extends _W{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class i2 extends fW{constructor(){super(...arguments),this.transformerConstructor=e2}}i2.transformerConstructor=e2,G(i2,AW);class s2 extends e2{transformSpec(t){super.transformSpec(t),WF(t)}}class n2 extends i2{constructor(){super(...arguments),this.transformerConstructor=s2,this.type="histogram",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}n2.type="histogram",n2.seriesType=PE.bar,n2.transformerConstructor=s2;class r2 extends V1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class a2 extends fW{constructor(){super(...arguments),this.transformerConstructor=r2,this.type="circularProgress",this.seriesType=PE.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=$1}}a2.type="circularProgress",a2.seriesType=PE.circularProgress,a2.transformerConstructor=r2,G(a2,AW);class o2 extends V1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=PE.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===PE.gauge||t.type===PE.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===PE.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 l2 extends fW{constructor(){super(...arguments),this.transformerConstructor=o2,this.type="gauge",this.seriesType=PE.gaugePointer}}l2.type="gauge",l2.seriesType=PE.gaugePointer,l2.transformerConstructor=o2;class h2 extends yW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class c2 extends fW{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}c2.transformerConstructor=h2;class d2 extends c2{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}d2.type="wordCloud",d2.seriesType=PE.wordCloud,d2.transformerConstructor=h2;class u2 extends yW{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class p2 extends fW{constructor(){super(...arguments),this.transformerConstructor=u2,this.type="funnel",this.seriesType=PE.funnel}}p2.type="funnel",p2.seriesType=PE.funnel,p2.transformerConstructor=u2;class g2 extends _W{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=oU(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=oU(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class f2 extends fW{constructor(){super(...arguments),this.transformerConstructor=g2,this.type="linearProgress",this.seriesType=PE.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}f2.type="linearProgress",f2.seriesType=PE.linearProgress,f2.transformerConstructor=g2,G(f2,AW);class m2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),WF(t)}}class v2 extends fW{constructor(){super(...arguments),this.transformerConstructor=m2,this.type="rangeColumn",this.seriesType=PE.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}v2.type="rangeColumn",v2.seriesType=PE.rangeColumn,v2.transformerConstructor=m2;class y2 extends yW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _2 extends fW{constructor(){super(...arguments),this.transformerConstructor=y2,this.type="sunburst",this.seriesType=PE.sunburst}}_2.type="sunburst",_2.seriesType=PE.sunburst,_2.transformerConstructor=y2;class b2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class x2 extends fW{constructor(){super(...arguments),this.transformerConstructor=b2,this.type="circlePacking",this.seriesType=PE.circlePacking}}x2.type="circlePacking",x2.seriesType=PE.circlePacking,x2.transformerConstructor=b2;class S2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class A2 extends fW{constructor(){super(...arguments),this.transformerConstructor=S2,this.type="treemap",this.seriesType=PE.treemap}}A2.type="treemap",A2.seriesType=PE.treemap,A2.transformerConstructor=S2;class k2 extends wK{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),WF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class C2 extends EK{constructor(){super(...arguments),this.transformerConstructor=k2,this.type="waterfall",this.seriesType=PE.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}C2.type="waterfall",C2.seriesType=PE.waterfall,C2.transformerConstructor=k2;class T2 extends _W{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),WF(t)}}class M2 extends fW{constructor(){super(...arguments),this.transformerConstructor=T2,this.type="boxPlot",this.seriesType=PE.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}M2.type="boxPlot",M2.seriesType=PE.boxPlot,M2.transformerConstructor=T2;class w2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class E2 extends fW{constructor(){super(...arguments),this.transformerConstructor=w2,this.type="sankey",this.seriesType=PE.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=IP(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}E2.type="sankey",E2.seriesType=PE.sankey,E2.transformerConstructor=w2;class B2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),WF(t)}}class P2 extends fW{constructor(){super(...arguments),this.transformerConstructor=B2,this.type="rangeArea",this.seriesType=PE.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}P2.type="rangeArea",P2.seriesType=PE.rangeArea,P2.transformerConstructor=B2;class R2 extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class O2 extends fW{constructor(){super(...arguments),this.transformerConstructor=R2,this.type="heatmap",this.seriesType=PE.heatmap}}O2.type="heatmap",O2.seriesType=PE.heatmap,O2.transformerConstructor=R2;class I2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class L2 extends fW{constructor(){super(...arguments),this.transformerConstructor=I2,this.type="correlation",this.seriesType=PE.correlation}}L2.type="correlation",L2.seriesType=PE.correlation,L2.transformerConstructor=I2;function D2(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=PP(t.style)),P(t.textStyle)||uB(s.textStyle,PP(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&PP(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&PP(s.background.style),s}function F2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const z2=(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},H2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:XB;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},j2={position:!0,item:!0,title:!0,pager:!0,background:!0};class N2 extends EU{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:()=>{Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(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=qE(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||j2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Tz(this._option,e),this._initSelectedData(),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(Tw(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(uB({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}N2.specKey="legends";class U2 extends N2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){YP(this._option.dataSet,"discreteLegendFilter",H2),YP(this._option.dataSet,"discreteLegendDataMake",z2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return Tw(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(!CM(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=mP(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,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=qE(s)?s:qE(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=D2(A):M.title={visible:!1},P(k.focusIconStyle)||PP(k.focusIconStyle),k.shape&&(k.shape=F2(wP(k.shape))),k.label&&(k.label=wP(k.label)),k.value&&(k.value=wP(k.value)),k.background&&(k.background=wP(k.background)),ZE(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),ZE(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),ZE(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||PP(C.railStyle),P(C.sliderStyle)||PP(C.sliderStyle)):(P(C.textStyle)||PP(C.textStyle),C.handler&&wP(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(uB(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return kX}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(vX.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(vX.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(vX.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,datum:t.datum,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}=zH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=zH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}U2.specKey="legends",U2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},U2.type=r.discreteLegend;const V2=(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[]},W2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?CP(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function G2(t){const i=uB({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=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=D2(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=PP(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=PP(r.style)),P(a.style)||(w.trackStyle=PP(a.style)),w.startText=wP(o),w.endText=wP(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>PP(i(t,e,s)):P(i)||(e.style=PP(i)),e}(h),P(c)||(w.sizeBackground=PP(c)),u.visible&&!P(u.style)&&(uB(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const Y2={color:EX,size:PX},X2={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}},K2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},X2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},$2={horizontal:K2(!0),vertical:K2(!1)},q2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},X2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},Z2={horizontal:q2(!0),vertical:q2(!1)},J2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Q2=[2,10];class t5 extends N2{static getSpecInfo(t){const e=HH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){YP(this._option.dataSet,"continuousLegendFilter",W2),YP(this._option.dataSet,"continuousLegendDataMake",V2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>Mw(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=mP(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!CM(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=mP(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?J2:Q2);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},G2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return Y2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}t5.specKey="legends",t5.builtInTheme={colorLegend:$2,sizeLegend:Z2},t5.type=r.continuousLegend;const e5=(t,e)=>p(e)?t.map((t=>e[t])):void 0,i5=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),s5=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function n5(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=r5(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>i5(i,s)(t)&&i5(n,r)(t)&&(u(a)||i5([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:jP.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:jP.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(a.id),m}return"none"}const r5=(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=e5(c,t);let y=e5(d,t);const _=s5(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(i5(c,v));if(!_&&(y=e5(d,i),!s5(y)))return;const n=e.type===PE.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=Lw(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(i5(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=e5(d,o),!s5(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(i5(c,n));if(!_&&(y=e5(d,r),!s5(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===PE.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(i5(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=e5(d,i),!s5(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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(i5(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=e5(d,a),h=y,!s5(y)&&!a)return;s5(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},a5=t=>p(t)&&!_(t),o5=t=>p(t)&&_(t),l5=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class h5 extends wU{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=uB({},...l5.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=uB({},s);l5.forEach((t=>{delete r[t]})),delete r.style;const a=uB({},r,i);return a.style=uB({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:xM(this._option.mode)||!_M(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=b_.getElementById(t.parentElement)):_M(this._option.mode)&&(t.parentElement=null==yM?void 0:yM.body)}}const c5={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class d5 extends EU{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=h5,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=_M(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&a5(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&RH.globalConfig.uniqueTooltip&&l&&RH.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:jP.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:jP.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?GW.canvas:GW.dom,n=vB.getComponentPluginInType(t);n||fM("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=vB.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(bM(s)||xM(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=n5(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(o5(t)){if(a5(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>Uj(t,e[i])))}if(o5(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}d5.type=r.tooltip,d5.transformerConstructor=h5,d5.builtInTheme={tooltip:c5},d5.specKey="tooltip";var u5,p5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(u5||(u5={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(p5||(p5={}));const g5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},f5={labelZIndex:!0,gridZIndex:!0},m5={xField:!0,yField:!0,categoryField:!0,valueField:!0},v5={visible:!0,width:!0,style:!0};class y5 extends EU{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Lw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||f5[i]||m5[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||v5[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:NP.chart}:{source:jP.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:bM(e)||xM(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:jP.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:jP.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:jP.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)=>{g5[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}y5.specKey="crosshair";const _5={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class b5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=Oj(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){Oj(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Ij(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"cartesian");e&&(DW(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=HW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new EG(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new BG(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}b5.specKey="crosshair",b5.builtInTheme={crosshair:_5},b5.type=r.cartesianCrosshair;class x5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=aU(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=zH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new EG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new RG(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new OG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new PG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}x5.specKey="crosshair",x5.builtInTheme={crosshair:_5},x5.type=r.polarCrosshair;const S5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},A5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},k5=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},C5=(t,e,i)=>{const s=e.domain();if(Ow(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},T5=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Ow(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},M5=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},w5=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}},E5=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),B5=(t,e,i)=>{if(Ow(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class P5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===Fj(Dj(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(P5,t$);class R5 extends EU{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:T5(t,this._stateScale,this._isHorizontal),a="percent"===n?e:T5(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=M5(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=B5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&w5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=Dj(t),this._isHorizontal="horizontal"===Fj(this._orient),this._dataFilterEvent=new P5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Ow(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>Fj(t._orient)===Fj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Ow(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};Tw(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Ow(d.getScale(0).type),p=Ow(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else Tw(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;XP(r,"dataview",Ia),YP(r,"dataFilterComputeDomain",k5);const a=new za(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Tz(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(YP(this._option.dataSet,"dataFilterWithNewDomain",A5),YP(this._option.dataSet,"lockStatisticsFilter",S5),Tw(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Ow(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;E5("start",i,this._spec)&&E5("end",s,this._spec)&&(t="percent"===i?this._spec.start:T5(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:T5(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?T5(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?T5(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=C5(this._start,this._stateScale,M5(i,this._isHorizontal)),this._endValue=C5(this._end,this._stateScale,M5(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Ow(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=B5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&Tw(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new AE:new iE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=w5(h);if(!this._dataUpdating&&Lw(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,Lw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(R5,t$);class O5 extends wU{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=uB({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const I5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),L5={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:I5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:I5(!0)},D5={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class F5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=O5,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=C5(e,this._stateScale,M5(s,this._isHorizontal)),a=C5(i,this._stateScale,M5(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new AE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(M5(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=M5(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return D5}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new AE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(M5(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Ow(t.type)||e[0]!==X(e))&&(!Lw(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:M5(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new vY(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:PP(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:PP(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:PP(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:PP(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:PP(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:PP(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:PP(g.style)},selectedBackgroundStyle:PP(this._spec.selectedBackground.style),dragMaskStyle:PP(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:uB(PP(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:uB(PP(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(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}=zH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(M5(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}F5.type=r.dataZoom,F5.transformerConstructor=O5,F5.builtInTheme={dataZoom:L5},F5.specKey="dataZoom";const z5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},H5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class j5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=vw(this._start,e)&&vw(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=M5(n,this._isHorizontal),a=C5(e,this._stateScale,r),o=C5(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return H5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new uG(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=PP(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=PP(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}j5.type=r.scrollBar,j5.builtInTheme={scrollBar:z5},j5.specKey="scrollBar";const N5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():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},U5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),V5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:U5("l1FontSize","primaryFontColor")},content:{visible:!0,style:U5("l2FontSize","tertiaryFontColor")}};class W5 extends EU{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){YP(this._option.dataSet,"indicatorFilter",N5);const t=new za(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 Tz(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=uB({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},BP(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?nB(l,this._computeLayoutRadius()):0,dy:h?nB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},BP(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new IX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}W5.type=r.indicator,W5.builtInTheme={indicator:V5},W5.specKey="indicator";const G5=["sum","average","min","max","variance","standardDeviation","median"];function Y5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function X5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function K5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&Y5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,X5(a,"xAxis"),t.x)),c=ZE(t.x)?J5(t.x,n)+r.x:Q5(h.getXAxisHelper(),[t.x])+r.x,c}function $5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&Y5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(a,"yAxis"),t.y)),c=ZE(t.y)?J5(t.y,n)+r.y:Q5(h.getYAxisHelper(),[t.y])+r.y,c}function q5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&Y5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"angleAxis"),t.angle)),Q5(o.angleAxisHelper,[t.angle])}function Z5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&Y5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"radiusAxis"),t.radius)),Q5(o.radiusAxisHelper,[t.radius])}function J5(t,e){return Number(t.substring(0,t.length-1))*e/100}function Q5(t,e){const i=t.getScale(0);return Ow(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function t3(t){return G5.includes(t)}function e3(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=K5(t,_,n,g,d,l,a),r=$5(t,b,n,g,u,l,a),i3(s,x,A,f.length),i3(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=K5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);i3(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=$5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);i3(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function i3(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=q5(t,h,n,a,r),i=Z5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=q5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=Z5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function n3(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function r3(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&Y5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,X5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&Y5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,X5(s,"yAxis"),d[0]))}(t,n3(t,e),i,n)})),a.forEach(((t,i)=>{const n=n3(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=ZE(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=ZE(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:Q5(n.getXAxisHelper(),p)+l.x+d,y:Q5(n.getYAxisHelper(),g)+l.y+u})})),r}function a3(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&Y5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&Y5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(s,"radiusAxis"),p[0])),n.push({angle:Q5(h.angleAxisHelper,u),radius:Q5(h.radiusAxisHelper,p)})})),n}function o3(t,e,i){let{x:s,y:n}=t;return ZE(s)&&(s=J5(s,e)),ZE(n)&&(n=J5(n,i)),{x:s,y:n}}function l3(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=o3(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>o3(t,n,r)))}function h3(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 c3(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},PP(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},u3(PP(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=u3(PP(r),i,s)),t}return{visible:!1}}function d3(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function u3(t,e,i){return d(t)?t(e,i):t}function p3(t,e){return d(t)?t(e):t}function g3(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 f3(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function m3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=f3(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function v3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=f3(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function y3(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function _3(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&t3(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&t3(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&t3(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&t3(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>x3(i,t,e))):i.x=x3(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>x3(i,t,e))):i.y=x3(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>x3(i,t,e))):i.angle=x3(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>x3(i,t,e))):i.radius=x3(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=x3(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const b3={min:(t,e)=>yw(t[0].latestData,e.field),max:(t,e)=>_w(t[0].latestData,e.field),sum:function(t,e){return bw(t[0].latestData,e.field)},average:function(t,e){return xw(t[0].latestData,e.field)},variance:function(t,e){return Sw(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(Sw(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function x3(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 b3[i](e,{field:s})}return t}function S3(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}const A3=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},k3=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},C3=t=>{if(!t)return;A3(t).forEach((e=>{k3(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{k3(e,t)}))},T3=(t,e)=>{if(!t)return;const i=new Set(A3(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(C3),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},M3="__vchart_marker_coordinate__",w3=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],E3=["position","positions","coordinatesOffset","regionRelative"],B3=["offsetX","offsetY","confine"],P3=t=>Array.isArray(t)?t.map(P3):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,R3=t=>{if(Array.isArray(t))return t.map(R3);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=R3(e[t])})),e},O3=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&w3.forEach((t=>{i[t]=M3})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),E3.forEach((t=>{t in i&&(i[t]=M3)})),"label"in i&&(i.label=P3(i.label)),Object.keys(i).forEach((t=>{i[t]=R3(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),B3.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=M3)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},P3(t)),{text:"__vchart_marker_text__"}))}return i};class I3 extends EU{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&t3(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Fa;return e.registerParser("array",s),new za(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&T3(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}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._updateMarkerLayout()}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._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=ww(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=QE(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QE(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(O3(e,{normalizeDomainPosition:i}),O3(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(O3(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),O3(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerFilter",S3),this._releaseMarkerData();const i=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function L3(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=yw(t,e),r=_w(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class D3 extends I3{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}=m3(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:u3(PP(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{line:d3(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return d3(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return d3(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:u3(PP(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:u3(PP(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=h3([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=m3(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerRegression",L3),YP(this._option.dataSet,"markerFilter",S3);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new za(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()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}D3.specKey="markLine";const F3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),z3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},H3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:F3(!1),endSymbol:F3(!0),label:z3};class j3 extends D3{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new sX(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}=m3(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=e3(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=r3(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=l3(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(ZE(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.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));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=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}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_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}=m3(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 za(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}j3.type=r.markLine,j3.coordinateType="cartesian",j3.builtInTheme={markLine:H3};class N3 extends D3{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=m3(this._spec);return e||i?new aX(t):new sX(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}=m3(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=s3(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=a3(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=m3(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}}}N3.type=r.polarMarkLine,N3.coordinateType="polar",N3.builtInTheme={polarMarkLine:H3};class U3 extends EU{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=qE(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return HH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=QE(this._spec.width,a.width,null,a.width),l=QE(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new RX(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}}U3.type=r.title,U3.specKey=r.title,U3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class V3 extends I3{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=v3(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:u3(PP(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{area:d3(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>d3(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return d3(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=h3([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=v3(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}V3.specKey="markArea";const W3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class G3 extends V3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new rX(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=v3(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=r3(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=l3(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=v3(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}}}G3.type=r.markArea,G3.coordinateType="cartesian",G3.builtInTheme={markArea:W3};class Y3 extends V3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=v3(this._spec);return i||e||s?new oX(t):new rX(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}=v3(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=s3(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());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=a3(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=v3(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}}}Y3.type=r.polarMarkArea,Y3.coordinateType="polar",Y3.builtInTheme={polarMarkArea:W3};const X3=t=>PP(Object.assign({},t)),K3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},PP(t.style))}),$3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=X3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=X3(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:{},PP(Object.assign({},_)));var _;const b=K3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=K3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=K3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=K3(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},q3=t=>"left"===t||"right"===t,Z3=t=>"top"===t||"bottom"===t,J3={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Q3 extends EU{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({},$3(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({},$3(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?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new KX(t):this._playerComponent=new ZX(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=q3(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=q3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(UX.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(UX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(UX.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(UX.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(UX.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(UX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=q3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Z3(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):q3(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))):Z3(this._orient)?this._maxSize():t.height}_computeDx(t){return q3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Z3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){var i,s;const n=null===(i=this._specs)||void 0===i?void 0:i[e];n&&(null===(s=this._option)||void 0===s?void 0:s.globalInstance)&&(this._option.globalInstance.updateFullData(n.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:n,index:e,specs:this._specs}}))}release(){var e,i,s,n;null===(i=null===(e=this._playerComponent)||void 0===e?void 0:e.pause)||void 0===i||i.call(e),null===(n=null===(s=this._option)||void 0===s?void 0:s.globalInstance)||void 0===n||n.off(t.ChartEvent.rendered,this.autoPlayCallback),super.release(),this._playerComponent=null,this._cacheAttrs=null,this._specs=[]}}Q3.builtInTheme={player:J3},Q3.specKey="player",Q3.type=r.player;class t4 extends EU{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,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=HE({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==tz.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}t4.type=r.label;class e4 extends rq{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}e4.type="text",e4.constructorType="label";const i4=()=>{aq(),vB.registerMark(e4.constructorType,e4)};class s4 extends wU{_initTheme(t,e){return{spec:t,theme:this._theme}}}class n4 extends t4{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=s4,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(FP.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(FP.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Tw(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=uB({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},x$(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[rP])):t=>t.filter((t=>t.data[nP]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?S$(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}n4.type=r.label,n4.specKey="label",n4.transformerConstructor=s4;class r4 extends t4{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[iP]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return uB({textStyle:{pickable:!0===this._spec.interactive},position:a4(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[rP]:t.data[nP]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>S$({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function a4(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}r4.type=r.totalLabel,r4.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},r4.specKey="totalLabel";class o4 extends I3{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=y3(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,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,O,I,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=u3(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=c3(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=u3(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=PP(u3(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=u3(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=u3(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:p3(D.offsetX,j),offsetY:p3(D.offsetY,j)},et),{style:u3(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:u3(z.style,this._markerData,this._markAttributeContext)},state:{line:d3(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:d3(it,this._markerData,this._markAttributeContext),textBackground:d3(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:d3(null!==(I=null===(O=this._spec.targetSymbol)||void 0===O?void 0:O.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:PP(lt.style)}):{visible:!1};return new hX(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:PP(C.style)}):{visible:!1},w=c3(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=h3([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=p3(S.offsetX,A),f=p3(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:g3(y,s,A),offsetY:g3(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=y3(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}o4.specKey="markPoint";const l4={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class h4 extends o4{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=e3(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=r3(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=l3(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=y3(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}}}h4.type=r.markPoint,h4.coordinateType="cartesian",h4.builtInTheme={markPoint:l4};class c4 extends o4{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=s3(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}c4.type=r.polarMarkPoint,c4.coordinateType="polar",c4.builtInTheme={polarMarkPoint:l4};class d4 extends o4{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}])]}}}d4.type=r.geoMarkPoint,d4.coordinateType="geo",d4.builtInTheme={geoMarkPoint:l4};const u4="inBrush",p4="outOfBrush",g4={style:!0,inBrush:!0,outOfBrush:!0};class f4 extends EU{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),u4,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),p4,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||g4[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:PP(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new eK(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:PP(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener($X.brushActive,(s=>{this._initMarkBrushState(i,p4),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener($X.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener($X.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener($X.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},PP(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];Yz(t,[...s.filter((t=>t!==u4&&t!==p4)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,u4),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,p4),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,u4),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,p4),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;Kz(s,[u4,p4]),i&&Xz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}f4.type=r.brush,f4.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},f4.specKey="brush";const m4={style:!0,state:!0};class v4 extends EU{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${NB}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||m4[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_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 Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}v4.type=r.customMark,v4.specKey="customMark";class y4{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>_4(t))),a=n.filter((t=>!_4(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>_4(t))),h=o.filter((t=>!_4(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 _4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}y4.type="grid";const b4=t=>{t?function(t){if(!t)throw new Error("installPoptipToApp requires an app instance");WA(t),MG(NA()),UA(),GA(t)}(t):(MG(m_()),MG(NA()),UA())},x4="vchart-tooltip",S4=`${x4}-container`,A4=`${x4}-title`,k4=`${x4}-content-box`,C4={offsetX:10,offsetY:10},T4="99999999999999";function M4(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const w4=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,E4=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?M4(t):"",B4=(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},P4={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},R4=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=P4[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class O4 extends sU{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=VH(null==T?void 0:T.position,b,e),w=null!==(r=VH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:UB,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:VB;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=_M(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=w4(e,F),N=w4(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(R4(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=B4(t,y),W.top=B4(i,y),W.right=B4(e,y),W.bottom=B4(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=B4(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?O:I,n="x"===t?A:C,r=R4(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",L4=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=I4(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=I4(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},D4=(t={})=>{const{lineHeight:e}=t;return t.fontSize?QE(e,t.fontSize):0},F4=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=I4(o)),{panelStyle:a,panelPadding:o}};function z4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const H4=t=>!!t&&1===t.nodeType&&"function"==typeof t.appendChild&&!!t.children;class j4 extends O4{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(j4.type),this.type=GW.dom,this._tooltipContainer=null==yM?void 0:yM.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}_getTooltipParentElement(t){return H4(t.parentElement)?t.parentElement:H4(this._chartContainer)?this._chartContainer:H4(null==yM?void 0:yM.body)?yM.body:void 0}initEl(){const t=this._component.getSpec(),e=this._getTooltipParentElement(t);if(yM&&e){for(let t=0;t{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=F4(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:I4(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=L4(h),x=L4(d),S=L4(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=I4(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=I4(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=I4(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(D4(p),D4(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(A4))),l=a.find((t=>t.className.includes(k4)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(A4),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(z4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${x4}-column`),e.classList.add(`${x4}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(k4),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];z4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));z4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${x4}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=E4(e.key),e.keyStyle&&L4(e.keyStyle,l)):"value"===i?(o.innerHTML=E4(e.value),e.valueStyle&&L4(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?M4(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?M4(c):m,_=p,b=t=>new Wg({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=su.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?M4(u):"currentColor",`\n \n \n \n `;const M=T?su.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),z4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(k4))),h=[...o.children].find((t=>t.className.includes(A4)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(A4)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=QE(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,z4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=fv({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function V4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:N4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const W4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class G4 extends O4{constructor(){super(G4.type),this.type=GW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new aK({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=iB(d.padding),x=V4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=V4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=V4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:W4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.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:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=uB({},S,V4(b,void 0,{})),{width:s,height:n,text:r}=U4(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=uB({},A,V4(x,void 0,{})),{width:e,height:s,text:n}=U4(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};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=uB({},x,V4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=U4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}G4.type=GW.canvas;const Y4=/\{([^}]+)\}/,X4=/\{([^}]+)\}/g,K4=/:/;class $4 extends sU{constructor(){super($4.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.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[$4.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)),vB.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=Y4.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(X4,((t,i)=>{if(!K4.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 this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}$4.pluginType="chart",$4.specKey="formatter",$4.type="formatterPlugin";RH.useRegisters([()=>{qW(),JW(),tG(),MW(),TW(),lW(),QV(),UN(),WN(),yH(),fH(),OV(),$V(),vB.registerSeries(hW.type,hW),vB.registerChart(eG.type,eG)},()=>{qW(),JW(),tG(),TW(),lW(),QV(),UN(),nG(),WN(),oG(),OV(),$V(),vB.registerSeries(cK.type,cK),MW(),vB.registerChart(uK.type,uK)},()=>{qW(),JW(),tG(),TW(),MK(),MW(),vB.registerChart(EK.type,EK)},()=>{qW(),JW(),MW(),TW(),jK(),vB.registerChart(UK.type,UK)},()=>{JW(),Nq(),vB.registerChart(X1.type,X1)},()=>{qW(),JW(),MW(),TW(),aZ(),vB.registerChart(q1.type,q1)},()=>{qW(),JW(),tG(),MW(),TW(),fZ(),vB.registerChart(J1.type,J1)},()=>{qW(),JW(),tG(),MW(),TW(),MK(),vB.registerTransform("bin",Qr),vB.registerChart(n2.type,n2)},()=>{JW(),i$(),XK(),vB.registerSeries(n$.type,n$),vB.registerImplement("registerMap",ZP),vB.registerImplement("unregisterMap",JP),mH(),vB.registerChart(N1.type,N1)},()=>{JW(),i1(),vB.registerSeries(n1.type,n1),Oq(),OZ(),iZ(),FZ(),vB.registerChart(l2.type,l2)},()=>{JW(),MQ(),vB.registerChart(d2.type,d2)},()=>{JW(),KQ(),vB.registerChart(p2.type,p2)},()=>{qW(),JW(),tG(),MW(),TW(),I$(),vB.registerChart(C2.type,C2)},()=>{qW(),JW(),MW(),TW(),nq(),vB.registerTransform("boxplot",ta),vB.registerChart(M2.type,M2)},()=>{qW(),JW(),MW(),TW(),FZ(),vB.registerChart(a2.type,a2)},()=>{qW(),JW(),MW(),TW(),YZ(),vB.registerChart(f2.type,f2)},()=>{qW(),JW(),MW(),TW(),fq(),vB.registerChart(v2.type,v2)},()=>{qW(),JW(),tG(),MW(),TW(),nG(),OV(),$V(),vB.registerSeries(bq.type,bq),vB.registerChart(P2.type,P2)},()=>{JW(),u0(),vB.registerChart(_2.type,_2)},()=>{JW(),y0(),vB.registerChart(x2.type,x2)},()=>{JW(),Y0(),vB.registerChart(A2.type,A2)},()=>{JW(),gG(),z0(),vB.registerChart(E2.type,E2)},()=>{JW(),u1(),vB.registerChart(O2.type,O2)},()=>{JW(),M1(),vB.registerChart(L2.type,L2)},()=>{qW(),JW(),tG(),MW(),vB.registerChart(t2.type,t2),TW()},$V,OV,()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(oK.type,oK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(lK.type,lK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(hK.type,hK)},nZ,iZ,()=>{vB.registerComponent(U2.type,U2)},()=>{vB.registerComponent(t5.type,t5)},()=>{vB.registerComponent(d5.type,d5)},()=>{vB.registerComponent(b5.type,b5)},()=>{vB.registerComponent(x5.type,x5)},()=>{vB.registerComponent(F5.type,F5)},()=>{vB.registerComponent(j5.type,j5)},()=>{vB.registerComponent(W5.type,W5)},i$,()=>{vB.registerComponent(j3.type,j3),iX()},()=>{vB.registerComponent(G3.type,G3),nX()},()=>{vB.registerComponent(h4.type,h4),lX()},()=>{vB.registerComponent(N3.type,N3),aX._animate=FY,iX()},()=>{vB.registerComponent(Y3.type,Y3),oX._animate=HY,nX()},()=>{vB.registerComponent(c4.type,c4),lX()},()=>{vB.registerComponent(d4.type,d4),lX()},()=>{vB.registerComponent(U3.type,U3)},()=>{vB.registerComponent(Q3.type,Q3)},()=>{vB.registerGraphicComponent(n4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(n4.type,n4,!0,1/0)},()=>{vB.registerGraphicComponent(r4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(r4.type,r4,!0)},()=>{vB.registerComponent(f4.type,f4)},()=>{vB.registerComponent(v4.type,v4)},()=>{vB.registerRuntimePluginInstaller("poptipForText",b4),b4()},()=>{vB.registerLayout(y4.type,y4)},()=>{var t;t=G4,vB.registerComponentPlugin(t.type,t)},()=>{var t;t=$4,vB.registerChartPlugin(t.type,t)},kH,MH]),RH.useRegisters([()=>{BO(iA)}]),t.DEFAULT_CHART_HEIGHT=VB,t.DEFAULT_CHART_WIDTH=UB,t.DEFAULT_CLOSE_STROKE_JOIN=LH,t.DEFAULT_DATA_INDEX=GB,t.DEFAULT_DATA_KEY=YB,t.DEFAULT_DATA_SERIES_FIELD=XB,t.DEFAULT_KEY=uP,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=IH,t.DEFAULT_MAP_LOOK_UP_KEY=pP,t.DEFAULT_MEASURE_CANVAS_ID=WB,t.DEFAULT_SERIES_STYLE_NAME=KB,t.DEFAULT_SMOOTH_INTERPOLATE=OH,t.Factory=vB,t.MOSAIC_CAT_END_PERCENT=hP,t.MOSAIC_CAT_START_PERCENT=lP,t.MOSAIC_VALUE_END_PERCENT=oP,t.MOSAIC_VALUE_START_PERCENT=aP,t.ManualTicker=class extends pb{constructor(t){super(t),this.lastFrameTime=0,this.status=wl.RUNNING}setupTickHandler(){const t=new DH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,!0}},t.PREFIX=NB,t.SEGMENT_FIELD_END=dP,t.SEGMENT_FIELD_START=cP,t.STACK_FIELD_END=ZB,t.STACK_FIELD_END_OffsetSilhouette=eP,t.STACK_FIELD_END_PERCENT=QB,t.STACK_FIELD_KEY=$B,t.STACK_FIELD_START=qB,t.STACK_FIELD_START_OffsetSilhouette=tP,t.STACK_FIELD_START_PERCENT=JB,t.STACK_FIELD_TOTAL=iP,t.STACK_FIELD_TOTAL_BOTTOM=rP,t.STACK_FIELD_TOTAL_PERCENT=sP,t.STACK_FIELD_TOTAL_TOP=nP,t.StreamLight=eF,t.ThemeManager=OB,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=RH,t.boundsInRect=eB,t.builtinThemes=SB,t.calcLayoutNumber=QE,t.calcPadding=tB,t.computeActualDataScheme=FE,t.convertPoint=sB,t.createArc=Vp,t.createArea=Yp,t.createGroup=tg,t.createLine=ag,t.createRect=mg,t.createRichText=jg,t.createSymbol=Gg,t.createText=Jg,t.darkTheme=cB,t.dataScheme=rB,t.default=RH,t.defaultThemeName=AB,t.getActualColor=HE,t.getActualNumValue=nB,t.getColorSchemeBySeries=VE,t.getDataScheme=DE,t.getFunnelTheme=bB,t.getMergedTheme=PB,t.getSpecInfo=HH,t.getTheme=wB,t.hasThemeMerged=TB,t.isColorKey=jE,t.isPercent=ZE,t.isPercentOffset=JE,t.isProgressiveDataColorScheme=NE,t.isTokenKey=oB,t.isValidOrient=qE,t.lightTheme=hB,t.lookup=jH,t.measureText=jB,t.normalizeLayoutPaddingSpec=iB,t.queryColorFromColorScheme=zE,t.queryToken=aB,t.registerDataSetInstanceParser=XP,t.registerDataSetInstanceTransform=YP,t.registerTheme=MB,t.removeTheme=EB,t.themeExist=BB,t.themes=kB,t.token=lB,t.transformColorSchemeToStandardStruct=UE,t.transformToGraphic=PP,t.version="2.1.3",t.vglobal=b_,t.warn=gM,Object.defineProperty(t,"__esModule",{value:!0})})); +let mQ=class t extends nQ{constructor(e){super(H({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),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 C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[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(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?uQ(t,o,l.width,l.height,h):"geometric"===t.type&&fQ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=tQ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};mQ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vQ extends nQ{constructor(t){super(H({},vQ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vQ.defaultOptions={enlarge:!1};const _Q={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bQ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xQ(t.fontFamily):"sans-serif",d=t.fontStyle?xQ(t.fontStyle):"normal",u=t.fontWeight?xQ(t.fontWeight):"normal",p=t.rotate?xQ(t.rotate):0,g=xQ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?xQ(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},_Q),t.as):_Q,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?xQ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=AQ(kQ(t,l),w);M=i=>e(t(i))}let E=aQ;"fast"===t.layoutType?E=vQ:"grid"===t.layoutType&&(E=mQ);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},xQ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],SQ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),AQ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SQ(t[0]),n=SQ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SQ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},kQ=(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 CQ(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{vB.registerGrammarTransform("wordcloud",{transform:bQ}),aq(),vB.registerAnimation("wordCloud",((t,e)=>({appear:sJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:uH.disappear.duration}}))),vB.registerSeries(TQ.type,TQ)},wQ=t=>d(t)?t():t,EQ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=wQ(e.valueField),v=null!==(i=wQ(e.heightVisual))&&void 0!==i&&i,y=null===(s=wQ(e.isCone))||void 0===s||s,_=wQ(e.range),b=a.reduce(((t,e)=>{const i=Number.parseFloat(e[m]);return k(i)?Math.max(t,i):t}),-1/0),x=null!==(n=null==_?void 0:_.min)&&void 0!==n?n:0,S=null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b,A=t=>k(t)&&k(x)&&k(S)?x===S?t{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0,S=A(n);p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=S),d&&(t[d]=e===a.length-1?y?0:t[c]:A(_)),u&&(t[u]=0===e?1:A(r)),g&&(t[g]=n)})),a},BQ=(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},PQ=`${NB}_FUNNEL_TRANSFORM_RATIO`,RQ=`${NB}_FUNNEL_REACH_RATIO`,OQ=`${NB}_FUNNEL_HEIGHT_RATIO`,IQ=`${NB}_FUNNEL_VALUE_RATIO`,LQ=`${NB}_FUNNEL_LAST_VALUE_RATIO`,DQ=`${NB}_FUNNEL_NEXT_VALUE_RATIO`,FQ=`${NB}_FUNNEL_LAST_VALUE`,zQ=`${NB}_FUNNEL_CURRENT_VALUE`,HQ=`${NB}_FUNNEL_NEXT_VALUE`,jQ=`${NB}_FUNNEL_TRANSFORM_LEVEL`;class NQ extends KH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[RQ])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class UQ extends qz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VQ extends UQ{constructor(){super(...arguments),this.type=VQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VQ.type="polygon";const WQ=()=>{vB.registerMark(VQ.type,VQ),KT(),yT(),w_.registerBuiltInAnimate("growPointsOut",VL),vB.registerGraphicComponent("polygon",ug)},GQ=Object.assign(Object.assign({},aj),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YQ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class XQ extends Ej{constructor(){super(...arguments),this.type=PE.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"funnel",EQ),YP(this._dataSet,"funnelTransform",BQ);const t=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new Tz(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:zQ,asTransformRatio:PQ,asReachRatio:RQ,asHeightRatio:OQ,asValueRatio:IQ,asNextValueRatio:DQ,asLastValueRatio:LQ,asLastValue:FQ,asNextValue:HQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:jQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},XQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:yj(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},XQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(XQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(XQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new NQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&uM(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&uM(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ew(RQ).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(gj(null===(s=vB.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),fj("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("fadeInOut")(),fj(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("funnel")({},o),fj(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(gj(null===(a=vB.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),fj("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[LQ])/2:this._getSecondaryAxisLength(t[IQ])/2,n=this._getSecondaryAxisLength(t[IQ])/2):(s=this._getSecondaryAxisLength(t[IQ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[DQ])/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[jQ])}_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[YB]===t[YB]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{WQ(),aq(),g$(),vB.registerSeries(XQ.type,XQ),vB.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},gH))),vB.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:lH,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),mH()},$Q=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},qQ=t=>{const e=t.filter((t=>t.context.diffState===tz.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},ZQ=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},JQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),QQ=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},t0=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),e0=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},i0=(t,e={})=>{if(!t)return[];const i=[];return oJ(t,i,e),i},s0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new LJ(i).layout(t,{width:s,height:n})};class n0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var r0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(r0||(r0={}));const a0=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===r0.DrillDown){return Y(AP(t,n,s,"children"))}if(i.type===r0.DrillUp){const e=kP(t,n,s,"children");if(e)return Y(e)}return t};class o0{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=JK(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;YP(t,"drillFilter",a0),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:r0.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:r0.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:r0.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:r0.DrillUp},model:this}),r}}const l0=Object.assign(Object.assign({},aj),{sunburst:{name:"sunburst",type:"arc"}}),h0=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:QH,operations:["max","min","values"]}),t.push({key:tj,operations:["values"]}),t),c0={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class d0 extends xq{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),YP(this._dataSet,"sunburstLayout",s0),YP(this._dataSet,"flatten",i0),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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(d0.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(d0.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new n0(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(gj(null===(e=vB.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}d0.type=PE.sunburst,d0.mark=l0,d0.builtInTheme={sunburst:c0},G(d0,o0);const u0=()=>{vB.registerSeries(d0.type,d0),Oq(),aq(),mH(),vB.registerAnimation("sunburst",((t,e)=>({appear:e0(0,e),enter:JQ(t),exit:t0(t),disappear:{duration:uH.disappear.duration}})))},p0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new AJ(i).layout(t,{width:s,height:n})};class g0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const f0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},m0=Object.assign(Object.assign({},aj),{circlePacking:{name:"circlePacking",type:"arc"}});class v0 extends Rj{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},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),YP(this._dataSet,"circlePackingLayout",p0),YP(this._dataSet,"flatten",i0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return h0(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new g0(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}v0.type=PE.circlePacking,v0.mark=m0,v0.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(v0,o0);const y0=()=>{vB.registerSeries(v0.type,v0),Oq(),aq(),fH(),vB.registerAnimation("circlePacking",((t,e)=>({appear:f0(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:uH.disappear.duration}})))},_0=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&_0(t,e.children,i)}))},b0=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},x0=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=S0(n,i),a=new RJ(i),o=[];return o.push(a.layout(r,s)),o},S0=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},A0=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:[]},k0=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 C0 extends KH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const T0=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),M0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:T0(t),w0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class E0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class B0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const P0=(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`},R0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class O0 extends j${constructor(){super(...arguments),this.type=O0.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?R0:P0,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}O0.type="linkPath";const I0=Object.assign(Object.assign({},aj),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class L0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const D0=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&Kz(t,e),Xz(t,e,s,n)};class F0 extends Rj{constructor(){super(...arguments),this.type=PE.sankey,this.transformerConstructor=L0,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=IP(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=IP(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):r.target===i.key?(s.includes(r.source)||s.push(r.source),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=IP(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),D0(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation())):(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=IP(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=IP(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=IP(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=IP(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=IP(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s},!0,this._hasLinkStateAnimation())}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value},!0,this._hasLinkStateAnimation());Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(IP(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=IP(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=IP(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation());const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a},!0,this._hasLinkStateAnimation())}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value},!0,this._hasLinkStateAnimation());Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}_hasStateAnimation(t){var e;return xj(this)&&!!(null===(e=null==t?void 0:t.hasAnimationByState)||void 0===e?void 0:e.call(t,"state"))}_hasLinkStateAnimation(){return this._hasStateAnimation(this._linkMark)}_hasNodeStateAnimation(){return this._hasStateAnimation(this._nodeMark)}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){YP(this._dataSet,"sankeyLayout",x0),YP(this._dataSet,"sankeyFormat",b0),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;YP(s,"sankeyNodes",A0),YP(s,"flatten",i0);const n=new za(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.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),n.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._nodesSeriesData=n,YP(s,"sankeyLinks",k0);const r=new za(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(F0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(F0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=zH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),fj("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),fj("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:NP.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(IP(e).key)?Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasNodeStateAnimation()):Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasNodeStateAnimation())}))}initTooltip(){this._tooltipHelper=new C0(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new WE;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return _0(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}F0.type=PE.sankey,F0.transformerConstructor=L0,F0.mark=I0,F0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const z0=()=>{bK(),N$(),cT(),vB.registerGraphicComponent("path",(t=>hg(t))),vB.registerMark(O0.type,O0),aq(),vB.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:M0(t,e)},gH))),vB.registerAnimation("sankeyLinkPath",((t,e)=>({appear:w0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:uH.disappear.duration}}))),w_.registerBuiltInAnimate("linkPathGrowOut",B0),w_.registerBuiltInAnimate("linkPathGrowIn",E0),mH(),vB.registerSeries(F0.type,F0)},H0=(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=i0(n);return i=qH([{latestData:r}],e),i};class j0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const N0=Object.assign(Object.assign({},aj),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),U0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class V0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const W0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new HJ(i).layout(t,s),n=[];return oJ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[tj,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class G0 extends Rj{constructor(){super(...arguments),this.type=PE.treemap,this.transformerConstructor=V0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,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:tj),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),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:YB},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),YP(this._dataSet,"treemap",W0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=H0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){YP(this._dataSet,"hierarchyDimensionStatistics",H0),YP(this._dataSet,"flatten",i0);const i=new za(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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(G0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(G0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("treemap"))||void 0===e?void 0:e(),fj(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 j0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(FP.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(FP.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}G0.type=PE.treemap,G0.mark=N0,G0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},G0.transformerConstructor=V0,G(G0,o0),G(G0,t$);const Y0=()=>{vB.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),vB.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),bK(),aq(),vB.registerAnimation("treemap",((t,e)=>({appear:U0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(G0.type,G0)},X0=Object.assign(Object.assign({},MZ),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),K0=Object.assign(Object.assign({},aj),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),$0={type:"fadeIn"};function q0(t,e){return"fadeIn"===e?$0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class Z0 extends Sj{constructor(){super(...arguments),this._supportStack=!1}}class J0 extends KH{enableByType(t){return"dimension"!==t}}const Q0="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",t1={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:Q0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Q0,fill:"#ddd"}}};class e1 extends EZ{constructor(){super(...arguments),this.type=PE.gaugePointer,this.transformerConstructor=Z0,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(e1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},e1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(e1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new J0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}e1.type=PE.gaugePointer,e1.mark=K0,e1.builtInTheme={gaugePointer:t1},e1.transformerConstructor=Z0;const i1=()=>{vB.registerSeries(e1.type,e1),XK(),bK(),vB.registerAnimation("gaugePointer",((t,e)=>{const i=q0(t,e);return{appear:i,enter:i,disappear:{duration:uH.disappear.duration}}})),nZ(),iZ()};class s1 extends Sj{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class n1 extends EZ{constructor(){super(...arguments),this.type=PE.gauge,this.transformerConstructor=s1,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();YP(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[dP]=t[this._angleField[0]],t[cP]=e>0?i[e-1][dP]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(n1.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(n1.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[cP])?this.angleAxisHelper.dataToPosition([t[cP]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[dP]])}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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}n1.type=PE.gauge,n1.mark=X0,n1.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},n1.transformerConstructor=s1;class r1 extends qz{constructor(){super(...arguments),this.type=r1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Gg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}r1.type="cell";function a1(t){return!1===t?{}:{type:"fadeIn"}}class o1 extends KH{enableByType(t){return"dimension"!==t}}const l1=Object.assign(Object.assign({},aj),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class h1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const c1={valueField:!0};class d1 extends Rj{constructor(){super(...arguments),this.type=PE.heatmap,this.transformerConstructor=h1}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),c1)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(d1.mark.cell,{isSeriesMark:!0},{morph:yj(this._spec,d1.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(d1.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Pj(this);this._cellMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),fj("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 o1(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}d1.type=PE.heatmap,d1.mark=l1,d1.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},d1.transformerConstructor=h1;const u1=()=>{aq(),vB.registerMark(r1.type,r1),vB.registerGraphicComponent("symbol",Gg),KT(),iM(),jN(),vB.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},gH),{appear:a1(e)}))),OV(),$V(),vB.registerSeries(d1.type,d1)},p1=Object.assign(Object.assign({},aj),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),g1=`${NB}_CORRELATION_X`,f1=`${NB}_CORRELATION_Y`,m1=`${NB}_CORRELATION_SIZE`,v1=t=>d(t)?t():t,y1=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=v1(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=v1(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=v1(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(v1(e.outerRadius),f),y=v1(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(v1(e.field)),A=c.map(x),[k,C]=It(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=v1(e.radiusField),w=v1(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?It(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),O=Math.max(p,g),I=_1(R,O,c.length),L=[],D=(O-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),b1({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>O?a=R: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},b1=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,S1=(t,e)=>{if(!t||!_(t))return[];const i=x1(e.keyword),s=x1(e.categoryField),n=t[0].latestData[0];return{[s]:i,[GB]:null==n?void 0:n[GB],[XB]:null==n?void 0:n[XB]}};class A1 extends j${constructor(){super(...arguments),this.type=A1.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}A1.type="ripple";const k1=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class C1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class T1 extends xq{constructor(){super(...arguments),this.type=PE.correlation,this.transformerConstructor=C1,this._viewBox=new Ue}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(){if(super.initData(),!this._data)return;YP(this._dataSet,"correlation",y1);const t=new Fa;XP(t,"dataview",Ia),YP(t,"correlationCenter",S1);const e=new za(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return 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 Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(T1.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:GB});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(T1.mark.ripplePoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(T1.mark.centerPoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[g1],y:t=>t[f1],size:t=>t[m1],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),fj("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}T1.type=PE.correlation,T1.mark=p1,T1.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},T1.transformerConstructor=C1;const M1=()=>{WN(),N$(),iM(),vB.registerMark(A1.type,A1),vB.registerGraphicComponent("symbol",(t=>Gg(t))),vB.registerSeries(T1.type,T1),vB.registerAnimation("correlation",((t,e)=>Object.assign({appear:k1(0,e)},pH)))},w1=Object.assign(Object.assign({},aj),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class E1 extends j${constructor(){super(...arguments),this.type=E1.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}E1.type="liquid";const B1=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class P1 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class R1 extends Ej{constructor(){super(...arguments),this.type=PE.liquid,this.transformerConstructor=GN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=mg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Gg({x:s,y:n,size:r,symbolType:B1(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=iB(this._spec.outlineMargin),this._paddingSpec=iB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(R1.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(R1.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(R1.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(R1.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new P1(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),fj("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),fj("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=RM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}R1.type=PE.liquid,R1.mark=w1,R1.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},R1.transformerConstructor=GN;const O1=t=>Y(t).join(",");class I1 extends KH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]])}}const L1=Object.assign(Object.assign({},aj),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class D1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const F1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?ZJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class z1 extends Ej{constructor(){super(...arguments),this.type=PE.venn,this.transformerConstructor=D1,this._viewBox=new Ue}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:YB)}initData(){var t;super.initData(),YP(this._dataSet,"venn",F1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(z1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(z1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new I1(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:O1(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return O1(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[O1(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(O1(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}}z1.type=PE.venn,z1.mark=L1,z1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},z1.transformerConstructor=D1;class H1 extends TK{constructor(){super(...arguments),this.type=PE.mosaic,this.transformerConstructor=kK}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(oP),this.setFieldX2(aP)),this.setFieldY(hP),this.setFieldY2(lP)):(t&&(this.setFieldY(oP),this.setFieldY2(aP)),this.setFieldX(hP),this.setFieldX2(lP)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}H1.type=PE.mosaic,H1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},H1.transformerConstructor=kK;class j1 extends yW{_isValidSeries(t){return t===PE.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class N1 extends fW{constructor(){super(...arguments),this.transformerConstructor=j1,this.type="map",this.seriesType=PE.map}}N1.type="map",N1.seriesType=PE.map,N1.transformerConstructor=j1;class U1 extends yW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class V1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=oU(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,uB({},s,l)),n&&Object.assign(o,uB({},n,o))}}class W1 extends U1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class G1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class Y1 extends fW{constructor(){super(...arguments),this.transformerConstructor=G1}}Y1.transformerConstructor=G1;class X1 extends Y1{constructor(){super(...arguments),this.transformerConstructor=G1,this.type="pie",this.seriesType=PE.pie}}X1.type="pie",X1.seriesType=PE.pie,X1.transformerConstructor=G1;class K1 extends W1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:AU,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:AU,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>uB({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const $1=(t,e)=>{if(!t)return null;const i=Yj(t,(t=>"angle"===t.getOrient()),e),s=Yj(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Lw(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=Aw({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=kw(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=Wj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Lw(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=Aw({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=kw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=Wj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class q1 extends fW{constructor(){super(...arguments),this.transformerConstructor=K1,this.type="rose",this.seriesType=PE.rose}_setModelOption(){this._modelOption.getDimensionInfo=$1}}q1.type="rose",q1.seriesType=PE.rose,q1.transformerConstructor=K1,G(q1,AW);class Z1 extends W1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=uB({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}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=>uB({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class J1 extends fW{constructor(){super(...arguments),this.transformerConstructor=Z1,this.type="radar",this.seriesType=PE.radar}_setModelOption(){this._modelOption.getDimensionInfo=$1}}J1.type="radar",J1.seriesType=PE.radar,J1.transformerConstructor=Z1,G(J1,AW);class Q1 extends yW{_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")&&uB(e,qF(this.type,t))})),this._transformAxisSpec(t)}}class t2 extends fW{constructor(){super(...arguments),this.transformerConstructor=Q1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=OW(t,e,i))&&void 0!==s?s:[],...null!==(n=$1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}t2.type="common",t2.transformerConstructor=Q1,G(t2,AW);class e2 extends _W{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class i2 extends fW{constructor(){super(...arguments),this.transformerConstructor=e2}}i2.transformerConstructor=e2,G(i2,AW);class s2 extends e2{transformSpec(t){super.transformSpec(t),WF(t)}}class n2 extends i2{constructor(){super(...arguments),this.transformerConstructor=s2,this.type="histogram",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}n2.type="histogram",n2.seriesType=PE.bar,n2.transformerConstructor=s2;class r2 extends V1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class a2 extends fW{constructor(){super(...arguments),this.transformerConstructor=r2,this.type="circularProgress",this.seriesType=PE.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=$1}}a2.type="circularProgress",a2.seriesType=PE.circularProgress,a2.transformerConstructor=r2,G(a2,AW);class o2 extends V1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=PE.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===PE.gauge||t.type===PE.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===PE.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 l2 extends fW{constructor(){super(...arguments),this.transformerConstructor=o2,this.type="gauge",this.seriesType=PE.gaugePointer}}l2.type="gauge",l2.seriesType=PE.gaugePointer,l2.transformerConstructor=o2;class h2 extends yW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class c2 extends fW{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}c2.transformerConstructor=h2;class d2 extends c2{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}d2.type="wordCloud",d2.seriesType=PE.wordCloud,d2.transformerConstructor=h2;class u2 extends yW{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class p2 extends fW{constructor(){super(...arguments),this.transformerConstructor=u2,this.type="funnel",this.seriesType=PE.funnel}}p2.type="funnel",p2.seriesType=PE.funnel,p2.transformerConstructor=u2;class g2 extends _W{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=oU(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=oU(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class f2 extends fW{constructor(){super(...arguments),this.transformerConstructor=g2,this.type="linearProgress",this.seriesType=PE.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}f2.type="linearProgress",f2.seriesType=PE.linearProgress,f2.transformerConstructor=g2,G(f2,AW);class m2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),WF(t)}}class v2 extends fW{constructor(){super(...arguments),this.transformerConstructor=m2,this.type="rangeColumn",this.seriesType=PE.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}v2.type="rangeColumn",v2.seriesType=PE.rangeColumn,v2.transformerConstructor=m2;class y2 extends yW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _2 extends fW{constructor(){super(...arguments),this.transformerConstructor=y2,this.type="sunburst",this.seriesType=PE.sunburst}}_2.type="sunburst",_2.seriesType=PE.sunburst,_2.transformerConstructor=y2;class b2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class x2 extends fW{constructor(){super(...arguments),this.transformerConstructor=b2,this.type="circlePacking",this.seriesType=PE.circlePacking}}x2.type="circlePacking",x2.seriesType=PE.circlePacking,x2.transformerConstructor=b2;class S2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class A2 extends fW{constructor(){super(...arguments),this.transformerConstructor=S2,this.type="treemap",this.seriesType=PE.treemap}}A2.type="treemap",A2.seriesType=PE.treemap,A2.transformerConstructor=S2;class k2 extends wK{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),WF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class C2 extends EK{constructor(){super(...arguments),this.transformerConstructor=k2,this.type="waterfall",this.seriesType=PE.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}C2.type="waterfall",C2.seriesType=PE.waterfall,C2.transformerConstructor=k2;class T2 extends _W{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),WF(t)}}class M2 extends fW{constructor(){super(...arguments),this.transformerConstructor=T2,this.type="boxPlot",this.seriesType=PE.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}M2.type="boxPlot",M2.seriesType=PE.boxPlot,M2.transformerConstructor=T2;class w2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class E2 extends fW{constructor(){super(...arguments),this.transformerConstructor=w2,this.type="sankey",this.seriesType=PE.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=IP(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}E2.type="sankey",E2.seriesType=PE.sankey,E2.transformerConstructor=w2;class B2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),WF(t)}}class P2 extends fW{constructor(){super(...arguments),this.transformerConstructor=B2,this.type="rangeArea",this.seriesType=PE.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}P2.type="rangeArea",P2.seriesType=PE.rangeArea,P2.transformerConstructor=B2;class R2 extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class O2 extends fW{constructor(){super(...arguments),this.transformerConstructor=R2,this.type="heatmap",this.seriesType=PE.heatmap}}O2.type="heatmap",O2.seriesType=PE.heatmap,O2.transformerConstructor=R2;class I2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class L2 extends fW{constructor(){super(...arguments),this.transformerConstructor=I2,this.type="correlation",this.seriesType=PE.correlation}}L2.type="correlation",L2.seriesType=PE.correlation,L2.transformerConstructor=I2;function D2(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=PP(t.style)),P(t.textStyle)||uB(s.textStyle,PP(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&PP(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&PP(s.background.style),s}function F2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const z2=(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},H2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:XB;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},j2={position:!0,item:!0,title:!0,pager:!0,background:!0};class N2 extends EU{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:()=>{Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(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=qE(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||j2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Tz(this._option,e),this._initSelectedData(),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(Tw(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(uB({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}N2.specKey="legends";class U2 extends N2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){YP(this._option.dataSet,"discreteLegendFilter",H2),YP(this._option.dataSet,"discreteLegendDataMake",z2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return Tw(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(!CM(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=mP(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,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=qE(s)?s:qE(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=D2(A):M.title={visible:!1},P(k.focusIconStyle)||PP(k.focusIconStyle),k.shape&&(k.shape=F2(wP(k.shape))),k.label&&(k.label=wP(k.label)),k.value&&(k.value=wP(k.value)),k.background&&(k.background=wP(k.background)),ZE(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),ZE(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),ZE(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||PP(C.railStyle),P(C.sliderStyle)||PP(C.sliderStyle)):(P(C.textStyle)||PP(C.textStyle),C.handler&&wP(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(uB(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return kX}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(vX.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(vX.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(vX.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,datum:t.datum,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}=zH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=zH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}U2.specKey="legends",U2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},U2.type=r.discreteLegend;const V2=(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[]},W2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?CP(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function G2(t){const i=uB({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=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=D2(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=PP(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=PP(r.style)),P(a.style)||(w.trackStyle=PP(a.style)),w.startText=wP(o),w.endText=wP(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>PP(i(t,e,s)):P(i)||(e.style=PP(i)),e}(h),P(c)||(w.sizeBackground=PP(c)),u.visible&&!P(u.style)&&(uB(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const Y2={color:EX,size:PX},X2={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}},K2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},X2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},$2={horizontal:K2(!0),vertical:K2(!1)},q2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},X2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},Z2={horizontal:q2(!0),vertical:q2(!1)},J2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Q2=[2,10];class t5 extends N2{static getSpecInfo(t){const e=HH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){YP(this._option.dataSet,"continuousLegendFilter",W2),YP(this._option.dataSet,"continuousLegendDataMake",V2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>Mw(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=mP(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!CM(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=mP(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?J2:Q2);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},G2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return Y2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}t5.specKey="legends",t5.builtInTheme={colorLegend:$2,sizeLegend:Z2},t5.type=r.continuousLegend;const e5=(t,e)=>p(e)?t.map((t=>e[t])):void 0,i5=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),s5=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function n5(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=r5(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>i5(i,s)(t)&&i5(n,r)(t)&&(u(a)||i5([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:jP.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:jP.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(a.id),m}return"none"}const r5=(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=e5(c,t);let y=e5(d,t);const _=s5(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(i5(c,v));if(!_&&(y=e5(d,i),!s5(y)))return;const n=e.type===PE.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=Lw(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(i5(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=e5(d,o),!s5(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(i5(c,n));if(!_&&(y=e5(d,r),!s5(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===PE.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(i5(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=e5(d,i),!s5(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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(i5(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=e5(d,a),h=y,!s5(y)&&!a)return;s5(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},a5=t=>p(t)&&!_(t),o5=t=>p(t)&&_(t),l5=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class h5 extends wU{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=uB({},...l5.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=uB({},s);l5.forEach((t=>{delete r[t]})),delete r.style;const a=uB({},r,i);return a.style=uB({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:xM(this._option.mode)||!_M(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=b_.getElementById(t.parentElement)):_M(this._option.mode)&&(t.parentElement=null==yM?void 0:yM.body)}}const c5={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class d5 extends EU{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=h5,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=_M(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&a5(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&RH.globalConfig.uniqueTooltip&&l&&RH.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:jP.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:jP.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?GW.canvas:GW.dom,n=vB.getComponentPluginInType(t);n||fM("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=vB.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(bM(s)||xM(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=n5(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(o5(t)){if(a5(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>Uj(t,e[i])))}if(o5(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}d5.type=r.tooltip,d5.transformerConstructor=h5,d5.builtInTheme={tooltip:c5},d5.specKey="tooltip";var u5,p5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(u5||(u5={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(p5||(p5={}));const g5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},f5={labelZIndex:!0,gridZIndex:!0},m5={xField:!0,yField:!0,categoryField:!0,valueField:!0},v5={visible:!0,width:!0,style:!0};class y5 extends EU{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Lw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||f5[i]||m5[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||v5[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:NP.chart}:{source:jP.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:bM(e)||xM(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:jP.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:jP.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:jP.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)=>{g5[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}y5.specKey="crosshair";const _5={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class b5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=Oj(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){Oj(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Ij(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"cartesian");e&&(DW(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=HW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new EG(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new BG(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}b5.specKey="crosshair",b5.builtInTheme={crosshair:_5},b5.type=r.cartesianCrosshair;class x5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=aU(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=zH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new EG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new RG(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new OG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new PG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}x5.specKey="crosshair",x5.builtInTheme={crosshair:_5},x5.type=r.polarCrosshair;const S5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},A5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},k5=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},C5=(t,e,i)=>{const s=e.domain();if(Ow(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},T5=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Ow(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},M5=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},w5=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}},E5=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),B5=(t,e,i)=>{if(Ow(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class P5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===Fj(Dj(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(P5,t$);class R5 extends EU{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:T5(t,this._stateScale,this._isHorizontal),a="percent"===n?e:T5(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=M5(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=B5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&w5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=Dj(t),this._isHorizontal="horizontal"===Fj(this._orient),this._dataFilterEvent=new P5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Ow(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>Fj(t._orient)===Fj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Ow(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};Tw(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Ow(d.getScale(0).type),p=Ow(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else Tw(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;XP(r,"dataview",Ia),YP(r,"dataFilterComputeDomain",k5);const a=new za(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Tz(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(YP(this._option.dataSet,"dataFilterWithNewDomain",A5),YP(this._option.dataSet,"lockStatisticsFilter",S5),Tw(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Ow(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;E5("start",i,this._spec)&&E5("end",s,this._spec)&&(t="percent"===i?this._spec.start:T5(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:T5(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?T5(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?T5(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=C5(this._start,this._stateScale,M5(i,this._isHorizontal)),this._endValue=C5(this._end,this._stateScale,M5(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Ow(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=B5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&Tw(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new AE:new iE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=w5(h);if(!this._dataUpdating&&Lw(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,Lw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(R5,t$);class O5 extends wU{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=uB({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const I5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),L5={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:I5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:I5(!0)},D5={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class F5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=O5,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=C5(e,this._stateScale,M5(s,this._isHorizontal)),a=C5(i,this._stateScale,M5(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new AE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(M5(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=M5(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return D5}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new AE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(M5(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Ow(t.type)||e[0]!==X(e))&&(!Lw(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:M5(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new vY(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:PP(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:PP(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:PP(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:PP(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:PP(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:PP(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:PP(g.style)},selectedBackgroundStyle:PP(this._spec.selectedBackground.style),dragMaskStyle:PP(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:uB(PP(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:uB(PP(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(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}=zH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(M5(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}F5.type=r.dataZoom,F5.transformerConstructor=O5,F5.builtInTheme={dataZoom:L5},F5.specKey="dataZoom";const z5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},H5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class j5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=vw(this._start,e)&&vw(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=M5(n,this._isHorizontal),a=C5(e,this._stateScale,r),o=C5(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return H5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new uG(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=PP(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=PP(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}j5.type=r.scrollBar,j5.builtInTheme={scrollBar:z5},j5.specKey="scrollBar";const N5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():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},U5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),V5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:U5("l1FontSize","primaryFontColor")},content:{visible:!0,style:U5("l2FontSize","tertiaryFontColor")}};class W5 extends EU{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){YP(this._option.dataSet,"indicatorFilter",N5);const t=new za(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 Tz(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=uB({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},BP(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?nB(l,this._computeLayoutRadius()):0,dy:h?nB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},BP(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new IX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}W5.type=r.indicator,W5.builtInTheme={indicator:V5},W5.specKey="indicator";const G5=["sum","average","min","max","variance","standardDeviation","median"];function Y5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function X5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function K5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&Y5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,X5(a,"xAxis"),t.x)),c=ZE(t.x)?J5(t.x,n)+r.x:Q5(h.getXAxisHelper(),[t.x])+r.x,c}function $5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&Y5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(a,"yAxis"),t.y)),c=ZE(t.y)?J5(t.y,n)+r.y:Q5(h.getYAxisHelper(),[t.y])+r.y,c}function q5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&Y5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"angleAxis"),t.angle)),Q5(o.angleAxisHelper,[t.angle])}function Z5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&Y5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"radiusAxis"),t.radius)),Q5(o.radiusAxisHelper,[t.radius])}function J5(t,e){return Number(t.substring(0,t.length-1))*e/100}function Q5(t,e){const i=t.getScale(0);return Ow(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function t3(t){return G5.includes(t)}function e3(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=K5(t,_,n,g,d,l,a),r=$5(t,b,n,g,u,l,a),i3(s,x,A,f.length),i3(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=K5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);i3(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=$5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);i3(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function i3(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=q5(t,h,n,a,r),i=Z5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=q5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=Z5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function n3(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function r3(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&Y5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,X5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&Y5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,X5(s,"yAxis"),d[0]))}(t,n3(t,e),i,n)})),a.forEach(((t,i)=>{const n=n3(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=ZE(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=ZE(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:Q5(n.getXAxisHelper(),p)+l.x+d,y:Q5(n.getYAxisHelper(),g)+l.y+u})})),r}function a3(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&Y5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&Y5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(s,"radiusAxis"),p[0])),n.push({angle:Q5(h.angleAxisHelper,u),radius:Q5(h.radiusAxisHelper,p)})})),n}function o3(t,e,i){let{x:s,y:n}=t;return ZE(s)&&(s=J5(s,e)),ZE(n)&&(n=J5(n,i)),{x:s,y:n}}function l3(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=o3(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>o3(t,n,r)))}function h3(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 c3(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},PP(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},u3(PP(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=u3(PP(r),i,s)),t}return{visible:!1}}function d3(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function u3(t,e,i){return d(t)?t(e,i):t}function p3(t,e){return d(t)?t(e):t}function g3(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 f3(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function m3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=f3(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function v3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=f3(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function y3(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function _3(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&t3(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&t3(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&t3(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&t3(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>x3(i,t,e))):i.x=x3(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>x3(i,t,e))):i.y=x3(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>x3(i,t,e))):i.angle=x3(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>x3(i,t,e))):i.radius=x3(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=x3(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const b3={min:(t,e)=>yw(t[0].latestData,e.field),max:(t,e)=>_w(t[0].latestData,e.field),sum:function(t,e){return bw(t[0].latestData,e.field)},average:function(t,e){return xw(t[0].latestData,e.field)},variance:function(t,e){return Sw(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(Sw(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function x3(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 b3[i](e,{field:s})}return t}function S3(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}const A3=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},k3=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},C3=t=>{if(!t)return;A3(t).forEach((e=>{k3(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{k3(e,t)}))},T3=(t,e)=>{if(!t)return;const i=new Set(A3(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(C3),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},M3="__vchart_marker_coordinate__",w3=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],E3=["position","positions","coordinatesOffset","regionRelative"],B3=["offsetX","offsetY","confine"],P3=t=>Array.isArray(t)?t.map(P3):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,R3=t=>{if(Array.isArray(t))return t.map(R3);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=R3(e[t])})),e},O3=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&w3.forEach((t=>{i[t]=M3})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),E3.forEach((t=>{t in i&&(i[t]=M3)})),"label"in i&&(i.label=P3(i.label)),Object.keys(i).forEach((t=>{i[t]=R3(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),B3.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=M3)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},P3(t)),{text:"__vchart_marker_text__"}))}return i};class I3 extends EU{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&t3(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Fa;return e.registerParser("array",s),new za(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&T3(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}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._updateMarkerLayout()}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._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=ww(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=QE(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QE(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(O3(e,{normalizeDomainPosition:i}),O3(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(O3(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),O3(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerFilter",S3),this._releaseMarkerData();const i=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function L3(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=yw(t,e),r=_w(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class D3 extends I3{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}=m3(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:u3(PP(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{line:d3(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return d3(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return d3(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:u3(PP(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:u3(PP(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=h3([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=m3(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerRegression",L3),YP(this._option.dataSet,"markerFilter",S3);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new za(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()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}D3.specKey="markLine";const F3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),z3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},H3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:F3(!1),endSymbol:F3(!0),label:z3};class j3 extends D3{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new sX(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}=m3(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=e3(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=r3(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=l3(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(ZE(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.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));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=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}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_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}=m3(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 za(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}j3.type=r.markLine,j3.coordinateType="cartesian",j3.builtInTheme={markLine:H3};class N3 extends D3{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=m3(this._spec);return e||i?new aX(t):new sX(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}=m3(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=s3(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=a3(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=m3(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}}}N3.type=r.polarMarkLine,N3.coordinateType="polar",N3.builtInTheme={polarMarkLine:H3};class U3 extends EU{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=qE(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return HH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=QE(this._spec.width,a.width,null,a.width),l=QE(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new RX(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}}U3.type=r.title,U3.specKey=r.title,U3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class V3 extends I3{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=v3(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:u3(PP(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{area:d3(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>d3(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return d3(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=h3([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=v3(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}V3.specKey="markArea";const W3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class G3 extends V3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new rX(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=v3(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=r3(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=l3(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=v3(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}}}G3.type=r.markArea,G3.coordinateType="cartesian",G3.builtInTheme={markArea:W3};class Y3 extends V3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=v3(this._spec);return i||e||s?new oX(t):new rX(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}=v3(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=s3(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());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=a3(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=v3(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}}}Y3.type=r.polarMarkArea,Y3.coordinateType="polar",Y3.builtInTheme={polarMarkArea:W3};const X3=t=>PP(Object.assign({},t)),K3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},PP(t.style))}),$3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=X3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=X3(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:{},PP(Object.assign({},_)));var _;const b=K3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=K3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=K3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=K3(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},q3=t=>"left"===t||"right"===t,Z3=t=>"top"===t||"bottom"===t,J3={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Q3 extends EU{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({},$3(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({},$3(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?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new KX(t):this._playerComponent=new ZX(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=q3(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=q3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(UX.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(UX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(UX.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(UX.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(UX.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(UX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=q3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Z3(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):q3(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))):Z3(this._orient)?this._maxSize():t.height}_computeDx(t){return q3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Z3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){var i,s;const n=null===(i=this._specs)||void 0===i?void 0:i[e];n&&(null===(s=this._option)||void 0===s?void 0:s.globalInstance)&&(this._option.globalInstance.updateFullData(n.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:n,index:e,specs:this._specs}}))}release(){var e,i,s,n;null===(i=null===(e=this._playerComponent)||void 0===e?void 0:e.pause)||void 0===i||i.call(e),null===(n=null===(s=this._option)||void 0===s?void 0:s.globalInstance)||void 0===n||n.off(t.ChartEvent.rendered,this.autoPlayCallback),super.release(),this._playerComponent=null,this._cacheAttrs=null,this._specs=[]}}Q3.builtInTheme={player:J3},Q3.specKey="player",Q3.type=r.player;class t4 extends EU{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,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=HE({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==tz.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}t4.type=r.label;class e4 extends rq{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}e4.type="text",e4.constructorType="label";const i4=()=>{aq(),vB.registerMark(e4.constructorType,e4)};class s4 extends wU{_initTheme(t,e){return{spec:t,theme:this._theme}}}class n4 extends t4{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=s4,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(FP.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(FP.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Tw(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=uB({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},x$(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[rP])):t=>t.filter((t=>t.data[nP]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?S$(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}n4.type=r.label,n4.specKey="label",n4.transformerConstructor=s4;class r4 extends t4{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[iP]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return uB({textStyle:{pickable:!0===this._spec.interactive},position:a4(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[rP]:t.data[nP]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>S$({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function a4(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}r4.type=r.totalLabel,r4.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},r4.specKey="totalLabel";class o4 extends I3{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=y3(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,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,O,I,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=u3(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=c3(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=u3(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=PP(u3(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=u3(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=u3(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:p3(D.offsetX,j),offsetY:p3(D.offsetY,j)},et),{style:u3(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:u3(z.style,this._markerData,this._markAttributeContext)},state:{line:d3(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:d3(it,this._markerData,this._markAttributeContext),textBackground:d3(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:d3(null!==(I=null===(O=this._spec.targetSymbol)||void 0===O?void 0:O.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:PP(lt.style)}):{visible:!1};return new hX(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:PP(C.style)}):{visible:!1},w=c3(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=h3([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=p3(S.offsetX,A),f=p3(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:g3(y,s,A),offsetY:g3(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=y3(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}o4.specKey="markPoint";const l4={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class h4 extends o4{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=e3(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=r3(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=l3(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=y3(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}}}h4.type=r.markPoint,h4.coordinateType="cartesian",h4.builtInTheme={markPoint:l4};class c4 extends o4{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=s3(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}c4.type=r.polarMarkPoint,c4.coordinateType="polar",c4.builtInTheme={polarMarkPoint:l4};class d4 extends o4{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}])]}}}d4.type=r.geoMarkPoint,d4.coordinateType="geo",d4.builtInTheme={geoMarkPoint:l4};const u4="inBrush",p4="outOfBrush",g4={style:!0,inBrush:!0,outOfBrush:!0};class f4 extends EU{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),u4,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),p4,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||g4[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:PP(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new eK(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:PP(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener($X.brushActive,(s=>{this._initMarkBrushState(i,p4),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener($X.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener($X.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener($X.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},PP(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];Yz(t,[...s.filter((t=>t!==u4&&t!==p4)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,u4),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,p4),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,u4),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,p4),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;Kz(s,[u4,p4]),i&&Xz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}f4.type=r.brush,f4.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},f4.specKey="brush";const m4={style:!0,state:!0};class v4 extends EU{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${NB}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||m4[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_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 Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}v4.type=r.customMark,v4.specKey="customMark";class y4{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>_4(t))),a=n.filter((t=>!_4(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>_4(t))),h=o.filter((t=>!_4(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 _4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}y4.type="grid";const b4=t=>{t?function(t){if(!t)throw new Error("installPoptipToApp requires an app instance");WA(t),MG(NA()),UA(),GA(t)}(t):(MG(m_()),MG(NA()),UA())},x4="vchart-tooltip",S4=`${x4}-container`,A4=`${x4}-title`,k4=`${x4}-content-box`,C4={offsetX:10,offsetY:10},T4="99999999999999";function M4(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const w4=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,E4=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?M4(t):"",B4=(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},P4={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},R4=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=P4[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class O4 extends sU{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=VH(null==T?void 0:T.position,b,e),w=null!==(r=VH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:UB,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:VB;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=_M(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=w4(e,F),N=w4(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(R4(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=B4(t,y),W.top=B4(i,y),W.right=B4(e,y),W.bottom=B4(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=B4(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?O:I,n="x"===t?A:C,r=R4(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",L4=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=I4(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=I4(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},D4=(t={})=>{const{lineHeight:e}=t;return t.fontSize?QE(e,t.fontSize):0},F4=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=I4(o)),{panelStyle:a,panelPadding:o}};function z4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const H4=t=>!!t&&1===t.nodeType&&"function"==typeof t.appendChild&&!!t.children;class j4 extends O4{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(j4.type),this.type=GW.dom,this._tooltipContainer=null==yM?void 0:yM.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}_getTooltipParentElement(t){return H4(t.parentElement)?t.parentElement:H4(this._chartContainer)?this._chartContainer:H4(null==yM?void 0:yM.body)?yM.body:void 0}initEl(){const t=this._component.getSpec(),e=this._getTooltipParentElement(t);if(yM&&e){for(let t=0;t{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=F4(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:I4(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=L4(h),x=L4(d),S=L4(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=I4(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=I4(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=I4(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(D4(p),D4(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(A4))),l=a.find((t=>t.className.includes(k4)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(A4),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(z4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${x4}-column`),e.classList.add(`${x4}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(k4),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];z4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));z4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${x4}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=E4(e.key),e.keyStyle&&L4(e.keyStyle,l)):"value"===i?(o.innerHTML=E4(e.value),e.valueStyle&&L4(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?M4(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?M4(c):m,_=p,b=t=>new Wg({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=su.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?M4(u):"currentColor",`\n \n \n \n `;const M=T?su.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),z4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(k4))),h=[...o.children].find((t=>t.className.includes(A4)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(A4)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=QE(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,z4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=fv({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function V4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:N4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const W4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class G4 extends O4{constructor(){super(G4.type),this.type=GW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new aK({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=iB(d.padding),x=V4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=V4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=V4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:W4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.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:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=uB({},S,V4(b,void 0,{})),{width:s,height:n,text:r}=U4(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=uB({},A,V4(x,void 0,{})),{width:e,height:s,text:n}=U4(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};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=uB({},x,V4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=U4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}G4.type=GW.canvas;const Y4=/\{([^}]+)\}/,X4=/\{([^}]+)\}/g,K4=/:/;class $4 extends sU{constructor(){super($4.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.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[$4.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)),vB.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=Y4.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(X4,((t,i)=>{if(!K4.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 this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}$4.pluginType="chart",$4.specKey="formatter",$4.type="formatterPlugin";RH.useRegisters([()=>{qW(),JW(),tG(),MW(),TW(),lW(),QV(),UN(),WN(),yH(),fH(),OV(),$V(),vB.registerSeries(hW.type,hW),vB.registerChart(eG.type,eG)},()=>{qW(),JW(),tG(),TW(),lW(),QV(),UN(),nG(),WN(),oG(),OV(),$V(),vB.registerSeries(cK.type,cK),MW(),vB.registerChart(uK.type,uK)},()=>{qW(),JW(),tG(),TW(),MK(),MW(),vB.registerChart(EK.type,EK)},()=>{qW(),JW(),MW(),TW(),jK(),vB.registerChart(UK.type,UK)},()=>{JW(),Nq(),vB.registerChart(X1.type,X1)},()=>{qW(),JW(),MW(),TW(),aZ(),vB.registerChart(q1.type,q1)},()=>{qW(),JW(),tG(),MW(),TW(),fZ(),vB.registerChart(J1.type,J1)},()=>{qW(),JW(),tG(),MW(),TW(),MK(),vB.registerTransform("bin",Qr),vB.registerChart(n2.type,n2)},()=>{JW(),i$(),XK(),vB.registerSeries(n$.type,n$),vB.registerImplement("registerMap",ZP),vB.registerImplement("unregisterMap",JP),mH(),vB.registerChart(N1.type,N1)},()=>{JW(),i1(),vB.registerSeries(n1.type,n1),Oq(),OZ(),iZ(),FZ(),vB.registerChart(l2.type,l2)},()=>{JW(),MQ(),vB.registerChart(d2.type,d2)},()=>{JW(),KQ(),vB.registerChart(p2.type,p2)},()=>{qW(),JW(),tG(),MW(),TW(),I$(),vB.registerChart(C2.type,C2)},()=>{qW(),JW(),MW(),TW(),nq(),vB.registerTransform("boxplot",ta),vB.registerChart(M2.type,M2)},()=>{qW(),JW(),MW(),TW(),FZ(),vB.registerChart(a2.type,a2)},()=>{qW(),JW(),MW(),TW(),YZ(),vB.registerChart(f2.type,f2)},()=>{qW(),JW(),MW(),TW(),fq(),vB.registerChart(v2.type,v2)},()=>{qW(),JW(),tG(),MW(),TW(),nG(),OV(),$V(),vB.registerSeries(bq.type,bq),vB.registerChart(P2.type,P2)},()=>{JW(),u0(),vB.registerChart(_2.type,_2)},()=>{JW(),y0(),vB.registerChart(x2.type,x2)},()=>{JW(),Y0(),vB.registerChart(A2.type,A2)},()=>{JW(),gG(),z0(),vB.registerChart(E2.type,E2)},()=>{JW(),u1(),vB.registerChart(O2.type,O2)},()=>{JW(),M1(),vB.registerChart(L2.type,L2)},()=>{qW(),JW(),tG(),MW(),vB.registerChart(t2.type,t2),TW()},$V,OV,()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(oK.type,oK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(lK.type,lK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(hK.type,hK)},nZ,iZ,()=>{vB.registerComponent(U2.type,U2)},()=>{vB.registerComponent(t5.type,t5)},()=>{vB.registerComponent(d5.type,d5)},()=>{vB.registerComponent(b5.type,b5)},()=>{vB.registerComponent(x5.type,x5)},()=>{vB.registerComponent(F5.type,F5)},()=>{vB.registerComponent(j5.type,j5)},()=>{vB.registerComponent(W5.type,W5)},i$,()=>{vB.registerComponent(j3.type,j3),iX()},()=>{vB.registerComponent(G3.type,G3),nX()},()=>{vB.registerComponent(h4.type,h4),lX()},()=>{vB.registerComponent(N3.type,N3),aX._animate=FY,iX()},()=>{vB.registerComponent(Y3.type,Y3),oX._animate=HY,nX()},()=>{vB.registerComponent(c4.type,c4),lX()},()=>{vB.registerComponent(d4.type,d4),lX()},()=>{vB.registerComponent(U3.type,U3)},()=>{vB.registerComponent(Q3.type,Q3)},()=>{vB.registerGraphicComponent(n4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(n4.type,n4,!0,1/0)},()=>{vB.registerGraphicComponent(r4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(r4.type,r4,!0)},()=>{vB.registerComponent(f4.type,f4)},()=>{vB.registerComponent(v4.type,v4)},()=>{vB.registerRuntimePluginInstaller("poptipForText",b4),b4()},()=>{vB.registerLayout(y4.type,y4)},()=>{var t;t=G4,vB.registerComponentPlugin(t.type,t)},()=>{var t;t=$4,vB.registerChartPlugin(t.type,t)},kH,MH]),RH.useRegisters([()=>{BO(iA)}]),t.DEFAULT_CHART_HEIGHT=VB,t.DEFAULT_CHART_WIDTH=UB,t.DEFAULT_CLOSE_STROKE_JOIN=LH,t.DEFAULT_DATA_INDEX=GB,t.DEFAULT_DATA_KEY=YB,t.DEFAULT_DATA_SERIES_FIELD=XB,t.DEFAULT_KEY=uP,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=IH,t.DEFAULT_MAP_LOOK_UP_KEY=pP,t.DEFAULT_MEASURE_CANVAS_ID=WB,t.DEFAULT_SERIES_STYLE_NAME=KB,t.DEFAULT_SMOOTH_INTERPOLATE=OH,t.Factory=vB,t.MOSAIC_CAT_END_PERCENT=hP,t.MOSAIC_CAT_START_PERCENT=lP,t.MOSAIC_VALUE_END_PERCENT=oP,t.MOSAIC_VALUE_START_PERCENT=aP,t.ManualTicker=class extends pb{constructor(t){super(t),this.lastFrameTime=0,this.status=wl.RUNNING}setupTickHandler(){const t=new DH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,!0}},t.PREFIX=NB,t.SEGMENT_FIELD_END=dP,t.SEGMENT_FIELD_START=cP,t.STACK_FIELD_END=ZB,t.STACK_FIELD_END_OffsetSilhouette=eP,t.STACK_FIELD_END_PERCENT=QB,t.STACK_FIELD_KEY=$B,t.STACK_FIELD_START=qB,t.STACK_FIELD_START_OffsetSilhouette=tP,t.STACK_FIELD_START_PERCENT=JB,t.STACK_FIELD_TOTAL=iP,t.STACK_FIELD_TOTAL_BOTTOM=rP,t.STACK_FIELD_TOTAL_PERCENT=sP,t.STACK_FIELD_TOTAL_TOP=nP,t.StreamLight=eF,t.ThemeManager=OB,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=RH,t.boundsInRect=eB,t.builtinThemes=SB,t.calcLayoutNumber=QE,t.calcPadding=tB,t.computeActualDataScheme=FE,t.convertPoint=sB,t.createArc=Vp,t.createArea=Yp,t.createGroup=tg,t.createLine=ag,t.createRect=mg,t.createRichText=jg,t.createSymbol=Gg,t.createText=Jg,t.darkTheme=cB,t.dataScheme=rB,t.default=RH,t.defaultThemeName=AB,t.getActualColor=HE,t.getActualNumValue=nB,t.getColorSchemeBySeries=VE,t.getDataScheme=DE,t.getFunnelTheme=bB,t.getMergedTheme=PB,t.getSpecInfo=HH,t.getTheme=wB,t.hasThemeMerged=TB,t.isColorKey=jE,t.isPercent=ZE,t.isPercentOffset=JE,t.isProgressiveDataColorScheme=NE,t.isTokenKey=oB,t.isValidOrient=qE,t.lightTheme=hB,t.lookup=jH,t.measureText=jB,t.normalizeLayoutPaddingSpec=iB,t.queryColorFromColorScheme=zE,t.queryToken=aB,t.registerDataSetInstanceParser=XP,t.registerDataSetInstanceTransform=YP,t.registerTheme=MB,t.removeTheme=EB,t.themeExist=BB,t.themes=kB,t.token=lB,t.transformColorSchemeToStandardStruct=UE,t.transformToGraphic=PP,t.version="2.1.4",t.vglobal=b_,t.warn=gM,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/harmony_vchart/library/CHANGELOG.md b/packages/harmony_vchart/library/CHANGELOG.md index 666d5e3a7d..2b80bc727c 100644 --- a/packages/harmony_vchart/library/CHANGELOG.md +++ b/packages/harmony_vchart/library/CHANGELOG.md @@ -1,3 +1,19 @@ +# v2.1.4 + +2026-07-16 + +**🆕 New Features** + +- **@visactor/vchart**: support automatic bar width for linear x axis +- **@visactor/vchart**: support theming conversion funnel arrow (line / symbol / text) via series.funnel.conversionArrow theme token + +**🐛 Bug Fixes** + +- **@visactor/vchart**: restore existing axis grid graphics when grid visibility is enabled again through updateSpec with animation disabled + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.1.3...v2.1.4 + +[more detail about v2.1.4](https://github.com/VisActor/VChart/releases/tag/v2.1.4) # v2.1.3 2026-07-08 diff --git a/packages/harmony_vchart/library/oh-package.json5 b/packages/harmony_vchart/library/oh-package.json5 index e81741fa23..4c17fa981d 100644 --- a/packages/harmony_vchart/library/oh-package.json5 +++ b/packages/harmony_vchart/library/oh-package.json5 @@ -1,6 +1,6 @@ { name: '@visactor/harmony-vchart', - version: '2.1.3', + version: '2.1.4', description: '@visactor/vchart 针对 harmonyOS 打造的图表库,拥有非常酷炫的动画能力,近20种图表类型,以及原生的渲染性能', main: 'Index.ets', author: { diff --git a/packages/harmony_vchart/library/src/main/ets/index-harmony-simple.es.min.js b/packages/harmony_vchart/library/src/main/ets/index-harmony-simple.es.min.js index acf0f0269a..62ad318028 100644 --- a/packages/harmony_vchart/library/src/main/ets/index-harmony-simple.es.min.js +++ b/packages/harmony_vchart/library/src/main/ets/index-harmony-simple.es.min.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var y=t=>Array.isArray?Array.isArray(t):l(t,"Array");var _=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>x(t)&&Number.isFinite(t);var k=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var C=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 M=Object.prototype;var T=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||M)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(_(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(T(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&y(t[a])?F(t,a,n[a]):L(t,e,a,i,s)}}}}function L(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(_(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function j(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function V(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(j(t)!==j(e))return!1;if(c(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(!V(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function et(t){return Number(t)}function it(t,e,i=et){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&x(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(t=rt.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),it(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var vt=function(t,e,i){return ti?i:t};var yt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Ct(t){if(A(t))return t;const e=+t;return A(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const Mt=4294967296;const Tt=t=>e=>P(e,t),Bt=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Et=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Pt=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Ot=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Zt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class re{static distancePP(t,e){return Kt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Kt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function he(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ce(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ue(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ge(t){return(t=ue(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const be=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function xe(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ce({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?ae(t.angle):t.angle,s=we(t);return[Ce({x:t.x1,y:t.y1},i,s),Ce({x:t.x2,y:t.y1},i,s),Ce({x:t.x2,y:t.y2},i,s),Ce({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=Me(t,i),n=Me(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+Ht;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Ee(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Le{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const Fe=(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}},ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),He=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ne{}class We extends Ne{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ce({x:this.x1,y:this.y1},this.angle,t),Ce({x:this.x2,y:this.y1},this.angle,t),Ce({x:this.x1,y:this.y2},this.angle,t),Ce({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ue,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ue;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=oe(r.rotateDeg),r}}class Ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ye(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Xe(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 Ke=/^#([0-9a-f]{3,8})$/,$e={transparent:4294967040},qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return x(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Ke.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u($e[t]))return function(t){return x(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}($e[t]);if(u(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Xe(this.color.r,this.color.g,this.color.b),r=Ye(d(t)?n.h:vt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new si(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Xe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new si(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Xe});function ai(t){if(A(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(p(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const li=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function hi(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 ci(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const di=1e-10;function ui(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+di)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=mi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=pi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-di,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function pi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function gi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return pi(t,t-(i*i-e*e+t*t)/(2*i))+pi(e,s)}function fi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function mi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let _i;function bi(t,e){const i=yi(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 xi{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Si=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ai(t){let e;if(e=Si.exec(t))return new xi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const ki=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ci{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 Ci.instance||(Ci.instance=new Ci),Ci.instance}newFormat(t){const e=Ai(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"):wi[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=wi[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?ki[8+_i/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 C=S.length+k.length+A.length,w=C>1)+S+k+A+w.slice(C);break;default:k=w+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Ai(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=yi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=ki[8+n/3];return function(t){return s(r*t)+a}}}const wi={"%":(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)=>bi(100*t,e),r:bi,s:function(t,e){const i=yi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+yi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Pi(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Pi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ii(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Li(){return new Fi}function Fi(){this.reset()}Fi.prototype={constructor:Fi,reset:function(){this.s=this.t=0},add:function(t){Hi(zi,t,this.t),Hi(this,zi.s,this.s),this.s?this.t+=zi.t:this.s=zi.t},valueOf:function(){return this.s}};var zi=new Fi;function Hi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var ji=1e-6,Ni=Math.PI,Vi=Ni/2,Wi=Ni/4,Ui=2*Ni,Gi=180/Ni,Yi=Ni/180,Xi=Math.abs,Ki=Math.atan,$i=Math.atan2,qi=Math.cos,Zi=Math.exp,Ji=Math.log,Qi=Math.pow,ts=Math.sin,es=Math.sign||function(t){return t>0?1:t<0?-1:0},is=Math.sqrt,ss=Math.tan;function ns(t){return t>1?0:t<-1?Ni:Math.acos(t)}function rs(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function as(){}function os(t,e){t&&hs.hasOwnProperty(t.type)&&hs[t.type](t,e)}var ls={Feature:function(t,e){os(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sNi?t+Math.round(-t/Ui)*Ui:t,e]}function Ss(t,e,i){return(t%=Ui)?e||i?bs(ks(t),Cs(e,i)):ks(t):e||i?Cs(e,i):xs}function As(t){return function(e,i){return[(e+=t)>Ni?e-Ui:e<-Ni?e+Ui:e,i]}}function ks(t){var e=As(t);return e.invert=As(-t),e}function Cs(t,e){var i=qi(t),s=ts(t),n=qi(e),r=ts(e);function a(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),rs(c*n+l*r)]}return a.invert=function(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),rs(c*i-o*s)]},a}function ws(t,e){(e=gs(e))[0]-=t,_s(e);var i=ns(-e[1]);return((-e[2]<0?-i:i)+Ui-ji)%Ui}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:as,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Xi(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 Ps(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Fs(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 zs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Fs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=ts(s),r=[ts(i),-qi(i),0],a=0,o=0;Is.reset(),1===n?s=Vi+ji:-1===n&&(s=-Vi-ji);for(var l=0,h=t.length;l=0?1:-1,C=k*A,w=C>Ni,M=f*x;if(Is.add($i(M*k*ts(C),m*S+M*qi(C))),a+=w?A+k*Ui:A,w^p>=i^_>=i){var T=ms(gs(u),gs(y));_s(T);var B=ms(r,T);_s(B);var E=(w^A>=0?-1:1)*rs(B[2]);(s>E||s===E&&(T[0]||T[1]))&&(o+=w^A>=0?1:-1)}}return(a<-ji||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(Hs))}return u}}function Hs(t){return t.length>1}function js(t,e){return((t=t.x)[0]<0?t[1]-Vi-ji:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-ji:Vi-e[1])}1===(Os=Ls).length&&(Rs=Os,Os=function(t,e){return Ls(Rs(t),e)});var Ns=zs((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?Ni:-Ni,l=Xi(r-i);Xi(l-Ni)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ni&&(Xi(i-n)ji?Ki((ts(e)*(r=qi(s))*ts(i)-ts(s)*(n=qi(e))*ts(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*Vi,s.point(-Ni,n),s.point(0,n),s.point(Ni,n),s.point(Ni,0),s.point(Ni,-n),s.point(0,-n),s.point(-Ni,-n),s.point(-Ni,0),s.point(-Ni,n);else if(Xi(t[0]-e[0])>ji){var r=t[0]0,n=Xi(e)>ji;function r(t,i){return qi(t)*qi(i)>e}function a(t,i,s){var n=[1,0,0],r=ms(gs(t),gs(i)),a=fs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ms(n,r),u=ys(n,h);vs(u,ys(r,c));var p=d,g=fs(u,p),f=fs(p,p),m=g*g-f*(fs(u,u)-1);if(!(m<0)){var v=is(m),y=ys(p,(-g-v)/f);if(vs(y,u),y=ps(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Xi(y[0]-b)Ni^(b<=y[0]&&y[0]<=x)){var w=ys(p,(-g+v)/f);return vs(w,u),[y,ps(w)]}}}function o(e,i){var n=s?t:Ni-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return zs(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?Ni:-Ni),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=qi(e),o=ts(e),l=s*i;null==n?(n=e+s*Ui,r=e-l/2):(n=ws(a,n),r=ws(a,r),(s>0?nr)&&(n+=s*Ui));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 Xi(s[0]-t)0?0:3:Xi(s[0]-i)0?2:1:Xi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,y,_=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&_.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=Fs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Es(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(Us,Math.min(Ws,g)),f=Math.max(Us,Math.min(Ws,f))],b=[r=Math.max(Us,Math.min(Ws,r)),a=Math.max(Us,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&&(_.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 Ys(t){return t}var Xs,Ks,$s,qs,Zs=Li(),Js=Li(),Qs={point:as,lineStart:as,lineEnd:as,polygonStart:function(){Qs.lineStart=tn,Qs.lineEnd=nn},polygonEnd:function(){Qs.lineStart=Qs.lineEnd=Qs.point=as,Zs.add(Xi(Js)),Js.reset()},result:function(){var t=Zs/2;return Zs.reset(),t}};function tn(){Qs.point=en}function en(t,e){Qs.point=sn,Xs=$s=t,Ks=qs=e}function sn(t,e){Js.add(qs*t-$s*e),$s=t,qs=e}function nn(){sn(Xs,Ks)}var rn=Qs,an=1/0,on=an,ln=-an,hn=ln;var cn,dn,un,pn,gn={point:function(t,e){tln&&(ln=t);ehn&&(hn=e)},lineStart:as,lineEnd:as,polygonStart:as,polygonEnd:as,result:function(){var t=[[an,on],[ln,hn]];return ln=hn=-(on=an=1/0),t}},fn=0,mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn={point:Cn,lineStart:wn,lineEnd:Bn,polygonStart:function(){kn.lineStart=En,kn.lineEnd=Pn},polygonEnd:function(){kn.point=Cn,kn.lineStart=wn,kn.lineEnd=Bn},result:function(){var t=An?[xn/An,Sn/An]:bn?[yn/bn,_n/bn]:vn?[fn/vn,mn/vn]:[NaN,NaN];return fn=mn=vn=yn=_n=bn=xn=Sn=An=0,t}};function Cn(t,e){fn+=t,mn+=e,++vn}function wn(){kn.point=Mn}function Mn(t,e){kn.point=Tn,Cn(un=t,pn=e)}function Tn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,Cn(un=t,pn=e)}function Bn(){kn.point=Cn}function En(){kn.point=On}function Pn(){Rn(cn,dn)}function On(t,e){kn.point=Rn,Cn(cn=un=t,dn=pn=e)}function Rn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,xn+=(n=pn*t-un*e)*(un+t),Sn+=n*(pn+e),An+=3*n,Cn(un=t,pn=e)}var In=kn;function Dn(t){this._context=t}Dn.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,Ui)}},result:as};var Ln,Fn,zn,Hn,jn,Nn=Li(),Vn={point:as,lineStart:function(){Vn.point=Wn},lineEnd:function(){Ln&&Un(Fn,zn),Vn.point=as},polygonStart:function(){Ln=!0},polygonEnd:function(){Ln=null},result:function(){var t=+Nn;return Nn.reset(),t}};function Wn(t,e){Vn.point=Un,Fn=Hn=t,zn=jn=e}function Un(t,e){Hn-=t,jn-=e,Nn.add(is(Hn*Hn+jn*jn)),Hn=t,jn=e}var Gn=Vn;function Yn(){this._string=[]}function Xn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Kn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),us(t,i(s))),s.result()}return r.area=function(t){return us(t,i(rn)),rn.result()},r.measure=function(t){return us(t,i(Gn)),Gn.result()},r.bounds=function(t){return us(t,i(gn)),gn.result()},r.centroid=function(t){return us(t,i(In)),In.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ys):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Yn):new Dn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function $n(t){return function(e){var i=new qn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function qn(){}function Zn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),us(i,t.stream(gn)),e(gn.result()),null!=s&&t.clipExtent(s),t}function Jn(t,e,i){return Zn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Qn(t,e,i){return Jn(t,[[0,0],e],i)}function tr(t,e,i){return Zn(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 er(t,e,i){return Zn(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)}Yn.prototype={_radius:4.5,_circle:Xn(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=Xn(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}},qn.prototype={constructor:qn,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 ir=16,sr=qi(30*Yi);function nr(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=is(b*b+x*x+S*S),k=rs(S/=A),C=Xi(Xi(S)-1)e||Xi((v*B+y*E)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Yi:0,B()):[m*Gi,v*Gi,y*Gi]},M.angle=function(t){return arguments.length?(_=t%360*Yi,B()):_*Gi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},M.precision=function(t){return arguments.length?(a=nr(o,w=t*t),E()):is(w)},M.fitExtent=function(t,e){return Jn(M,t,e)},M.fitSize=function(t,e){return Qn(M,t,e)},M.fitWidth=function(t,e){return tr(M,t,e)},M.fitHeight=function(t,e){return er(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&T,B()}}function cr(t){var e=0,i=Ni/3,s=hr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Yi,i=t[1]*Yi):[e*Gi,i*Gi]},n}function dr(t,e){var i=ts(t),s=(i+ts(e))/2;if(Xi(s)2?t[2]*Yi:0),e.invert=function(e){return(e=t.invert(e[0]*Yi,e[1]*Yi))[0]*=Gi,e[1]*=Gi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===yr?[[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 br(t){return ss((Vi+t)/2)}function xr(t,e){var i=qi(t),s=t===e?ts(t):Ji(i/qi(e))/Ji(br(e)/br(t)),n=i*Qi(br(t),s)/s;if(!s)return yr;function r(t,e){n>0?e<-Vi+ji&&(e=-Vi+ji):e>Vi-ji&&(e=Vi-ji);var i=n/Qi(br(e),s);return[i*ts(s*t),n-i*qi(s*t)]}return r.invert=function(t,e){var i=n-e,r=es(s)*is(t*t+i*i),a=$i(t,Xi(i))*es(i);return i*s<0&&(a-=Ni*es(t)*es(i)),[a/s,2*Ki(Qi(n/r,1/s))-Vi]},r}function Sr(t,e){return[t,e]}function Ar(t,e){var i=qi(t),s=t===e?ts(t):(i-qi(e))/(e-t),n=i/s+t;if(Xi(s)ji&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Or.invert=fr(rs),Rr.invert=fr((function(t){return 2*Ki(t)})),Ir.invert=function(t,e){return[-e,2*Ki(Zi(t))-Vi]};var Fr={exports:{}},zr=function(t,e){this.p1=t,this.p2=e};zr.prototype.rise=function(){return this.p2[1]-this.p1[1]},zr.prototype.run=function(){return this.p2[0]-this.p1[0]},zr.prototype.slope=function(){return this.rise()/this.run()},zr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},zr.prototype.isVertical=function(){return!isFinite(this.slope())},zr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},zr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},zr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},zr.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)},zr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Hr=zr,jr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Hr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=jr(t.slice(0,s),e),o=jr(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},Nr=jr;!function(t){var e=Nr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Yr,e),{tolerance:s}=i;return Vr(t,s)};var Kr;!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"}(Kr||(Kr={}));const $r=(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},qr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(A(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let C=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/C:0,w.push(_[t])}return w},Jr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],T=M.length?M:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:T});if(!w.length)return Zr(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...M,...w];return Zr(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",T=null!==(l=k.q1)&&void 0!==l?l:"q1",B=null!==(h=k.median)&&void 0!==h?h:"median",E=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(u=k.iqr)&&void 0!==u?u:"iqr",O=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",D=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",L=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),y(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}y(S)&&(S=[vt(Math.min.apply(null,S),0,1),vt(Math.max.apply(null,S),0,1)]);const V=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[M]=o,f[T]=l,f[B]=h,f[E]=c,f[P]=d,f[O]=n,f[R]=r,f[I]=u,f[D]=p,f[L]=g,A&&(f[F]=H.get(t)||[]),V.push(f)}return V};var ta={},ea={};function ia(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function sa(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function na(t,e){var i=t+"",s=i.length;return s9999?"+"+na(e,6):na(e,4))+"-"+na(t.getUTCMonth()+1,2)+"-"+na(t.getUTCDate(),2)+(r?"T"+na(i,2)+":"+na(s,2)+":"+na(n,2)+"."+na(r,3)+"Z":n?"T"+na(i,2)+":"+na(s,2)+":"+na(n,2)+"Z":s||i?"T"+na(i,2)+":"+na(s,2)+"Z":"")}function aa(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 ea;if(h)return h=!1,ta;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=Kr.DSV;const s=Wr(ha,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return aa(n).parse(t)},da=(t,e={},i)=>(i.type=Kr.DSV,oa(t)),ua=(t,e={},i)=>(i.type=Kr.DSV,la(t));function pa(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return ga(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 ga(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ma(t);default:throw new Error("unknown GeoJSON type")}}function ga(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=fa(t.properties),e.geometry=ma(t.geometry),e}function fa(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]=fa(s):e[i]=s})),e):e}function ma(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return ma(t)})),e):(e.coordinates=va(t.coordinates),e)}function va(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return va(t)}))}function ya(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 _a(t){for(var e,i,s=ya(t),n=0,r=1;r0}function ba(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=pa(t));var r=[];switch(t.type){case"GeometryCollection":return xa(t,(function(t){Aa(t,s)})),t;case"FeatureCollection":return ba(t,(function(t){ba(Aa(t,s),(function(t){r.push(t)}))})),ci(r)}return Aa(t,s)}function Aa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return xa(t,(function(t){Aa(t,e)})),t;case"LineString":return ka(ya(t),e),t;case"Polygon":return Ca(ya(t),e),t;case"MultiLineString":return ya(t).forEach((function(t){ka(t,e)})),t;case"MultiPolygon":return ya(t).forEach((function(t){Ca(t,e)})),t;case"Point":case"MultiPoint":return t}}function ka(t,e){_a(t)===e&&t.reverse()}function Ca(t,e){_a(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=wa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Ea=(t,e={},i)=>{i.type=Kr.GEO;const s=Wr(Ta,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Sa(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=Ma.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=Ma.bounds(t);t.bbox=e}})),t.features=l,t},Pa={},Oa=(t,e,i)=>{i.type=Kr.GEO;const s=Wr(Ta,Pa,e),{object:n}=s;if(!v(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Lr(a,t)}))}:Lr(a,o));var a,o;return Ea(r,s,i)},Ra=(t,e,i)=>{const s=!h(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 Ia=0;function Da(t="dataset"){return Ia>1e8&&(Ia=0),t+"_"+Ia++}class La{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Fa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Fa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",qr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Kn();const za={},Ha={albers:pr,albersusa:function(){var t,e,i,s,n,r,a=pr(),o=ur().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=ur().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)}},ja=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Na(t,e){return function i(){const s=e();return s.type=t,s.path=Kn().projection(s),s.copy=s.copy||function(){const t=i();return ja.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ua extends o{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=qa.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Za(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(Za(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,Za(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Za(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 Ka))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=qa.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Ja(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Xa,this.rootWheelEvent=new Ka,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&v(t)&&!R(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const io=jt-1e-8;class so{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>io)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ro=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ao={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},oo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let lo,ho,co,uo,po,go;function fo(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tgo){let t,e=co;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),w=.5*(b+S)+k*(x-_),M=Math.atan2(b-w,_-C);let T=Math.atan2(S-w,x-C)-M;T<0&&1===r?T+=jt:T>0&&0===r&&(T-=jt);const B=Math.ceil(Math.abs(T/(Ht+.001))),E=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 Mo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Lo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function zo(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new Ho(i,n),new Ho(n,s)]}class Ho extends To{constructor(t,e){super(),this.type=bo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===_o.ROW?Vt(this.p0.x-this.p1.x):t===_o.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class jo{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Fo(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Ho(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===_o.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===_o.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class No extends jo{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 Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?_o.ROW:_o.COLUMN;return"monotoneY"===t?new No(t,s):new jo(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 Go(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Yo(new Uo(n,s),t),n}function Yo(t,e){return Vo(t,e,1)}function Xo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Ko{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Xo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Xo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function $o(t,e){return Vo(t,e,2)}function qo(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("basis",i,t);return $o(new Ko(n,s),t),n}function Zo(t){return t<0?-1:1}function Jo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Zo(r)+Zo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Qo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class el{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:tl(this,this._t0,Qo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,tl(this,Qo(this,e=Jo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:tl(this,this._t0,e=Jo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class il extends el{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function sl(t,e){return Vo(t,e,2)}function nl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("monotoneX",i,t);return sl(new el(n,s),t),n}function rl(t,e){return Vo(t,e,2)}function al(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("monotoneY",i,t);return rl(new il(n,s),t),n}let ol=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class ll extends ol{lineEnd(){this.context.closePath()}}function hl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new jo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?_o.ROW:_o.COLUMN);return cl(new ol(r,e,n),t),r}function cl(t,e){return Vo(t,e,1)}function dl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new jo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?_o.ROW:_o.COLUMN);return cl(new ll(r,e,n),t),r}class ul extends Uo{lineEnd(){this.context.closePath()}}function pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return gl(new ul(n,s),t),n}function gl(t,e){return Vo(t,e,1)}function fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ft){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function ml(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Go(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const vl=ml("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const yl=ml("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class _l extends To{constructor(t,e,i){super(),this.type=bo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Io(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===_o.ROW?Vt(this.p0.x-this.p2.x):t===_o.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Io(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new _l(i,a,r),new _l(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class bl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Ho(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new _l(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Fo(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function xl(t,e,i){var s,n;switch(e){case"linear":default:return Go(t,i);case"basis":return qo(t,i);case"monotoneX":return nl(t,i);case"monotoneY":return al(t,i);case"step":return hl(t,.5,i);case"stepClosed":return dl(t,.5,i);case"stepBefore":return hl(t,0,i);case"stepAfter":return hl(t,1,i);case"catmullRom":return vl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return yl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return pl(t,i)}}class Sl extends no{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new so(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([oo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([oo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([oo.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([oo.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([oo.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([oo.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([oo.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([oo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([oo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new bl(this);Mo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[oo.M]=t=>`M${t[1]} ${t[2]}`,t[oo.L]=t=>`L${t[1]} ${t[2]}`,t[oo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[oo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[oo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];Co(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[oo.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=fo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=xl(e,i);"x"===s?this.direction=_o.ROW:"y"===s?this.direction=_o.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[oo.M]=this.moveToTransform,t[oo.L]=this.lineToTransform,t[oo.Q]=this.quadraticCurveToTransform,t[oo.C]=this.bezierCurveToTransform,t[oo.AT]=this.arcToTransform,t[oo.E]=this.ellipseTransform,t[oo.R]=this.rectTransform,t[oo.A]=this.arcTransform,t[oo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Mo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===_o.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===_o.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),Kl=Object.assign(Object.assign({},jl),{points:[],cornerRadius:0,closePath:!0}),$l=Object.assign(Object.assign({},jl),{width:100,height:100,spikes:5,thickness:.5}),ql=Object.assign(Object.assign({},jl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Zl=Object.assign(Object.assign({},jl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},jl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Ql=Object.assign(Object.assign(Object.assign({},jl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),th=Object.assign(Object.assign(Object.assign({},jl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),eh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},jl),{fill:!0,cornerRadius:0,cornerType:"round"}),ih=Object.assign(Object.assign({},eh),{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});class sh{}const nh=Symbol.for("@visactor/vrender-core/application-state");function rh(){const t=globalThis;return t[nh]||(t[nh]={application:new sh}),t[nh]}const ah=rh().application;class oh{static GetImage(t,e){var i;const s=oh.cache.get(t);s?"fail"===s.loadState?ah.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):oh.loadImage(t,e)}static GetSvg(t,e){var i;let s=oh.cache.get(t);s?"fail"===s.loadState?ah.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"},oh.cache.set(t,s),s.dataPromise=ah.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=oh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},oh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=ah.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=ah.global.loadBlob(t):"json"===e&&(i.dataPromise=ah.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!oh.isLoading&&oh.toLoadAueue.length){oh.isLoading=!0;const t=oh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(oh.cache.set(i,n),n.dataPromise=ah.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()})).catch((t=>{console.error(t),oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()}))}}),0)}static loadImage(t,e){const i=lh(t,oh.toLoadAueue);if(-1!==i)return oh.toLoadAueue[i].marks.push(e),void oh.loading();oh.toLoadAueue.push({url:t,marks:[e]}),oh.loading()}static improveImageLoading(t){const e=lh(t,oh.toLoadAueue);if(-1!==e){const t=oh.toLoadAueue.splice(e,1);oh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function lh(t,e){for(let i=0;i{var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)ch[s]=t,i&&(i=!(null!==(e=ch[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ch[e]=!!t[e],i&&(i=!!ch[e]);else ch[0]=!1,ch[1]=!1,ch[2]=!1,ch[3]=!1;return{isFullStroke:i,stroke:ch}},uh=[0,0,0,0],ph=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(uh[0]=t[0],uh[2]=t[0],uh[1]=t[1],uh[3]=t[1],uh):t:t:0,gh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],fh=[1,2,3,0,1,2,3,0];function mh(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;gh[0].x=i,gh[1].y=i,gh[2].x=-i,gh[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Ut(t)*i,Xt(t)*i),s.add(Ut(e)*i,Xt(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}xh.TimeOut=1e3/60;const Sh=new xh,Ah=(t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,kh=(t,e)=>{const i=Ah(t,e);return isNaN(i)?i:Math.max(e,i)};class Ch{bounds(t,e){if(x(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function wh(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var Mh=new class extends Ch{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 wh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Th=new class extends Ch{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Eh=new class extends Ch{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Ph(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Ch{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Ph(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ph(t,this.parseSize(e)/2+n,i,s)}};function Rh(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Ih extends Ch{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 Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Ih;var Lh=new class extends Ih{constructor(){super(...arguments),this.type="triangle"}};const Fh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),zh=Math.sin(jt/10)*Fh,Hh=-Math.cos(jt/10)*Fh;function jh(t,e,i,s){const n=zh*e,r=Hh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Nh=new class extends Ch{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 jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return jh(t,this.parseSize(e)/2+n,i,s)}};const Vh=Kt(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Uh=new class extends Ch{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Gh(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 Yh=new class extends Ch{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Gh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Gh(t,this.parseSize(e)/2+n,i,s)}};function Xh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Kh=new class extends Ch{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Xh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Xh(t,this.parseSize(e)/2+n,i,s)}};const $h=-.5,qh=Kt(3)/2,Zh=1/Kt(12);function Jh(t,e,i,s){const n=e/2,r=e*Zh,a=n,o=e*Zh+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($h*n-qh*r+i,qh*n+$h*r+s),t.lineTo($h*a-qh*o+i,qh*a+$h*o+s),t.lineTo($h*l-qh*h+i,qh*l+$h*h+s),t.lineTo($h*n+qh*r+i,$h*r-qh*n+s),t.lineTo($h*a+qh*o+i,$h*o-qh*a+s),t.lineTo($h*l+qh*h+i,$h*h-qh*l+s),t.closePath(),!1}var Qh=new class extends Ch{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 Jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Jh(t,this.parseSize(e)/2+n,i,s)}};function tc(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ec=new class extends Ch{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 tc(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return tc(t,this.parseSize(e)/2,i,s,n)}};function ic(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var sc=new class extends Ch{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 ic(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ic(t,this.parseSize(e)/2,i,s,n)}};function nc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var rc=new class extends Ch{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 nc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return nc(t,this.parseSize(e)/2,i,s,n)}};const ac=Kt(3);function oc(t,e,i,s){const n=e*ac;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var lc=new class extends Ch{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return oc(t,this.parseSize(e)/2/ac,i,s)}drawOffset(t,e,i,s,n){return oc(t,this.parseSize(e)/2/ac+n,i,s)}};function hc(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 cc=new class extends Ch{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 hc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hc(t,this.parseSize(e)/4+n,i,s)}};function dc(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 uc=new class extends Ch{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 dc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return dc(t,this.parseSize(e)/4+n,i,s)}};function pc(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 gc=new class extends Ch{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 pc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pc(t,this.parseSize(e)/4+n,i,s)}};function fc(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 mc=new class extends Ch{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 fc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return fc(t,this.parseSize(e)/4+n,i,s)}};function vc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var yc=new class extends Ch{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return vc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function _c(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var bc=new class extends Ch{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return _c(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return _c(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function xc(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 Sc=new class extends Ch{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 xc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return xc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function Ac(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function kc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Cc=new class extends Ch{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return x(e)?kc(t,e,i,s):Ac(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?kc(t,e+2*n,i,s):Ac(t,[e[0]+2*n,e[1]+2*n],i,s)}};const wc=new Ve;class Mc{constructor(t,e,i=!1){this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Mo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Mo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{wc.x1=i.bounds.x1*t,wc.y1=i.bounds.y1*t,wc.x2=i.bounds.x2*t,wc.y2=i.bounds.y2*t,e.union(wc)}))}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 Tc=[Mh,Th,Eh,Oh,lc,Lh,Nh,Uh,Yh,Kh,Qh,ec,sc,Dh,rc,cc,uc,gc,mc,Cc,yc,bc,Sc],Bc={};Tc.forEach((t=>{Bc[t.type]=t}));const Ec={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Pc{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 Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Rc(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Rc(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Rc(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 Pc(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 Pc(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 Lc(t,e){return Fc(t)}function Fc(t,e){const i={};for(let e=0;e$c.set(t,!0)));const qc=new Map;function Zc(t){if($c.has(t))return!0;if(qc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Jc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>qc.set(t,!0)));const Qc=Yc(),td=Yc(),ed=Yc(),id=Yc(),sd=Yc(),nd=Yc(),rd=Yc(),ad=Yc(),od=Yc(),ld=Yc(),hd=Yc(),cd=Yc(),dd=Yc(),ud=Yc(),pd=Yc(),gd=Yc(),fd=Yc(),md=Symbol.for("GraphicService"),vd=Symbol.for("GraphicCreator"),yd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},_d=Object.keys(yd),bd={"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"},xd=Object.keys(bd),Sd={duration:200,easing:"cubicOut"},Ad=Symbol.for("CanvasFactory"),kd=Symbol.for("Context2dFactory");function Cd(t){return function(){var t,e;const i=null===(t=ah.global)||void 0===t?void 0:t.env,s=i?null===(e=ah.canvasFactory)||void 0===e?void 0:e.call(ah,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const wd=1e-4,Md=Math.sqrt(3),Td=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Pd(t){return"number"==typeof t&&Number.isFinite(t)}const Od=[0,0],Rd=[0,0],Id=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Ld(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Fd(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 zd(t){return(t%=Nt)<0&&(t+=Nt),t}function Hd(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function Vd(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(Bd(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 Gd=[-1,-1,-1],Yd=[-1,-1];function Xd(){const t=Yd[0];Yd[0]=Yd[1],Yd[1]=t}function Kd(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(Bd(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,Td):Math.pow(i,Td),s=s<0?-Math.pow(-s,Td):Math.pow(s,Td);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+Md*Math.sin(e)))/(3*a),h=(-o+i*(s-Md*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,Gd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Xd(),p=Fd(e,s,r,o,Yd[0]),u>1&&(g=Fd(e,s,r,o,Yd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Gd);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=Ld(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Gd[0]=-l,Gd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=Gd[0]+t&&a<=Gd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=Gd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function Zd(t){return Math.round(t/zt*1e8)/1e8%2*zt}function Jd(t,e){let i=Zd(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-Zd(i-n)):e&&i1&&(i||(h+=Oe(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;Qd[0]=S,Qd[1]=A,Jd(Qd,Boolean(a[6])),S=Qd[0],A=Qd[1];const k=S,C=A-S,w=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case oo.M:u=m,p=v,c=u,d=p;break;case oo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case oo.C:if(i){if(jd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=Kd(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case oo.Q:if(i){if(Hd(c,d,m,v,y,_,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case oo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Nd(m,v,y,k,k+C,w,e,M,n))return!0}else h+=qd(m,v,y,k,k+C,w,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case oo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case oo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class iu{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(iu.IsGradientStr(t))try{const e=eu(t)[0];if(e){if("linear"===e.type)return iu.ParseLinear(e);if("radial"===e.type)return iu.ParseRadial(e);if("conic"===e.type)return iu.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:iu.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:iu.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function ru(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function au(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];return 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}function ou(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];return 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}function lu(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];return 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,t}function hu(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 cu(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 du(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function uu(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 pu(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];return Math.abs(g-b)0&&(xu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(xu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ku),function(t,e,i){return tu(t,0,!1,e,i)}(this.path.commandList,ku.x,ku.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ku);const i=su(this,this.lineWidth,this.dpr);return function(t,e,i,s){return tu(t,e,!0,i,s)}(this.path.commandList,i,ku.x,ku.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Au,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>xu.free(t))),this.stack.length=0}}const wu={WIDTH:500,HEIGHT:500,DPR:1};class Mu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=wu.WIDTH,height:n=wu.HEIGHT,dpr:r=wu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Tu;Mu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Tu||(Tu={}));class Bu{static Get(t,e=Tu.Color1,i=[0,0,0,1]){if(e===Tu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Tu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Eu(t,e=!1){return Array.isArray(t)&&x(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Pu(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ou(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ou(t,e,i,s,n)}function Ou(t,e,i,s,n){if(!t||!e)return t&&Eu(t)||e&&Eu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Tu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Tu.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:Eu(a)})))});return o?Pu(r,l,i,s,n):Pu(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 Ru(s,n,i);if("radial"===s.gradient)return Iu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Eu(Lu(r,a,i),s)}function Ru(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Iu(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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]}function Fu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const zu=[0,0,0,0],Hu=[0,0,0,0];function ju(t,e,i){return Bu.Get(t,Tu.Color255,zu),Bu.Get(e,Tu.Color255,Hu),`rgba(${Math.round(zu[0]+(Hu[0]-zu[0])*i)},${Math.round(zu[1]+(Hu[1]-zu[1])*i)},${Math.round(zu[2]+(Hu[2]-zu[2])*i)},${zu[3]+(Hu[3]-zu[3])*i})`}class Nu{static GetCanvas(){try{return Nu.canvas||(Nu.canvas=ah.global.createCanvas({})),Nu.canvas}catch(t){return null}}static GetCtx(){if(!Nu.ctx){const t=Nu.GetCanvas();Nu.ctx=t.getContext("2d")}return Nu.ctx}}class Vu extends Ge{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Nu.GetCanvas(),s=Nu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Uu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Nt;for(;i>Nt;)i-=Nt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Pu(o.color,l.color,h,!1)}function Gu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Nu.GetCanvas(),d=Nu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Yu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Xu(t){return null==t?void 0:t}class Ku{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Xu(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Yu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Xu(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function $u(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function qu(t){if(!$u(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=qu(t[i])})),e}function Zu(t,e){var i;const s=null!==(i=qu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];$u(n)&&$u(i)?s[t]=Zu(n,i):s[t]=qu(i)})),s}class Ju{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=qu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];$u(r)&&$u(n)?t[i]=Zu(r,n):!$u(r)&&$u(a)&&$u(n)?t[i]=Zu(a,n):t[i]=qu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?Qu.PAINT|Qu.BOUNDS|Qu.PICK:Qu.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?Qu.PAINT|Qu.BOUNDS:Qu.PAINT}};class ip{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Sd;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:yo.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:yo.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:yo.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const sp=new Ku;function np(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,rp(t),!0)}function rp(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=sp.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function ap(t){if(t)return t.parentScope&&ap(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&rp(t),t}function op(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function lp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function hp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,lp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),op(null!=e?e:t.ownerStage))}const cp=new Ve,dp=new Ue,up=["lineWidth","scaleX","scaleY","angle","anchor","visible"],pp=["x","y"],gp=["scaleX","scaleY"],fp=["angle"],mp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),vp=new ne,yp=[],_p=Qu.PAINT|Qu.SHAPE|Qu.BOUNDS|Qu.TRANSFORM|Qu.LAYOUT;function bp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function xp(t){if(!bp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=bp(s)?xp(s):s})),i}function Sp(t,e){return t===e||!!(bp(t)||bp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function Ap(t,e){var i;const s=null!==(i=xp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];bp(n)&&bp(i)?s[t]=Ap(n,i):s[t]=xp(i)})),s}const kp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Cp extends Ua{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,lp(this.stage,this),op(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&ap(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:yo.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(ap(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new Ku).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=xp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&bp(n)&&bp(s)?e[t]=Ap(n,s):e[t]=xp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:xp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Sp(a,o)||(s.set(n,{prev:a,next:o}),t[n]=xp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ep[t];return n?n(e,i):null!==(s=tp[t])&&void 0!==s?s:Qu.PAINT}(e,i,s):null!==(n=tp[e])&&void 0!==n?n:Qu.PAINT;return r&Qu.PICK&&(r|=Qu.BOUNDS),r===Qu.PAINT&&this.needUpdateTag(e)&&(r=Qu.SHAPE|Qu.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&_p)!==_p?(t&Qu.SHAPE?this.addUpdateShapeAndBoundsTag():t&Qu.BOUNDS&&this.addUpdateBoundTag(),t&Qu.PAINT&&this.addUpdatePaintTag(),t&Qu.TRANSFORM&&this.addUpdatePositionTag(),t&Qu.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=Qu.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!bp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=bp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&mo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Tp.userSymbolMap[t],e)return e;if(!0===jc(t=Ec[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=y(i.path)?i.path:[i.path];cp.clear();const n=[];s.forEach((t=>{const e=(new Sl).fromString(t.d),i={};xd.forEach((e=>{t[e]&&(i[bd[e]]=t[e])})),n.push({path:e,attribute:i}),cp.union(e.bounds)}));const r=cp.width(),a=cp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new Mc(t,n,!0);return Tp.userSymbolMap[t]=l,l}const i=(new Sl).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Gt(s,n);i.transform(0,0,r,r);const a=new Mc(t,i);return Tp.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=ph(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new so(t);return Mo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&mo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&mo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&mo.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&mo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=mo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vo.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===yo.STATE||null!=i&&i>=yo.ANIMATE_BIND&&i<=yo.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===yo.STATE||null!=o&&o>=yo.ANIMATE_BIND&&o<=yo.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Sp(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:yp,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:yo.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Sd}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:yp,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?xp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:yo.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:yp,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:yp,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:yo.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:yo.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Pl.x,y:e=Pl.y,scaleX:i=Pl.scaleX,scaleY:s=Pl.scaleY,angle:n=Pl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ut(a),f=Xt(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,!0),ah.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Pl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:ah.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:yo.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:yo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=ah.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new Sl).fromString(t):this.pathProxy=new Sl,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:ah.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new $a(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ua.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:yo.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:yo.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||ah.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Cu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Cp.userSymbolMap={};const wp=Symbol.for("@visactor/vrender-core/graphic-class");function Mp(){var t;const e=globalThis;return null!==(t=e[wp])&&void 0!==t||(e[wp]={Graphic:Cp}),e[wp]}const Tp=Mp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!mp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Ip=Op();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Pp.forEach((t=>{this._defaultTheme[t]=Object.create(Ip[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Pp.forEach((s=>{const n=Object.create(Ip[s]);t&&t[s]&&Rp(n,t[s]),i[s]&&Rp(n,i[s]),e[s]&&Rp(n,e[s]),this.combinedTheme[s]=n})),e.common&&Pp.forEach((t=>{Rp(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 Lp=new Dp;function Fp(t,e){return t.glyphHost?Fp(t.glyphHost):e?(t.isContainer,e):zp(t)||t.attachedThemeGraphic&&Fp(t.attachedThemeGraphic)||Lp.getTheme()}function zp(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)):Lp.getTheme()}return null}const Hp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},jp=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...up];class Np extends Tp{constructor(t){super(t),this.type="arc",this.numberType=Qc}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=le(e),i=e+a,s&&Vt(a)>Ft&&Vt(a)Ft&&o>Ft)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Kt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*Xt(g)),n=qt(Number(l)/a*Xt(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Fp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);Hp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Nt-Ft?i.set(-s,-s,s,s):(mh(l,o,s,i),mh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,jp)}needUpdateTag(t){return super.needUpdateTag(t,jp)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Nt-Ft)n.moveTo(0+h*Ut(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Ut(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Ut(a),e=h*Xt(a),i=l*Ut(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Np(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Np.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Np(t)}Np.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);const Wp=["segments","points","curveType","curveTension",...up];class Up extends Tp{constructor(t){super(t),this.type="area",this.numberType=ed}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Fp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),ah.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Sl;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Gp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Yp=["radius","startAngle","endAngle",...up];class Xp extends Tp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Fp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-Ft?i.set(-r,-r,r,r):mh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Yp)}needUpdateTag(t){return super.needUpdateTag(t,Yp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Sl,s.arc(0,0,r,a,o),s}clone(){return new Xp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xp.NOWORK_ANIMATE_ATTR}}function Kp(t){return new Xp(t)}Xp.NOWORK_ANIMATE_ATTR=kp;class $p extends Tp{constructor(t){super(t),this.type="glyph",this.numberType=sd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Fp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new $p(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return $p.NOWORK_ANIMATE_ATTR}}function qp(t){return new $p(t)}var Zp;$p.NOWORK_ANIMATE_ATTR=kp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Zp||(Zp={}));let Jp=class t extends Tp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=nd,this._childUpdateTag=mo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(np(this.sharedStateScope,t),hp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vo.GLOBAL){const i=new ne(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&mo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Pl.x,y:e=Pl.y,dx:i=Pl.dx,dy:s=Pl.dy,scaleX:n=Pl.scaleX,scaleY:r=Pl.scaleY,angle:a=Pl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Fp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=mo.CLEAR_BOUNDS,this._childUpdateTag&=mo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&mo.UPDATE_BOUNDS||(this._childUpdateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:ah.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&mo.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=ah.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&np(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return rp({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function Qp(t){return new Jp(t)}Jp.NOWORK_ANIMATE_ATTR=kp;const tg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...up];class eg extends Tp{constructor(t){super(t),this.type="image",this.numberType=rd,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Fp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return eh[t]}needUpdateTags(t){return super.needUpdateTags(t,tg)}needUpdateTag(t){return super.needUpdateTag(t,tg)}clone(){return new eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return eg.NOWORK_ANIMATE_ATTR}}function ig(t){return new eg(t)}eg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},kp);const sg=["segments","points","curveType","curveTension",...up];let ng=class t extends Tp{constructor(t={}){super(t),this.type="line",this.numberType=ad}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=_h(i,s,e))}getGraphicTheme(){return Fp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),ah.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,sg)}needUpdateTag(t){return super.needUpdateTag(t,sg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Sl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function rg(t){return new ng(t)}ng.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const ag=["path","customPath",...up];class og extends Tp{constructor(t){super(t),this.type="path",this.numberType=od}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Sl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Sl?this.cache:t.path)}getGraphicTheme(){return Fp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Sl).fromString(t.path):t.customPath&&(this.cache=new Sl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,ag)}needUpdateTag(t){return super.needUpdateTag(t,ag)}toCustomPath(){return(new Sl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return og.NOWORK_ANIMATE_ATTR}}function lg(t){return new og(t)}og.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},kp);const hg=["points","cornerRadius",...up];class cg extends Tp{constructor(t){super(t),this.type="polygon",this.numberType=ld}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Fp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),ah.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,hg)}needUpdateTag(t){return super.needUpdateTag(t,hg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Sl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new cg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return cg.NOWORK_ANIMATE_ATTR}}function dg(t){return new cg(t)}cg.NOWORK_ANIMATE_ATTR=kp;const ug=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},pg=["width","x1","y1","height","cornerRadius",...up];class gg extends Tp{constructor(t){super(t),this.type="rect",this.numberType=cd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Fp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,pg)}needUpdateTag(t){return super.needUpdateTag(t,pg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=ug(e);return t=new Sl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new gg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return gg.NOWORK_ANIMATE_ATTR}}function fg(t){return new gg(t)}gg.NOWORK_ANIMATE_ATTR=kp;const mg=Symbol.for("EnvContribution"),vg=Symbol.for("VGlobal"),yg="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",_g={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"}},bg=!0,xg=!1,Sg=/\w|\(|\)|-/,Ag=/[.?!,;:/,。?!、;:]/,kg=/\S/,Cg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=ah.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=Mg(t,a)),a}function Mg(t,e,i=!1){let s=e;for(;Sg.test(t[s-1])&&Sg.test(t[s])||Ag.test(t[s]);)if(s--,s<=0)return i?Tg(t,e):e;return s}function Tg(t,e){let i=e;for(;Sg.test(t[i+1])&&Sg.test(t[i])||Ag.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=ah.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Eg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=_g[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Pg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Og{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=kh(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Pg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=wg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Rg extends eg{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=ph(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=ph(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=eh.width,height:e=eh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Ig{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Rg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=_g[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=kg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Rg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Rg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Rg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||xg;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,Cg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||bg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?nu(t,s,{AABBBounds:i}):s,Cg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Rg)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Rg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=_g[this.direction]}store(t){if(t instanceof Rg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Ig(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Rg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character,t.ascentDescentMode),new Og(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Lg=!1;try{Lg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Lg=!1}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...up];class zg extends Tp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ud,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:th.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:th.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:th.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:th.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:th.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:th.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:th.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:th.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Fp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&zg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&zg.splitText(t.text).length>1)))}static splitText(t){if(Lg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=zg.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),ah.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||ah.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!zg.AllSingleCharacter(y)&&(y=zg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),w=new Eg(0,0,(k?n:S?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&S,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(w);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&w.lines[w.lines.length-1].paragraphs.push(s)):M.deal(s,!0),w.lines.length!==t&&(t=w.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,w.lines[w.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===w.layoutDirection?k:C)){const t=w.getActualSizeWidthEllipsis();let e="horizontal"===w.layoutDirection?t.width:t.height;("horizontal"===w.layoutDirection?S:A)&&(e=Math.min(e,"horizontal"===w.layoutDirection?i:s)),w.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&w.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new zg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function Hg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},kp);class jg extends Jp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ng(t){return new jg(t)}const Vg=["symbolType","size",...up];let Wg=class t extends Tp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=gd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Fp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Uc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Sl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Sl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Ug(t){return new Wg(t)}function Gg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Yg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Xg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[li(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=li(s);d(t[s])||(e[n]=i(t[s]))})),u(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&v(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},kp);class Kg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Cl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=fd}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Fp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new qg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ce(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=ah.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Uc(n,o/Math.abs(r+a),!0,l),i.union(n)}return ah.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||ah.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Kg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new Kg(a,w,C),T=y(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=T.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=Gg(y,a),e=this.cache.verticalList.length*v,i=Yg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>Kc(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Xc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const S=Gg(y,a),A=x.verticalList.length*v,k=Yg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=kh(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=$g){return super.needUpdateTags(t,e)}needUpdateTag(t,e=$g){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return qg.baselineMapAlign}getAlignMapBaseline(){return qg.alignMapBaseline}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},kp),qg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},qg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Jg=["heightLimit","lineClamp"];class Qg extends qg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=kh(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new Kg(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),w=[],M=[0,0];let T=1/0;if(y>0&&(T=Math.max(Math.floor(y/x),1)),b&&(T=Math.min(T,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 df extends cf{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let uf=0;class pf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=ah.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++uf,t),this.tryRunAnimationFrameNextFrame(),uf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class gf{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var ff=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 mf extends gf{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new df(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new pf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new pf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return ff(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class vf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Cd(Object.assign({nativeCanvas:ah.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Cd(Object.assign({nativeCanvas:ah.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const yf=new vf,_f=Symbol.for("VWindow"),bf=Symbol.for("WindowHandlerContribution");function xf(t){const e=ah.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Sf extends gf{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(t=ah.global,e=xf){super(),this.handlerFactory=e,this.hooks={onChange:new df(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class Af{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=ah.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=yf.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=ah.windowFactory)||void 0===s?void 0:s.call(ah))&&void 0!==n?n:new Sf(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var kf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(kf||(kf={}));const Cf=new Ue;class wf{constructor(){this.matrix=new Ue}init(t){return this.mode=kf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=kf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Cf.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(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Cf.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(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}scale(t,e,i){return this.mode===kf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===kf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Cf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}translate(t,e){return this.mode===kf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===kf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const Mf=Symbol.for("@visactor/vrender-core/factory-state");function Tf(){const t=globalThis;return t[Mf]||(t[Mf]={pluginClasses:{}}),t[Mf]}class Bf{constructor(){this.global=ah.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ue(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new ne(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Ef=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 Pf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Of(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Pf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Pf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Lf{constructor(){this.time=xo.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Hf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Fp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Xf(t,e,i,s)}}const Ff=new Lf,zf=new Set(["top","center","bottom"]);function Hf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function jf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Nf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Nf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:jf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Uf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:zf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Gf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Yf(t){if(!t)return null;const e=Gf(t.naturalWidth,t.videoWidth,t.width),i=Gf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Xf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Yf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Uf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=yf.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),yf.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Kf{constructor(t){this.subRenderContribitions=t,this.time=xo.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)}))}}class $f{constructor(){this.time=xo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const qf=new $f;class Zf{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Jf=new Zf,Qf={getContributions:()=>[]};class tm{constructor(t=[],e=Qf,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Of(e,jl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ne,this.backupDirtyBounds=new Ne,this.global=null!==(s=i.global)&&void 0!==s?s:ah.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:ah.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:Qf,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,xu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=If(e,i,jl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=xu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),xu.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||function(){const t=ah.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class im{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class sm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class nm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const am={getContributions:()=>[]};class om{constructor(t=am,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new nm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class lm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class hm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=ah.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=ah.global.getRequestAnimationFrame();this.rafId=t((()=>{ah.global.devicePixelRatio!==this.dpr&&(this.dpr=ah.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=ah.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class cm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,ah.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const dm=new Ve;class um{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&mo.UPDATE_PAINT)||s._updateTag&mo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(dm.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(dm,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let pm;function gm(){if(null==pm)try{const t=document.createElement("canvas"),e=t.getContext("2d");pm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),pm&&(pm=!!document.createElement)}catch(t){pm=!1}}function fm(){gm();const t=ah.global&&ah.global.env;return t?"browser"===t:pm}function mm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle: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(ru(t),hu(t,t,[n+o,r+l,a+h]),hu(t,t,[y[0],y[1],y[2]]),au(t,t,g),ou(t,t,p),hu(t,t,[-y[0],-y[1],y[2]]),du(t,t,[c,d,u]),f){const i=Su.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]}hu(i,i,[s[0],s[1],0]),lu(i,i,f),hu(i,i,[-s[0],-s[1],0]),uu(t,t,i)}}function vm(t){const{alpha:e,beta:i}=t.attribute;return e||i}class ym{constructor(t=of){this.creator=t,this.hooks={onAttributeUpdate:new df(["graphic"]),onSetStage:new df(["graphic","stage"]),onRemove:new df(["graphic"]),onRelease:new df(["graphic"]),onAddIncremental:new df(["graphic","group","stage"]),onClearIncremental:new df(["graphic","group","stage"]),beforeUpdateAABBBounds:new df(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new df(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new df(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Yg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Gg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Uc(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;Uc(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const _m="white";class bm extends Jp{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:_m}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,y,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new df(["stage"]),afterRender:new df(["stage"]),afterClearScreen:new df(["stage"]),afterClearRect:new df(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:ah.global,!this.global.env&&fm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:ah.windowFactory)&&void 0!==n?n:()=>new Sf(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=ah.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=ah.renderServiceFactory)||void 0===h?void 0:h.call(ah))&&void 0!==c?c:ah.renderService)&&void 0!==d?d:new em,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=ah.pluginServiceFactory)||void 0===p?void 0:p.call(ah))&&void 0!==g?g:ah.pluginService)&&void 0!==f?f:new om,this.layerService=null!==(y=null!==(m=e.layerService)&&void 0!==m?m:ah.layerService)&&void 0!==y?y:new wm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:ah.graphicService)&&void 0!==b?b:new ym,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:_m,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,rp(s)),hp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new eo(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=km.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=km.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=km.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new lm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new hm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new cm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ne;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new um,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=km.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=km.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=km.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return rp({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class xm{constructor(t=bm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Sm extends Jp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{ah.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=>{ah.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)))}}class Am{constructor(t=Sm){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let km=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Cm(t){const e=ah.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}km._pluginClasses=Tf().pluginClasses;class wm{static GenerateLayerId(){return`${wm.idprefix}_${wm.prefix_count++}`}constructor(t=ah.global,e=new Am,i=Cm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:wm.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)}}wm.idprefix="visactor_layer",wm.prefix_count=0;const Mm=Symbol.for("TransformUtil"),Tm=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Em=Symbol.for("StaticLayerHandlerContribution"),Pm=Symbol.for("DynamicLayerHandlerContribution"),Om=Symbol.for("VirtualLayerHandlerContribution"),Rm=Symbol.for("@visactor/vrender-core/contribution-store-state");function Im(){const t=globalThis;return t[Rm]||(t[Rm]={store:new Map}),t[Rm]}const Dm=Symbol("ContributionProvider");class Lm{constructor(t,e){this.serviceIdentifier=t,this.container=e,jm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function Fm(t,e){return new Lm(t,e)}function zm(t,e){t(Dm).toDynamicValue((({container:t})=>Fm(e,t))).inSingletonScope().whenTargetNamed(e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>Fm(e,t))).whenTargetNamed(e)}class jm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}jm.store=Im().store;class Nm{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=Ql.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Mg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Mg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Nm{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Um({bind:t}){t(vg).toDynamicValue((({container:t})=>new mf(Fm(mg,t)))).inSingletonScope(),t(_f).to(Sf),t(Tm).toDynamicValue((({container:t})=>new Af(Fm(Vm,t)))).inSingletonScope(),t(Mm).to(wf).inSingletonScope(),t(Bm).to(wm).inSingletonScope()}const Gm=Symbol.for("RenderService"),Ym=Symbol.for("BeforeRenderConstribution");function Xm({bind:t}){t(Gm).to(em)}const Km=Symbol.for("GraphicPicker"),$m=Symbol.for("PickerService"),qm=Symbol.for("BoundsPicker"),Zm=Symbol.for("GlobalPickerService"),Jm=Symbol.for("PickItemInterceptor"),Qm=Symbol.for("PickServiceInterceptor"),tv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===td,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},ev=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class iv extends gg{constructor(t){super(t),this.type="rect3d",this.numberType=dd}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Yt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return Fp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,nv)}needUpdateTag(t){return super.needUpdateTag(t,nv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Sl,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new rv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rv.NOWORK_ANIMATE_ATTR}}function av(t){return new rv(t)}rv.NOWORK_ANIMATE_ATTR=kp;class ov extends Np{constructor(t){super(t),this.type="arc3d",this.numberType=td}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return ov.NOWORK_ANIMATE_ATTR}}function lv(t){return new ov(t)}ov.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);class hv extends cg{constructor(t){super(t),this.type="pyramid3d",this.numberType=hd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return hv.NOWORK_ANIMATE_ATTR}}function cv(t){return new hv(t)}let dv,uv;function pv(t){return dv||(dv=hf("text",{})),dv.initAttributes(t),dv.AABBBounds}function gv(t){return uv||(uv=hf("richtext",{})),uv.setAttributes(t),uv.AABBBounds}hv.NOWORK_ANIMATE_ATTR=kp;class fv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Fp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=xu.allocateByObj(a),u=new ne(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class vv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=tv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function _v({bind:t,isBound:e}){e($m)||(t(Zm).toSelf(),t($m).toService(Zm)),t(yv).toSelf().inSingletonScope(),t(Jm).toService(yv),t(mv).toSelf().inSingletonScope(),t(Jm).toService(mv),t(vv).toSelf().inSingletonScope(),t(Jm).toService(vv),zm(t,Jm),t(fv).toSelf().inSingletonScope(),t(Qm).toService(fv),zm(t,Qm)}function bv({bind:t}){t(md).to(ym),t(vd).toConstantValue(of)}const xv=Symbol.for("AutoEnablePlugins"),Sv=Symbol.for("PluginService");class Av{constructor(){this.type="static",this.offscreen=!1,this.global=ah.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Cd({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()}}function kv(t){(function({bind:t}){zm(t,mg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),zm(t,Vm)}({bind:t.bind}),function({bind:t}){t(Av).toSelf(),t(Em).toService(Av)}({bind:t.bind})}const Cv=zt/2;function wv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!$(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Cv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!$(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Cv,!1)}if(o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),!$(S,A)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Cv,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Cv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Mv(t,e){return!(!t&&!e)}function Tv(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Ev(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Pv(t,e){return t*e>0}function Ov(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Rv(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*uE*E+P*P&&(k=w,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Ut(c),k=n*Xt(c),C=s*Ut(u),w=s*Xt(u);let M,T,B,E;if((b>Ft||_>Ft)&&(M=n*Ut(d),T=n*Xt(d),B=s*Ut(p),E=s*Xt(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:B,yirs:E,xore:M,yore:T,xire:C,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Lv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Nt-Ft)e.moveTo(i+n*Ut(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Ut(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:w,innerDeltaAngle:M,innerEndAngle:T,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:O}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(y,m),o=Iv(g,f,u,p,n,t,Number(c)),l=Iv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Ut(Wt(l.y01,l.x01)),s+o.cy+m*Xt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ut(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Ut(C),s+n*Xt(C));if(!(r>Ft)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(w>Ft){const t=Yt(E,w),n=Yt(P,w),o=Iv(S,A,b,x,r,-n,Number(c)),l=Iv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ut(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,T,B,c):e.moveTo(i+r*Ut(B),s+r*Xt(B))}return a?a[3]&&e.lineTo(i+n*Ut(o),s+n*Xt(o)):e.closePath(),d}const Fv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class zv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=yf.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])),yf.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Nt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=yf.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Ug({}));const C=h.columns?v/h.columns:b,w=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,w-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:Fv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=yf.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),yf.free(l),c}yf.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const Hv=new zv;class jv{constructor(){this.time=xo.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,w-=m;const T=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:su(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:w-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Lv(t,e,i,s,M+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&T(u,"outerBorder"),f&&T(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:w,startAngle:y,endAngle:_})}}const Nv=new jv,Vv=Hv,Wv=Ff;class Uv{constructor(){this.time=xo.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:su(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Gv=new Uv,Yv=Hv,Xv=Ff;class Kv extends Lf{constructor(){super(...arguments),this.time=xo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Hf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const $v=new Kv;function qv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Zv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:k-i)||0,T=(null!=T?T:C-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:su(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,T-o*g)):(e.beginPath(),wv(e,u,p,M-o*g,T-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}class Jv{constructor(){this.time=xo.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;qv(p)&&(u.doStroke=!1)}}class Qv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,qv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return wv(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ty=new Zv,ey=Hv,iy=Ff;class sy extends Zv{constructor(){super(...arguments),this.time=xo.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)}}const ny=new sy,ry=Ff;class ay{constructor(){this.time=xo.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:su(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class oy{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const ly=new ay,hy=new oy,cy=Hv,dy=Ff,uy=Hv,py=Ff;class gy extends zv{constructor(){super(...arguments),this.time=xo.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:bh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:bh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:bh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:bh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class fy{constructor(t){this.groupRenderContribitions=t,this.numberType=nd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push($v)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Fp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:w=l.y}=t.attribute,M=Ev(p,m,g,f,c),T=Ov(p,v,g,f),B=Mv(c,u),E=Tv(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(M||T||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),wv(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push($v));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===xo.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o,P)})),h&&e.clip();const O=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,w-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,C-i,w-s,l),e.stroke()))};A?(R(),O()):(O(),R()),this._groupRenderContribitions.forEach((r=>{r.time===xo.afterFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=ah.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Fp(t,null==s?void 0:s.theme).group,i=Su.allocate(),n=Su.allocate();mm(n,t,e),uu(i,p||i,n),a.modelMatrix=i,Su.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Su.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var my,vy=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"}(my||(my={}));class yy extends tm{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=my.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new df([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return vy(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return vy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return vy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>vy(this,void 0,void 0,(function*(){if(2!==t.count)yield Rf(t,jl.zIndex,((i,s)=>{if(this.status===my.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return vy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return vy(this,void 0,void 0,(function*(){this.rendering&&(this.status=my.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=my.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 vy(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:()=>vy(this,void 0,void 0,(function*(){yield Rf(t,jl.zIndex,(t=>vy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const _y=Symbol.for("IncrementalDrawContribution"),by=Symbol.for("ArcRender"),xy=Symbol.for("Arc3dRender"),Sy=Symbol.for("AreaRender"),Ay=Symbol.for("CircleRender"),ky=Symbol.for("GraphicRender"),Cy=Symbol.for("GroupRender"),wy=Symbol.for("LineRender"),My=Symbol.for("PathRender"),Ty=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Ey=Symbol.for("Rect3DRender"),Py=Symbol.for("SymbolRender"),Oy=Symbol.for("TextRender"),Ry=Symbol.for("RichTextRender"),Iy=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Ly=Symbol.for("ImageRender"),Fy=Symbol.for("RenderSelector"),zy=Symbol.for("DrawContribution"),Hy=Symbol.for("StarRender"),jy=Symbol.for("DrawItemInterceptor"),Ny=new Ve,Vy=new Ve;class Wy{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){Ny.copy(s.dirtyBounds),Vy.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,xu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Ny),s.backupDirtyBounds.copy(Vy)),!0}}class Uy{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}}class Gy{constructor(){this.order=1,this.interceptors=[new Wy,new Xy,new Yy,new Uy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Su.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const Ky=Symbol.for("ArcRenderContribution"),$y=Symbol.for("AreaRenderContribution"),qy=Symbol.for("CircleRenderContribution"),Zy=Symbol.for("GroupRenderContribution"),Jy=Symbol.for("ImageRenderContribution"),Qy=Symbol.for("PathRenderContribution"),t_=Symbol.for("PolygonRenderContribution"),e_=Symbol.for("RectRenderContribution"),i_=Symbol.for("SymbolRenderContribution"),s_=Symbol.for("TextRenderContribution"),n_=Symbol.for("StarRenderContribution"),r_=Symbol.for("CommonRenderContribution"),a_=Symbol.for("InteractiveSubRenderContribution");function o_(t){!function({bind:t}){t(Lf).toSelf().inSingletonScope(),t(zv).toSelf().inSingletonScope(),t(zy).to(tm),t(_y).to(yy),t(Cy).toDynamicValue((({container:t})=>new fy(Fm(Zy,t)))).inSingletonScope(),t(ky).toService(Cy),zm(t,Zy),zm(t,a_),t(Kf).toDynamicValue((({container:t})=>new Kf(Fm(a_,t)))).inSingletonScope(),zm(t,ky),t(Gy).toSelf().inSingletonScope(),t(jy).toService(Gy),zm(t,jy)}({bind:t.bind})}class l_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class h_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new l_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function c_(){return new h_}const d_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const u_=function(){const t=globalThis;return t[d_]||(t[d_]={legacyBindingContext:c_(),preloaded:!1}),t[d_]}(),p_=u_.legacyBindingContext;function g_(){u_.preloaded||(u_.preloaded=!0,Um({bind:p_.bind}),bv({bind:p_.bind}),Xm({bind:p_.bind}),_v({bind:p_.bind,isBound:p_.isBound}),function({bind:t}){t(Sv).to(om),Hm(t,xv)}({bind:p_.bind}),kv(p_),o_(p_))}function f_(){return p_}function m_(t){g_();const[e]=p_.getAll(t);return e}function v_(t,e){return g_(),p_.getNamed(t,e)}function y_(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const __=y_((()=>m_(vg)));ah.global=__;class b_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?ah.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:ah.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Xg("text"===t.type&&t.attribute?t.attribute:Fp(t).text)}getTransformOfText(t){const e=Fp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const u=t.globalAABBBounds;let g=n.anchorType;if(d(g)&&(g="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===g&&(g="top-left"),"position"===g||u.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=Fe(u,g);l=t.x,h=t.y}const f=ah.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),y=e.viewBox,_=l+m.left-f.left+y.x1,b=h+m.top-f.top+y.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===g&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),c(n.style)){const e=n.style({top:b,left:_,width:u.width(),height:u.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else p(n.style)?o=Object.assign(Object.assign({},o),n.style):v(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));ah.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===ah.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{this.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&&ah.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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=d(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"===ah.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 x_=()=>{km.registerPlugin("HtmlAttributePlugin",b_)};class S_ extends b_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?ah.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&ah.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const A_=()=>{km.registerPlugin("ReactAttributePlugin",S_)};class k_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return k_.instance||(k_.instance=new k_),k_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function C_(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function w_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:M_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=C_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:M_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=C_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:w,customType:M,controlOptions:T}=t,B=e.animate();B.priority=k;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],O=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&O&&(i=null!==(h=P[O])&&void 0!==h?h:i),B.startAt(b);const R=i*x+E;R>0&&B.wait(R);let I=null,D=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.props),L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,M,L,D,_,m,f,T,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(B,e,p,D);let z=0;x&&(z=x*(s-i-1));const H=c(y)?y(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&B.wait(z),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,y,_,b;if(e&&i){i=C_(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(y=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:M_.builtInAnimateMap[r],m=t.custom?t.customType:C_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{w_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}M_.builtInAnimateMap={};const T_="appear",B_="disappear",E_="update",P_="highlight",O_="unhighlight";class R_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class I_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new M_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new M_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([T_],[{name:T_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyHighlightState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([O_],[{name:O_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new I_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new R_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class L_{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-L_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*L_.bounceIn(2*t):.5*L_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){L_[t]=e}}function F_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}L_.quadIn=L_.getPowIn(2),L_.quadOut=L_.getPowOut(2),L_.quadInOut=L_.getPowInOut(2),L_.cubicIn=L_.getPowIn(3),L_.cubicOut=L_.getPowOut(3),L_.cubicInOut=L_.getPowInOut(3),L_.quartIn=L_.getPowIn(4),L_.quartOut=L_.getPowOut(4),L_.quartInOut=L_.getPowInOut(4),L_.quintIn=L_.getPowIn(5),L_.quintOut=L_.getPowOut(5),L_.quintInOut=L_.getPowInOut(5),L_.backIn=L_.getBackIn(1.7),L_.backOut=L_.getBackOut(1.7),L_.backInOut=L_.getBackInOut(1.7),L_.elasticIn=L_.getElasticIn(1,.3),L_.elasticOut=L_.getElasticOut(1,.3),L_.elasticInOut=L_.getElasticInOut(1,.3*1.5),L_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),L_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},L_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)L_[`flicker${t}`]=e=>F_(e,t);for(let t=2;t<10;t++)L_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function z_(t,e,i){return t+(e-t)*i}const H_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=z_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=z_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=z_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=z_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=z_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=z_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=z_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=z_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=z_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Pu(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Fu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Pu(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Fu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=z_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=z_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=z_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=z_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=z_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=z_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=z_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=z_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=z_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=_h(e,i,s),r.addUpdateBoundTag()}}};function j_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:yo.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=L_[s])&&void 0!==n?n:L_.linear:L_.linear,"wait"===t&&(this.onUpdate=q_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=q_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=Bu.Get(i,Tu.Color255),r=Bu.Get(s,Tu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(H_["fill"===e?"fillPure":"strokePure"])}else H_[e]?t.push(H_[e]):t.push(j_)}else H_[e]?t.push(H_[e]):t.push(j_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class Q_ extends J_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();K_(this.target,t,yo.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class tb extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const eb=new tb;eb.isGlobal=!0;class ib extends J_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class sb extends ib{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class nb extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class rb extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){K_(this.target,this.from,yo.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ab(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class hb{constructor(t=Va.GenAutoIncrementId(),e=eb,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(lb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new J_(Tl.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new Q_(Tl.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new rb(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(lb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&K_(this.target,this._startProps,yo.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const cb=new pf;class db{constructor(){this.released=!1}tick(t,e){cb.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class ub extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ml.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ml.INITIAL,ah.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),ah.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new db;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ml.INITIAL&&(this.status=Ml.PAUSE,!0)}resume(){return this.status!==Ml.INITIAL&&(this.status=Ml.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ml.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ml.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ml.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ml.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ml.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ml.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,ah.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function gb(){U(Tp,D_),U(Tp,pb)}function fb(){lf("arc",Vp)}function mb(){lf("arc3d",lv)}function vb(){lf("area",Gp)}function yb(){lf("circle",Kp)}function _b(){lf("glyph",qp)}function bb(){lf("group",Qp)}function xb(){lf("image",ig)}function Sb(){lf("line",rg)}function Ab(){lf("path",lg)}function kb(){lf("polygon",dg)}function Cb(){lf("pyramid3d",cv)}function wb(){lf("rect",fg)}function Mb(){lf("rect3d",sv)}function Tb(){lf("richtext",Hg)}function Bb(){lf("shadowRoot",Ng)}function Eb(){lf("star",av)}function Pb(){lf("symbol",Ug)}function Ob(){lf("text",Zg)}function Rb(){lf("wrapText",tf)}function Ib(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Lb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(qf),e(Jf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===xo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===xo.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Fp(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=Bv(d,u,h),_=Pv(d,g),b=Mv(h),x=Tv(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Mo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Pv(o,c),g=Mv(n,r),f=Tv(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||vm(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Su.allocate(),n=Su.allocate();mm(n,t,e),uu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Su.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Su.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class Fb extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Qc,this.builtinContributions=[Nv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nFt){const t=Yt(b,_),r=Yt(x,_),a=Iv(v,y,f,m,n,t,Number(u)),o=Iv(A,k,C,w,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||T<.001)e.lineTo(i+C,s+w),p=!0;else if(M>Ft){const t=Yt(E,M),n=Yt(P,M),a=Iv(C,w,A,k,r,-n,Number(u)),o=Iv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Ut(B),s+r*Xt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Fp(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let w=0;const M=(h(S)&&S||S[0])&&"conical"===c.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Nt-Ft){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),T||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Uu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const zb=new WeakSet;function Hb({bind:t}){Ib(zb,t)||(t(Fb).toDynamicValue((({container:t})=>new Fb(Fm(Ky,t)))).inSingletonScope(),t(by).toService(Fb),t(ky).toService(by),t(Ky).toService(Kf),zm(t,Ky))}const jb=Hb;class Nb extends Lb{constructor(){super(...arguments),this.numberType=td}drawShape(t,e,i,s,n,r,a,o){var l;const h=Fp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Tu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},w={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Nt-Ft)e.moveTo(i+r*Ut(o),s+r*Xt(o),n),e.arc(i,s,r,o,l,!c,n),a>Ft&&(e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Ut(p),y=r*Xt(p),_=a*Ut(f),b=a*Xt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>Ft)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Nt,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=Ft)e.moveTo(i,s,n);else if(c>=Nt-Ft)e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Ut(h),s+a*Xt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Ut(c),f=a*Xt(c),m=a*Ut(p),v=a*Xt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Ib(Vb,t)||(t(Nb).toDynamicValue((()=>new Nb)).inSingletonScope(),t(xy).toService(Nb),t(ky).toService(xy))}const Ub=Wb;function Gb(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]=Lo(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 Yb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?_o.ROW:_o.COLUMN,Number.isFinite(c)||(o=_o.COLUMN),Number.isFinite(d)||(o=_o.ROW);const u=i*(o===_o.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Gb(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),Gb(t,l,1,s),o=!1):o=!0}t.closePath()}function Kb(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function $b(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Kb(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Gb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=_o.ROW:"y"===s?u=_o.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Zb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Jb=new gy,Qb=Ff;class tx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ed,this.builtinContributions=[Jb,Qb],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Fp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:w,points:M,segments:T}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===C&&!T&&!M.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,_,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=xl(E(t.points,x),B,{startPoint:e,curveTension:b});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=xl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=xl(e,B,{curveTension:b}),n=xl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Yt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=_o.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Vt(_.x-b.x),A=Vt(_.y-b.y);x=null==_.x1?_o.ROW:null==_.y1?_o.COLUMN:Number.isFinite(S+A)?S>A?_o.ROW:_o.COLUMN:_o.ROW,Yb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),$b(t,i[0]?e.top:e.bottom,l,x===_o.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ex=new WeakSet;function ix({bind:t}){Ib(ex,t)||(t(tx).toDynamicValue((({container:t})=>new tx(Fm($y,t)))).inSingletonScope(),t(Sy).toService(tx),t(ky).toService(Sy),t($y).toService(Kf),zm(t,$y))}const sx=ix;class nx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Gv,Xv,Yv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const rx=new WeakSet;function ax({bind:t}){Ib(rx,t)||(t(nx).toDynamicValue((({container:t})=>new nx(Fm(qy,t)))).inSingletonScope(),t(Ay).toService(nx),t(ky).toService(Ay),t(qy).toService(Kf),zm(t,qy))}const ox=ax;class lx{constructor(){this.numberType=sd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Fp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const hx=new WeakSet;function cx({bind:t}){Ib(hx,t)||(t(lx).toDynamicValue((()=>new lx)).inSingletonScope(),t(Dy).toService(lx),t(ky).toService(Dy))}const dx=cx,ux=["","repeat-x","repeat-y","repeat"];function px(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?ux[i]:"no-repeat"}function gx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=px(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const fx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function mx(t){return{backgroundMode:fx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function vx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=gx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function yx(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=gx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?mx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Xf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class _x extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=rd,this.builtinContributions=[ny,ry],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:_=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:w,doStroke:M}=A;if(!S||!t.resources)return;const T=t.resources.get(S);if("success"!==T.state)return;const B=t.width,E=t.height;e.beginPath();let P=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,B,E):(wv(e,i,s,B,E,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const O=()=>{w&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),yx(e,T.data,i,s,B,E,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x})))},R=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=vx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x}),D=P||I;g?(R(),D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore()):(D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore(),R()),this.afterRenderStep(t,e,i,s,w,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&v(s))return void oh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Fp(t).image;this._draw(t,a,!1,i)}}const bx=new WeakSet;function xx({bind:t}){Ib(bx,t)||(t(Ly).toDynamicValue((({container:t})=>new _x(Fm(Jy,t)))).inSingletonScope(),t(ky).toService(Ly),t(Jy).toService(Kf),zm(t,Jy))}const Sx=xx;class Ax extends Lb{constructor(){super(...arguments),this.numberType=ad}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();$b(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=xl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const kx=new WeakSet;function Cx({bind:t}){Ib(kx,t)||(t(Ax).toDynamicValue((()=>new Ax)).inSingletonScope(),t(wy).toService(Ax),t(ky).toService(wy))}const Mx=Cx,Tx=Hv,Bx=Ff;class Ex extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=od,this.builtinContributions=[Bx,Tx],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:Fp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Mo(t.pathShape.commandList,e,i,s,1,1,f);else{Mo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Px=new WeakSet;function Ox({bind:t}){Ib(Px,t)||(t(Ex).toDynamicValue((({container:t})=>new Ex(Fm(Qy,t)))).inSingletonScope(),t(My).toService(Ex),t(ky).toService(My),t(Qy).toService(Kf),zm(t,Qy))}const Rx=Ox;function Ix(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Ix(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Ix(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Lx(h,y,_,d,u),A=Lx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,w=Dx(k,C),M=Lx(h,Dx(y,v),w,k,C);let T=Math.atan2(S.y-M.y,S.x-M.x);const B=Math.atan2(A.y-M.y,A.x-M.x);let E=B-T;E<0&&(T=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const jx=new WeakSet;function Nx({bind:t}){Ib(jx,t)||(t(Ty).toDynamicValue((({container:t})=>new Hx(Fm(t_,t)))).inSingletonScope(),t(ky).toService(Ty),t(t_).toService(Kf),zm(t,t_))}const Vx=Nx;class Wx extends Lb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Tu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Ux extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=hd}drawShape(t,e,i,s,n,r,a,o){var l;const h=Fp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=Fp(t).polygon;this._draw(t,s,!1,i)}}const Gx=new WeakSet;function Yx({bind:t}){Ib(Gx,t)||(t(Ux).toDynamicValue((()=>new Ux)).inSingletonScope(),t(Iy).toService(Ux),t(ky).toService(Iy))}const Xx=Yx;class Kx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=cd,this.builtinContributions=[ty,iy,ey],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Fp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:M}=t.attribute;w=(null!=w?w:b-S)||0,M=(null!=M?M:x-A)||0;const T=Ev(g,f,w,M,h),B=Ov(g,v,w,M,C),E=Mv(h,c),P=Tv(d,m);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||B||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,M)):(e.beginPath(),wv(e,i,s,w,M,u,"bevel"!==p));const O={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,T,B,l,n,a,o,O),k?(this._runStroke(t,e,i,s,l,O,B,S,A,o),this._runFill(t,e,i,s,l,O,T,S,A,a)):(this._runFill(t,e,i,s,l,O,T,S,A,a),this._runStroke(t,e,i,s,l,O,B,S,A,o)),this.afterRenderStep(t,e,i,s,E,P,T,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const $x=new WeakSet;function qx({bind:t}){Ib($x,t)||(t(Kx).toDynamicValue((({container:t})=>new Kx(Fm(e_,t)))).inSingletonScope(),t(By).toService(Kx),t(ky).toService(By),t(Qv).toSelf(),t(Jv).toSelf(),t(e_).toService(Qv),t(e_).toService(Jv),t(e_).toService(Kf),zm(t,e_))}const Zx=qx;class Jx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=dd}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=Fp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,w=Ev(v,y,A,k,d),M=Ov(v,b,A,k,S),T=Mv(d),B=Tv(u,_);if(!t.valid||!x)return;if(!T&&!B)return;if(!(w||M||a||o))return;const{light:E}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,E,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=Fp(t).rect;this._draw(t,s,!1,i)}}const Qx=new WeakSet;function tS({bind:t}){Ib(Qx,t)||(t(Jx).toDynamicValue((()=>new Jx)).inSingletonScope(),t(Ey).toService(Jx),t(ky).toService(Ey))}const eS=tS;const iS=new class extends Lf{constructor(){super(...arguments),this.time=xo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:T=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:O=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let I,{background:D}=t.attribute;if(!D)return;const L=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=p(D)&&D.background?D:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(g=z.dx)&&void 0!==g?g:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),D=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=pv(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 i=t.resources.get(D);if(!i||"success"!==i.state||!i.data)return void L();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,O&&(e.beginPath(),R?wv(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:w,backgroundKeepAspectRatio:M,backgroundScale:T,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=D,R?(wv(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),L()}};class sS extends Lb{constructor(){super(),this.numberType=ud,this.builtinContributions=[iS],this.init()}drawShape(t,e,i,s,n){const r=Fp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Fp(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(),wv(e,i-t,s-n,v,y,f,!0)),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=Fp(t).richtext;this._draw(t,s,!1,i)}}const nS=new WeakSet;function rS({bind:t}){Ib(nS,t)||(t(sS).toDynamicValue((()=>new sS)).inSingletonScope(),t(Ry).toService(sS),t(ky).toService(Ry))}const aS=rS;class oS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=pd,this.builtinContributions=[py,uy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const lS=new WeakSet;function hS({bind:t}){Ib(lS,t)||(t(oS).toDynamicValue((({container:t})=>new oS(Fm(n_,t)))).inSingletonScope(),t(Hy).toService(oS),t(ky).toService(Hy),zm(t,n_))}const cS=hS;class dS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[ly,dy,cy,hy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Fp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,M=s,T=C;const B=e.camera;if(k&&B&&e.project){const t=e.project(i,s,C);e.camera=null,y(c)&&(c[0],c[1]),w=t.x,M=t.y,T=void 0}!1===A.draw(e,c,w,M,T,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const uS=new WeakSet;function pS({bind:t}){Ib(uS,t)||(t(dS).toDynamicValue((({container:t})=>new dS(Fm(i_,t)))).inSingletonScope(),t(Py).toService(dS),t(ky).toService(Py),t(i_).toService(Kf),zm(t,i_))}const gS=pS;class fS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[iS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Fp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=kh(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:w}=S,M=!f,T=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,w,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,T,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=xu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),xu.free(t)}w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,T))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,T))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,T),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,T)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,T),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,T,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,T,e),this.afterRenderStep(t,e,i,s,C,w,A,k,d,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:Gg(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const mS=new WeakSet;function vS({bind:t}){Ib(mS,t)||(t(Oy).toDynamicValue((({container:t})=>new fS(Fm(s_,t)))).inSingletonScope(),t(ky).toService(Oy),t(s_).toService(Kf),zm(t,s_))}const yS=vS,_S=fm();function bS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function xS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const SS=Symbol.for("MathPickerContribution"),AS=Symbol.for("MathArcPicker"),kS=Symbol.for("MathAreaPicker"),CS=Symbol.for("MathCirclePicker"),wS=Symbol.for("MathImagePicker"),MS=Symbol.for("MathLinePicker"),TS=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),ES=Symbol.for("MathSymbolPicker"),PS=Symbol.for("MathTextPicker"),OS=Symbol.for("MathPolygonPicker"),RS=Symbol.for("MathGlyphPicker"),IS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),LS=Symbol.for("CanvasArc3dPicker"),FS=Symbol.for("CanvasAreaPicker"),zS=Symbol.for("CanvasCirclePicker"),HS=Symbol.for("CanvasImagePicker"),jS=Symbol.for("CanvasGifImagePicker"),NS=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),US=Symbol.for("CanvasRectPicker"),GS=Symbol.for("CanvasRect3dPicker"),YS=Symbol.for("CanvasSymbolPicker"),XS=Symbol.for("CanvasTextPicker"),KS=Symbol.for("CanvasPolygonPicker"),$S=Symbol.for("CanvasPyramid3dPicker"),qS=Symbol.for("CanvasRichTextPicker"),ZS=Symbol.for("CanvasGlyphPicker"),JS=Symbol.for("CanvasGroupPicker"),QS=Symbol.for("CanvasStarPicker"),tA=Symbol.for("CanvasPickerContribution"),eA=f_(),iA=y_((()=>m_(Tm))),sA=y_((()=>m_(Mm))),nA=y_((()=>m_(md))),rA=y_((()=>m_(Bm)));function aA(){ah.global=__,ah.graphicUtil=iA,ah.transformUtil=sA,ah.graphicService=nA,ah.layerService=rA,ah.canvasFactory=t=>v_(Ad,t),ah.context2dFactory=t=>v_(kd,t),ah.windowFactory=()=>new Sf(ah.global),ah.windowHandlerFactory=t=>function(t){const e=v_(bf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),ah.renderServiceFactory=()=>m_(Gm),ah.renderService=y_((()=>m_(Gm))),ah.pluginServiceFactory=()=>m_(Sv),ah.pluginService=y_((()=>m_(Sv))),ah.pickerServiceFactory=()=>m_($m),ah.layerHandlerFactory=t=>m_("static"===t?Em:"dynamic"===t?Pm:Om),ah.incrementalDrawContributionFactory=()=>m_(_y)}aA();var oA=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 lA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return oA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class hA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class cA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Tu.Color1),this.ambient=i;const s=Kt(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=Yt(Gt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=v(e)?Bu.Get(e,Tu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const dA=()=>{km.registerPlugin("DirectionalLight",cA)};class uA{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=Su.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Su.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return pu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Su.allocate()),this._vp=uu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Su.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Su.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return gu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Su.allocate()),this._vp=uu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return fu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;fu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const pA=()=>{km.registerPlugin("OrthoCamera",uA)},gA={getContributions:()=>[]},fA={getContributions:()=>[]};class mA{constructor(t=gA,e=fA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:ah.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:gA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:fA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ue(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Fp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new ne(e.x,e.y);l.transformPoint(a,a);const o=Fp(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&&Su.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),xu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class vA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new im,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new sm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new rm,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new nm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new xm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new Am,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new ef}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new em(new tm([],(t=this.registry.contribution,e=jy,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class yA{constructor(t={}){this.context=new vA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function _A(t={}){return new yA(t)}class bA extends yA{}class xA extends yA{}class SA extends tx{constructor(){super(...arguments),this.numberType=ed}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=Fp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=Mv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=Fp(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=Bv(u,p,c),y=Pv(u,g),_=Mv(c),b=Tv(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{};function DA(){wA.preloaded||(wA.preloaded=!0,Um({bind:MA.bind}),bv({bind:MA.bind}),Xm({bind:MA.bind}),_v({bind:MA.bind,isBound:MA.isBound}),kv(MA),o_(MA))}function LA(t,e){const i=jA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function FA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function zA(t,e){let i=EA.get(t);i||(i=new Map,EA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function HA(t,e,i){const s=zA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function jA(){return DA(),MA}function NA(){jm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=wA.runtimeGlobal)&&void 0!==t||(wA.runtimeGlobal=new mf(Fm(mg,MA))),wA.runtimeGlobal}function WA(t){const e=jA(),i=VA();ah.global=i,ah.canvasFactory=t=>e.getNamed(Ad,t),ah.context2dFactory=t=>e.getNamed(kd,t),ah.windowHandlerFactory=t=>LA(bf,t),ah.windowFactory=()=>new Sf(i,(t=>LA(bf,t))),ah.pluginServiceFactory=()=>new om(Fm(xv,e),{pluginRegistry:t.context.registry.plugin}),ah.incrementalDrawContributionFactory=()=>new yy([],new AA,new SA(Fm($y,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,jy))}function UA(t){var e;const i=jA();NA();const s=i.getAll(ky),n=zA(t.registry.renderer,TA);HA(t.registry.renderer,TA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),FA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,TA)}function GA(t){var e;const i=jA();NA();const s=i.getAll(jy),n=null!==(e=PA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,jy,e)})),n.clear(),PA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(jy));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(jy,e),r.add(e)),n.add(e)}))}function YA(t,e){var i;const s=jA();NA();const n=s.getAll(e),r=zA(t.registry.picker,BA);HA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),FA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function XA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=OA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,IA,t.isBound,t.rebind),function(t,e){let i=OA.get(t);i||(i=new WeakSet,OA.set(t,i)),i.add(e)}(t,e))}function KA(t,{app:e,legacy:i=!0,targets:s}={}){XA(jA(),t),i&&(g_(),XA(f_(),t)),NA(),e&&function(t,e){const i=null!=e?e:RA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&GA(t),s&&UA(t),r.forEach((e=>{YA(t,e)}))}(e,s)}function $A(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function qA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function ZA(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 JA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ak(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=ug(t.attribute),n=lk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=lk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=lk(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{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;n{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return yk(l,e,h),h},gk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return uk(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 uk(t,e)}return[]};const fk=t=>t.map((t=>({x:t.x,y:t.y}))),mk=(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]},vk=t=>{const e=new Ne;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return mk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return mk(t,{x:e.x1,y:n},{x:e.x2,y:n})},yk=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=vk(t);yk(n[0],s,i),yk(n[1],e-s,i)}},_k=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:fk(i)}];const s=[];return yk(i,e,s),s},bk=(t,e)=>{const i=rk(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;rObject.assign({},t))):[]}function Sk(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:xk(t.touches),configurable:!0},changedTouches:{value:xk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Ak(t,e){try{return t[e]}catch(t){return}}function kk(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Sk(t),l=Ak(t,"target"),h=Ak(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Ck=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Tk(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:Mk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},wk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},wk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Ck(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=Mk(i,this.selectionStartCursorIdx),a=Mk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=wk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Tk(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),ah.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),ah.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Ek{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=Mk(i,Math.ceil(t)),n=Mk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=Mk(i.attribute.textConfig,a),h=Mk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Pk,[this.formatTextCommandCb]),this.commandCbs.set(Ok,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):p(t)&&e.forEach((e=>z(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),ah.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(ah.global.isMacOS()&&t.metaKey&&"c"===t.key||!ah.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return ah.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(ah.global.isMacOS()&&t.metaKey&&"a"===t.key||!ah.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},wk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=Hg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:gv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||fg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},wk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),ah.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=Qp({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Rk.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=rg({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=Qp({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=gv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=gv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(fg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(fg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(fg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=gv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=gv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:gv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Jk=new Zk;class Qk{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const tC=()=>{km.registerPlugin("ViewTransform3dPlugin",Qk)},eC=new Ve;class iC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Fp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&eC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(eC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const sC=()=>{km.registerPlugin("FlexLayoutPlugin",iC)};var nC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:nh,ARC3D_NUMBER_TYPE:td,ARC_NUMBER_TYPE:Qc,AREA_NUMBER_TYPE:ed,AbstractGraphicRender:class{},get AnimateMode(){return wl},get AnimateStatus(){return Bl},get AnimateStepType(){return Tl},AppContext:vA,Application:sh,Arc:Np,Arc3d:ov,Arc3dRender:xy,ArcRender:by,ArcRenderContribution:Ky,Area:Up,AreaRender:Sy,AreaRenderContribution:$y,get AttributeUpdateType(){return yo},AutoEnablePlugins:xv,Base3dRender:Wx,BaseCanvas:Mu,BaseEnvContribution:lA,BaseRender:Lb,get BaseRenderContributionTime(){return xo},BaseWindowHandlerContribution:hA,Basis:Ko,BeforeRenderConstribution:Ym,BoundsContext:so,BoundsPicker:qm,BrowserEntry:yA,CIRCLE_NUMBER_TYPE:id,CONTRIBUTION_STORE_STATE_SYMBOL:Rm,Canvas3DDrawItemInterceptor:Xy,Canvas3DPickItemInterceptor:yv,CanvasFactory:Ad,CanvasTextLayout:Kg,Circle:Xp,CircleRender:Ay,CircleRenderContribution:qy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Tu},CommonDrawItemInterceptorContribution:Gy,CommonRenderContribution:r_,Context2dFactory:kd,ContributionProvider:Dm,ContributionRegistry:rm,ContributionStore:jm,CubicBezierCurve:Fo,CurveContext:bl,get CurveTypeEnum(){return bo},CustomEvent:$a,CustomPath2D:Sl,CustomSymbolClass:Mc,DEFAULT_TEXT_FONT_FAMILY:yg,DebugDrawItemInterceptorContribution:Uy,DefaultArcAllocate:Fk,DefaultArcAttribute:Nl,DefaultArcRenderContribution:jv,DefaultAreaAllocate:Hk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:gy,DefaultAttribute:jl,DefaultBaseBackgroundRenderContribution:Lf,DefaultBaseClipRenderAfterContribution:Zf,DefaultBaseClipRenderBeforeContribution:$f,DefaultBaseInteractiveRenderContribution:Kf,DefaultBaseTextureRenderContribution:zv,DefaultCanvasAllocate:vf,DefaultCanvasArc3DRender:Nb,DefaultCanvasArcRender:Fb,DefaultCanvasAreaRender:tx,DefaultCanvasCircleRender:nx,DefaultCanvasGroupRender:fy,DefaultCanvasImageRender:_x,DefaultCanvasLineRender:Ax,DefaultCanvasPathRender:Ex,DefaultCanvasPolygonRender:Hx,DefaultCanvasPyramid3dRender:Ux,DefaultCanvasRect3dRender:Jx,DefaultCanvasRectRender:Kx,DefaultCanvasSymbolRender:dS,DefaultCanvasTextRender:fS,DefaultCircleAllocate:Nk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Uv,DefaultConnectAttribute:zl,DefaultDebugAttribute:Hl,DefaultFillStyle:Ol,DefaultGlobal:mf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Gl,DefaultGraphicAllocate:Ik,DefaultGraphicMemoryManager:Zk,DefaultGraphicService:ym,DefaultGraphicUtil:Af,DefaultGroupAttribute:Ul,DefaultGroupBackgroundRenderContribution:Kv,DefaultImageAttribute:eh,DefaultImageRenderContribution:sy,DefaultLayerService:wm,DefaultLayout:El,DefaultLineAllocate:Wk,DefaultLineAttribute:Yl,DefaultMat4Allocate:bu,DefaultMatrixAllocate:_u,DefaultPathAllocate:Gk,DefaultPathAttribute:Xl,DefaultPickService:mA,DefaultPickStyle:Ll,DefaultPolygonAttribute:Kl,DefaultRect3dAttribute:Zl,DefaultRectAllocate:Dk,DefaultRectAttribute:ql,DefaultRectRenderContribution:Zv,DefaultRenderService:em,DefaultRichTextAttribute:th,DefaultRichTextIconAttribute:ih,DefaultStarAttribute:$l,DefaultStrokeStyle:Il,DefaultStyle:Fl,DefaultSymbolAllocate:Xk,DefaultSymbolAttribute:Jl,DefaultSymbolClipRangeStrokeRenderContribution:oy,DefaultSymbolRenderContribution:ay,DefaultTextAllocate:$k,DefaultTextAttribute:Ql,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Pl,DefaultTransformUtil:wf,DefaultWindow:Sf,get Direction(){return _o},DirectionalLight:cA,DrawContribution:zy,DrawItemInterceptor:jy,DynamicLayerHandlerContribution:Pm,get Edge(){return hh},EditModule:Bk,EmptyContext2d:Cu,EnvContribution:mg,EventManager:Ja,EventSystem:eo,EventTarget:Qa,FACTORY_STATE_SYMBOL:Mf,FORMAT_ALL_TEXT_COMMAND:Ok,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Pk,Factory:km,FederatedEvent:Ga,FederatedMouseEvent:Ya,FederatedPointerEvent:Xa,FederatedWheelEvent:Ka,FlexLayoutPlugin:iC,GLYPH_NUMBER_TYPE:sd,GRAPHIC_CLASS_SYMBOL:wp,GRAPHIC_REGISTRY_SYMBOL:nf,GRAPHIC_UPDATE_TAG_KEY:up,GROUP_NUMBER_TYPE:nd,Generator:Va,GlobalPickerService:Zm,Glyph:$p,GlyphRender:Dy,GradientParser:iu,Graphic:Tp,GraphicCreator:vd,GraphicFactory:ef,GraphicPicker:Km,GraphicRender:ky,GraphicService:md,GraphicUtil:Tm,Group:Jp,GroupRender:Cy,GroupRenderContribution:Zy,get GroupUpdateAABBBoundsMode(){return Zp},HtmlAttributePlugin:b_,get IContainPointMode(){return vo},IMAGE_NUMBER_TYPE:rd,Image:eg,ImageRender:Ly,ImageRenderContribution:Jy,IncrementalDrawContribution:_y,InteractiveDrawItemInterceptorContribution:Yy,InteractivePickItemInterceptorContribution:vv,InteractiveSubRenderContribution:a_,LINE_NUMBER_TYPE:ad,Layer:Sm,LayerFactory:Am,LayerService:Bm,Line:ng,LineRender:wy,Linear:Uo,LinearClosed:ul,Mat4Allocate:vu,MatrixAllocate:mu,get MeasureModeEnum(){return Cl},MiniappEntry:xA,MonotoneX:el,MonotoneY:il,NOWORK_ANIMATE_ATTR:kp,Node:Ua,NodeEntry:bA,OrthoCamera:uA,PATH_NUMBER_TYPE:od,POLYGON_NUMBER_TYPE:ld,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:hd,Path:og,PathRender:My,PathRenderContribution:Qy,PerformanceRAF:pf,PickItemInterceptor:Jm,PickServiceInterceptor:Qm,PickerRegistry:sm,PickerService:$m,PluginRegistry:nm,PluginService:Sv,Polygon:cg,PolygonRender:Ty,PolygonRenderContribution:t_,Pyramid3d:hv,Pyramid3dRender:Iy,RECT3D_NUMBER_TYPE:dd,RECT_NUMBER_TYPE:cd,RICHTEXT_NUMBER_TYPE:ud,RUNTIME_INSTALLER_STATE_SYMBOL:kA,RafBasedSTO:xh,ReactAttributePlugin:S_,Rect:gg,Rect3DRender:Ey,Rect3d:iv,RectRender:By,RectRenderContribution:e_,ReflectSegContext:No,RenderSelector:Fy,RenderService:Gm,RendererRegistry:im,ResourceLoader:oh,RichText:zg,RichTextEditPlugin:Rk,RichTextRender:Ry,STAR_NUMBER_TYPE:pd,get STATUS(){return Ml},SVG_ATTRIBUTE_MAP:yd,SVG_ATTRIBUTE_MAP_KEYS:_d,SVG_PARSE_ATTRIBUTE_MAP:bd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:xd,SYMBOL_NUMBER_TYPE:gd,SegContext:jo,ShadowPickServiceInterceptorContribution:fv,ShadowRoot:jg,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:mv,SplitRectAfterRenderContribution:Qv,SplitRectBeforeRenderContribution:Jv,Stage:bm,StageFactory:xm,Star:rv,StarRender:Hy,StarRenderContribution:n_,StateDefinitionCompiler:Ku,StateEngine:Ju,StaticLayerHandlerContribution:Em,Step:ol,StepClosed:ll,Symbol:Wg,SymbolRender:Py,SymbolRenderContribution:i_,TEXT_NUMBER_TYPE:fd,Text:qg,get TextDirection(){return Xc},TextMeasureContribution:Vm,TextRender:Oy,TextRenderContribution:s_,Theme:Dp,TransformUtil:Mm,get UpdateTag(){return mo},VGlobal:vg,VWindow:_f,ViewTransform3dPlugin:Qk,VirtualLayerHandlerContribution:Om,WILDCARD:"*",WindowHandlerContribution:bf,WrapText:Qg,XMLParser:Vc,_calculateLineHeight:Ah,_interpolateColor:Ou,addArcToBezierPath:Co,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:nk,alignSubpath:JA,application:ah,applyTransformOnBezierCurves:ak,arc3dModule:Ub,arcModule:jb,areaModule:sx,bezier:Ao,bezierCurversToPath:ok,binarySplitPolygon:vk,bindArc3dRenderModule:Wb,bindArcRenderModule:Hb,bindAreaRenderModule:ix,bindCircleRenderModule:ax,bindContributionProvider:zm,bindContributionProviderNoSingletonScope:Hm,bindGlyphRenderModule:cx,bindImageRenderModule:xx,bindLineRenderModule:Cx,bindPathRenderModule:Ox,bindPolygonRenderModule:Nx,bindPyramid3dRenderModule:Yx,bindRect3dRenderModule:tS,bindRectRenderModule:qx,bindRichtextRenderModule:rS,bindStarRenderModule:hS,bindSymbolRenderModule:pS,bindTextRenderModule:vS,boundStroke:Uc,builtInSymbolStrMap:Ec,builtinSymbols:Tc,builtinSymbolsMap:Bc,calcLineCache:xl,calculateArcCornerRadius:Dv,calculateLineHeight:kh,canvasAllocate:yf,centroidOfSubpath:ek,circleBounds:mh,circleModule:ox,clock:qa,colorEqual:function(t,e){const i=ii.parseColorString(t),s=ii.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:ju,configureRuntimeApplicationForApp:WA,container:eA,cornerTangents:Iv,createApp:_A,createArc:Vp,createArc3d:lv,createArea:Gp,createBrowserApp:_A,createCanvasEventTransformer:function(t,e,i,s){return kk(t.parentElement,e,i,s)},createCircle:Kp,createColor:nu,createConicalGradient:Gu,createContributionProvider:Fm,createEventTransformer:kk,createGlyph:qp,createGraphic:hf,createGroup:Qp,createImage:ig,createLine:rg,createMat4:yu,createMiniappApp:function(t={}){return new xA(t)},createNodeApp:function(t={}){return new bA(t)},createPath:lg,createPolygon:dg,createPyramid3d:cv,createRect:fg,createRect3d:sv,createRectPath:wv,createRichText:Hg,createShadowRoot:Ng,createStage:function(t){return aA(),(new xm).create(t)},createStar:av,createSymbol:Ug,createText:Zg,createWrapText:tf,cubicCalc:Po,cubicLength:Eo,cubicPointAt:Oo,cubicSubdivide:ZA,defaultArcAllocate:zk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Nv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:jk,defaultBaseBackgroundRenderContribution:Ff,defaultBaseClipRenderAfterContribution:Jf,defaultBaseClipRenderBeforeContribution:qf,defaultBaseTextureRenderContribution:Hv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Xv,defaultCircleRenderContribution:Gv,defaultCircleTextureRenderContribution:Yv,defaultGraphicMemoryManager:Jk,defaultGroupBackgroundRenderContribution:$v,defaultImageBackgroundRenderContribution:ry,defaultImageRenderContribution:ny,defaultLineAllocate:Uk,defaultPathAllocate:Yk,defaultRectAllocate:Lk,defaultRectBackgroundRenderContribution:iy,defaultRectRenderContribution:ty,defaultRectTextureRenderContribution:ey,defaultStarBackgroundRenderContribution:py,defaultStarTextureRenderContribution:uy,defaultSymbolAllocate:Kk,defaultSymbolBackgroundRenderContribution:dy,defaultSymbolClipRangeStrokeRenderContribution:hy,defaultSymbolRenderContribution:ly,defaultSymbolTextureRenderContribution:cy,defaultTextAllocate:qk,diff:qA,divideCubic:Lo,drawArc:ko,drawArcPath:Lv,drawAreaSegments:Yb,drawBackgroundImage:Xf,drawImageWithLayout:yx,drawIncrementalAreaSegments:Zb,drawIncrementalSegments:qb,drawSegments:$b,enumCommandMap:oo,fillVisible:Bv,findBestMorphingRotation:sk,findConfigIndexByCursorIdx:Mk,findCursorIdxByConfigIndex:Tk,findNextGraphic:If,flatten_simplify:$A,foreach:Of,foreachAsync:Rf,genBasisSegments:qo,genBasisTypeSegments:$o,genLinearClosedSegments:pl,genLinearClosedTypeSegments:gl,genLinearSegments:Go,genLinearTypeSegments:Yo,genMonotoneXSegments:nl,genMonotoneXTypeSegments:sl,genMonotoneYSegments:al,genMonotoneYTypeSegments:rl,genNumberType:Yc,genStepClosedSegments:dl,genStepSegments:hl,genStepTypeSegments:cl,getApplicationState:rh,getAttributeFromDefaultAttrList:bh,getBackgroundImage:Hf,getConicGradientAt:Uu,getContributionStoreState:Im,getCurrentEnv:function(){return fm()?"browser":"node"},getDefaultCharacterConfig:wk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Gg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Su.allocate();return hu(o,o,[a[0],a[1],0]),n&&au(o,o,n),s&&ou(o,o,s),hu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Tf,getGraphicClassState:Mp,getGraphicRegistryState:rf,getLegacyBindingContext:f_,getModelMatrix:mm,getRichTextBounds:gv,getRuntimeInstallerBindingContext:jA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:CA,getScaledStroke:su,getTextBounds:pv,getTheme:Fp,getThemeFromGroup:zp,globalTheme:Lp,glyphModule:dx,graphicCreator:of,graphicService:nA,graphicUtil:iA,identityMat4:ru,imageModule:Sx,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:KA,installRuntimeDrawContributionsToApp:GA,installRuntimeGraphicRenderersToApp:UA,installRuntimePickersToApp:YA,interpolateColor:Pu,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Ru,interpolateGradientRadialColor:Iu,interpolatePureColorArray:Lu,interpolatePureColorArrayToStr:Fu,intersect:Rv,isBrowserEnv:fm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){gm();const t=ah.global&&ah.global.env;return t?"node"===t:!pm},isSvg:jc,isXML:Nc,layerService:rA,lineModule:Mx,lookAt:pu,mapToCanvasPointForCanvas:function(t){var e;if(Pd(t._canvasX)&&Pd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:cu,mat4Allocate:Su,matrixAllocate:xu,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:uu,newThemeObj:Op,ortho:gu,parsePadding:ph,parseStroke:dh,parseSvgPath:fo,pathModule:Rx,pathToBezierCurves:rk,point:Xo,pointEqual:vh,pointInterpolation:yh,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Zt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Zt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>vh(t,e[i]))):!Number.isNaN(t.x+t.y)&&vh(t,e))},pointsInterpolation:_h,polygonModule:Vx,preLoadAllModule:g_,pyramid3dModule:Xx,quadCalc:Ro,quadLength:Do,quadPointAt:Io,rafBasedSto:Sh,rect3dModule:eS,rectFillVisible:Ev,rectModule:Zx,rectStrokeVisible:Ov,recursiveCallBinarySplit:yk,refreshRuntimeInstallerContributions:NA,registerArc3dGraphic:mb,registerArcGraphic:fb,registerAreaGraphic:vb,registerCircleGraphic:yb,registerDirectionalLight:dA,registerFlexLayoutPlugin:sC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=kk(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:_b,registerGraphic:lf,registerGroupGraphic:bb,registerHtmlAttributePlugin:x_,registerImageGraphic:xb,registerLineGraphic:Sb,registerOrthoCamera:pA,registerPathGraphic:Ab,registerPolygonGraphic:kb,registerPyramid3dGraphic:Cb,registerReactAttributePlugin:A_,registerRect3dGraphic:Mb,registerRectGraphic:wb,registerRichtextGraphic:Tb,registerShadowRootGraphic:Bb,registerStarGraphic:Eb,registerSymbolGraphic:Pb,registerTextGraphic:Ob,registerViewTransform3dPlugin:tC,registerWindowEventTransformer:function(t,e,i,s,n){const r=kk(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Rb,renderCommandList:Mo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:mx,resolveBackgroundPosition:Uf,resolveBackgroundSizing:jf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:gx,resolveImageRepeatMode:px,resolveRenderableImageSize:Yf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:aS,rotateX:au,rotateY:ou,rotateZ:lu,runFill:Mv,runStroke:Tv,scaleMat4:du,segments:So,shouldClipImageByLayout:vx,shouldUseMat4:vm,snapLength:Bo,splitArc:ck,splitArea:pk,splitCircle:dk,splitLine:gk,splitPath:bk,splitPolygon:_k,splitRect:hk,splitToGrids:lk,starModule:cS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Pv,symbolModule:gS,textAttributesToStyle:Xg,textDrawOffsetX:Gg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Yg,textModule:yS,transformMat4:fu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:sA,translate:hu,verticalLayout:Kc,vglobal:__,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{ah.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)}))},wrapCanvas:Cd,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=ah.global)||void 0===t?void 0:t.env,s=i?null===(e=ah.context2dFactory)||void 0===e?void 0:e.call(ah,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=y(t)?t[0]:t,i=[];if(!e)return i;if(!0===Nc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Jc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Jc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class rC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:su(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class aC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Qc}}let oC=!1;function lC(t){oC||(oC=!0,t.bind(DS).toDynamicValue((()=>new aC(bS(t,by)))).inSingletonScope(),t.bind(tA).toService(DS))}class hC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Qc}}let cC=!1;function dC(t){cC||(cC=!0,t.bind(AS).toDynamicValue((()=>new hC(bS(t,by)))).inSingletonScope(),t.bind(SS).toService(AS))}function uC(){if(uC.__loaded)return;uC.__loaded=!0;const t=f_();fb(),jb({bind:t.bind}),_S?lC(t):dC(t)}uC.__loaded=!1;const pC=uC;class gC extends Lb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Su.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class fC extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=td,this.themeType="arc"}}let mC=!1;function vC(t){var e;mC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,xy))&&(mC=!0,t.bind(LS).toDynamicValue((()=>new fC(bS(t,xy)))).inSingletonScope(),t.bind(tA).toService(LS))}function yC(){if(yC.__loaded)return;yC.__loaded=!0;const t=f_();mb(),dA(),pA(),Ub({bind:t.bind}),vC(t)}yC.__loaded=!1;const _C=yC;class bC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ed}}let xC=!1;function SC(t){xC||(xC=!0,t.bind(FS).toDynamicValue((()=>new bC(bS(t,Sy)))).inSingletonScope(),t.bind(tA).toService(FS))}class AC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ed}}let kC=!1;function CC(t){kC||(kC=!0,t.bind(kS).toDynamicValue((()=>new AC(bS(t,Sy)))).inSingletonScope(),t.bind(SS).toService(kS))}function wC(){if(wC.__loaded)return;wC.__loaded=!0;const t=f_();vb(),sx({bind:t.bind}),_S?SC(t):CC(t)}wC.__loaded=!1;const MC=wC;class TC{constructor(){this.type="glyph",this.numberType=sd}contains(t,e,i){if(!t.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}}class BC extends TC{constructor(t){super(),this.canvasRenderer=t}}let EC=!1;function PC(t){EC||(EC=!0,t.bind(ZS).toDynamicValue((()=>new BC(bS(t,Dy)))).inSingletonScope(),t.bind(tA).toService(ZS))}class OC extends TC{constructor(t){super(),this.canvasRenderer=t}}let RC=!1;function IC(t){RC||(RC=!0,t.bind(RS).toDynamicValue((()=>new OC(bS(t,Dy)))).inSingletonScope(),t.bind(SS).toService(RS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=f_();_b(),dx({bind:t.bind}),_S?PC(t):IC(t)}DC.__loaded=!1;const LC=DC;function FC(){FC.__loaded||(FC.__loaded=!0,bb())}FC.__loaded=!1;const zC=FC;class HC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=rd}}let jC=!1;function NC(t){jC||(jC=!0,t.bind(HS).toDynamicValue((()=>new HC(bS(t,Ly)))).inSingletonScope(),t.bind(tA).toService(HS))}class VC{constructor(){this.type="image",this.numberType=rd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function UC(t){WC||(WC=!0,t.bind(wS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(SS).toService(wS))}function GC(){if(GC.__loaded)return;GC.__loaded=!0;const t=f_();xb(),Sx({bind:t.bind}),_S?NC(t):UC(t)}GC.__loaded=!1;const YC=GC;class XC extends Lb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:su(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Su.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class KC extends XC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ad}}let $C=!1;function qC(t){$C||($C=!0,t.bind(NS).toDynamicValue((()=>new KC(bS(t,wy)))).inSingletonScope(),t.bind(tA).toService(NS))}class ZC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ad}}let JC=!1;function QC(t){JC||(JC=!0,t.bind(MS).toDynamicValue((()=>new ZC(bS(t,wy)))).inSingletonScope(),t.bind(SS).toService(MS))}function tw(){if(tw.__loaded)return;tw.__loaded=!0;const t=f_();Sb(),Mx({bind:t.bind}),_S?qC(t):QC(t)}tw.__loaded=!1;const ew=tw;class iw extends XC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=od}}let sw=!1;function nw(t){sw||(sw=!0,t.bind(WS).toDynamicValue((()=>new iw(bS(t,My)))).inSingletonScope(),t.bind(tA).toService(WS))}class rw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=od}}let aw=!1;function ow(t){aw||(aw=!0,t.bind(TS).toDynamicValue((()=>new rw(bS(t,My)))).inSingletonScope(),t.bind(SS).toService(TS))}function lw(){if(lw.__loaded)return;lw.__loaded=!0;const t=f_();Ab(),Rx({bind:t.bind}),_S?nw(t):ow(t)}lw.__loaded=!1;const hw=lw;class cw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ld}}let dw=!1;function uw(t){dw||(dw=!0,t.bind(KS).toDynamicValue((()=>new cw(bS(t,Ty)))).inSingletonScope(),t.bind(tA).toService(KS))}class pw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ld}}let gw=!1;function fw(t){gw||(gw=!0,t.bind(OS).toDynamicValue((()=>new pw(bS(t,Ty)))).inSingletonScope(),t.bind(SS).toService(OS))}function mw(){if(mw.__loaded)return;mw.__loaded=!0;const t=f_();kb(),Vx({bind:t.bind}),_S?uw(t):fw(t)}mw.__loaded=!1;const vw=mw;class yw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=hd,this.themeType="polygon"}}let _w=!1;function bw(t){var e;_w||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Iy))&&(_w=!0,t.bind($S).toDynamicValue((()=>new yw(bS(t,Iy)))).inSingletonScope(),t.bind(tA).toService($S))}function xw(){if(xw.__loaded)return;xw.__loaded=!0;const t=f_();Cb(),dA(),pA(),Xx({bind:t.bind}),bw(t)}xw.__loaded=!1;const Sw=xw,Aw=new Ve;class kw{constructor(){this.type="rect",this.numberType=cd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||x(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:su(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;Aw.setValue(i.x1,i.y1,i.x2,i.y2),Aw.expand(-r/2),h=!Aw.containsPoint(e)}}return s.highPerformanceRestore(),h}}class Cw extends kw{constructor(t){super(),this.canvasRenderer=t}}let ww=!1;function Mw(t){ww||(ww=!0,t.bind(US).toDynamicValue((()=>new Cw(bS(t,By)))).inSingletonScope(),t.bind(tA).toService(US))}class Tw extends kw{constructor(t){super(),this.canvasRenderer=t}}let Bw=!1;function Ew(t){Bw||(Bw=!0,t.bind(BS).toDynamicValue((()=>new Tw(bS(t,By)))).inSingletonScope(),t.bind(SS).toService(BS))}function Pw(){if(Pw.__loaded)return;Pw.__loaded=!0;const t=f_();wb(),Zx({bind:t.bind}),_S?Mw(t):Ew(t)}Pw.__loaded=!1;const Ow=Pw;class Rw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=dd,this.themeType="rect"}}let Iw=!1;function Dw(t){var e;Iw||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ey))&&(Iw=!0,t.bind(GS).toDynamicValue((()=>new Rw(bS(t,Ey)))).inSingletonScope(),t.bind(tA).toService(GS))}function Lw(){if(Lw.__loaded)return;Lw.__loaded=!0;const t=f_();Mb(),eS({bind:t.bind}),Dw(t)}Lw.__loaded=!1;const Fw=Lw;class zw{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ud}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let Hw=!1;function jw(t){Hw||(Hw=!0,t.bind(qS).toDynamicValue((()=>new zw(bS(t,Ry)))).inSingletonScope(),t.bind(tA).toService(qS))}class Nw{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ud}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let Vw=!1;function Ww(t){Vw||(Vw=!0,t.bind(IS).toDynamicValue((()=>new Nw(bS(t,Ry)))).inSingletonScope(),t.bind(SS).toService(IS))}function Uw(){if(Uw.__loaded)return;Uw.__loaded=!0;const t=f_();Tb(),aS({bind:t.bind}),_S?jw(t):Ww(t)}Uw.__loaded=!1;const Gw=Uw;function Yw(){Yw.__loaded||(Yw.__loaded=!0,Bb())}Yw.__loaded=!1;const Xw=Yw;class Kw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=gd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:su(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Su.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let $w=!1;function qw(t){$w||($w=!0,t.bind(YS).toDynamicValue((()=>new Kw(bS(t,Py)))).inSingletonScope(),t.bind(tA).toService(YS))}class Zw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=gd}}let Jw=!1;function Qw(t){Jw||(Jw=!0,t.bind(ES).toDynamicValue((()=>new Zw(bS(t,Py)))).inSingletonScope(),t.bind(SS).toService(ES))}function tM(){if(tM.__loaded)return;tM.__loaded=!0;const t=f_();Pb(),gS({bind:t.bind}),_S?qw(t):Qw(t)}tM.__loaded=!1;const eM=tM;class iM extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Yg(a,u,n),v=Gg(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&&Su.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let sM=!1;function nM(t){sM||(sM=!0,t.bind(XS).toDynamicValue((()=>new iM(bS(t,Oy)))).inSingletonScope(),t.bind(tA).toService(XS))}class rM{constructor(){this.type="text",this.numberType=fd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let aM=!1;function oM(t){aM||(aM=!0,t.bind(PS).toDynamicValue((()=>new rM)).inSingletonScope(),t.bind(SS).toService(PS))}function lM(){if(lM.__loaded)return;lM.__loaded=!0;const t=f_();Ob(),yS({bind:t.bind}),_S?nM(t):oM(t)}lM.__loaded=!1;const hM=lM;function cM(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),pM=(t,e)=>(c(fM.warnHandler)&&fM.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),gM=(t,e,i)=>{if(!c(fM.errorHandler))throw new Error(t);fM.errorHandler.call(null,t,e)},fM={silent:!1,warnHandler:!1,errorHandler:!1},mM=fm(),vM=mM&&globalThis?globalThis.document:void 0;function yM(t){return("desktop-browser"===t||"mobile-browser"===t)&&mM}function _M(t){return bM(t)||"mobile-browser"===t}function bM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let xM=0;function SM(){return xM>=9999999&&(xM=0),xM++}function AM(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function kM(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&y(t[0].fields))}function CM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&CM(t,e)}))}const wM=t=>!d(t)&&!1!==t.visible;function MM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function TM(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 EM=["#ffffff","#000000"];function PM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return OM(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(...EM);for(const n of a)if(t!==n&&OM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function OM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?RM(t,e)>s:"largeText"===i?RM(t,e)>3:RM(t,e)>4.5}function RM(t,e){const i=IM(t),s=IM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function IM(t){const e=ni(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function DM(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 LM(t,e){return[t[0]*e,t[1]*e]}function FM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function zM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const HM=hf,jM={arc:t=>HM("arc",t),circle:t=>HM("circle",t),group:t=>HM("group",t),image:t=>HM("image",t),line:t=>HM("line",t),path:t=>HM("path",t),polygon:t=>HM("polygon",t),rect:t=>HM("rect",t),richtext:t=>HM("richtext",t),symbol:t=>HM("symbol",t),text:t=>HM("text",t)},NM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 UM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(UM||(UM={}));const GM={[UM.selectedReverse]:{},[UM.selected]:{},[UM.hover]:{},[UM.hoverReverse]:{}},YM={container:"",width:30,height:30,style:{}},XM="scrollDrag",KM=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:pv,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function $M(t,e,i={}){if(!t)return{width:0,height:0};const s=pv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 qM(t,e="type"){var i,s;return p(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function ZM(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function JM(t,e="type"){const i=qM(t,e);return"rich"===i?jM.richtext(ZM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),jM.text(t))}function QM(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 tT=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function eT(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 iT(t,e){const{dx:i,dy:s}=eT(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const sT={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},nT={size:8,stroke:"#000",lineWidth:1,zIndex:1};function rT(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Se(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Te(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const aT=Math.sin(Math.PI/10);function oT(t,e=aT){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function lT(t,e=aT){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function hT(t){const e={};return CM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function cT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function dT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return LM(r,(s?-1:1)*(n?-1:1)*t/FM(r))}function uT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function gT(t,e,i){var s;if(lT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>He(n,r)}function fT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function yT(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function _T(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function bT(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function xT(t,e){const i=bT(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 ST(t,e){const i=AT(t),s=AT(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 AT(t,e={x:0,y:0}){return re.distancePP(t,e)}function kT(t){return A(t.x)&&A(t.y)}function CT(t,e,i){let s=!1;if(e&&c(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function wT(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const MT=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function BT(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&BT(t[i],e)}}var ET;!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"}(ET||(ET={}));const PT={};function OT(t){switch(t){case ET.Linear:case ET.Log:case ET.Pow:case ET.Sqrt:case ET.Symlog:case ET.Time:return!0;default:return!1}}function RT(t){return!!PT[t]}function IT(t){switch(t){case ET.Ordinal:case ET.Point:case ET.Band:return!0;default:return!1}}function DT(t){return t}Object.values(ET).forEach((t=>{PT[t]=!0}));const LT=t=>-Math.log(-t),FT=t=>-Math.exp(-t),zT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,HT=t=>10===t?zT:t===Math.E?Math.exp:e=>Math.pow(t,e),jT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),NT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),VT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function WT(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 UT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function GT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function YT(t,e,i,s){return 1===i&&(i=0),GT(t,i,s)*(e/(1-i))}function XT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function KT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class qT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=XT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const ZT=Symbol("implicit");class JT extends qT{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=ET.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=ZT}clone(){const t=(new JT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==ZT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return QT(t,e,r,n)}class eB extends JT{constructor(t){super(),this.type=ET.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=YT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:tB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return tB(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&x(this._userBandwidth)}clone(){var t,e,i;return new eB(!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:iB}=ri;function sB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=iB(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof si?iB(t,e):e instanceof ii?iB(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class nB extends qT{constructor(t=DT,e=DT){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=DT,this._piecewise=UT,this._interpolate=sB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?KT:UT,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:DT),this.rescale(i)):this._clamp!==DT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const rB=Math.sqrt(50),aB=Math.sqrt(10),oB=Math.sqrt(2),lB=[1,2,5,10],hB=(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=pB(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),J(0,e).map((t=>n+t*s))):t>0?dB(0,-(e-1)/s,s):dB((e-1)/s,0,s)},cB=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 hB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return hB(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=dB(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=dB(t,e,l);return n&&r.reverse(),r})),pB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=lB[0];return i>=rB?s=lB[3]:i>=aB?s=lB[2]:i>=oB&&(s=lB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function gB(t,e,i){const s=(e-t)/Math.max(0,i);return pB(s)}function fB(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=gB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function vB(t,e){const i=x(e.forceMin),s=x(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const yB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),_B=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})),bB=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=uB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?yB(t,e,n):yB(t,e,$T(n)),h=yB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),xB=mt(((t,e,i,s,n)=>fB(s(t),s(e),i).map((t=>$T(n(t))))));class SB extends nB{constructor(){super(...arguments),this.type=ET.Linear}clone(){var t;const e=new SB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return cB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=uB(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return fB(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function kB(t){return e=>-t(-e)}function CB(t=Number.EPSILON){return e=>Math.max(e,t)}class wB extends nB{constructor(){super(jT(10),HT(10)),this.type=ET.Log,this._limit=CB(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new wB).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=jT(this._base),s=HT(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=kB(i),this._pows=kB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=LT,this.untransformer=FT):(this._logs=i,this._pows=s,this._limit=CB(),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 DT}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return _B(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return bB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return xB(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(wB,AB);class MB extends SB{constructor(){super(NT(1),VT(1)),this.type=ET.Symlog,this._const=1}clone(){return(new MB).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=NT(t),this.untransformer=VT(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return _B(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return bB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(MB,AB);class TB{constructor(){this.type=ET.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new TB).domain(this._domain).range(this._range).unknown(this._unknown)}}var BB,EB,PB;function OB(t){var e,i;const{type:s}=t;return s===EB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BB||(BB={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(EB||(EB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(PB||(PB={}));const RB={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},IB={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DB(t,e){var i;if(!t)return[];const s=VB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?jB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>HB(i)?FB(t,i,e):i)).filter(u)}))):i.map((i=>HB(i)?FB(t,i,e):i)).filter(u):[]}return[]}function LB(t,e){var i,s;return jB(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function FB(t,e,i){var s;const n=VB(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=RB[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=IB[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ii(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Xe(t,i,s),a=Ye(n,r,e.l),l=new ii(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const zB=(t,e)=>{if(e&&HB(t)){const i=FB(e,t);if(i)return i}return t};function HB(t){return t&&"palette"===t.type&&!!t.key}function jB(t){return!(!y(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function NB(t){return y(t)?{dataScheme:t}:t}function VB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=OB(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 WB extends JT{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!jB(this._range))return void super.range(this._range);const t=LB(this._range,this._domain);super.range(t)}}const UB={linear:SB,band:eB,point:class extends eB{constructor(t){super(!1),this.type=ET.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:JT,threshold:TB,colorOrdinal:WB};function GB(t){const e=UB[t];return e?new e:null}function YB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function XB(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function KB(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function $B(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function qB(t){return!!v(t)&&(!!t.endsWith("%")&&AM(t.substring(0,t.length-1)))}function ZB(t){return!!p(t)&&("percent"in t||"offset"in t)}function JB(t,e,i,s=0){var n,r;return x(t)?t:qB(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function QB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=JB(t[s],e.size,i)}))})),o}function tE(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function eE(t){let e={};return y(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||qB(t)||c(t)||ZB(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function iE(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const sE=(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},nE=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function rE(t,e){return t&&e.key in t?t[e.key]:e.default}function aE(t){return t&&"token"===t.type&&!!t.key}const oE={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%"},lE={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:nE,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:oE,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},hE={name:"dark",colorScheme:{default:{dataScheme:nE,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},cE=(t,e)=>t===e||!c(t)&&!c(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>cE(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>cE(t[i],e[i])))),dE=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),dE(t[s],e.slice(1),i))},uE=t=>t instanceof Fa||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function pE(t,e=["data"]){return I(t,uE,e)}function gE(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=NB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}_E._charts=yE.charts,_E._series=yE.series,_E._components=yE.components,_E._graphicComponents=yE.graphicComponents,_E._marks=yE.marks,_E._regions=yE.regions,_E._animations=yE.animations,_E._implements=yE.implements,_E._chartPlugin=yE.chartPlugin,_E._vChartPlugin=yE.vChartPlugin,_E._componentPlugin=yE.componentPlugin,_E.transforms=yE.transforms,_E.dataParser=yE.dataParser,_E._layout=yE.layout,_E._grammarTransforms=yE.grammarTransforms,_E._stageEventPlugins=yE.stageEventPlugins,_E.registerStageEventPlugin=(t,e)=>{_E._stageEventPlugins[t]=e},_E.getStageEventPlugin=t=>_E._stageEventPlugins[t],_E._interactionTriggers=yE.interactionTriggers,_E.registerInteractionTrigger=(t,e)=>{_E._interactionTriggers[t]=e},_E._composedEventMap=yE.composedEventMap,_E.registerComposedEvent=(t,e)=>{_E._composedEventMap[t]=e},_E._tooltipProcessors=yE.tooltipProcessors,_E.registerTooltipProcessor=(t,e)=>{_E._tooltipProcessors[t]=e},_E.createTooltipProcessor=(t,e)=>{const i=_E._tooltipProcessors[t];return i?new i(e):null},_E._runtimePluginInstallers=yE.runtimePluginInstallers,_E.registerRuntimePluginInstaller=(t,e)=>{_E._runtimePluginInstallers[t]=e},_E.getRuntimePluginInstaller=t=>_E._runtimePluginInstallers[t];const SE=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},AE=SE(),kE={[lE.name]:lE},CE=lE.name,wE=new Map(Object.keys(kE).map((t=>[t,kE[t]]))),ME=new Map,TE=new Map(Object.keys(kE).map((t=>[t,t===CE]))),BE=(t,e)=>{if(!t)return;const i=RE(e);wE.set(t,i),TE.set(t,!0)},EE=(t=CE)=>(TE.has(t)&&!TE.get(t)&&BE(t,wE.get(t)),wE.get(t)),PE=t=>wE.delete(t)&&ME.delete(t)&&TE.delete(t),OE=t=>!!v(t)&&wE.has(t),RE=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:CE;return bE({},EE(i),t)};class IE{static registerInstance(t){IE.instances.set(t.id,t)}static unregisterInstance(t){IE.instances.delete(t.id)}static getInstance(t){return IE.instances.get(t)}static instanceExist(t){return IE.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return IE.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}IE.instances=new Map;class DE{static registerTheme(t,e){BE(t,e)}static getTheme(t,e=!1){return EE(t)}static removeTheme(t){return PE(t)}static themeExist(t){return OE(t)}static getDefaultTheme(){return DE.themes.get(CE)}static setCurrentTheme(t){DE.themeExist(t)&&(DE._currentThemeName=t,IE.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return DE.getTheme(DE._currentThemeName,t)}static getCurrentThemeName(){return DE._currentThemeName}}function LE(t){return v(t)?DE.themeExist(t)?DE.getTheme(t):{}:p(t)?t:{}}DE.themes=wE,DE._currentThemeName=CE;const FE=["animationThreshold","colorScheme","name","padding"];function zE(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];FE.includes(n)?s[n]=r:f(r)?HB(r)?s[n]=zB(r,e):aE(r)?s[n]=rE(i,r):s[n]=zE(r,e,i):s[n]=r})),s}function HE(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]=HE(t[s],e)}return i}return y(t)?t.map((t=>HE(t,e))):t}function jE(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=jE(t[s],e)}return i}return y(t)?t.map((t=>jE(t,e))):t}function NE(t,...e){return c(t)?t(...e):t}const VE=(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:oE.fontFamily,fontSize:oE.fontSize}))(e,i,s).measure(t),WE="__VCHART",UE=500,GE=500,YE=`${WE}_MEASURE_CANVAS_ID`,XE=`${WE}_DEFAULT_DATA_INDEX`,KE=`${WE}_DEFAULT_DATA_KEY`,$E=`${WE}_DEFAULT_DATA_SERIES_FIELD`,qE=`${WE}_DEFAULT_SERIES_STYLE_NAME`,ZE=`${WE}_STACK_KEY`,JE=`${WE}_STACK_START`,QE=`${WE}_STACK_END`,tP=`${WE}_STACK_START_PERCENT`,eP=`${WE}_STACK_END_PERCENT`,iP=`${WE}_STACK_START_OffsetSilhouette`,sP=`${WE}_STACK_END_OffsetSilhouette`,nP=`${WE}_STACK_TOTAL`,rP=`${WE}_STACK_TOTAL_PERCENT`,aP=`${WE}_STACK_TOTAL_TOP`,oP=`${WE}_STACK_TOTAL_BOTTOM`,lP=`${WE}_MOSAIC_VALUE_START_PERCENT`,hP=`${WE}_MOSAIC_VALUE_END_PERCENT`,cP=`${WE}_MOSAIC_CAT_START_PERCENT`,dP=`${WE}_MOSAIC_CAT_END_PERCENT`,uP=`${WE}_SEGMENT_START`,pP=`${WE}_SEGMENT_END`,gP=`${WE}_KEY`,fP=`${WE}_MAP_LOOK_UP_KEY`;function mP(t,e){for(let i=0;it.key===e))}function yP(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 _P(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},kP(t,a,n[o],l,e,r))})),s?bP(n):n}function bP(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))):bP(t[e].nodes);return t}function xP(t,e){if("values"in t&&t.values.length){const i=_T(t.values,e),s=yT(t.values,eP);t.values.forEach((t=>{t[nP]=i,t[rP]=s}))}else for(const i in t.nodes)xP(t.nodes[i],e)}function SP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][QE]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)AP(t.nodes[r],e,i,s,n)}function kP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[QE]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),kP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const CP=(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]=MP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function TP(t){return!c(t)&&!E(t)&&Object.keys(t).some((e=>c(t[e])))}function BP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(c(t))return RP(t(r,i,s,n));if(TP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{c(e[t])&&(e[t]=e[t](r,i,s,n))})),RP(e)}return RP(t)}function EP(t={}){const e=Object.assign({},t);if(c(t.style)||TP(t.style)?e.style=(e,i,s,n)=>BP(t.style,e,i,s,n):E(t.style)||(e.style=RP(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])||TP(t.state[e])?i[e]=(i,s,n,r)=>BP(t.state[e],i,s,n,r):E(t.state[e])||(i[e]=RP(t.state[e]))})),e.state=i}return e}function PP(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RP(t[i](e,s,n,r)):E(t[i])||(e[i]=RP(t[i]))})),e}function OP(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),RP(i)}function RP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const IP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},DP=t=>"line"===t||"area"===t,LP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return DP(i)?e:null==e?void 0:e[0]},FP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let zP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=_E.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(_E.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var HP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(HP||(HP={}));const jP=["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 NP,VP,WP;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(NP||(NP={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(VP||(VP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(WP||(WP={}));const UP=[WP.mark,WP.model,WP.chart,WP.vchart];class GP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(WP.vchart,[]),this._levelNodes.set(WP.chart,[]),this._levelNodes.set(WP.model,[]),this._levelNodes.set(WP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const YP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class XP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>LP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||VP.chart);o.get(t)||o.set(t,new GP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||VP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||VP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||VP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?UP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[VP.chart,VP.window,VP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return YP[a]&&(a=YP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?WP.model:WP.vchart:WP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=VP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==WP.model&&s!==WP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=WP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case VP.chart:return this._viewBubbles;case VP.window:return this._windowBubbles;case VP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case VP.chart:return this._viewListeners;case VP.window:return this._windowListeners;case VP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return jP.includes(t)||Object.values(HP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&_E.hasInteractionTrigger(e)}}function KP(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function $P(t,e,i){t.getParser(e)||t.registerParser(e,i)}const qP=new Map;let ZP;function JP(){ZP||(ZP=new La,$P(ZP,"geojson",Ea),$P(ZP,"topojson",Oa),KP(ZP,"simplify",Xr))}function QP(t,e,i={type:"geojson",centroid:!0}){qP.has(t)&&pM(`map type of '${t}' already exists, will be overwritten.`),JP();const s=new Fa(ZP),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):p(r)&&s.transform({type:"simplify",options:r}),qP.set(t,s)}function tO(t){qP.has(t)?qP.delete(t):pM(`map type of '${t}' does not exists.`)}function eO(t,e=!1){let i=e;return t.latestData instanceof Fa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const iO=(t,e)=>0===t.length?[]:1===t.length?eO(t[0],null==e?void 0:e.deep):t.map((t=>eO(t,null==e?void 0:e.deep)));function sO(t,e,i){KP(e=e instanceof La?e:t.dataSet,"copyDataView",iO);const s=new Fa(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:aO.copyDataView}),s}function nO(t,e,i=[]){var s;if(t instanceof Fa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Fa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return pM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return pM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),pM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function rO(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var aO,oO,lO,hO;!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"}(aO||(aO={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(oO||(oO={})),function(t){t.data="data",t.mark="mark"}(lO||(lO={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(hO||(hO={}));const cO=["line","area","trail"];function dO(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(gP,i?t.slice().sort(i):t.slice()),{keys:[gP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const uO=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function pO(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{pO(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function fO(t,e,i,s){const n=dO(t,(t=>i(t))),r=dO(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const mO=`${WE}_BuiltIn_CallBack_Disappear`;var vO;!function(t){t.render="render",t.disappear="disappear"}(vO||(vO={}));const yO=[0,0,0];class _O{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ol),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Il),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xu.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&&(xu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(xu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Nt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(fu(yO,[e,i,s],this.modelMatrix),e=yO[0],i=yO[1],s=yO[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=nu(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:su(this,a,this.dpr),r.strokeStyle=nu(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>xu.free(t))),this.stack.length=0}}_O.env="browser";class bO extends Mu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=ah.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new _O(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 xO(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,Ad,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,kd,e.env));r||i.bind(Ad).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(kd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}bO.env="browser";const SO=xO(bO,_O);class AO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}AO.env="feishu";class kO extends Mu{constructor(t){super(t)}init(){this._context=new AO(this,this._dpr)}release(...t){}}kO.env="feishu";const CO=xO(kO,AO);class wO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:su(this,l,this.dpr),r.strokeStyle=nu(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=ah.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,ah.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}wO.env="harmony";class MO extends Mu{constructor(t){super(t)}init(){this._context=new wO(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}MO.env="harmony";const TO=xO(MO,wO);class BO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:su(this,l,this.dpr),r.strokeStyle=nu(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=ah.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,ah.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}BO.env="lynx";class EO extends Mu{constructor(t){super(t)}init(){this._context=new BO(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}EO.env="lynx";const PO=xO(EO,BO);class OO extends _O{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}OO.env="node";class RO extends Mu{constructor(t){super(t)}init(){this._context=new OO(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}}RO.env="node";const IO=xO(RO,OO);class DO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(nu(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:su(this,l,this.dpr)),r.setStrokeStyle(nu(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}DO.env="taro";class LO extends Mu{constructor(t){super(t)}init(){this._context=new DO(this,this._dpr)}release(...t){}}LO.env="taro";const FO=xO(LO,DO);class zO extends AO{}zO.env="tt";class HO extends Mu{constructor(t){super(t)}init(){this._context=new zO(this,this._dpr)}release(...t){}}HO.env="tt";const jO=xO(HO,zO);class NO extends _O{draw(){}createPattern(t,e){return null}}NO.env="wx";class VO extends Mu{constructor(t){super(t)}init(){this._context=new NO(this,this._dpr)}release(...t){}}VO.env="wx";const WO=xO(VO,NO);class UO extends mA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=yf.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;nnew XO(bS(t,Ay)))).inSingletonScope(),t.bind(tA).toService(zS))}class qO extends kw{constructor(t){super(),this.canvasRenderer=t}}let ZO=!1;class JO extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=pd}}let QO=!1;function tR(t){var e;QO||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Hy))&&(QO=!0,t.bind(QS).toDynamicValue((()=>new JO(bS(t,Hy)))).inSingletonScope(),t.bind(tA).toService(QS))}const eR=Yc();Yc();class iR{constructor(){this.type="gif-image",this.numberType=eR}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let sR=!1;function nR(t){sR||(sR=!0,t.bind(jS).toDynamicValue((()=>new iR)).inSingletonScope(),t.bind(tA).toService(jS))}function rR(t){t.isBound(UO)||t.bind(UO).toDynamicValue((()=>new UO(xS(tA,t),bS(t,zy),xS(Jm,t),xS(Qm,t)))).inSingletonScope(),t.isBound($m)?t.rebind($m).toService(UO):t.bind($m).toService(UO)}function aR(t){(function(t){YO||(YO=!0,t.bind(JS).toDynamicValue((()=>new GO)).inSingletonScope(),t.bind(tA).toService(JS),zm(t.bind.bind(t),tA))})(t),lC(t),vC(t),SC(t),$O(t),PC(t),NC(t),qC(t),function(t){ZO||(ZO=!0,t.bind(VS).toDynamicValue((()=>new qO(bS(t,By)))).inSingletonScope(),t.bind(tA).toService(VS))}(t),nw(t),uw(t),bw(t),Mw(t),Dw(t),jw(t),tR(t),qw(t),nM(t),nR(t),rR(t)}class oR extends hA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${oR.idprefix}_${oR.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=ah.global,this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:oR.GenerateCanvasId(),canvasControled:!0};this.canvas=new bO(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new bO({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function lR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,oR))||t.bind(oR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,oR.env))||t.bind(bf).toService(oR).whenTargetNamed(oR.env)}oR.env="browser",oR.idprefix="visactor_window",oR.prefix_count=0;var hR=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 cR{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 dR(t,e=!1){const i=document.createElement("img");if(ah.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class uR extends lA{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new cR(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return dR(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return dR(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return hR(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function pR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uR))||(t.bind(uR).toSelf().inSingletonScope(),t.bind(mg).toService(uR))}function gR(t=f_(),e=!0){gR.__loaded||(gR.__loaded=!0,pR(t),SO(t),lR(t),e&&aR(t))}gR.__loaded=!1;class fR extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new kO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 kO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fR))||t.bind(fR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,fR.env))||t.bind(bf).toService(fR).whenTargetNamed(fR.env)}fR.env="feishu";class vR extends mA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Cu(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}}let yR=!1;class _R extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=id}}let bR=!1;function xR(t){bR||(bR=!0,t.bind(CS).toDynamicValue((()=>new _R(bS(t,Ay)))).inSingletonScope(),t.bind(SS).toService(CS))}function SR(t){(function(t){yR||(yR=!0,zm(t.bind.bind(t),SS))})(t),function(t){t.isBound(vR)||t.bind(vR).toDynamicValue((()=>new vR(xS(SS,t),xS(Jm,t),xS(Qm,t)))).inSingletonScope(),t.isBound($m)?t.rebind($m).toService(vR):t.bind($m).toService(vR)}(t),dC(t),CC(t),xR(t),IC(t),UC(t),QC(t),fw(t),ow(t),Ew(t),Ww(t),Qw(t),oM(t)}class AR{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class kR{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function CR(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function wR(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new AR(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function MR(t,e,i,s){const n=CR(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new kR(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function TR(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function BR(t,e=TR(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class ER extends lA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=TR(i),n=null!==(e=t.dpr)&&void 0!==e?e:BR(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return BR(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function PR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,ER))||(t.bind(ER).toSelf().inSingletonScope(),t.bind(mg).toService(ER))}function OR(t=f_(),e=!0){OR.__loaded||(OR.__loaded=!0,PR(t),CO(t),mR(t),e&&SR(t))}OR.__loaded=!1;function RR(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function IR(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new MO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 MO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return RR(t,"target",s),RR(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=IR(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=IR(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&DR(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),DR(t,"x",_),DR(t,"y",b),DR(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),DR(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),DR(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),DR(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),DR(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),DR(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function FR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,LR))||t.bind(LR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,LR.env))||t.bind(bf).toService(LR).whenTargetNamed(LR.env)}LR.env="harmony";const zR="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function HR(t){return"number"==typeof t&&Number.isFinite(t)}function jR(...t){for(let e=0;e({width:i,height:s})),new kR(t,l,n,i,s,e)}function GR(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=WR(e*s,i*s);if(t)return t}throw new Error(zR)}class YR extends lA{constructor(){super(),this.type="harmony",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,this.rafSTO=new xh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=NR(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=NR(s),r=null!==(i=t.dpr)&&void 0!==i?i:VR(s),a=function(t,e){if(!HR(t)||!HR(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=UR(GR(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=UR(GR(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return VR(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=jR(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=jR(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function XR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,YR))||(t.bind(YR).toSelf().inSingletonScope(),t.bind(mg).toService(YR))}function KR(t=f_(),e=!0){KR.__loaded||(KR.__loaded=!0,XR(t),TO(t),FR(t),e&&SR(t))}KR.__loaded=!1;function $R(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function qR(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new EO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 EO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return $R(t,"target",s),$R(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=qR(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=qR(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&ZR(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),ZR(t,"x",_),ZR(t,"y",b),ZR(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),ZR(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),ZR(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),ZR(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),ZR(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),ZR(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function QR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,JR))||t.bind(JR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,JR.env))||t.bind(bf).toService(JR).whenTargetNamed(JR.env)}JR.env="lynx";function tI(t){return"number"==typeof t&&Number.isFinite(t)}function eI(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=sI(r),o=null!==(i=t.dpr)&&void 0!==i?i:nI(r,a),l=aI(t.width,t.height),h=oI(lI(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=sI(a),l=null!==(n=t.dpr)&&void 0!==n?n:nI(a,o),h=aI(t.width,t.height),c=Math.random().toString(),d=oI(lI(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return nI(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=eI(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=eI(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function cI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,hI))||(t.bind(hI).toSelf().inSingletonScope(),t.bind(mg).toService(hI))}function dI(t=f_(),e=!0){dI.__loaded||(dI.__loaded=!0,cI(t),PO(t),QR(t),e&&SR(t))}dI.__loaded=!1;class uI extends hA{get container(){return null}constructor(t=ah.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new RO(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new RO({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function pI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,uI))||t.bind(uI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,uI.env))||t.bind(bf).toService(uI).whenTargetNamed(uI.env)}uI.env="node";class gI extends lA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function fI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,gI))||(t.bind(gI).toSelf().inSingletonScope(),t.bind(mg).toService(gI))}function mI(t=f_(),e=!0){mI.__loaded||(mI.__loaded=!0,fI(t),IO(t),pI(t))}mI.__loaded=!1;class vI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new LO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 LO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function yI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,vI))||t.bind(vI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,vI.env))||t.bind(bf).toService(vI).whenTargetNamed(vI.env)}vI.env="taro";class _I extends lA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=MR(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=wR(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function bI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,_I))||(t.bind(_I).toSelf().inSingletonScope(),t.bind(mg).toService(_I))}function xI(t=f_(),e=!0){xI.__loaded||(xI.__loaded=!0,bI(t),FO(t),yI(t),e&&SR(t))}xI.__loaded=!1;class SI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new HO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 HO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function AI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,SI))||t.bind(SI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,SI.env))||t.bind(bf).toService(SI).whenTargetNamed(SI.env)}SI.env="tt";function kI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function CI(t,e=kI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class wI extends lA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=kI(i),n=null!==(e=t.dpr)&&void 0!==e?e:CI(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return CI(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function MI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,wI))||(t.bind(wI).toSelf().inSingletonScope(),t.bind(mg).toService(wI))}function TI(t=f_(),e=!0){TI.__loaded||(TI.__loaded=!0,MI(t),jO(t),AI(t),e&&SR(t))}TI.__loaded=!1;class BI{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={}}}function EI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class PI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="wx",this.eventManager=new BI}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new VO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 VO({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return EI(t,"target",o),EI(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function OI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,PI))||t.bind(PI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,PI.env))||t.bind(bf).toService(PI).whenTargetNamed(PI.env)}PI.env="wx";function RI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function II(t,e=RI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class DI extends lA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=RI(i),n=null!==(e=t.dpr)&&void 0!==e?e:II(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return II(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function LI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,DI))||(t.bind(DI).toSelf().inSingletonScope(),t.bind(mg).toService(DI))}function FI(t=f_(),e=!0){FI.__loaded||(FI.__loaded=!0,LI(t),WO(t),OI(t),e&&SR(t))}FI.__loaded=!1;var zI={},HI={},jI={};Object.defineProperty(jI,"__esModule",{value:!0}),jI.loop=jI.conditional=jI.parse=void 0;jI.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};jI.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};jI.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var NI={};Object.defineProperty(NI,"__esModule",{value:!0}),NI.readBits=NI.readArray=NI.readUnsigned=NI.readString=NI.peekBytes=NI.readBytes=NI.peekByte=NI.readByte=NI.buildStream=void 0;NI.buildStream=function(t){return{data:t,pos:0}};var VI=function(){return function(t){return t.data[t.pos++]}};NI.readByte=VI;NI.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var WI=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};NI.readBytes=WI;NI.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};NI.readString=function(t){return function(e){return Array.from(WI(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};NI.readUnsigned=function(t){return function(e){var i=WI(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};NI.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=WI(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=QI(t),i=XI(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=QI(this.attribute.gifImage),e=XI(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=ah.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=ah.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function iD(t){return new eD(t)}class sD extends _x{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=eR,this._renderContribitions=void 0,this.builtinContributions=[nD],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=Fp(t).image;this._draw(t,n,!1,i)}}const nD=new class extends Zv{constructor(){super(...arguments),this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let rD=!1;function aD(t){rD||(rD=!0,t.bind(sD).toDynamicValue((()=>new sD(xS(Jy,t)))).inSingletonScope(),t.bind(ky).toService(sD))}function oD(){of.RegisterGraphicCreator("gif",iD)}function lD(){if(lD.__loaded)return;lD.__loaded=!0;const t=f_();oD(),aD(t),nR(t)}lD.__loaded=!1;const hD=lD,cD=[{register:fb,bindModule:jb},{register:mb,bindModule:Ub},{register:vb,bindModule:sx},{register:yb,bindModule:ox},{register:_b,bindModule:dx},{register:bb},{register:xb,bindModule:Sx},{register:Sb,bindModule:Mx},{register:Ab,bindModule:Rx},{register:kb,bindModule:Vx},{register:Cb,bindModule:Xx},{register:wb,bindModule:Zx},{register:Mb,bindModule:eS},{register:Tb,bindModule:aS},{register:Bb},{register:Eb,bindModule:cS},{register:Pb,bindModule:gS},{register:Ob,bindModule:yS},{register:Rb},{register:oD}];let dD=!1;const uD=[lC,vC,SC,$O,PC,NC,qC,nw,uw,bw,Mw,Dw,jw,tR,qw,nM,nR];function pD(t){return{getContributions:t}}function gD(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function fD(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=jA();i(a),s(a),n(a),NA(),gD(e,{envParams:r,force:!0})}function mD(t,e){fD(t,"browser",{bindEnv:pR,bindCanvasModules:SO,bindWindowContribution:lR},e)}function vD(t,e){fD(t,"node",{bindEnv:fI,bindCanvasModules:IO,bindWindowContribution:pI},e)}function yD(t){WA(t),function(){if(dD)return;const t=jA();dD=!0,cD.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),aD(t),NA()}(),GA(t),UA(t)}function _D(t){WA(t);const e=jA();uD.forEach((t=>t(e))),rR(e),YA(t,tA),function(t){const e=jA(),i=pD((()=>t.registry.picker.getAll())),s=pD((()=>e.isBound(Jm)?e.getAll(Jm):[])),n=pD((()=>e.isBound(Qm)?e.getAll(Qm):[])),r=VA();ah.pickerServiceFactory=()=>new UO(i,{},s,n),ah.global=r}(t)}function bD(t){WA(t);SR(jA()),YA(t,SS),function(t){const e=jA(),i=pD((()=>t.registry.picker.getAll())),s=pD((()=>e.isBound(Jm)?e.getAll(Jm):[])),n=pD((()=>e.isBound(Qm)?e.getAll(Qm):[]));ah.pickerServiceFactory=()=>new vR(i,s,n)}(t)}function xD(){if(xD.__loaded)return;xD.__loaded=!0;const t=f_();yb(),ox({bind:t.bind}),_S?$O(t):xR(t)}xD.__loaded=!1;const SD=xD;function AD(){if(AD.__loaded)return;AD.__loaded=!0;const t=f_();Eb(),cS({bind:t.bind}),tR(t)}AD.__loaded=!1;const kD=AD;function CD(){CD.__loaded||(CD.__loaded=!0,Rb())}CD.__loaded=!1;const wD=CD;class MD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,K_(this.target,i,yo.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class ED extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class PD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class OD extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const RD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class ID extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){Y_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){Y_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class DD extends ID{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=RD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r),this.determineUpdateFunction()}}class LD extends ID{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class FD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class zD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const HD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class jD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=HD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ND extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const VD=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class WD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(Y_(this.target,{points:r.map(((t,i)=>yh(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class UD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:VD(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class GD extends WD{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:VD(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const YD=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class XD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:YD(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class KD extends WD{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:YD(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const $D=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class qD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:$D(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class ZD extends WD{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:$D(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const JD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class QD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class tL extends QD{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=JD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}}class eL extends QD{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const iL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class sL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=iL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aL extends rL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&A(m.x)?m.x:g,b=u.includes("y")?y:m&&A(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}}class oL extends rL{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,y=v&&A(v.x)?v.x:f,_=v&&A(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class lL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,K_(this.target,{text:n})}}class hL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class cL extends hL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}}class dL extends hL{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class uL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),w=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,T=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,B=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,E=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(T){case"x":A={scaleX:null!==(g=null!=B?B:w.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=E?E:w.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=B?B:w.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=E?E:w.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&$_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),Y_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class pL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class gL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const fL={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function mL(t,e){for(let i=0;ifL[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&w_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(Y_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class yL{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new M_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function _L(t){return new yL(t)}class bL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;K_(this.target,{text:o})}}class xL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if($_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),$_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),$_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),$_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;$_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:bL});const i=s._titleBottom.attribute.text;$_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:bL})}else $_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),$_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;$_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());$_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class SL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class AL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if($_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:bL}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:bL}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class kL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class CL extends nb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=__.createCanvas({width:t.width,height:t.height,dpr:__.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=__.createCanvas({width:t.width,height:t.height,dpr:__.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CL.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class wL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==ML.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==ML.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TL{static createTempCanvas(t,e,i){return __.createCanvas({width:t,height:e,dpr:i||__.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=TL.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TL.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TL.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(TL.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(TL.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(TL.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(TL.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(TL.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class PL extends ML{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class DL extends ML{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=TL.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class LL extends CL{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=__.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=__.createCanvas({width:i,height:s,dpr:__.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class FL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}K_(this.target,{textConfig:o})}}class zL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),K_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),K_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class HL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),K_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),K_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function WL(t,e){Y_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class UL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,$_(this.target,m)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class GL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,$_(this.target,d)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class YL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,$_(this.target,p)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class XL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,$_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),K_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class KL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,$_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),K_(this.target,n)}}class $L extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new M_(this.target);a.execute({type:"custom",custom:UL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:GL,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class qL extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new M_(this.target);a.execute({type:"custom",custom:UL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:YL,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class ZL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class JL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class QL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class tF extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new M_(this.target);n.execute({type:"custom",custom:JL,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class eF extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new M_(this.target);n.execute({type:"custom",custom:QL,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class iF extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),Y_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Pu(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Pu(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class sF extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=ah.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Sl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=ah.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Lo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Lo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function cF(t){var e,i;const s=null!==(e=f_().getAll(ky))&&void 0!==e?e:[],n=lF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;hF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=oF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function dF(t,e){var i,s;const n=null!==(i=f_().getAll(e))&&void 0!==i?i:[],r=lF(t.registry.picker,"vrender:legacy-picker"),a=new Set;hF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=oF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const uF=mD,pF=vD,gF={taro:{installEnv:function(t,e){fD(t,"taro",{bindEnv:bI,bindCanvasModules:FO,bindWindowContribution:yI},e)},loadEnv:xI},feishu:{installEnv:function(t,e){fD(t,"feishu",{bindEnv:PR,bindCanvasModules:CO,bindWindowContribution:mR},e)},loadEnv:OR},tt:{installEnv:function(t,e){fD(t,"tt",{bindEnv:MI,bindCanvasModules:jO,bindWindowContribution:AI},e)},loadEnv:TI},wx:{installEnv:function(t,e){fD(t,"wx",{bindEnv:LI,bindCanvasModules:WO,bindWindowContribution:OI},e)},loadEnv:FI},lynx:{installEnv:function(t,e){fD(t,"lynx",{bindEnv:cI,bindCanvasModules:PO,bindWindowContribution:QR},e)},loadEnv:dI},harmony:{installEnv:function(t,e){fD(t,"harmony",{bindEnv:XR,bindCanvasModules:TO,bindWindowContribution:FR},e)},loadEnv:KR}},fF=[sC,tC,x_,A_,dA,pA],mF=[()=>{M_.registerBuiltInAnimate("increaseCount",lL),M_.registerBuiltInAnimate("fromTo",rb),M_.registerBuiltInAnimate("scaleIn",uL),M_.registerBuiltInAnimate("scaleOut",pL),M_.registerBuiltInAnimate("growHeightIn",jD),M_.registerBuiltInAnimate("growHeightOut",ND),M_.registerBuiltInAnimate("growWidthIn",sL),M_.registerBuiltInAnimate("growWidthOut",nL),M_.registerBuiltInAnimate("growCenterIn",FD),M_.registerBuiltInAnimate("growCenterOut",zD),M_.registerBuiltInAnimate("clipIn",BD),M_.registerBuiltInAnimate("clipOut",ED),M_.registerBuiltInAnimate("fadeIn",PD),M_.registerBuiltInAnimate("fadeOut",OD),M_.registerBuiltInAnimate("growPointsIn",UD),M_.registerBuiltInAnimate("growPointsOut",GD),M_.registerBuiltInAnimate("growPointsXIn",XD),M_.registerBuiltInAnimate("growPointsXOut",KD),M_.registerBuiltInAnimate("growPointsYIn",qD),M_.registerBuiltInAnimate("growPointsYOut",ZD),M_.registerBuiltInAnimate("growAngleIn",DD),M_.registerBuiltInAnimate("growAngleOut",LD),M_.registerBuiltInAnimate("growRadiusIn",tL),M_.registerBuiltInAnimate("growRadiusOut",eL),M_.registerBuiltInAnimate("moveIn",aL),M_.registerBuiltInAnimate("moveOut",oL),M_.registerBuiltInAnimate("rotateIn",cL),M_.registerBuiltInAnimate("rotateOut",dL),M_.registerBuiltInAnimate("update",vL),M_.registerBuiltInAnimate("state",gL),M_.registerBuiltInAnimate("labelItemAppear",xL),M_.registerBuiltInAnimate("labelItemDisappear",SL),M_.registerBuiltInAnimate("poptipAppear",AL),M_.registerBuiltInAnimate("poptipDisappear",kL),M_.registerBuiltInAnimate("inputText",bL),M_.registerBuiltInAnimate("inputRichText",FL),M_.registerBuiltInAnimate("outputRichText",zL),M_.registerBuiltInAnimate("slideRichText",jL),M_.registerBuiltInAnimate("slideOutRichText",HL),M_.registerBuiltInAnimate("slideIn",UL),M_.registerBuiltInAnimate("growIn",GL),M_.registerBuiltInAnimate("spinIn",YL),M_.registerBuiltInAnimate("moveScaleIn",$L),M_.registerBuiltInAnimate("moveRotateIn",qL),M_.registerBuiltInAnimate("strokeIn",XL),M_.registerBuiltInAnimate("slideOut",ZL),M_.registerBuiltInAnimate("growOut",JL),M_.registerBuiltInAnimate("spinOut",QL),M_.registerBuiltInAnimate("moveScaleOut",tF),M_.registerBuiltInAnimate("moveRotateOut",eF),M_.registerBuiltInAnimate("strokeOut",KL),M_.registerBuiltInAnimate("pulse",iF),M_.registerBuiltInAnimate("MotionPath",NL),M_.registerBuiltInAnimate("streamLight",sF),M_.registerBuiltInAnimate("dissolve",EL),M_.registerBuiltInAnimate("grayscale",IL),M_.registerBuiltInAnimate("distortion",PL),M_.registerBuiltInAnimate("particle",DL),M_.registerBuiltInAnimate("glitch",RL),M_.registerBuiltInAnimate("gaussianBlur",OL),M_.registerBuiltInAnimate("pixelation",LL)},gb],vF=[pC,_C,MC,SD,LC,hD,zC,YC,ew,hw,vw,Sw,Ow,Fw,Gw,Xw,eM,hM,wD,kD];function yF(){fF.forEach((t=>t())),mF.forEach((t=>t()))}function _F(t,e){if(!aF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==__?void 0:__.env)?__.envParams:void 0}(e);return void 0===i?vD(t):pF(t,i),yD(t),bD(t),mI(),vF.forEach((t=>t())),cF(t),dF(t,SS),yF(),t}function bF(t,e,i){if(!aF(t,e))return t;const s=gF[e];return s.installEnv(t,i),yD(t),function(t){bD(t)}(t),s.loadEnv(),vF.forEach((t=>t())),cF(t),dF(t,SS),yF(),t}const xF=Symbol.for("visactor.vrender.sharedAppRegistry");function SF(){var t;const e=globalThis,i=null!==(t=e[xF])&&void 0!==t?t:new Map;return e[xF]=i,i}function AF(t,e){const i=SF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function kF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=SF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function CF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=AF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(kF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>kF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=AF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&kF(t,i,s))}}}(t,s,r,o)}const wF=KA,MF=[];function TF(t){MF.forEach((({module:e,options:i})=>{wF(e,Object.assign(Object.assign({},i),{app:t}))}))}var BF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),cF(t),dF(t,tA),yF(),t):t}(_A(BF(t,["envParams"])),e);return TF(i),i}var PF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(t){case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony";case s.lynx:return"lynx";default:return"browser"}},zF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},HF=(t,e)=>{const i=FF(t),s=zF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},jF=(t,e)=>{const i=CF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,LF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},NF="poptipForText";class VF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(NP.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(NP.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(NP.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(NF))&&this._dedupeStagePlugin(NF)}initView(){var t,e,i,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:g,autoPreventDefault:f,background:m}=this._option,v=HF(l,h);__.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const s=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=FF(i.mode),n=HF(i.mode,i.modeParams);return jF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=s.releaseAppRef,null===(t=this._option.runtimePluginInstallers)||void 0===t||t.forEach((t=>t(s.app)));try{this._stage=(_=s.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:g,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:u(a)?a:!u(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=Qp({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(u(c)?c:_M(l))&&!1!==d&&_E.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,p(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=hO.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!y(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!yM(this._option.mode))return!1;return!1===(u(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:__.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(__.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=__.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>pO(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>pO(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{pO(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===hO.before;(e||i)&&(uM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=hO.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=hO.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),uM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=gO(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=fO(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=fO(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=dO(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=dO(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:mO,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{pO(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===oO.appear))?oO.appear:e.every((t=>t===oO.disappear))?oO.disappear:oO.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===VP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=IP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=IP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:LP(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===VP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===VP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===VP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===VP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===VP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{pO(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=gO(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return yM(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{__.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{pO(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=__.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){__.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function WF(t,i){var s;return e(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==i?void 0:i.onError)&&void 0!==s?s:gM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const UF={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}},GF={poptip:z({},UF)};function YF(t){t.crosshair=G(t.crosshair||{}).map((e=>gE({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function XF(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=oi(l,i.width,i.height);a=t,o=e}else if(h&&yM(e.mode)){let t;t=v(h)?__.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(bM(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}}const KF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function $F(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function qF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function ZF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;KF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function JF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}const QF=9,tz=0,ez=-1;var iz,sz,nz,rz,az,oz;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(iz||(iz={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(sz||(sz={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(nz||(nz={}));class lz{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},lz.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}lz.defaultMarkInfo={};class hz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class cz{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=>gE({},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 dz extends hz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=cz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new lz,this._lastLayoutRect=null,this.id=SM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new zP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${WE}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=_E.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return P(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class uz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=sz.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=QB(eE(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:JB(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:JB(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:JB(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:JB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:JB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:JB(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=JB(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=JB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=JB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(tE(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class pz extends dz{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new uz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class gz extends cz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class fz extends pz{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=gz,this.modelType="region",this.specKey="region",this.type=fz.type,this._series=[],this.layoutType="region",this.layoutZIndex=iz.Region,this.seriesDataFilterOver=()=>{this.event.emit(NP.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",iz.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",nz.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:iz.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:iz.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",nz.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",nz.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",nz.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",nz.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",nz.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function mz(t){const e=[],i=[],s=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function vz(t,e,i){e?t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function yz(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 _z(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=Az(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),yz(d,!0,p,l),s&&vz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function bz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=Az(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=Az(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),yz(d,!1,p,o),s&&vz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function Sz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=Az(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=Az(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&_z(n,e,i,!1,"left",s),r.length&&_z(r,e,i,!0,"left",s),a.length&&bz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&xz(n,e,i,!1,"top",s),r.length&&xz(r,e,i,!0,"top",s),a.length&&Sz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&_z(n,e,i,!1,"right",s),r.length&&_z(r,e,i,!0,"right",s),a.length&&bz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&xz(n,e,i,!1,"bottom",s),r.length&&xz(r,e,i,!0,"bottom",s),a.length&&Sz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=Az(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=Az(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:gM)("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}}}kz.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(rz||(rz={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(az||(az={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(oz||(oz={}));const Cz=["linear","radial","conical"],wz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Mz={};Object.values(az).forEach((t=>{Mz[t]=!0})),az.STATE_HOVER,az.STATE_HOVER_REVERSE,az.STATE_SELECTED,az.STATE_SELECTED_REVERSE,az.STATE_DIMENSION_HOVER,az.STATE_DIMENSION_HOVER_REVERSE;class Tz extends hz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class Bz extends Tz{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];u(s.domain)&&(n.domain=s.domain),u(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,cO.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Mz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(WE)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(WE))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(OT(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class Ez extends hz{constructor(){super(...arguments),this.id=SM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=_E.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Pz extends Ez{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Oz=1e3,Rz="quadInOut",Iz=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Dz=(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=Pu(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Lz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?rk(t):[],n=rk(e);i&&s&&(i.fromTransform&&ak(s,i.fromTransform.clone().getInverse()),ak(s,i.toTransfrom));const[r,a]=nk(s,n);return t?sk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},zz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Hz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!zz.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Tu.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class jz extends ib{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Lz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Dz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):K_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Nz=(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=Fz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Hz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new jz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Oz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Rz);return c.play(d),c};class Vz extends ib{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Lz(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&&Dz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Wz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Iz.includes(t))(i)||(e[i]=t[i])})),e},Uz=(t,e,i)=>{const s=Wz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=ah.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Gz=(t,e,i)=>{const s=[],n=i?null:Wz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Wz(t.attribute);if("rect"===t.type)hk(t,e).forEach((t=>{s.push(ah.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)ck(t,e).forEach((t=>{s.push(ah.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)dk(t,e).forEach((t=>{s.push(ah.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=gk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(ah.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?_k(t,e).forEach((t=>{s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?pk(t,e).forEach((t=>{s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&bk(t,e).forEach((t=>{"path"in t?s.push(ah.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Uz(t,s,e),s},Xz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Kz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Xz(l.delay,n,a,o),d=Xz(l.duration,n,a,o),u=Xz(l.oneByOne,n,a,o),p=Xz(l.splitPath,n,a,o),g=A(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Gz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Yz)(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);Nz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Gz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Yz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Fz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Hz(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:yo.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 jz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Oz,null!==(l=i.easing)&&void 0!==l?l:Rz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:yo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Vz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Oz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Rz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Nz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},$z=(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))))},qz=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},Zz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},Jz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];Zz(t,a,s)},Qz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));Zz(t,r,i)},tH=Symbol("statesClearedBeforeReInit");class eH extends Ez{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Pz(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Qp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:iz.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Sl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===rz.enter||t.context.diffState===rz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&Zz(t,r,e)},this.name=t,this.model=e.model,this.key=e.key,this.state=new Bz(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(t){return[nz.User_Mark,nz.User_Series,nz.User_Chart,nz.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&gE(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(RT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=GB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):Cz.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):RT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",nz.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,nz.User_Mark)}else this.setStyle(i,t,nz.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=LB(DB(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},wz[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ii.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)Cz.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=LB(DB(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return dO(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return _E.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[KE],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=dO(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===oO.appear))?oO.appear:t.every((t=>t===oO.disappear))?oO.disappear:t[0];return null!=e?e:oO.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{qz(t),s.push(...t.getGraphics())})),e.forEach((t=>{qz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Kz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=$z(e,n),r=$z(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===oO.exit?oO.exit:i===oO.update?oO.update:oO.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===rz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===rz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=rz.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=rz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=rz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=oO.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=oO.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return uO(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=uO(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||c(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!c(r)&&(!Cz.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!RT(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);d(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,FP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===az.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=_E.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=_E.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===hO.before||(this._product||this._initProduct(),uM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[tH],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?Jz(i,t,!0,a):Qz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[tH]=e:delete s[tH]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===rz.exit&&!e.isExiting)if(e.context.animationState===rz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===rz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:rz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Qp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[tH]=t.currentStates.slice())}))}}var iH;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(iH||(iH={}));class sH extends eH{constructor(){super(...arguments),this.type=sH.type,this._marks=[],this._diffState=rz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(pM("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?(pM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return pO(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===rz.update){const t=this.hasAnimation(),e=FP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=rz.update}render(){this._isCommited&&(uM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}sH.type="group";const nH={measureText:VE};class rH{static instance(){return rH.instance_||(rH.instance_=new rH),rH.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 aH{constructor(){this.id=SM(),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))?pM("不要重复添加相同的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 oH extends aH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const lH=(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"},hH=(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 cH extends o{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=qa.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=qa.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||lH(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=hH(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=qa.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=hH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=lH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=qa.now()-i>this.config.press.time&&hH(s[0],t){ah.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:yo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class uH extends dH{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 C=ah.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,M;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},M={startAngle:x}):(w={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?w:M,"in"===b?M:w,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class pH extends dH{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=ah.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 gH extends ib{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&w_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(Y_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=yh(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));K_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const fH={type:"fadeIn"};function mH(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 fH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class vH extends nb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const yH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},_H={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},bH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},xH=()=>{_E.registerAnimation("scaleInOut",(()=>_H))},SH=()=>{_E.registerAnimation("fadeInOut",(()=>bH))},AH=(t,e)=>({appear:mH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:gH,duration:yH.update.duration,easing:yH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),kH=()=>{_E.registerAnimation("line",AH)},CH=()=>{M_.registerBuiltInAnimate("growPointsIn",UD),M_.registerBuiltInAnimate("growPointsOut",GD),M_.registerBuiltInAnimate("growPointsXIn",XD),M_.registerBuiltInAnimate("growPointsXOut",KD),M_.registerBuiltInAnimate("growPointsYIn",qD),M_.registerBuiltInAnimate("growPointsYOut",ZD),M_.registerBuiltInAnimate("clipIn",BD),M_.registerBuiltInAnimate("clipOut",ED)},wH=()=>{gb(),M_.registerBuiltInAnimate("scaleIn",uL),M_.registerBuiltInAnimate("scaleOut",pL),M_.registerBuiltInAnimate("fadeIn",PD),M_.registerBuiltInAnimate("fadeOut",OD),M_.registerBuiltInAnimate("moveIn",aL),M_.registerBuiltInAnimate("moveOut",oL),M_.registerBuiltInAnimate("rotateIn",cL),M_.registerBuiltInAnimate("rotateOut",dL),M_.registerBuiltInAnimate("update",vL),M_.registerBuiltInAnimate("state",gL),M_.registerBuiltInAnimate("fromTo",rb),M_.registerBuiltInAnimate(mO,vH)},MH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};az.STATE_HIGHLIGHT,az.STATE_BLUR;class TH{constructor(t){this._markSet=new lz,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const BH={highlightState:az.STATE_HIGHLIGHT,blurState:az.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class EH extends TH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},BH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Qz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}EH.type="element-highlight",EH.defaultOptions=BH;const PH=()=>{_E.registerInteractionTrigger(EH.type,EH)},OH={state:az.STATE_SELECTED,trigger:"click"};class RH extends TH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},OH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),Jz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Qz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}RH.type="element-select",RH.defaultOptions=OH;const IH=()=>{_E.registerInteractionTrigger(RH.type,RH)};class DH extends aH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const LH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},FH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...FH(t))})),s},zH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(LH(t,r),!1)};class HH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>_E.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>_E.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>_E.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return _E.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>_E.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){_E.registerTransform(t,e)}static registerFunction(t,e){t&&e&&rH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&rH.instance().unregisterFunction(t)}static getFunction(t){return t?rH.instance().getFunction(t):null}static getFunctionList(){return rH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=_E.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=_E.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,qP.get(e);var e}static registerSVG(t,e,i){const s=_E.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=_E.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){IE.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=SM(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=vO.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=ZF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?_E.getSeriesBuiltInTheme(e):_E.getComponentBuiltInTheme(e);i=i?gE({},s,i[e]):s}s===t.length-1&&u(i)&&(i=zE({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},BT(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:y,stage:_,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=yM(y);if(S?gR(eA):"node"===y&&mI(eA),S&&f&&(this._container=v(f)?__.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==y&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=DE.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=_E.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===e.type&&A.push("scrollbar");const C=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new VF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new XP(this,this._compiler),this._event=new zP(this._eventDispatcher,y),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),IE.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=gE({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=HE(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;HH.getFunctionList()&&HH.getFunctionList().length&&(t=jE(t,HH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=_E.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=_E.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=_E.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(NP.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(NP.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return XF(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:UE,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:GE})}_initDataSet(t){this._dataSet=t instanceof La?t:new La,$P(this._dataSet,"dataview",Ra),$P(this._dataSet,"array",i),KP(this._dataSet,"copyDataView",iO);for(const t in _E.transforms)KP(this._dataSet,t,_E.transforms[t]);for(const t in _E.dataParser)$P(this._dataSet,t,_E.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),$F(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(NP.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?oO.none:oO.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,IE.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{LH(t)})),this._exitingVRenderComponents.clear())}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Fa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=nO(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?gE({},t[n][e.index],i):i):t[n]=s?gE({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?gE({},t[n][r],i):i)}else t.id===e&&(t[n]=s?gE({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=gE({},t.getSpec(),e));const r=t.updateSpec(e),a=$F(r),o=qF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(NP.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=bE({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=LE(this._currentThemeName),this._currentTheme=o(a,l);else{const t=bE({},LE(p(r)&&r.type?r.type:p(n)&&n.type?n.type:this._currentThemeName),LE(n),LE(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(GF.poptip,UF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!yM(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return LE(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!DE.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=u(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield WF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!yM(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(u(this._container))return this._container;let e;return e=v(this._canvas)?__.getElementById(this._canvas):this._canvas,u(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?iE(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return pM("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?iE(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(pM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return rH.instance().getFunction(t)}registerFunction(t,e){t&&e&&rH.instance().registerFunction(t,e)}unregisterFunction(t){t&&rH.instance().unregisterFunction(t)}getFunctionList(){return rH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=_E.getChartPlugins();t.length>0&&(this._chartPlugin=new oH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=_E.getVChartPlugins();e.length>0&&(this._vChartPlugin=new DH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=vO.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=vO.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}HH.InstanceManager=IE,HH.ThemeManager=DE,HH.globalConfig={uniqueTooltip:!0},HH.Utils=nH,HH.vglobal=__;_E.registerRegion("region",fz),_E.registerLayout("base",kz),Xw(),zC(),_E.registerMark(sH.type,sH),_E.registerStageEventPlugin("gesture",cH),PH(),IH(),BE(hE.name,hE);const jH="monotone",NH="linear",VH="bevel";var WH;!function(t){t.vertical="vertical",t.horizontal="horizontal"}(WH||(WH={}));class UH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}class GH extends ub{constructor(t){super(t),this.lastFrameTime=0,this.status=Ml.RUNNING}setupTickHandler(){const t=new UH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ml.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ml.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ml.RUNNING,!0}}function YH(t,e){return e("component",t)}function XH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=_E.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const KH=(t,e,i,s)=>{if(d(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},$H=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,c(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],p=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(c(e.set))g=function(t){const i=p.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=p.get(`${e[a]}`);if(d(i))for(let i=0;i(g(t),t)))},qH="2.1.3",ZH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},JH=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=XH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},QH=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const tj=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function ej(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=sj(JH(h,r,a,c),p,g),o.value=sj(JH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=JH(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function ij(t,e,i,s,n,r,a){if(c(e)){ej(t,e(n,a),i,s,r,a)}else e&&ej(t,e,i,s,r,a)}const sj=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=vi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class nj{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(u(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{ij(a,t,e,i,s,n,r)})):c(t)?ij(a,t,e,i,s,n,r):t&&ej(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:JH(r.visible,t,n),value:sj(JH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:JH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=JH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&tj(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const rj={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},aj=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=mP([],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 oj(a,n,o)},oj=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{AM(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{AM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=rj[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},lj=(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=>{AM(t[e])||(t[e]=0)}))})),t},hj=`${WE}_HIERARCHY_DEPTH`,cj=`${WE}_HIERARCHY_ROOT`,dj=`${WE}_HIERARCHY_ROOT_INDEX`;function uj(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function pj(t,e,i){t&&(i.needDefaultSeriesField&&(t[$E]=i.defaultSeriesField),t[XE]=e,t[KE]=i.getKey(t,e,i))}function gj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function fj(t,e,i,s=0,n,r){void 0===r&&(r=e),pj(t,e,i),t[hj]=s,t[cj]=n||t[i.categoryField],t[dj]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>fj(e,s,i,t[hj]+1,t[cj],r)))}const mj={label:{name:"label",type:"text"}},vj=`${WE}_rect_x`,yj=`${WE}_rect_x1`,_j=`${WE}_rect_y`,bj=`${WE}_rect_y1`,xj={data:!0},Sj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},Aj=[...Object.keys(yH),"normal"];function kj(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 Bj(n)&&delete n.type,n.oneByOne&&(n=wj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Mj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=gE({},o[e],a);return Bj(n)&&delete n.type,n.oneByOne&&(n=wj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Mj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function Cj(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),Ej(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function wj(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=c(n)?n(t,i,a):A(n)?n:0,h=c(r)?r(t,i,a):A(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):A(n)?n:0,d=c(a)?a(t,r,o):A(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function Mj(t,e){var i;return null!==(i=null==t?void 0:t[XE])&&void 0!==i?i:e.context.graphicIndex}function Tj(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 Bj(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function Ej(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),Ej(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),Ej(t[s],e,i))}function Pj(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Oj extends cz{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=OB(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=_E.getSeriesMarkMap(o)?function(t,e,i){const s=_E.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=gE({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return gE({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=gE({},i,s,t),n=i.label;return n&&p(n)&&y(e.label)&&(e.label=e.label.map((t=>gE({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Rj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(Sj[e]||(t[e]=!0),t)),{}),Ij={compileOnlyKeys:Sj,dataRelatedKeys:Rj,seriesOnlyKeys:{tooltip:!0}},Dj={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Lj=t=>(t=>p(t)&&!y(t)&&!c(t))(t)?t:d(t)?{}:null,Fj=(t,e,i)=>{const s=Lj(t),n=Lj(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function zj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class Hj extends dz{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${WE}_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=Oj,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=iz.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(NP.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Pj(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(NP.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),u(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(KP(this._rawData.dataSet,"invalidTravel",lj),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=nO(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=sO(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=sO(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Pz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=oj(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){KP(this._dataSet,"dimensionStatistics",aj);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Fa(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&&mP(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){KP(this._dataSet,"dimensionStatistics",aj);const s=new Fa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=mP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&mP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Fa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:v(t)?e=>e[t]:y(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(KP(this._rawData.dataSet,"addVChartProperty",ZH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uj.bind(this),call:pj}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(NP.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(NP.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(NP.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(NP.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=kj({},Cj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:_M(i)||bM(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=gE(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=gE(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=MH(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=MH(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:az.STATE_HOVER_REVERSE,highlightState:az.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:az.STATE_SELECTED_REVERSE,state:az.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=MH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:$E;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:qE,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,qE,nz.User_SeriesStyle)}))}afterInitMark(){this.event.emit(NP.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",nz.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(_E.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new nj(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,zj(i))}_getSpecUpdatePolicy(){return Ij}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},xj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(G(t.label),G(e.label),l),!l.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Fj(t[i],e[i],Dj)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Fj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?zj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&zj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Fa||rO(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Pj(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:$E,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DB(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:$E}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,u=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${u}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,gE({},p,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:KE}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${d(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==QE&&t!==eP&&t!==JE&&t!==tP||(t=this.getStackValueField()),null!==(e=yP(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>AM(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:$E]}}function jj(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();OT(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 Nj(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}}}Hj.mark=mj,Hj.transformerConstructor=Oj;class Vj extends Hj{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);OT(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:`${WE}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(QE),this.setFieldX2(JE)):(this.setFieldY(QE),this.setFieldY2(JE))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(eP),this.setFieldX2(tP)):(this.setFieldY(eP),this.setFieldY2(tP))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(sP),this.setFieldX2(iP)):(this.setFieldY(sP),this.setFieldY2(iP))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),u(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(NP.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)&&(jj("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Wj(t){return"bottom"===t||"top"===t}function Uj(t){return"left"===t||"right"===t}function Gj(t){return"z"===t}function Yj(t,e){return $B(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Xj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Kj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Wj(t)?"linear":"band":Wj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const $j=(t,e,i)=>{var s;const n=null!==(s="band"===e?YH("axisBand",i):["linear","log","symlog"].includes(e)?YH("axisLinear",i):{})&&void 0!==s?s:{},r=Wj(t)?YH("axisX",i):Uj(t)?YH("axisY",i):YH("axisZ",i);return gE({},YH("axis",i),n,r)};class qj{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:gM)("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:gM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>IT(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Wj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Zj extends qj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Jj=(t,e)=>{var i,s;return t===e||!d(t)&&!d(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},Qj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return A(s)?[-s,s]:s},tN=(t,e,i,s)=>{var n;const r=e.getScale(),a=IT(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:eN(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,iN=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class sN extends qj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Jj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:VP.canvas}),callback:this.onMouseOut}),_M(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),_M(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var nN;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(nN||(nN={}));const rN={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},aN={sampling:!0,samplingFactor:!0};class oN{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(rN.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:VH,curveType:NH,closePath:!0},"normal",nz.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===jH?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",nz.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",nz.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(rN.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:Tj(this._spec,rN.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Fa(this._option.dataSet,{name:`${WE}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(nN.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:nz.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:az.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",nz.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",nz.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[rN.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(nN.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,gE({},this._spec[rN.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:az.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",nz.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",nz.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const lN=Object.assign(Object.assign({},mj),rN),hN=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>hN(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},cN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class dN extends eH{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return cN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(RT(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?hN(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:rz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[KE]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const uN=new Uint32Array(33),pN=new Uint32Array(33);pN[0]=0,uN[0]=~pN[0];for(let t=1;t<=32;++t)pN[t]=pN[t-1]<<1|1,uN[t]=~pN[t];function gN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&uN[31&o]&pN[1+(31&l)])return!0}else{if(i[h]&uN[31&o])return!0;if(i[c]&pN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,uN[31&o]&pN[1+(31&l)]);else for(s(h,uN[31&o]),s(c,pN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,pN[31&a]|uN[1+(31&o)]);else for(n(l,pN[31&a]),n(h,uN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function fN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function mN(t,e,i=!1){return i?fN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function vN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=mN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=fN(t,r)),e.getRange(r)))}function yN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return yN(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return yN(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return yN(t,e,n,s,h,d)}return!1}const bN=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],xN=["top","inside-top","inside"];function SN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const AN={mode:"same-time",duration:300,easing:"linear"};function kN(t){return 3===t||4===t}function CN(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 wN=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 MN(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)}}class TN extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class BN extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const EN=(t,e)=>Math.ceil(t)>Math.floor(e),PN=([t,e],[i,s])=>s>t&&e>i;function ON(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const RN=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class IN extends Jp{constructor(t,e){super(t),this._skipRenderAttributes=RN,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{FN(t,e,i)})),e}function zN(t,e){e&&(null==t||t.onComplete.push(e))}function HN(t){t.forEach((t=>{t()}))}function jN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var NN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(UM.hover,!0),CM(this,(t=>{t===e||E(t.states)||t.addState(UM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(CM(this,(t=>{E(t.states)||(t.removeState(UM.hoverReverse),t.removeState(UM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void CM(this,(t=>{E(t.states)||(t.removeState(UM.selectedReverse),t.removeState(UM.selected))}));E(e.states)||(e.addState(UM.selected,!0),CM(this,(t=>{t===e||E(t.states)||t.addState(UM.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)===yo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===yo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Se(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[MN(g,f,c,d,a,o),MN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=jM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Sl)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),HN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,zN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(AN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=FN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=FN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},jN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(c(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=c(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!h(t)&&c(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}c(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return JM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=c(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&EN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&EN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(ON([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!PN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(mN(i,e,!0))}))),h.length>0&&h.forEach((t=>{v(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(mN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(mN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;LN(i,null==n?void 0:n.attribute),LN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{WN[t]=e};var GN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};YN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const XN=()=>{UN("line",YN),UN("area",YN)};var KN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}$N.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const qN=()=>{UN("symbol",$N),UN("line-data",$N)};class ZN extends dN{constructor(){super(...arguments),this.type=ZN.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)===EB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}ZN.type="line";const JN=()=>{_E.registerMark(ZN.type,ZN),Xw(),ew(),XN(),qN(),CH(),_E.registerGraphicComponent("line",rg)};class QN extends eH{constructor(){super(...arguments),this.type=QN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}QN.type="symbol";const tV=()=>{_E.registerMark(QN.type,QN),Xw(),eM(),qN(),_E.registerGraphicComponent("symbol",Ug)};class eV extends Oj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function iV(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function sV(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function nV(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 rV(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 aV(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 oV(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 lV=t=>t.map(((t,e)=>({index:e,value:t}))),hV=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},cV=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=KM(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return lV(v)};class pV{constructor(t){this.id=SM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class gV extends pV{constructor(){super(gV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!OT(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(NP.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&iV(c)&&iV(d)))return;const u=sV(t,c),p=sV(e,d);if(!0===u.break&&!0===p.break)return;const{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(!rV(u,p))return}else if(0===_&&0===b){if(!rV(p,u))return}else if(y||A)if(y&&!A){if(!nV(u,p))return}else if(A&&!y){if(!nV(p,u))return}else{if(f===b)return;if(f>b){if(!aV(u,p))return}else if(!aV(p,u))return}else{if(0===f&&0===_){if(!oV(u,p))return}else if(0===b&&0===g&&!oV(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){KP(e.getOption().dataSet,"tickAlign",uV);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}gV.pluginType="component",gV.type="AxisSyncPlugin";const fV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function mV(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 vV(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 yV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const _V=t=>"band"===t||"ordinal"===t||"point"===t;function bV(t,e){return{id:t,label:t,value:e,rawValue:t}}function xV(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class SV extends aH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const AV=`${WE}_ARC_TRANSFORM_VALUE`,kV=`${WE}_ARC_RATIO`,CV=`${WE}_ARC_START_ANGLE`,wV=`${WE}_ARC_END_ANGLE`,MV=`${WE}_ARC_K`,TV=`${WE}_ARC_MIDDLE_ANGLE`,BV=`${WE}_ARC_QUADRANT`,EV=`${WE}_ARC_RADIAN`,PV=-Math.PI/2,OV=3*Math.PI/2,RV=.6,IV=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},DV=(t,e,i)=>{var s;const n=null!==(s="band"===e?YH("axisBand",i):"linear"===e?YH("axisLinear",i):{})&&void 0!==s?s:{},r=YH("angle"===t?"axisAngle":"axisRadius",i);return gE({},YH("axis",i),n,r)};function LV(t,e,i,s){switch(t){case n.cartesianBandAxis:return $j(Yj(i,["z"]),"band",e);case n.cartesianLinearAxis:return $j(Yj(i,["z"]),"linear",e);case n.cartesianLogAxis:return $j(Yj(i,["z"]),"log",e);case n.cartesianSymlogAxis:return $j(Yj(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return $j(Yj(i),void 0,e);case n.polarBandAxis:return DV(i.orient,"band",e);case n.polarLinearAxis:return DV(i.orient,"linear",e);case n.polarAxis:return DV(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=YH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>Wj(t.orient)));let g;g=u(p)?gE({},_V(p.type)?a:o,l):l;const f=r.find((t=>Uj(t.orient)));let m;return m=u(f)?gE({},IT(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=YH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?gE({},_V(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?gE({},IT(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return FV(i,YH(t,e));default:return YH(t,e)}}const FV=(t,e)=>{var i;const s=gE({},e,e[Xj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class zV extends cz{getTheme(t,e){return LV(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({},eE(e)),{[s]:0}))}}class HV extends pz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=zV,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof $a||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:VP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new SV(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;LH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=FH(t),s=zH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}LH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var jV,NV;HV.transformerConstructor=zV,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(jV||(jV={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(NV||(NV={}));class VV extends eH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=zH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?LH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(LH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=_E.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(HP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}VV.type="component";const WV=()=>{_E.registerMark(VV.type,VV)};var UV,GV;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(UV||(UV={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(GV||(GV={}));const YV={[GV.selectedReverse]:{},[GV.selected]:{},[GV.hover]:{},[GV.hoverReverse]:{}},XV=t=>t,KV={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class $V extends HV{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?jV.circleAxis:jV.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?NV.circleAxisGrid:NV.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:iz.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(this._syncComponentVisibility(),(null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=kj(null===(l=_E.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=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||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Pz(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&CT(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=y(a)?OT(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!OT(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return CT(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;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(NP.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=wT(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),CT(this._regions,(t=>{t.event.on(NP.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(NP.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):CT(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(CT(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;tV(null==e?void 0:e[i],null==t?void 0:t[i])||KV[i]))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=EP(s=e.domainLine)).startSymbol=EP(s.startSymbol),s.endSymbol=EP(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=H(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return RP(gE({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:RP(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RP(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=RP(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return RP(gE({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:RP(e.tick.style)),e.tick.state&&(i.tick.state=PP(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return RP(gE({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:RP(e.subTick.style)),e.subTick.state&&(i.subTick.state=PP(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=fV[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:gE({},u,RP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:RP(h.style)}),h.state&&(i.title.state.shape=PP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:RP(o.style)}),o.state&&(i.title.state.background=PP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=PP(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=RP(e.background.style)),e.background.state&&(i.panel.state=PP(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:NE(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return RP(gE({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:RP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:NE(t.subGrid.alternateColor),style:RP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=XH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){$P(this._option.dataSet,"scale",XV);const i=this.registerTicksTransform();return new Fa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===UV.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}$V.specKey="axes";const qV=()=>{WV(),_E.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},ZV=[gV];class JV extends $V{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=iz.Axis,this.layoutLevel=sz.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),CT(this._regions,(t=>{const e=this.getOrient();Wj(e)?xV(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Uj(e)?xV(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Gj(e)&&xV(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=gE({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(gE({x:e.x,y:e.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Wj(this.getOrient()),n=t=>{var e;return(s?!Wj(t.getOrient()):Wj(t.getOrient()))&&OT(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Yj(e,["z"]),Gj(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!yV(e))return null;const{axisType:t,componentName:s}=Kj(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=>Uj(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(!yV(t))return;const{axisType:s,componentName:n}=Kj(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=_E.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Wj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Gj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(ZV.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Wj(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!Wj(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Gj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Uj(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=JB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=JB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Wj(this.getOrient())?t.fieldX:Gj(this.getOrient())?t.fieldZ:t.fieldY,OT(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:OT(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(HP.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(Wj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Wj(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return CT(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]:Wj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Gj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();CT(this._regions,(e=>{Wj(t)?xV(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Uj(t)?xV(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Gj(t)&&xV(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Wj(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=Wj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=gE(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ne).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Wj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return bV(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:OT(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(NP.layoutEnd,this._updateAxisLayout),this.event.on(NP.layoutEnd,this._fixAxisOnZero),this.event.on(NP.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}JV.type=n.cartesianAxis,JV.specKey="axes";class QV{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Pz(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(NP.scaleDomainUpdate,{model:this}),this.event.emit(NP.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(n.push(r),o){const e=bV(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=>bV(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(NP.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const tW=(t,e,i,s)=>{const n=dV(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},eW=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,iW=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?lV([s[s.length-1]]):lV([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=X(g);if(s.length<=f/n){const i=tW(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=nW(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=tW(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!eW(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?iW(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function aW(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=pT(t,!!n),o=pT(r,!!n);const h=re.distancePP(s,l),c=re.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=rW(e,t,!1,!!n),o=rW(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=pT(t,!!n),o=pT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class oW extends IN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&hT(this._innerView),this.removeAllChild(!0),this._innerView=jM.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 cT(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?`${UV.grid}-sub`:`${UV.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=pT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=rW(t,o,!1,!!a)}const u=jM.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:oW.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=pT(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=jM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:oW.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}oW.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class lW{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=FM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return LM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class hW extends sb{onBind(){var t;const e=_L(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;LN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class cW extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;LN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function dW(){zC(),ew(),Gw(),hM(),M_.registerBuiltInAnimate("axisEnter",hW),M_.registerBuiltInAnimate("axisUpdate",cW)}zC(),hw();class uW extends oW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},oW.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NM,endAngle:r=VM}=this.attribute;i=uT(t,s,re.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function pW(){zC(),ew(),vw(),eM()}function gW(){zC(),ew(),pC(),eM()}U(uW,lW),pW();class fW extends IN{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fW.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=jM.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),E(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=jM.line;G(i)[0].cornerRadius&&(t=jM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=jM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:Z(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}fW.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}}},gW();class mW extends fW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fW.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=jM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function vW(){zC(),Ow(),eM(),Gw(),hM()}var yW=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nc&&(w=c,R.setAttribute("maxLineWidth",c-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=w,A&&A.setAttribute("x",(A.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):j>0&&S.setAttribute("x",b[3]):(k-=w/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const N="right"===_||"end"===_,V="left"===_||"start"===_,W=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:G(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=w-b[1]-b[3],e=I+B,i=1===j?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(V&&1!==j){const t=w-b[1]-b[3],e=0===j?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=w-b[1]-b[3],e=0===j?t/2+B/2:t;if(W(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-D/2),S.setAttribute("y",-b[2])):"top"===H&&(S.setAttribute("y",b[0]),A&&A.setAttribute("y",D/2)),E(null==m?void 0:m.text)||(R.states=m.text);const{visible:U}=a,Y=yW(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:M,x:k,y:C}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Sl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},_W.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}_W.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const bW=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(UM.hover,!0),CM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(UM.hoverReverse,!0)})),s):i},xW=(t,e,i)=>i?(CM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(UM.hoverReverse),t.removeState(UM.hover))})),null):i,SW=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(UM.selected)?(CM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(UM.selectedReverse),t.removeState(UM.selected))})),null):s.name&&!E(s.states)?(s.addState(UM.selected,!0),CM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(UM.selectedReverse,!0)})),s):i},AW={type:"default",duration:300,easing:"linear"};class kW extends DN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=bW(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=xW(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=SW(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=jM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),HN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,zN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(CM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=FN(this),{delay:a=0,duration:o=AW.duration,easing:l=AW.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};LN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=FN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},jN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&hT(this._innerView),this.removeAllChild(!0),this._innerView=jM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(AW)}_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=jM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=UV.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=jM.group({x:0,y:0,pickable:!1});t.name=UV.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=jM.group({x:0,y:0,pickable:!1});i.name=UV.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=jM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=UV.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=GM;else{const t=this.data[s],e=z({},GM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=jM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=UV.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=GM;else{const i=z({},GM,s.state);Object.keys(i).forEach((s=>{c(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=jM.group({x:0,y:0,pickable:!1});return r.name=`${UV.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=JM(this._getLabelAttribute(t,e,n,i));if(a.name=UV.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=GM;else{const s=z({},GM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new _W(Object.assign({},e));i.name=UV.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return cT(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&c(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=c(y)?z({},sT.label.style,y(t,e,i,s)):y;y=z(this.getLabelAlign(m,o,y.angle),y),c(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return c(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},CM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=I(r.attribute),a=I(e.attribute),o=qA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},LN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const CW={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&&gT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function wW(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function MW(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:CW[n]||CW.parity;if(s.length>=3&&fT(s,r)){do{s=a(s,r)}while(s.length>=3&&fT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);gT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),MW(l,s,n,(t=>gT(t,l,r))),MW(h,s,o,(t=>gT(t,h,r)||!(!n||t===l)&&gT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function BW(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},OW(t,e.attribute.angle)),{angle:PW(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({},RW(t,e.attribute.angle)),{angle:PW(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Ce({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function PW(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function OW(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=PW(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 RW(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=PW(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 IW(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=lT(h),m=oT(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function DW(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var LW=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=jM.group({zIndex:999});e.name=UV.axisBreak,e.id=this._getNodeId(`${UV.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},nT,s),a=null!==(e=r.size)&&void 0!==e?e:nT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=jM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=UV.axisBreakSymbol;const h=jM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=UV.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=jM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=UV.background,n.id=this._getNodeId("background"),n.states=z({},YV,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new _W(Object.assign({},t));e.name=UV.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=LW(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},YV,l),symbol:z({},YV,l)});const d=new fW(c);d.name=UV.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=LW(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),k=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let w,M,{angle:T}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(T)&&o){T=zM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else w=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(T&&0!==T){const t=Math.abs(Math.sin(T));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},k),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:M},a),state:{text:z({},YV,c.text),shape:z({},YV,c.shape),panel:z({},YV,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=LW(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=zM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return OW(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return RW(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=Y(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=ae(e)})),EW(i,t),!BW(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=lT(a),l=oT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=DW(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Yt(c,i))}}else{if(l){const i=DW(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Yt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);IW(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&TW(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=jM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=UV.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=$M(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}FW.defaultAttributes=sT,U(FW,lW);const zW={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},HW={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}}},jW={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}}},NW={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}}};class VW extends JV{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new eB}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,sW),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=YT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),p=e=>{const i=t===n?a:0;if(d(r)||t{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),qV(),_E.registerComponent(VW.type,VW,!1)},UW=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function GW(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,XW=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function KW(t,e,i="count"){const s=XW(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const $W=Math.sqrt(50),qW=Math.sqrt(10),ZW=Math.sqrt(2);class JW{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=vV(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=Wj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!c(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(Y(e)-e[0]);i<=1||A(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(YW),e.sort(YW),{domain:GW(t,e),scope:KW(t,e,i)}}(r,cM(t),this._spec.breaks[0].scopeType);e=cM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=vV(this._spec);if(u(e)||u(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=$W?10:n>=qW?5:n>=ZW?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(NP.scaleDomainUpdate,{model:this}),this.event.emit(NP.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(NP.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function QW(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function tU(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!OT(t.type))return lV(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return lV([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(u(h))m=QW(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=QW(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=QW(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=dV(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=dV(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?iU.greedy:iU.parity;for(;l.length>=3&&fT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;gT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),tU(t,l,a,(e=>gT(e,t,i))),tU(n,l,o,(e=>gT(e,n,i)||!(!a||e===t)&&gT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return lV(m)},iU={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&gT(i,t,e)||(i=t,0))))}},sU={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class nU extends JV{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new SB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Gj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Wj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=qB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=cM(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,eU),t}}nU.type=n.cartesianLinearAxis,nU.specKey="axes",nU.builtInTheme={axis:HW,axisLinear:sU,axisX:jW,axisY:NW},U(nU,JW);const rU=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),qV(),_E.registerComponent(nU.type,nU)},aU=`${WE}_hide_`;function oU(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const lU=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[aU]&&(oU(t,!0),t[aU]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[aU]=!0,oU(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},hU=()=>{_E.registerGrammarTransform("symbolOverlap",{transform:lU,runType:"afterEncode"})},cU={min:K,max:X,average:bT,sum:_T};function dU(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function uU(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 pU(t,e,i,s){return uU(t,e,i,"min",s)}function gU(t,e,i,s){return uU(t,e,i,"max",s)}function fU(t,e,i,s){return uU(t,e,i,"average",s)}function mU(t,e,i,s){return uU(t,e,i,"sum",s)}const vU=(t,e)=>{let i=c(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=dU;if("min"===n?l=pU:"max"===n?l=gU:"average"===n?l=fU:"sum"===n&&(l=mU),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[]},yU=()=>{_E.registerGrammarTransform("dataSampling",{transform:vU})};class _U extends Vj{constructor(){super(...arguments),this.type=EB.line,this.transformerConstructor=eV,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),aN)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(kj(null===(i=_E.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),Cj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Nj(this);this._symbolMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Cj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}_U.type=EB.line,_U.mark=lN,_U.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},_U.transformerConstructor=eV,U(_U,oN);class bU{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{rO(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Fa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];pM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];pM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class xU{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)=>{kM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{mP(e,[{key:t,operations:OT(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&&mP(e,[{key:i.field,operations:OT(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?GB("colorOrdinal"):GB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(kM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),kM(s.domain)?e.reRender=!0:V(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(!kM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=OT(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=OT(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;OT(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(OT(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=OT(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)));OT(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class SU{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Jz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Qz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Qz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Jz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&Jz(t,i,!0,l):a&&Jz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&Jz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Qz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Qz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const AU={[n.markPoint]:!0,[n.markLine]:!0,[n.markArea]:!0},kU={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class CU extends hz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=SM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:UE,height:GE},this._viewRect={width:UE,height:GE},this._viewBox={x1:0,y1:0,x2:UE,y2:GE},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>u(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(kU).some((t=>!d(e[t])))},this._paddingSpec=eE(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new zP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new bU(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new SU;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=_E.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(kj({},Cj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=_E.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:iz.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=_E.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(NP.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(NP.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(NP.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof dz)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 eH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof eH)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&rO(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=XF(this._spec,this._option,{width:UE,height:GE})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DB(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new xU(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){ZF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DB(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=eE(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{ZF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},r={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===n.label||l.type===n.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));r[l.type]&&(r[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(y(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);qF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),ZF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);qF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),ZF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(r).forEach((e=>{if(r[e]){const i=this._spec[e];(y(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(AU[t]&&y(e)&&y(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return AU[t]&&y(e)&&e.length>0&&y(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!AU[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;AU[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];ZF(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=QB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(NP.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(az.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(az.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(az.STATE_SELECTED)}clearHovered(){this.clearState(az.STATE_HOVER)}_initEvent(){[NP.dataZoomChange,NP.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(HP.AFTER_MARK_RENDER_END,e)};this._event.on(HP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:LP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(DP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===nN.dimensionHover||s===nN.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>IT(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>IT(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const wU=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)},MU={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class TU{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},MU),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):dE(t,a,c.spec),dE(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=wU(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=wU(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(_E.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(_E.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=_E.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=_E.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=_E.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):KH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=KH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class BU extends TU{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&gE(i,JF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class EU extends BU{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),YF(t)}}const PU=(t,e)=>{const i={nodes:{}},{fields:s}=c(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=_P(t,!0);for(const e in o)for(const i in o[e].nodes)AP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)SP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&xP(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(NP.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class RU{_beforeInit(){this._dataSet&&KP(this._dataSet,"stackSplit",PU)}_initStack(){this._stack=new OU(this),this._stack.init()}}const IU={state:az.STATE_DIMENSION_HOVER,reverseState:az.STATE_DIMENSION_HOVER_REVERSE,trigger:nN.dimensionHover};class DU extends TH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},IU,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=LP(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}DU.type="dimension-hover",DU.defaultOptions=IU;const LU=()=>{_E.registerInteractionTrigger(DU.type,DU)},FU=()=>{_E.registerComposedEvent(nN.dimensionHover,sN),_E.registerComposedEvent(nN.dimensionClick,Zj)},zU=t=>t.fieldX[0],HU=t=>t.fieldY[0],jU=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},NU=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},VU=(t,e)=>t?e?zU:jU:e?HU:NU,WU=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=iN(t,(t=>Wj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=iN(t,(t=>Uj(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{IT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=UU(t,i,VU(e,IT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=UU(t,i,VU(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},UU=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:GU(t,s,i)},GU=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=tN(e,t,"cartesian",null!=i?i:Wj(t.getOrient())?zU:HU);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},YU=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(IT(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(OT(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=mV(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};KU(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&XU(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),XU=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=XH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},KU=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},$U=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=qU(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},qU=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},ZU=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return YU(c,r,e),c.xField.cacheInfo?$U(c.xField):c.yField.cacheInfo?$U(c.yField):void 0},JU=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],QU=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&JU.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(tG(s).every((t=>{var e;return!tj("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},tG=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},eG={dom:`${WE}_TOOLTIP_HANDLER_DOM`,canvas:`${WE}_TOOLTIP_HANDLER_CANVAS`},iG={key:"其他",value:"..."};var sG;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(sG||(sG={}));class nG{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(NP.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=QU(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},iG),t):iG;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&tj(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class rG extends nG{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!IT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const aG=()=>{_E.registerTooltipProcessor("dimension",rG)};class oG extends nG{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,vo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(LP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const lG=()=>{_E.registerTooltipProcessor("mark",oG)};class hG extends nG{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const cG=()=>{_E.registerTooltipProcessor("group",hG)};class dG extends CU{constructor(){super(...arguments),this.transformerConstructor=EU,this.type="line",this.seriesType=EB.line}_setModelOption(){this._modelOption.getDimensionInfo=WU,this._modelOption.getDimensionInfoByValue=GU,this._modelOption.getRectByDimensionData=ZU}}dG.type="line",dG.seriesType=EB.line,dG.transformerConstructor=EU,U(dG,RU);const uG=[...cN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class pG extends dN{constructor(){super(...arguments),this.type=pG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return uG}_getIgnoreAttributes(){return[]}}pG.type="area";const gG=()=>{_E.registerMark(pG.type,pG),Xw(),MC(),XN(),qN(),CH(),_E.registerGraphicComponent("area",Gp)};class fG extends nj{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),u(e))return e}return i}}}const mG=Object.assign(Object.assign(Object.assign({},mj),rN),{area:{name:"area",type:"area"}}),vG=()=>{_E.registerAnimation("area",AH),kH(),xH()};class yG extends eV{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||p&&!d)&&(g=h,f=l),l.style=gE({},f.style,g.style),l.state=gE({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function _G(){zC(),Ow()}function bG(){return"browser"===__.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const xG={debounce:xt,throttle:St};_G();let SG=class t extends IN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=bG(),a="browser"===__.env?__:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=vt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:xG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(XM,{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",xG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(yt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ai(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ai(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=vt(t[0],0,1),c=vt(t[1],0,1),d=vt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=bG(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};SG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class AG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ne).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=AG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(XM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new SG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),D.setAttribute("x",D.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),D.setAttribute("y",D.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}OG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class RG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,OG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new OG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,z(e,GF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class IG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class DG extends IG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class LG extends IG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function FG(t){t.isBound(RG)||(t.bind(RG).toSelf().inSingletonScope(),t.bind(a_).toService(RG)),t.isBound(DG)||(t.bind(DG).toSelf(),t.bind(xv).toService(DG)),t.isBound(LG)||(t.bind(LG).toSelf(),t.bind(xv).toService(LG))}class zG extends IN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zC(),ew();class HG extends zG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HG.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})}}HG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zC(),Ow();class jG extends zG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jG.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})}}jG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zC(),pC();class NG extends zG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}NG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zC(),pC();class VG extends zG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},VG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NM,endAngle:s=VM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}VG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zC(),hw();class WG extends zG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},WG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=he(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}WG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class UG{isInValidValue(t){const{startAngle:e=NM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return dT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function GG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=GG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var KG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=uT(n,l,c,e,i);h=jM.path(Object.assign(Object.assign({},a.style),{path:pT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=jM.circle(t)}h.name=UV.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},YV,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=KG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;d(_)&&(_=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:y,textAlign:"center"},l),state:{text:z({},YV,u.text),shape:z({},YV,u.shape),panel:z({},YV,u.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=GG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&YG(e,c,i)}else e.AABBBounds.width()>r&&YG(e,r,i)}else o>a.x&&h.x2>n.x2?(YG(e,n.x2-o,i),r&&XG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}$G.defaultAttributes=sT,U($G,UG);const qG=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=cT(r,dT(s,r,e,n));return o=a,l=dT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(pt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return lV(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=qG(t,i,e),r=K(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=JG(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return lV(d)},JG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&hV(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var QG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=ge(h.endAngle-d/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new iY(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):kN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=kN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=kN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(ft(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=kN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?kN(t.quadrant)?"left":"right":kN(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(kN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(pt(l/2,u))g=0,f=1,m=-p;else if(pt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),HN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,zN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}rY.defaultAttributes={pickable:!1};var aY,oY,lY,hY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(cY,UG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(aY||(aY={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(oY||(oY={})),function(t){t.dataZoomChange="dataZoomChange"}(lY||(lY={}));const dY="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",uY={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:dY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:dY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},pY={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}},gY=0,fY=1,mY=2,vY=3,yY=4,_Y=5,bY=5,xY=999,SY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var AY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:mY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:mY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:gY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,w;const{orient:M,middleHandlerStyle:T={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:O,end:R}=this._getState(),{position:I,width:D,height:L}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(T.visible){const t=(null===(i=T.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+O*D,y:I.y-t,width:(R-O)*D,height:t,zIndex:_Y},null===(s=T.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=T.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(O+R)/2*D,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=T.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:_Y},T.icon),{pickable:!P&&(null===(h=T.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*D,y:I.y+L/2,size:L,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},pY.horizontal),{zIndex:_Y}),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*D,y:I.y+L/2,size:L,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},pY.horizontal),{zIndex:_Y}),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+O*D-t/2,y:I.y+L/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:xY},pY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+R*D-g/2,y:I.y+L/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:xY},pY.horizontal),{pickable:!P}),"rect")}else{if(T.visible){const t=(null===(g=T.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+D,y:I.y+O*L,width:t,height:(R-O)*L,zIndex:_Y},null===(f=T.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=T.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+D+t/2,y:I.y+(O+R)/2*L,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=T.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:_Y},T.icon),{pickable:!P&&(null===(S=null===(x=T.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+O*L,size:D,symbolType:null!==(A=B.symbolType)&&void 0!==A?A:"square"},pY.vertical),{zIndex:_Y}),B),{pickable:!P&&(null===(k=B.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+R*L,size:D,symbolType:null!==(C=E.symbolType)&&void 0!==C?C:"square",zIndex:_Y},pY.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+D/2+t/2,y:I.y+O*L-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:xY},pY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+D/2+i/2,y:I.y+R*L-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:xY},pY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:vY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:vY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:fY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:yY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return $A(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ne).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=AY(c,["formatMethod"]),{formatMethod:g}=d,f=AY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,w,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},w={textAlign:SY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:SY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:SY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:SY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:bY}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:bY}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new _W(e),s.name=i,t.add(s)),s}}const CY={debounce:xt,throttle:St};class wY extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=aY.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=aY.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=aY.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=aY.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=aY.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===__.env?__:this.stage,s=bG();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===aY.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===aY.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===aY.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===aY.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(oY.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(oY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(oY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===aY.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(oY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(oY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:CY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===__.env?__:this.stage,e=bG();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:vt(e+t,0,1),end:vt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=aY.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}vW(),Ow(),eM(),MC(),ew();let MY=class t extends IN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new kY(this._getRendererAttrs()),this._interaction=new wY(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(oY.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(oY.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(lY.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(oY.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(lY.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var TY,BY,EY,PY;function OY(){zC(),vW(),gb()}MY.defaultAttributes=uY,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"}(TY||(TY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(BY||(BY={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(EY||(EY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(PY||(PY={}));class RY extends IN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=bW(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=xW(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=SW(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=jM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=jM.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=jM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),HN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,zN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=FN(this);this.markerAnimate("exit");const n=FN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},jN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function IY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function DY(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;LN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function LY(t,e,i,s){t&&(DY(t.startSymbol,e,i,s),IY(t).forEach((t=>DY(t,e,i,s))),DY(t.endSymbol,e,i,s))}function FY(t,e,i,s){t&&(DY(t.getTextShape(),e,i,s),DY(t.getBgRect(),e,i,s))}function zY(t,e,i,s){var n,r,a,o;t&&(LN(t,{fillOpacity:0,strokeOpacity:0},{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 HY(t,e,i,s){t&&(zY(t.startSymbol,e,i,s),IY(t).forEach((t=>zY(t,e,i,s))),zY(t.endSymbol,e,i,s))}function jY(t,e,i,s){t&&(zY(t.getTextShape(),e,i,s),zY(t.getBgRect(),e,i,s))}function NY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;DY(t.startSymbol,s,r,n);const h=IY(t);h.forEach((t=>LN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),DY(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;DY(t.getTextShape(),e,l,n),DY(t.getBgRect(),e,l,n)}))}function VY(t,e,i,s,n){LY(t,s,i,n),G(e).forEach((t=>{FY(t,s,i,n)}))}function WY(t,e,i,s,n){DY(t,s,i,n),G(e).forEach((t=>{FY(t,s,i,n)}))}function UY(t,e,i,s,n){DY(t,s,i,n),G(e).forEach((t=>{FY(t,s,i,n)}))}function GY(t,e,i,s,n,r){var a;LY(t,n,s,r),DY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?FY(i,n,s,r):DY(i,n,s,r)}function YY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;DY(t.startSymbol,n,o,r);const u=IY(t);u.forEach((t=>LN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),DY(e,n+o+l,h,r),DY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(DY(i.getTextShape(),n+o+l+h+c,d,r),DY(i.getBgRect(),n+o+l+c,d,r)):DY(i,n+o+l+c,d,r)}function XY(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?NY(t,e,s,r,a):"fadeIn"===i&&VY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?NY(t,e,s,n,a):"fadeIn"===i&&VY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){HY(t,s,i,n),G(e).forEach((t=>{jY(t,s,i,n)}))}(t,e,i,s,n)}}function KY(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&&WY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&WY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){zY(t,s,i,n),G(e).forEach((t=>{jY(t,s,i,n)}))}(t,e,i,s,n)}}function $Y(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&&UY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&UY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){zY(t,s,i,n),G(e).forEach((t=>{jY(t,s,i,n)}))}(t,e,i,s,n)}}function qY(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?GY(n,r,e,i,s,o):"callIn"===t&&YY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?GY(n,r,e,i,s,a):"callIn"===t&&YY(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;HY(t,n,s,r),zY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?jY(i,n,s,r):zY(i,n,s,r)}(n,r,e,t,i,s)}}const ZY={type:"clipIn",duration:500,easing:"linear",delay:0},JY={type:"fadeIn",duration:500,easing:"linear",delay:0},QY={type:"callIn",duration:500,easing:"linear",delay:0},tX={type:"fadeOut",duration:500,easing:"linear",delay:0};class eX{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new _W(Object.assign(Object.assign({},h),{state:{panel:z({},GM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},GM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},GM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},GM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class iX extends RY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=ZY,this.defaultExitAnimation=tX}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;iT(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(iX,eX);const sX=.001,nX={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:TY.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]}},rX={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"}}},aX={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:EY.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]}},oX={interactive:!0,label:{position:BY.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}},lX={interactive:!0,label:{autoRotate:!0,position:EY.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}},hX={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"}},cX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},dX={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 uX(){pX._animate=XY}OY(),pW(),gb();class pX extends iX{markerAnimate(t){pX._animate&&this._animationConfig&&pX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(MM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return TM(Math.abs(e),Math.PI/2,sX)||TM(Math.abs(e),3*Math.PI/2,sX)?BM(i,e,t):MM(e)?rX.postiveXAxis[t]:rX.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new fW({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},GM,null==a?void 0:a.line),startSymbol:z({},GM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},GM,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({},GM,null==a?void 0:a.line),startSymbol:z({},GM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},GM,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=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",pX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(pX.defaultAttributes.label)}}function gX(){fX._animate=KY}pX.defaultAttributes=nX,OY(),vw(),gb();class fX extends RY{markerAnimate(t){fX._animate&&this._animationConfig&&fX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=JY,this.defaultExitAnimation=tX}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},cX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;iT(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=jM.polygon(Object.assign({points:e},i));n.states=z({},GM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",fX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},GM,null==i?void 0:i.area)),this._updateMarkLabels(fX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}fX.defaultAttributes=oX,U(fX,eX),OY(),gW(),gb();class mX extends iX{markerAnimate(t){mX._animate&&this._animationConfig&&mX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case EY.arcInnerStart:l=n;case EY.arcOuterStart:l=n;break;case EY.arcInnerEnd:l=r;case EY.arcOuterEnd:l=r;break;case EY.center:case EY.arcInnerMiddle:case EY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return hX[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new mW({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},GM,null==o?void 0:o.line),startSymbol:z({},GM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},GM,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({},GM,null==o?void 0:o.line),startSymbol:z({},GM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},GM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",mX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(mX.defaultAttributes.label)}}mX.defaultAttributes=aX,OY(),pC(),gb();class vX extends RY{markerAnimate(t){vX._animate&&this._animationConfig&&vX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=JY,this.defaultExitAnimation=tX}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case EY.center:h=(s+n)/2,c=(r+a)/2;break;case EY.arcInnerStart:h=s,c=r;break;case EY.arcOuterStart:h=n,c=r;break;case EY.arcInnerEnd:h=s,c=a;break;case EY.arcOuterEnd:h=n,c=a;break;case EY.arcInnerMiddle:h=s,c=(r+a)/2;break;case EY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},hX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;iT(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=jM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},GM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",vX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},GM,null==o?void 0:o.area)),this._updateMarkLabels(vX.defaultAttributes.label)}isValidPoints(){return!0}}function yX(){_X._animate=qY}vX.defaultAttributes=lX,U(vX,eX),OY(),pW(),gW(),eM(),YC(),ew(),gb();class _X extends RY{markerAnimate(t){_X._animate&&this._animationConfig&&_X._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_X.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=QY,this.defaultExitAnimation=tX,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return TM(Math.abs(s),Math.PI/2,sX)||TM(Math.abs(s),3*Math.PI/2,sX)?BM(t,s,n):MM(s)?dX.postiveXAxis[n]:dX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=PY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},GM,null==p?void 0:p.textBackground),text:z({},GM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},GM,null==p?void 0:p.itemContent));const v=MM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=jM.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"text"===n?o=new _W(Object.assign(Object.assign({},i),{state:{panel:z({},GM,null==s?void 0:s.textBackground),text:z({},GM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=jM.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"image"===n?(o=jM.image(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},GM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=TM(c,0,sX)||TM(d,0,sX),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=tT(e-u,t-d),o=tT(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(TX.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(TX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===TX.focus||"focus"===o){const s=a.hasState(wX.focus);a.toggleState(wX.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[wX.unSelected,wX.unSelectedHover,wX.focus],t),this._setLegendItemState(e,wX.selected,t)})):(this._setLegendItemState(a,wX.selected,t),this._removeLegendItemState(a,[wX.unSelected,wX.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[wX.selected,wX.selectedHover,wX.focus],t),this._setLegendItemState(e,wX.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(wX.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(wX.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(MX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[wX.selected,wX.selectedHover],t),this._setLegendItemState(a,wX.unSelected,t)):(this._setLegendItemState(a,wX.selected,t),this._removeLegendItemState(a,[wX.unSelected,wX.unSelectedHover],t))}else this._setLegendItemState(a,wX.selected,t),this._removeLegendItemState(a,[wX.unSelected,wX.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[wX.selected,wX.selectedHover],t),this._setLegendItemState(e,wX.unSelected,t))}))}this._dispatchLegendEvent(MX.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,wX.selected),this._removeLegendItemState(e,[wX.unSelected,wX.unSelectedHover])):(this._removeLegendItemState(e,[wX.selected,wX.selectedHover]),this._setLegendItemState(e,wX.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=AX,spaceRow:l=kX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,w=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=w+l,w=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,w=Math.max(w,m),M.push(i)):(u(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=jM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=K(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:p,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:_,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),C=this._handleStyle(x,t,e,i,s),w=ai(c);let M;!1===x.visible?(M=jM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,TX.item,t,M)):(M=jM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,TX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?wX.selected:wX.unSelected);const T=jM.group({x:0,y:0,pickable:!1});M.add(T);let B,E=0,O=0,R=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);O=y(i)?i[0]||0:i,R=P(v,"space",8);const s=jM.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,TX.itemShape,t,M,S.state),s.addState(e?wX.selected:wX.unSelected),T.add(s)}let I=0;if(p){const e=P(g,"size",10);B=jM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,TX.focus,t,M),I=e}const D=_.formatMethod?_.formatMethod(o,t,i):o,L=JM(Object.assign(Object.assign({x:O/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:D,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(L,TX.itemLabel,t,M,A.state),L.addState(e?wX.selected:wX.unSelected),T.add(L);const F=P(_,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=JM(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,TX.itemValue,t,M,k.state),r.addState(e?wX.selected:wX.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-O-R-F-I-s;this._autoEllipsis(m,t,L,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2))}else r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),T.add(r)}else this._itemWidthByUser?(L.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-O-R-I),E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2)):E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2);B&&(B.setAttribute("x",E),T.add(B));const z=T.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;T.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=z.height(),N=u(this.attribute.item.width)?this.attribute.item.width:H+w[1]+w[3],V=this._itemHeightByUser||j+w[0]+w[2];return M.setAttributes({width:N,height:V}),B&&B.setAttribute("visible",!1),T.translateTo(-z.x1+w[3],-z.y1+w[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new SX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new SX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new SG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new SG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=AX,spaceRow:o=kX}=n,l=this._itemsContainer,{space:h=CX,defaultCurrent:c=1}=r,d=OX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=jM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=AX,spaceRow:a=kX}=s,o=this._itemsContainer,{space:l=CX,defaultCurrent:h=1}=n,c=OX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=jM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=jM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(wX.selected)?this._setLegendItemState(t,wX.selectedHover,e):this._setLegendItemState(t,wX.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===TX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(MX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(wX.unSelectedHover)||t.hasState(wX.selectedHover))&&(i=!0),t.removeState(wX.unSelectedHover),t.removeState(wX.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(wX.unSelectedHover)&&!t.hasState(wX.selectedHover)||(i=!0),t.removeState(wX.unSelectedHover),t.removeState(wX.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===TX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(MX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(MX.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!==TX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(MX.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!==TX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(MX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(wX.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},RX,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(wX.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var DX;function LX(t){return y(t)?t:[t,t]}function FX(t){return t?"ew-resize":"ns-resize"}IX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:AX,spaceRow:kX,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:CX,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"}(DX||(DX={})),EX();class zX extends IN{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({},zX.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=bG(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=bG(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(u(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=G(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:LX(p)[0],endValue:LX(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=jM.group({x:0,y:0});f.name=DX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=jM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=DX.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=jM.group({x:g?v:0,y:g?0:v});f.add(y);const _=jM.group({x:0,y:0});let b;if(_.name=DX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=jM.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=DX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=jM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=DX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=LX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":FX(p)},r));if(v.name=DX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=DX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":FX(p)},r));if(i.name=DX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=DX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=yt(h,i,s);c=t[0],u=t[1]}else c=i,u=vt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=jM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=DX.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":FX(g);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(u,e?"end":"start"),b=jM.rect(Object.assign({x:g?Math.min(y,_):0,y:g?0:Math.min(y,_),width:g?Math.abs(_-y):r,height:g?n:Math.abs(_-y),cursor:v},a));b.name=DX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return jM.symbol(t)}_renderHandlerText(t,e){return jM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return c(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":FX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=jM.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=jM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=bG(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===DX.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===DX.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===DX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===DX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}zX.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}}},PX(),EX();class HX extends BX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 jX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}HX.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"}}},PX(),EX(),hw();class NX extends BX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NX.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=jM.group({x:0,y:0});this._innerView.add(x);const S=new zX({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:jX(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 C=jM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}NX.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)"}},zC(),hM(),Gw();let VX=class t extends IN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:w,subtextStyle:M={},width:T,height:B,minWidth:E,maxWidth:P,minHeight:O,maxHeight:R,align:I,verticalAlign:D,padding:L=0}=this.attribute,F=ai(L),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||u(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:T)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},YM),C),x:h,y:c,width:null!==(s=null!=t?t:T)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:T,heightLimit:null!==(a=C.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,R-j);if("rich"===k||u(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:T)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:w},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:w},YM),M),x:n,y:r,width:null!==(c=null!=t?t:T)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(w)?w:[w],whiteSpace:"normal"},M),{maxLineWidth:null!==(p=M.maxLineWidth)&&void 0!==p?p:T,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const V=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(N,W),G=j+(null!==(f=M.height)&&void 0!==f?f:V);if(u(T)&&(U=T),u(B)&&(G=B),u(E)&&UP&&(U=P),u(O)&&GR&&(G=R),z.setAttributes({width:U,height:G,boundsPadding:F}),this._mainTitle){if(u(I)||u(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:U;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:D,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(_=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==_?_:U;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:D,e=this._mainTitle?u(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};VX.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 WX={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"}}};zC(),hM(),Gw();let UX=class extends IN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(WX,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=JM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const p=$M(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",u(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;A(_)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",u(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class GX extends Wg{constructor(t){super(t)}}var YX,XX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(YX||(YX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(XX||(XX={}));class KX extends IN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KX.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"},KX.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"},KX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},KX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},KX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{d(this._playController)&&(this._playController=new GX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new GX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new GX(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(YX.OnPlay)},this.pause=()=>{this._dispatchEvent(YX.OnPause)},this.forward=()=>{this._dispatchEvent(YX.OnForward)},this.backward=()=>{this._dispatchEvent(YX.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()}}KX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},KX.defaultAttributes={[XX.Start]:{},[XX.Pause]:{},[XX.Backward]:{},[XX.Forward]:{}};const $X={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},qX=[200,10];var ZX,JX;!function(t){t.Default="default",t.Reverse="reverse"}(ZX||(ZX={})),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"}(JX||(JX={}));const QX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===ZX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===ZX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),tK=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===ZX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===ZX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),eK=t=>"top"===t||"bottom"===t;class iK extends IN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},iK.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(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(eK(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:qX[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:qX[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 zX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=eK(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new KX(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=eK(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:qX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(eK(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:eK(this._orient)?t+s:(this._size.width-r)/2,y:eK(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:eK(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:eK(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:eK(this._orient)?t+s:(this._size.width-r)/2,y:eK(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function sK(){EX(),zC(),eM()}iK.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({},$X),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},$X),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},$X),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},$X),{key:"backward",position:"start"})}},sK();class nK extends iK{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:ZX.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(YX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(YX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(YX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(YX.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(JX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(QX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||tK({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===ZX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(JX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=__.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(JX.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(JX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=__.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(),__.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(JX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(JX.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(JX.change),this.dispatchCustomEvent(JX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var rK,aK=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())}))};sK();class oK extends iK{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(YX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(YX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(YX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(YX.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(JX.change))},this.play=()=>aK(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(JX.play),this._rafId=__.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=__.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(JX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(JX.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(JX.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(JX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(rK||(rK={}));const lK={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},hK=5;const cK={debounce:xt,throttle:St};zC(),vw();let dK=class t extends IN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=lK.updateTrigger,endTrigger:i=lK.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(G(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:cK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(rK.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=lK.trigger,resetTrigger:i=lK.resetTrigger}=this.attribute;G(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),G(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(rK.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(rK.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=hK}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(rK.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(rK.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(rK.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=hK}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(rK.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(rK.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),G(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=lK.updateTrigger,endTrigger:s=lK.endTrigger}=this.attribute;G(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),G(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=jM.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};dK.defaultAttributes=lK;const uK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},pK=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},gK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},fK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zC(),Ow(),eM(),hM(),Gw();let mK=class t extends IN{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=ai(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:wM(p)&&wM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:wM(p)&&wM(p.value)},pK(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:wM(p)&&wM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:wM(p)&&wM(p.value)},pK(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},YM),p.value),visible:wM(p)&&wM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=wM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const y=wM(p)?p.height+p.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!wM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let p="right"===c?(o?d:0)+(wM(n.key)?r+n.key.spacing:0)+(wM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(QM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:wM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),QM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(wM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=kh(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(wM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},pK(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},pK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(wM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},pK(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},pK(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=>fK.includes(t)))?(this._mergeAttributes(e,s),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&wM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=wM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=KM(d),y=KM(u);let _=0;if(wM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(wM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return uK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return uK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};mK.defaultAttributes=gK;class vK extends nU{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),CT(this._regions,(t=>{Wj(this.getOrient())?xV(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):xV(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=gE({},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 Fa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Pz(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=vi.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=>bV(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=>bV(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,eU),t}transformScaleDomain(){}}vK.type=n.cartesianTimeAxis,vK.specKey="axes",vK.builtInTheme={axis:HW,axisX:jW,axisY:NW};const yK=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),qV(),_E.registerComponent(vK.type,vK)};class _K extends nU{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new wB}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,eU),t}transformScaleDomain(){}}_K.type=n.cartesianLogAxis,_K.specKey="axes",_K.builtInTheme={axis:HW,axisLinear:sU,axisX:jW,axisY:NW},U(_K,JW);const bK=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),qV(),_E.registerComponent(_K.type,_K)};class xK extends nU{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new MB}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,eU),t}transformScaleDomain(){}}xK.type=n.cartesianSymlogAxis,xK.specKey="axes",xK.builtInTheme={axis:HW,axisLinear:sU,axisX:jW,axisY:NW},U(xK,JW);const SK=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),qV(),_E.registerComponent(xK.type,xK)};class AK extends Vj{constructor(){super(...arguments),this.type=EB.area,this.transformerConstructor=yG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),aN)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(AK.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===jH?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return YB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",nz.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return YB(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",nz.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[QE]},"normal",nz.Series),this.setMarkStyle(o,{curveType:a},"normal",nz.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(kj(null===(e=_E.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),Cj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(kj(null===(i=_E.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),Cj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Nj(this);this._symbolMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Cj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new fG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}AK.type=EB.area,AK.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},AK.mark=mG,AK.transformerConstructor=yG,U(AK,oN);class kK extends BU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),YF(t)}}class CK extends CU{constructor(){super(...arguments),this.transformerConstructor=kK,this.type="area",this.seriesType=EB.area}_setModelOption(){this._modelOption.getDimensionInfo=WU,this._modelOption.getDimensionInfoByValue=GU,this._modelOption.getRectByDimensionData=ZU}}CK.type="area",CK.seriesType=EB.area,CK.transformerConstructor=kK,U(CK,RU);function wK(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 MK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:wK(t,e)}),TK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:wK(t,e)}),BK={type:"fadeIn"},EK={type:"growCenterIn"};function PK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return BK;case"scaleIn":return EK;default:return MK(t)}}class OK extends eH{constructor(){super(...arguments),this.type=OK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}OK.type="rect";const RK=()=>{Xw(),Ow(),UN("rect",tY),_E.registerMark(OK.type,OK),M_.registerBuiltInAnimate("growHeightIn",jD),M_.registerBuiltInAnimate("growHeightOut",ND),M_.registerBuiltInAnimate("growWidthIn",sL),M_.registerBuiltInAnimate("growWidthOut",nL),M_.registerBuiltInAnimate("growCenterIn",FD),M_.registerBuiltInAnimate("growCenterOut",zD),_E.registerGraphicComponent("rect",fg)},IK=Object.assign(Object.assign({},mj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function DK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=sE(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):YB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[yj]):YB(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=YB(this._dataToPosX(t),e,i),n=YB(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[_j]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):YB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[bj]):YB(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=YB(this._dataToPosY(t),e,i),n=YB(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),zK)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},HK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:Tj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(HK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",nz.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===n.cartesianBandAxis));let r;if(KP(this._option.dataSet,"addVChartProperty",ZH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};KP(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Fa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:uj.bind(this),call:pj}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new Pz(this._option,r)}init(t){super.init(t),this.initRectMarkStyle()}_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=bj,s=_j,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=yj,s=vj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=_P(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)DK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=YB(this[r](t),l,i),u=YB(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!XB(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",nz.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",nz.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&d(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,d=!1,p=1/0,g=-1/0;i.values.forEach((e=>{const i=e[JE],n=e[QE],r=e[tP],c=e[eP];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?_j:vj],i=e[a?bj:yj];l=Math.min(l,t,i),h=Math.max(h,t,i)}u(r)&&u(c)&&(d=!0,p=Math.min(p,r,c),g=Math.max(g,r,c))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[JE]:s,[QE]:o}),d?{[tP]:p,[eP]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(fg(Object.assign(Object.assign({},m),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>YB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",nz.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",nz.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>YB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",nz.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",nz.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",nz.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",nz.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Nj(this);this._barMark.setAnimationConfig(kj(null===(e=_E.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),Cj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=sE(this._spec.barWidth,a)),l&&(c=Math.max(c,sE(this._spec.barMinWidth,a))),h&&(c=Math.min(c,sE(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=sE(null!==(l=i[r-1])&&void 0!==l?l:Y(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 _=OT(g.type||"band");return p(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}HK.type=EB.bar,HK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},HK.mark=IK,HK.transformerConstructor=FK;const jK=()=>{yU(),RK(),_E.registerAnimation("bar",((t,e)=>({appear:PK(t,e),enter:MK(t,!1),exit:TK(t,!1),disappear:{duration:yH.disappear.duration}}))),WW(),rU(),_E.registerSeries(HK.type,HK)};class NK extends BU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),YF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=p(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class VK extends CU{constructor(){super(...arguments),this.transformerConstructor=NK,this.type="bar",this.seriesType=EB.bar}_setModelOption(){this._modelOption.getDimensionInfo=WU,this._modelOption.getDimensionInfoByValue=GU,this._modelOption.getRectByDimensionData=ZU}}VK.type="bar",VK.seriesType=EB.bar,VK.transformerConstructor=NK,U(VK,RU);const WK=[10,20],UK=ET.Linear,GK="circle",YK=ET.Ordinal,XK=["circle","square","triangle","diamond","star"],KK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},$K=Object.assign(Object.assign({},mj),{point:{name:"point",type:"symbol"}});class qK extends Oj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const ZK={sizeField:!0};class JK extends Vj{constructor(){super(...arguments),this.type=EB.scatter,this.transformerConstructor=qK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),ZK)})}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(c(e))return e;if(y(e)){if(d(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${WE}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${WE}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:UK,defaultRange:WK},"size")}getShapeAttribute(t,e){return d(e)?GK:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:YK,defaultRange:XK},"shape")}initMark(){this._symbolMark=this._createMark(JK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Tj(this._spec,JK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Nj(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(kj(null===(i=_E.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),Cj("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:GK},az.STATE_NORMAL,nz.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},az.STATE_NORMAL,nz.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},az.STATE_NORMAL,nz.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",nz.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",nz.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},az.STATE_NORMAL,nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},az.STATE_NORMAL,nz.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ue});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}JK.type=EB.scatter,JK.mark=$K,JK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},JK.transformerConstructor=qK;const QK=()=>{tV(),_E.registerAnimation("scatter",((t,e)=>Object.assign({appear:KK(0,e)},_H))),WW(),rU(),_E.registerSeries(JK.type,JK)};class t$ extends BU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class e$ extends CU{constructor(){super(...arguments),this.transformerConstructor=t$,this.type="scatter",this.seriesType=EB.scatter}_setModelOption(){this._modelOption.getDimensionInfo=WU,this._modelOption.getDimensionInfoByValue=GU,this._modelOption.getRectByDimensionData=ZU}}e$.type="scatter",e$.seriesType=EB.scatter,e$.transformerConstructor=t$,U(e$,RU);const i$=()=>{aG(),lG(),FU(),LU(),QK(),_E.registerChart(e$.type,e$)};class s$ extends Hj{constructor(){super(...arguments),this.type=EB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return d(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${WE}_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 n$=(t,e)=>{const i=c(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[XE]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[fP]=a||r})),s};class r$ extends nj{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 a$ extends eH{constructor(){super(...arguments),this.type=a$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}a$.type="path";const o$=()=>{_E.registerMark(a$.type,a$),Xw(),hw(),_E.registerGraphicComponent("path",lg)},l$=Object.assign(Object.assign({},mj),{area:{name:"area",type:"path"}});class h${constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Na(i,e):Ha[i]?(za[i]||(za[i]=Na(i,Ha[i])),za[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class c${parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class d${constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function u$(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:c$}:_M(t)||bM(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:d$}:null}const p$={debounce:xt,throttle:St};class g${constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=_M(this._renderMode)||bM(this._renderMode),u$(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return u$(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:WP.chart,consume:!1}];l.on(...c,p$[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,p$[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||u$(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||u$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return d(r)&&d(a)?s:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:WP.chart,consume:!1}];l.on(...c,p$[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,p$[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){u$(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||u$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:WP.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:WP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||u$(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||u$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=p$[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=p$[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:WP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp)}))}}class f$ extends HV{constructor(){var t,e;super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=iz.Mark,this._projectionSpec={name:(t=this.type,e=this.id,`${WE}_${e}_${t}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:n.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=gE(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(NP.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new h$(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===EB.map||e.type===EB.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),CT(this._regions,(t=>{var e;if(t.type===EB.map||t.type===EB.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==EB.map&&e.type!==EB.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[fP],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}f$.type=n.geoCoordinate,U(f$,g$);const m$=()=>{_E.registerComponent(f$.type,f$)};class v$ extends Oj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class y$ extends s${constructor(){super(...arguments),this.type=EB.map,this.transformerConstructor=v$,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 !`),qP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),KP(this._dataSet,"copyDataView",iO),KP(this._dataSet,"map",n$),KP(this._dataSet,"lookup",$H);const i=qP.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Fa(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:aO.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:fP,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 Pz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(y$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:Tj(this._spec,y$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:$E])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:$E]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",nz.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",nz.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(kj(null===(t=_E.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),Cj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new r$(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[XE]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[XE],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(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 XE}getActiveMarks(){return[this._pathMark]}}y$.type=EB.map,y$.mark=l$,y$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},y$.transformerConstructor=v$;const _$=`${WE}_waterfall_default_seriesField`,b$=(t,e)=>{if(!t||0===t.length)return t;const i=c(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let d=Array.from(l[s]);"decrease"===a&&(d=d.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return d.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[aP]=!0:delete t[aP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===d.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=x$([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}=S$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>se(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=ie(y,e)):(t[c]=+_,_=ie(_,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,d,e,i,a),void o.push(s)}u=x$(r,t,s,o,u,d,e,i),o.push(s)})),o};function x$(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=S$(t,i,s,n,u);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(d(p)||p===_$)&&(t[_$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function S$(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?pM("total.collectCountField error"):n=e[a].start;o<0?pM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ie(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const A$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=c(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},k$={type:"fadeIn"},C$={type:"growCenterIn"};function w$(t,e){switch(e){case"fadeIn":return k$;case"scaleIn":return C$;default:return MK(t,!1)}}class M$ extends eH{constructor(){super(...arguments),this.type=M$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return rg(t)}}M$.type="rule";const T$=()=>{_E.registerMark(M$.type,M$),Xw(),ew(),_E.registerGraphicComponent("line",rg)},B$=Object.assign(Object.assign({},IK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),E$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:P$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function P$(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)=>P$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class O${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 Fa(e instanceof La?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),KP(e,"dimensionTree",E$),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 R$ extends FK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const I$={rect:j$,symbol:z$,arc:V$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=z$(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:W$,line:U$,area:U$,rect3d:j$,arc3d:V$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function D$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=I$[t])&&void 0!==i?i:I$.point;return e.series.type===EB.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=F$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:G$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function L$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==EB.sankey){const{formatFunc:t,args:n}=XH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function F$(t){return c(t)?e=>t(e.data):t}function z$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=F$(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:H$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function H$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function j$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=F$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:N$(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function N$(t){const e=[{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"]}}];return e}function V$(t){var e;const{labelSpec:i}=t,s=null!==(e=F$(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function W$(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=L$(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),Zg(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function U$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[$E]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function G$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const Y$={calculationMode:!0};class X$ extends HK{constructor(){super(...arguments),this.type=EB.waterfall,this.transformerConstructor=R$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&xP(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Y$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new O$(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],d(this._seriesField)&&(this._seriesField=_$)}getSeriesKeys(){return this._seriesField===_$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),KP(this._dataSet,"waterfallFillTotal",A$),KP(this._dataSet,"waterfall",b$),(d(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=sO(this.getViewData(),this._dataSet,{name:`${WE}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Pz(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:JE,endAs:QE,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Nj(this);this._barMark.setAnimationConfig(kj(null===(i=_E.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),Cj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Cj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(X$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return W$(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?YB(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):YB(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,y1:e=>this.totalPositionY(e,"index",this._getLeaderLineCategoryPos(!1,t))},"normal",nz.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,x1:e=>this.totalPositionX(e,"index",this._getLeaderLineCategoryPos(!1,t)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",nz.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&XB([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}X$.type=EB.waterfall,X$.mark=B$,X$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},X$.transformerConstructor=R$;const K$=()=>{T$(),RK(),_E.registerAnimation("waterfall",((t,e)=>({appear:w$(t,e),enter:MK(t,!1),exit:TK(t,!1),disappear:{duration:yH.disappear.duration}}))),SH(),WW(),rU(),_E.registerSeries(X$.type,X$)},$$=`${WE}_BOX_PLOT_OUTLIER_VALUE`;var q$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(q$||(q$={}));const Z$=(t,e)=>{const i=[],s=c(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=y(e)?e:[e];i.push(...s.map((e=>{const i={[$$]:e};return r.forEach((e=>{i[e]=t[e]})),u(a)&&(i[a]=t[a]),i})))})),i};class J$ extends nj{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===q$.OUTLIER)return this.series.getOutliersField();if(t===q$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case q$.MIN:return this.series.getMinField();case q$.MAX:return this.series.getMaxField();case q$.MEDIAN:return this.series.getMedianField();case q$.Q1:return this.series.getQ1Field();case q$.Q3:return this.series.getQ3Field();case q$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===q$.OUTLIER)return e[$$];if(t===q$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case q$.MIN:return e[this.series.getMinField()];case q$.MAX:return e[this.series.getMaxField()];case q$.MEDIAN:return e[this.series.getMedianField()];case q$.Q1:return e[this.series.getQ1Field()];case q$.Q3:return e[this.series.getQ3Field()];case q$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[$$])}getDefaultContentList(t){return[{key:this.getContentKey(q$.OUTLIER),value:this.getContentValue(q$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(q$.MAX),value:this.getContentValue(q$.MAX)},{key:this.getContentKey(q$.Q3),value:this.getContentValue(q$.Q3)},{key:this.getContentKey(q$.MEDIAN),value:this.getContentValue(q$.MEDIAN)},{key:this.getContentKey(q$.Q1),value:this.getContentValue(q$.Q1)},{key:this.getContentKey(q$.MIN),value:this.getContentValue(q$.MIN)},{key:this.getContentKey(q$.SERIES_FIELD),value:this.getContentValue(q$.SERIES_FIELD)}]}}const Q$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class tq extends eH{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==rz.enter&&t.context.diffState!==rz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{Q$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?z(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=qp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=_E.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const eq=()=>{_E.registerGraphicComponent("glyph",qp),Xw(),LC()},iq=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],sq=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class nq extends tq{constructor(){super(...arguments),this.type=nq.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=iq,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=sq,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}nq.type="boxPlot";const rq=Object.assign(Object.assign({},mj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),aq=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.from.min=o,f.to.min=c),A(d)&&(f.from.max=o,f.to.max=d),A(u)&&(f.from.q1=o,f.to.q1=u),A(p)&&(f.from.q3=o,f.to.q3=p),A(g)&&(f.from.median=o,f.to.median=g),f},oq=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.to.min=o,f.from.min=c),A(d)&&(f.to.max=o,f.from.max=d),A(u)&&(f.to.q1=o,f.from.q1=u),A(p)&&(f.to.q3=o,f.from.q3=p),A(g)&&(f.to.median=o,f.from.median=g),f},lq=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),hq=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,k,C;if(i&&A(i.center))return i.center;let w,M,T,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=lq(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=lq(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,T=null===(p=null===(u=null===(d=null===(c=lq(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=lq(t,"box").attribute.width,i=lq(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=lq(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=lq(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,T=null===(C=null===(k=null===(S=null===(x=lq(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===k?void 0:k[0])||void 0===C?void 0:C.y;const e=lq(t,"box").attribute.height,i=lq(t,"box").attribute.y;B=i,E=i+e}return A(w)?w:A(B)&&A(E)?(B+E)/2:A(M)&&A(T)?(M+T)/2:A(T)?T:A(M)?M:NaN},cq=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(A(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=lq(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=lq(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=lq(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=lq(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=lq(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=lq(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=lq(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=lq(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=lq(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=lq(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return A(v)?v:A(b)&&A(x)?(b+x)/2:A(y)&&A(_)?(y+_)/2:A(_)?_:A(y)?y:NaN};class dq extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return aq(hq)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class uq extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return oq(hq)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class pq extends dq{computeAttribute(){return aq(cq)(this.target,this.params,this.params.options)}}class gq extends uq{computeAttribute(){return oq(cq)(this.target,this.params,this.params.options)}}class fq extends Oj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const mq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class vq extends Vj{constructor(){super(...arguments),this.type=EB.boxPlot,this.transformerConstructor=fq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),mq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(vq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(vq.mark.outlier,{key:XE,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,az.STATE_NORMAL,nz.Series),this.setMarkStyle(a,s,az.STATE_NORMAL,nz.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},az.STATE_NORMAL,nz.Series),this.initBoxPlotMarkStyle()}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>YB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>YB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>YB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>YB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>YB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},az.STATE_NORMAL,nz.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>YB(t(this.getDatumPositionValues(e,$$),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>YB(t(this.getDatumPositionValues(e,$$),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,az.STATE_NORMAL,nz.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;KP(this._dataSet,"foldOutlierData",Z$),KP(this._dataSet,"addVChartProperty",ZH);const t=new Fa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${WE}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:uj.bind(this),call:pj}},!1),this._outlierData=new Pz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return u(this._spec.boxWidth)&&(r=sE(this._spec.boxWidth,n)),u(this._spec.boxMinWidth)&&(r=Math.max(r,sE(this._spec.boxMinWidth,n))),u(this._spec.boxMaxWidth)&&(r=Math.min(r,sE(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),p=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,p-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(p>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=sE(null!==(a=i[o-1])&&void 0!==a?a:Y(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=OT(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Nj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=_E.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(Cj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(kj(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(kj(null===(a=_E.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new J$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}vq.type=EB.boxPlot,vq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},vq.mark=rq,vq.transformerConstructor=fq;const yq=()=>{eq(),ew(),Ow(),_E.registerGraphicComponent("line",(t=>rg(t))),_E.registerGraphicComponent("rect",(t=>fg(t))),_E.registerMark(nq.type,nq),tV(),xH(),WW(),rU(),M_.registerBuiltInAnimate("boxplotScaleIn",dq),M_.registerBuiltInAnimate("boxplotScaleOut",uq),M_.registerBuiltInAnimate("barBoxplotScaleIn",pq),M_.registerBuiltInAnimate("barBoxplotScaleOut",gq),_E.registerSeries(vq.type,vq)};class _q extends eH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=_q.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Hg(t):Zg(t)}}_q.type="text";const bq=()=>{_E.registerMark(_q.type,_q),Xw(),hM(),Gw(),_E.registerGraphicComponent("text",Zg),_E.registerGraphicComponent("richtext",Hg)};class xq extends nj{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const Sq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),Aq={type:"fadeIn"},kq=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function Cq(t,e){return"fadeIn"===e?Aq:Sq(t)}const wq=Object.assign(Object.assign({},IK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class Mq extends FK{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 Tq extends HK{constructor(){super(...arguments),this.type=EB.rangeColumn,this._barMarkType="rect",this._barName=EB.bar,this.transformerConstructor=Mq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(Tq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Tj(this._spec,Tq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(Tq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(Tq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",nz.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Nj(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(kj(null===(i=_E.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),Cj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Cj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(kj(null===(n=_E.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),Cj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new xq(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)}}Tq.type=EB.rangeColumn,Tq.mark=wq,Tq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},Tq.transformerConstructor=Mq;const Bq=()=>{RK(),bq(),_E.registerAnimation("rangeColumn",((t,e)=>({appear:Cq(t,e),enter:Sq(t),exit:kq(t),disappear:{duration:yH.disappear.duration}}))),SH(),WW(),rU(),_E.registerSeries(Tq.type,Tq)};var Eq,Pq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(Eq||(Eq={})),function(t){t.middle="middle",t.start="start",t.end="end"}(Pq||(Pq={}));class Oq extends nj{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const Rq=Object.assign({},mG);class Iq extends AK{constructor(){super(...arguments),this.type=EB.rangeArea}initMark(){this._areaMark=this._createMark(Iq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",nz.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",nz.Series),this.setMarkStyle(t,{stroke:!1},"normal",nz.Series))}initTooltip(){this._tooltipHelper=new Oq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}Iq.type=EB.rangeArea,Iq.mark=Rq;class Dq extends Hj{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=RV,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};OT(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:[]};OT(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(NP.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)&&jj(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Lq(t){return AM(t)?Number.parseFloat(t):0}const Fq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&zq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[AV],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[AV]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},zq=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===Lq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Lq(i[e])),0)));function Hq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const jq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Hq(t,!0,oO.appear)}),Nq={type:"fadeIn"},Vq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Hq(t,!0,oO.enter)}),Wq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Hq(t,!0,oO.exit)});function Uq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Nq;case"growRadius":return jq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return jq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Gq extends eH{constructor(t,e){super(t,e),this.type=Yq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[TV])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Yq extends Gq{constructor(){super(...arguments),this.type=Yq.type}}Yq.type="arc";const Xq=()=>{Xw(),pC(),UN("arc",sY),M_.registerBuiltInAnimate("growRadiusIn",tL),M_.registerBuiltInAnimate("growRadiusOut",eL),M_.registerBuiltInAnimate("growAngleIn",DD),M_.registerBuiltInAnimate("growAngleOut",LD),_E.registerGraphicComponent("arc",Vp),_E.registerMark(Yq.type,Yq)},Kq=Object.assign(Object.assign({},mj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class $q extends Oj{_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=gE({},this._theme,i,t);const n=(t,e)=>gE({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const qq=`${WE}_LABEL_VISIBLE`,Zq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},Jq={outerRadius:!0};class Qq extends Dq{constructor(){super(...arguments),this.transformerConstructor=$q,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:JB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:JB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=PV,this._endAngle=OV,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[TV];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(u(this._spec.startAngle)?ae(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?ae(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;KP(this._dataSet,"pie",Fq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:CV,asEndAngle:wV,asRatio:kV,asMiddleAngle:TV,asRadian:EV,asQuadrant:BV,asK:MV,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Fa(this._dataSet,{name:`${WE}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Pz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Qq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:KE,groupKey:this._seriesField,isSeriesMark:!0},{morph:Tj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return TT(CV)(t)}endAngleScale(t){return TT(wV)(t)}_computeLayoutRadius(){return IV((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:KB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:KB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",nz.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",nz.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,nz.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",nz.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:TT(qq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(NP.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Jq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Zq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[TV];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===oO.appear)return this._startAngle;if(i===oO.disappear)return this._endAngle;const r=[oO.disappear,oO.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[XE];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[TV]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[TV]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[TV]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[TV]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=kj(null===(i=_E.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Qq.transformerConstructor=$q,Qq.mark=Kq,Qq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class tZ extends Qq{constructor(){super(...arguments),this.type=EB.pie}}tZ.type=EB.pie;const eZ=()=>{Xq(),_E.registerAnimation("pie",((t,e)=>({appear:Uq(t,e),enter:Vq(t),exit:Wq(t),disappear:{duration:yH.disappear.duration}}))),_E.registerAnimation("emptyCircle",((t,e)=>({appear:Uq(t,e)}))),_E.registerSeries(tZ.type,tZ)};function iZ(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const sZ=t=>({type:iZ(t.growField),options:{overall:!0}}),nZ={type:"fadeIn"},rZ=t=>({type:iZ(t.growField)}),aZ=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function oZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return nZ;case"growAngle":return sZ(Object.assign(Object.assign({},t),{growField:"angle"}));default:return sZ(Object.assign(Object.assign({},t),{growField:"radius"}))}}const lZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class hZ extends Dq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),lZ)})}getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(QE),this.setInnerRadiusField(JE)}setValueFieldToPercent(){this.setRadiusField(eP),this.setInnerRadiusField(tP)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const cZ=Object.assign(Object.assign({},mj),{rose:{name:"rose",type:"arc"}});class dZ extends Oj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class uZ extends $V{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=_E.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=iz.Axis,this._tick=void 0,this._center=null,this._startAngle=PV,this._endAngle=OV,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),CT(this._regions,(t=>{"radius"===this.getOrient()?xV(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):xV(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:JB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:JB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:mV(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){CT(this._regions,(t=>{"radius"===this.getOrient()?xV(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):xV(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return OT(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:OT(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>bV(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=re.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return IV((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=RV,e=0;const i=this.getChart().getSpec();return CT(this.getRegions(),(s=>{const n=s;if(r=n.type,[EB.rose,EB.radar,EB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(gE({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(gE({},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)}}uZ.type=n.polarAxis,uZ.specKey="axes";const pZ={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},gZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class fZ extends uZ{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new SB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,eU),t}}fZ.type=n.polarLinearAxis,fZ.specKey="axes",fZ.builtInTheme={axis:HW,axisLinear:sU,axisAngle:gZ,axisRadius:pZ},U(fZ,JW);const mZ=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),_E.registerGraphicComponent(jV.circleAxis,((t,e)=>new $G(t,e))),_E.registerGraphicComponent(NV.circleAxisGrid,((t,e)=>new cY(t,e))),qV(),_E.registerComponent(fZ.type,fZ)};class vZ extends uZ{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new eB}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,ZG),t}transformScaleDomain(){}}vZ.type=n.polarBandAxis,vZ.specKey="axes",vZ.builtInTheme={axis:HW,axisBand:zW,axisAngle:gZ,axisRadius:pZ},U(vZ,QV);const yZ=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),_E.registerGraphicComponent(jV.circleAxis,((t,e)=>new $G(t,e))),_E.registerGraphicComponent(NV.circleAxisGrid,((t,e)=>new cY(t,e))),qV(),_E.registerComponent(vZ.type,vZ)};class _Z extends hZ{constructor(){super(...arguments),this.type=EB.rose,this.transformerConstructor=dZ,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(_Z.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Tj(this._spec,_Z.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>YB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=YB(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(kj(null===(i=_E.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),Cj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}_Z.type=EB.rose,_Z.mark=cZ,_Z.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},_Z.transformerConstructor=dZ;const bZ=()=>{_E.registerSeries(_Z.type,_Z),Xq(),_E.registerAnimation("rose",((t,e)=>({appear:oZ(t,e),enter:rZ(t),exit:aZ(t),disappear:{duration:yH.disappear.duration}}))),yZ(),mZ()};class xZ extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,mT(this._fromAngle,this._toAngle)&&mT(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class SZ extends gH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!kT(t)&&!kT(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new ne(s,n,r,a);return o.defined=e.defined,o}}const AZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function kZ(t,e,i){return"fadeIn"===e?AZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function CZ(t,e,i){return"fadeIn"===e?AZ(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 wZ=(t,e)=>({custom:uH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),MZ=Object.assign(Object.assign(Object.assign({},mj),rN),{area:{name:"area",type:"area"}});class TZ extends hZ{constructor(){super(...arguments),this.type=EB.radar,this.transformerConstructor=eV,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(TZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:NH,closePath:!0},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:u(this._spec.startAngle)?ae(this._spec.startAngle):PV},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(kj(null===(s=_E.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),Cj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=_E.getAnimationInKey(e);t.setAnimationConfig(kj(null==i?void 0:i(n,r),Cj(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}}}TZ.type=EB.radar,TZ.mark=MZ,TZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},TZ.transformerConstructor=eV,U(TZ,oN);const BZ=()=>{_E.registerSeries(TZ.type,TZ),gG(),JN(),tV(),_E.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:kZ(t,e,"in"),enter:kZ(t,e,"in"),exit:kZ(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:yH.disappear.duration},update:[{channel:["points","center"],custom:SZ,customParameters:t,duration:yH.update.duration,easing:yH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),_E.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:CZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:yH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:xZ,customParameters:t,duration:yH.update.duration,easing:yH.update.easing}]}))),_E.registerAnimation("radarGroup",((t,e)=>({appear:wZ(t,"in"),disappear:{duration:yH.disappear.duration}}))),pC(),yZ(),mZ()};class EZ extends nj{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>vi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const PZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(WE)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[XE]:r,[KE]:`${s}_${e}`})),r++}))})),n},OZ={fill:"#bbb",fillOpacity:.2},RZ=Object.assign(Object.assign({},mj),{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"}}),IZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},DZ={grid:{background:!0}};class LZ extends Vj{constructor(){super(...arguments),this.type=EB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),IZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),DZ)})}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),KP(this._option.dataSet,"objFlat",PZ),KP(this._option.dataSet,"copyDataView",iO),$P(this._option.dataSet,"dataview",Ra),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:aO.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(gE(OZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(LZ.mark.group),this._containerMark=this._createMark(LZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(LZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(LZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(LZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(LZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(LZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(LZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",nz.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",nz.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",nz.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",nz.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",nz.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",nz.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",nz.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",nz.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",nz.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:$E}}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 WB).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:$E}}initTooltip(){this._tooltipHelper=new EZ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}LZ.type=EB.dot,LZ.mark=RZ,LZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class FZ extends nj{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>vi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const zZ=Object.assign(Object.assign({},mj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),HZ=(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 jZ extends Vj{constructor(){super(...arguments),this.type=EB.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),KP(this._option.dataSet,"linkDotInfo",HZ),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:aO.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(jZ.mark.group),this._containerMark=this._createMark(jZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(jZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(jZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",nz.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",nz.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",nz.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",nz.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:$E}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new FZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}jZ.type=EB.link,jZ.mark=zZ,jZ.builtInTheme={link:{arrow:{style:{size:10}}}};const NZ=Object.assign(Object.assign({},mj),{group:{name:"group",type:"group"}}),VZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class WZ extends Dq{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()?JE:uP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle);let o;if(u(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return d(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?QE:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),VZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=u(n)?ae(n):PV;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?ae(r):OV,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||u(null==s?void 0:s.startAngle)||u(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=YB(this.angleAxisHelper.dataToPosition([t[JE]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=YB(this.angleAxisHelper.dataToPosition([t[QE]]),this.angleAxisHelper.getScale(0));if(A(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?YB(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(WZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",nz.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[fg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const XZ=()=>{_E.registerAnimation("circularProgress",((t,e)=>({appear:YZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:yH.disappear.duration}})))};class KZ extends Oj{constructor(){super(...arguments),this._supportStack=!0}}const $Z={cornerRadius:!0,roundCap:!0};class qZ extends WZ{constructor(){super(...arguments),this.type=EB.circularProgress,this.transformerConstructor=KZ,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(A(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(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),$Z)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(qZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:Tj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",nz.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(qZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?JE:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?QE: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",nz.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(kj(null===(i=_E.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),Cj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Cj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}qZ.type=EB.circularProgress,qZ.mark=UZ,qZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},qZ.transformerConstructor=KZ;const ZZ=()=>{_E.registerSeries(qZ.type,qZ),Xq(),XZ(),SH(),yZ(),mZ()};function JZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const QZ={type:"fadeIn"};function tJ(t,e="grow"){return!1===e?{}:"fadeIn"===e?QZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:JZ(t)}))(t)}class eJ extends nj{enableByType(t){return"dimension"!==t}}const iJ=Object.assign(Object.assign({},mj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),sJ={bandWidth:!0,cornerRadius:!0,clamp:!0},nJ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class rJ extends Vj{constructor(){super(...arguments),this.type=EB.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),sJ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),nJ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(rJ.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return YB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?YB(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",nz.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return YB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?YB(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",nz.Series)}}_initTrackMark(){return this._trackMark=this._createMark(rJ.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",nz.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return YB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",nz.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(kj(null===(i=_E.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),Cj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Cj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new eJ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}rJ.type=EB.linearProgress,rJ.mark=iJ,rJ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const aJ=()=>{RK(),_E.registerAnimation("linearProgress",((t,e)=>({appear:tJ(t,e),enter:tJ(t),disappear:{duration:yH.disappear.duration}}))),SH(),_E.registerSeries(rJ.type,rJ)},oJ=[0],lJ=[20,40],hJ=[200,500],cJ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},dJ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class uJ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const pJ=`${WE}_WORD_CLOUD_TEXT`,gJ=Object.assign(Object.assign({},mj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),fJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class mJ extends Hj{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=lJ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:hJ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:oJ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?pJ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:cJ},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||yM(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:oJ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!dJ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new uJ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(mJ.mark.word,{key:KE,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(mJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:iz.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",nz.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",nz.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",nz.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(kj(_E.getAnimationInKey("wordCloud")(n,s),Cj("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 WB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:$E])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new SB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new SB).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[XE])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,NP.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:KE,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:__.createCanvas.bind(__),getTextBounds:pv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:ig,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}mJ.mark=gJ,mJ.builtInTheme={wordCloud:fJ};function vJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||yH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=yJ(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,Ct(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Ct(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},_J=(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=_J(t.children,e,t,n))})),s},bJ=(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=bJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},xJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):xJ(t.children,e,i)))})),e};function SJ(t,e){let i,s;if(CJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function CJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*w*T))/(2*w):T/M);return{x:s+S+A*B,y:n+k+C*B,radius:B}}function BJ(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 EJ(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 PJ(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 OJ(t){return{_:t,next:null,prev:null}}function RJ(t,e){const i=(t=G(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];BJ(n,s,r);let a,o,l,h,c,d,u,p=OJ(s),g=OJ(n),f=OJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=yJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:FJ.defaultOpionts.nodeSort;_J([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)_J([o],IJ(h)),bJ([o],DJ(this._getPadding,.5,a)),_J([o],LJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);_J([o],IJ(FJ.defaultOpionts.setRadius)),bJ([o],DJ(Ot,1,a)),d&&bJ([o],DJ(this._getPadding,o.radius/t,a)),_J([o],LJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}FJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const zJ=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=zJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function HJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){zJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:Ct(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Ct(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function jJ(t){return t.depth}function NJ(t,e){return e-1-t.endDepth}const VJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),WJ=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},UJ={left:jJ,right:NJ,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:jJ,end:NJ},GJ=_t(0,1);class YJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>VJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>VJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},YJ.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):UJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return HJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!d(r.source),l=!d(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&d(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[WJ(s[t.source]),WJ(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(v(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*GJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}d(this.options.nodeSortBy)&&n.sort(VJ),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(VJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];XJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),KJ);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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},$J.defaultOpionts,t):Object.assign({},$J.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,u=h?a.map((t=>Pt(t,n))):Pt(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Pt(r,n),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(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=yJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=he({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function qJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:XJ,slice:qJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?qJ:XJ)(t,e,i,s,n)}};class QJ{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({},QJ.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Et(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?ZJ(this.options.aspectRatio):null!==(e=JJ[this.options.splitType])&&void 0!==e?e:JJ.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=yJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function tQ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+di?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=tQ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ii(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=eQ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function lQ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*hQ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},dQ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||sQ,s=e.lossFunction||iQ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ui(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:cQ(f),arcs:f})}))},uQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:pQ,triangle:pQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function pQ(){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 gQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const fQ=t=>uQ[t]?uQ[t]():uQ.circle(),mQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function vQ(t){return c(t)?t:function(){return t}}class yQ{constructor(t){var e,i;switch(this.options=z({},yQ.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=fQ(this.options.shape),this.getText=null!==(e=vQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=vQ(this.options.fontWeight),this.getTextFontSize=vQ(this.options.fontSize),this.getTextFontStyle=vQ(this.options.fontStyle),this.getTextFontFamily=vQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>mQ(10,50);break;case"random-light":this.getTextColor=()=>mQ(50,90);break;default:this.getTextColor=vQ(this.options.color)}if(d(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=c(this.options.rotate)?t=>{var e;return ae(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():wt(e);return ae(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!d(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class bQ extends yQ{constructor(t){var e;super(z({},bQ.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<=bQ.defaultOptions.minFontSize&&(this.options.minFontSize=bQ.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=_Q[this.options.spiral])&&void 0!==e?e:_Q.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=vQ(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}=gQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(kQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(AQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}kQ(p,this._size)&&(p=CQ(p,this._size))}else if(kQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||SQ(p,i))&&(!i||!xQ(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 xQ(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 SQ(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,kQ=(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 CQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},MQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},TQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},BQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=gQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=fQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)TQ(n,MQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)TQ(n,MQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)TQ(n,MQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)TQ(n,MQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)TQ(n,MQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=MQ({x:l,y:h},o,-Math.PI/2,5),e=MQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);TQ(n,i)}else n.fillRect(0,0,i,s)}; +function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var y=t=>Array.isArray?Array.isArray(t):l(t,"Array");var _=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>x(t)&&Number.isFinite(t);var k=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var C=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 M=Object.prototype;var T=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||M)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(_(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(T(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&y(t[a])?F(t,a,n[a]):L(t,e,a,i,s)}}}}function L(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(_(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function j(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function V(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(j(t)!==j(e))return!1;if(c(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(!V(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function et(t){return Number(t)}function it(t,e,i=et){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&x(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(t=rt.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),it(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var vt=function(t,e,i){return ti?i:t};var yt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Ct(t){if(A(t))return t;const e=+t;return A(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const Mt=4294967296;const Tt=t=>e=>P(e,t),Bt=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Et=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Pt=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Ot=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Zt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class re{static distancePP(t,e){return Kt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Kt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function he(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ce(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ue(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ge(t){return(t=ue(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const be=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function xe(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ce({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?ae(t.angle):t.angle,s=we(t);return[Ce({x:t.x1,y:t.y1},i,s),Ce({x:t.x2,y:t.y1},i,s),Ce({x:t.x2,y:t.y2},i,s),Ce({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=Me(t,i),n=Me(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+Ht;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Ee(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Le{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const Fe=(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}},ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),He=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ne{}class We extends Ne{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ce({x:this.x1,y:this.y1},this.angle,t),Ce({x:this.x2,y:this.y1},this.angle,t),Ce({x:this.x1,y:this.y2},this.angle,t),Ce({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ue,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ue;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=oe(r.rotateDeg),r}}class Ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ye(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Xe(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 Ke=/^#([0-9a-f]{3,8})$/,$e={transparent:4294967040},qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return x(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Ke.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u($e[t]))return function(t){return x(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}($e[t]);if(u(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Xe(this.color.r,this.color.g,this.color.b),r=Ye(d(t)?n.h:vt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new si(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Xe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new si(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Xe});function ai(t){if(A(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(p(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const li=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function hi(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 ci(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const di=1e-10;function ui(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+di)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=mi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=pi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-di,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function pi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function gi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return pi(t,t-(i*i-e*e+t*t)/(2*i))+pi(e,s)}function fi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function mi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let _i;function bi(t,e){const i=yi(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 xi{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Si=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ai(t){let e;if(e=Si.exec(t))return new xi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const ki=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ci{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 Ci.instance||(Ci.instance=new Ci),Ci.instance}newFormat(t){const e=Ai(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"):wi[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=wi[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?ki[8+_i/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 C=S.length+k.length+A.length,w=C>1)+S+k+A+w.slice(C);break;default:k=w+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Ai(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=yi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=ki[8+n/3];return function(t){return s(r*t)+a}}}const wi={"%":(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)=>bi(100*t,e),r:bi,s:function(t,e){const i=yi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+yi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Pi(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Pi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ii(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Li(){return new Fi}function Fi(){this.reset()}Fi.prototype={constructor:Fi,reset:function(){this.s=this.t=0},add:function(t){Hi(zi,t,this.t),Hi(this,zi.s,this.s),this.s?this.t+=zi.t:this.s=zi.t},valueOf:function(){return this.s}};var zi=new Fi;function Hi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var ji=1e-6,Ni=Math.PI,Vi=Ni/2,Wi=Ni/4,Ui=2*Ni,Gi=180/Ni,Yi=Ni/180,Xi=Math.abs,Ki=Math.atan,$i=Math.atan2,qi=Math.cos,Zi=Math.exp,Ji=Math.log,Qi=Math.pow,ts=Math.sin,es=Math.sign||function(t){return t>0?1:t<0?-1:0},is=Math.sqrt,ss=Math.tan;function ns(t){return t>1?0:t<-1?Ni:Math.acos(t)}function rs(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function as(){}function os(t,e){t&&hs.hasOwnProperty(t.type)&&hs[t.type](t,e)}var ls={Feature:function(t,e){os(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sNi?t+Math.round(-t/Ui)*Ui:t,e]}function Ss(t,e,i){return(t%=Ui)?e||i?bs(ks(t),Cs(e,i)):ks(t):e||i?Cs(e,i):xs}function As(t){return function(e,i){return[(e+=t)>Ni?e-Ui:e<-Ni?e+Ui:e,i]}}function ks(t){var e=As(t);return e.invert=As(-t),e}function Cs(t,e){var i=qi(t),s=ts(t),n=qi(e),r=ts(e);function a(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),rs(c*n+l*r)]}return a.invert=function(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),rs(c*i-o*s)]},a}function ws(t,e){(e=gs(e))[0]-=t,_s(e);var i=ns(-e[1]);return((-e[2]<0?-i:i)+Ui-ji)%Ui}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:as,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Xi(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 Ps(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Fs(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 zs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Fs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=ts(s),r=[ts(i),-qi(i),0],a=0,o=0;Is.reset(),1===n?s=Vi+ji:-1===n&&(s=-Vi-ji);for(var l=0,h=t.length;l=0?1:-1,C=k*A,w=C>Ni,M=f*x;if(Is.add($i(M*k*ts(C),m*S+M*qi(C))),a+=w?A+k*Ui:A,w^p>=i^_>=i){var T=ms(gs(u),gs(y));_s(T);var B=ms(r,T);_s(B);var E=(w^A>=0?-1:1)*rs(B[2]);(s>E||s===E&&(T[0]||T[1]))&&(o+=w^A>=0?1:-1)}}return(a<-ji||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(Hs))}return u}}function Hs(t){return t.length>1}function js(t,e){return((t=t.x)[0]<0?t[1]-Vi-ji:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-ji:Vi-e[1])}1===(Os=Ls).length&&(Rs=Os,Os=function(t,e){return Ls(Rs(t),e)});var Ns=zs((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?Ni:-Ni,l=Xi(r-i);Xi(l-Ni)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ni&&(Xi(i-n)ji?Ki((ts(e)*(r=qi(s))*ts(i)-ts(s)*(n=qi(e))*ts(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*Vi,s.point(-Ni,n),s.point(0,n),s.point(Ni,n),s.point(Ni,0),s.point(Ni,-n),s.point(0,-n),s.point(-Ni,-n),s.point(-Ni,0),s.point(-Ni,n);else if(Xi(t[0]-e[0])>ji){var r=t[0]0,n=Xi(e)>ji;function r(t,i){return qi(t)*qi(i)>e}function a(t,i,s){var n=[1,0,0],r=ms(gs(t),gs(i)),a=fs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ms(n,r),u=ys(n,h);vs(u,ys(r,c));var p=d,g=fs(u,p),f=fs(p,p),m=g*g-f*(fs(u,u)-1);if(!(m<0)){var v=is(m),y=ys(p,(-g-v)/f);if(vs(y,u),y=ps(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Xi(y[0]-b)Ni^(b<=y[0]&&y[0]<=x)){var w=ys(p,(-g+v)/f);return vs(w,u),[y,ps(w)]}}}function o(e,i){var n=s?t:Ni-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return zs(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?Ni:-Ni),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=qi(e),o=ts(e),l=s*i;null==n?(n=e+s*Ui,r=e-l/2):(n=ws(a,n),r=ws(a,r),(s>0?nr)&&(n+=s*Ui));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 Xi(s[0]-t)0?0:3:Xi(s[0]-i)0?2:1:Xi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,y,_=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&_.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=Fs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Es(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(Us,Math.min(Ws,g)),f=Math.max(Us,Math.min(Ws,f))],b=[r=Math.max(Us,Math.min(Ws,r)),a=Math.max(Us,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&&(_.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 Ys(t){return t}var Xs,Ks,$s,qs,Zs=Li(),Js=Li(),Qs={point:as,lineStart:as,lineEnd:as,polygonStart:function(){Qs.lineStart=tn,Qs.lineEnd=nn},polygonEnd:function(){Qs.lineStart=Qs.lineEnd=Qs.point=as,Zs.add(Xi(Js)),Js.reset()},result:function(){var t=Zs/2;return Zs.reset(),t}};function tn(){Qs.point=en}function en(t,e){Qs.point=sn,Xs=$s=t,Ks=qs=e}function sn(t,e){Js.add(qs*t-$s*e),$s=t,qs=e}function nn(){sn(Xs,Ks)}var rn=Qs,an=1/0,on=an,ln=-an,hn=ln;var cn,dn,un,pn,gn={point:function(t,e){tln&&(ln=t);ehn&&(hn=e)},lineStart:as,lineEnd:as,polygonStart:as,polygonEnd:as,result:function(){var t=[[an,on],[ln,hn]];return ln=hn=-(on=an=1/0),t}},fn=0,mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn={point:Cn,lineStart:wn,lineEnd:Bn,polygonStart:function(){kn.lineStart=En,kn.lineEnd=Pn},polygonEnd:function(){kn.point=Cn,kn.lineStart=wn,kn.lineEnd=Bn},result:function(){var t=An?[xn/An,Sn/An]:bn?[yn/bn,_n/bn]:vn?[fn/vn,mn/vn]:[NaN,NaN];return fn=mn=vn=yn=_n=bn=xn=Sn=An=0,t}};function Cn(t,e){fn+=t,mn+=e,++vn}function wn(){kn.point=Mn}function Mn(t,e){kn.point=Tn,Cn(un=t,pn=e)}function Tn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,Cn(un=t,pn=e)}function Bn(){kn.point=Cn}function En(){kn.point=On}function Pn(){Rn(cn,dn)}function On(t,e){kn.point=Rn,Cn(cn=un=t,dn=pn=e)}function Rn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,xn+=(n=pn*t-un*e)*(un+t),Sn+=n*(pn+e),An+=3*n,Cn(un=t,pn=e)}var In=kn;function Dn(t){this._context=t}Dn.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,Ui)}},result:as};var Ln,Fn,zn,Hn,jn,Nn=Li(),Vn={point:as,lineStart:function(){Vn.point=Wn},lineEnd:function(){Ln&&Un(Fn,zn),Vn.point=as},polygonStart:function(){Ln=!0},polygonEnd:function(){Ln=null},result:function(){var t=+Nn;return Nn.reset(),t}};function Wn(t,e){Vn.point=Un,Fn=Hn=t,zn=jn=e}function Un(t,e){Hn-=t,jn-=e,Nn.add(is(Hn*Hn+jn*jn)),Hn=t,jn=e}var Gn=Vn;function Yn(){this._string=[]}function Xn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Kn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),us(t,i(s))),s.result()}return r.area=function(t){return us(t,i(rn)),rn.result()},r.measure=function(t){return us(t,i(Gn)),Gn.result()},r.bounds=function(t){return us(t,i(gn)),gn.result()},r.centroid=function(t){return us(t,i(In)),In.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ys):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Yn):new Dn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function $n(t){return function(e){var i=new qn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function qn(){}function Zn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),us(i,t.stream(gn)),e(gn.result()),null!=s&&t.clipExtent(s),t}function Jn(t,e,i){return Zn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Qn(t,e,i){return Jn(t,[[0,0],e],i)}function tr(t,e,i){return Zn(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 er(t,e,i){return Zn(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)}Yn.prototype={_radius:4.5,_circle:Xn(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=Xn(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}},qn.prototype={constructor:qn,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 ir=16,sr=qi(30*Yi);function nr(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=is(b*b+x*x+S*S),k=rs(S/=A),C=Xi(Xi(S)-1)e||Xi((v*B+y*E)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Yi:0,B()):[m*Gi,v*Gi,y*Gi]},M.angle=function(t){return arguments.length?(_=t%360*Yi,B()):_*Gi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},M.precision=function(t){return arguments.length?(a=nr(o,w=t*t),E()):is(w)},M.fitExtent=function(t,e){return Jn(M,t,e)},M.fitSize=function(t,e){return Qn(M,t,e)},M.fitWidth=function(t,e){return tr(M,t,e)},M.fitHeight=function(t,e){return er(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&T,B()}}function cr(t){var e=0,i=Ni/3,s=hr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Yi,i=t[1]*Yi):[e*Gi,i*Gi]},n}function dr(t,e){var i=ts(t),s=(i+ts(e))/2;if(Xi(s)2?t[2]*Yi:0),e.invert=function(e){return(e=t.invert(e[0]*Yi,e[1]*Yi))[0]*=Gi,e[1]*=Gi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===yr?[[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 br(t){return ss((Vi+t)/2)}function xr(t,e){var i=qi(t),s=t===e?ts(t):Ji(i/qi(e))/Ji(br(e)/br(t)),n=i*Qi(br(t),s)/s;if(!s)return yr;function r(t,e){n>0?e<-Vi+ji&&(e=-Vi+ji):e>Vi-ji&&(e=Vi-ji);var i=n/Qi(br(e),s);return[i*ts(s*t),n-i*qi(s*t)]}return r.invert=function(t,e){var i=n-e,r=es(s)*is(t*t+i*i),a=$i(t,Xi(i))*es(i);return i*s<0&&(a-=Ni*es(t)*es(i)),[a/s,2*Ki(Qi(n/r,1/s))-Vi]},r}function Sr(t,e){return[t,e]}function Ar(t,e){var i=qi(t),s=t===e?ts(t):(i-qi(e))/(e-t),n=i/s+t;if(Xi(s)ji&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Or.invert=fr(rs),Rr.invert=fr((function(t){return 2*Ki(t)})),Ir.invert=function(t,e){return[-e,2*Ki(Zi(t))-Vi]};var Fr={exports:{}},zr=function(t,e){this.p1=t,this.p2=e};zr.prototype.rise=function(){return this.p2[1]-this.p1[1]},zr.prototype.run=function(){return this.p2[0]-this.p1[0]},zr.prototype.slope=function(){return this.rise()/this.run()},zr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},zr.prototype.isVertical=function(){return!isFinite(this.slope())},zr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},zr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},zr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},zr.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)},zr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Hr=zr,jr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Hr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=jr(t.slice(0,s),e),o=jr(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},Nr=jr;!function(t){var e=Nr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Yr,e),{tolerance:s}=i;return Vr(t,s)};var Kr;!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"}(Kr||(Kr={}));const $r=(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},qr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(A(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let C=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/C:0,w.push(_[t])}return w},Jr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],T=M.length?M:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:T});if(!w.length)return Zr(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...M,...w];return Zr(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",T=null!==(l=k.q1)&&void 0!==l?l:"q1",B=null!==(h=k.median)&&void 0!==h?h:"median",E=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(u=k.iqr)&&void 0!==u?u:"iqr",O=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",D=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",L=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),y(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}y(S)&&(S=[vt(Math.min.apply(null,S),0,1),vt(Math.max.apply(null,S),0,1)]);const V=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[M]=o,f[T]=l,f[B]=h,f[E]=c,f[P]=d,f[O]=n,f[R]=r,f[I]=u,f[D]=p,f[L]=g,A&&(f[F]=H.get(t)||[]),V.push(f)}return V};var ta={},ea={};function ia(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function sa(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function na(t,e){var i=t+"",s=i.length;return s9999?"+"+na(e,6):na(e,4))+"-"+na(t.getUTCMonth()+1,2)+"-"+na(t.getUTCDate(),2)+(r?"T"+na(i,2)+":"+na(s,2)+":"+na(n,2)+"."+na(r,3)+"Z":n?"T"+na(i,2)+":"+na(s,2)+":"+na(n,2)+"Z":s||i?"T"+na(i,2)+":"+na(s,2)+"Z":"")}function aa(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 ea;if(h)return h=!1,ta;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=Kr.DSV;const s=Wr(ha,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return aa(n).parse(t)},da=(t,e={},i)=>(i.type=Kr.DSV,oa(t)),ua=(t,e={},i)=>(i.type=Kr.DSV,la(t));function pa(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return ga(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 ga(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ma(t);default:throw new Error("unknown GeoJSON type")}}function ga(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=fa(t.properties),e.geometry=ma(t.geometry),e}function fa(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]=fa(s):e[i]=s})),e):e}function ma(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return ma(t)})),e):(e.coordinates=va(t.coordinates),e)}function va(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return va(t)}))}function ya(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 _a(t){for(var e,i,s=ya(t),n=0,r=1;r0}function ba(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=pa(t));var r=[];switch(t.type){case"GeometryCollection":return xa(t,(function(t){Aa(t,s)})),t;case"FeatureCollection":return ba(t,(function(t){ba(Aa(t,s),(function(t){r.push(t)}))})),ci(r)}return Aa(t,s)}function Aa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return xa(t,(function(t){Aa(t,e)})),t;case"LineString":return ka(ya(t),e),t;case"Polygon":return Ca(ya(t),e),t;case"MultiLineString":return ya(t).forEach((function(t){ka(t,e)})),t;case"MultiPolygon":return ya(t).forEach((function(t){Ca(t,e)})),t;case"Point":case"MultiPoint":return t}}function ka(t,e){_a(t)===e&&t.reverse()}function Ca(t,e){_a(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=wa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Ea=(t,e={},i)=>{i.type=Kr.GEO;const s=Wr(Ta,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Sa(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=Ma.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=Ma.bounds(t);t.bbox=e}})),t.features=l,t},Pa={},Oa=(t,e,i)=>{i.type=Kr.GEO;const s=Wr(Ta,Pa,e),{object:n}=s;if(!v(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Lr(a,t)}))}:Lr(a,o));var a,o;return Ea(r,s,i)},Ra=(t,e,i)=>{const s=!h(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 Ia=0;function Da(t="dataset"){return Ia>1e8&&(Ia=0),t+"_"+Ia++}class La{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Fa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Fa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",qr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Kn();const za={},Ha={albers:pr,albersusa:function(){var t,e,i,s,n,r,a=pr(),o=ur().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=ur().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)}},ja=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Na(t,e){return function i(){const s=e();return s.type=t,s.path=Kn().projection(s),s.copy=s.copy||function(){const t=i();return ja.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ua extends o{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=qa.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Za(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(Za(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,Za(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Za(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 Ka))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=qa.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Ja(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Xa,this.rootWheelEvent=new Ka,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&v(t)&&!R(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const io=jt-1e-8;class so{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>io)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ro=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ao={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},oo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let lo,ho,co,uo,po,go;function fo(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tgo){let t,e=co;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),w=.5*(b+S)+k*(x-_),M=Math.atan2(b-w,_-C);let T=Math.atan2(S-w,x-C)-M;T<0&&1===r?T+=jt:T>0&&0===r&&(T-=jt);const B=Math.ceil(Math.abs(T/(Ht+.001))),E=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 Mo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Lo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function zo(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new Ho(i,n),new Ho(n,s)]}class Ho extends To{constructor(t,e){super(),this.type=bo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===_o.ROW?Vt(this.p0.x-this.p1.x):t===_o.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class jo{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Fo(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Ho(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===_o.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===_o.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class No extends jo{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 Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?_o.ROW:_o.COLUMN;return"monotoneY"===t?new No(t,s):new jo(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 Go(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Yo(new Uo(n,s),t),n}function Yo(t,e){return Vo(t,e,1)}function Xo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Ko{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Xo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Xo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function $o(t,e){return Vo(t,e,2)}function qo(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("basis",i,t);return $o(new Ko(n,s),t),n}function Zo(t){return t<0?-1:1}function Jo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Zo(r)+Zo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Qo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class el{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:tl(this,this._t0,Qo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,tl(this,Qo(this,e=Jo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:tl(this,this._t0,e=Jo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class il extends el{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function sl(t,e){return Vo(t,e,2)}function nl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("monotoneX",i,t);return sl(new el(n,s),t),n}function rl(t,e){return Vo(t,e,2)}function al(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("monotoneY",i,t);return rl(new il(n,s),t),n}let ol=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class ll extends ol{lineEnd(){this.context.closePath()}}function hl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new jo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?_o.ROW:_o.COLUMN);return cl(new ol(r,e,n),t),r}function cl(t,e){return Vo(t,e,1)}function dl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new jo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?_o.ROW:_o.COLUMN);return cl(new ll(r,e,n),t),r}class ul extends Uo{lineEnd(){this.context.closePath()}}function pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return gl(new ul(n,s),t),n}function gl(t,e){return Vo(t,e,1)}function fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ft){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function ml(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Go(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const vl=ml("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const yl=ml("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class _l extends To{constructor(t,e,i){super(),this.type=bo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Io(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===_o.ROW?Vt(this.p0.x-this.p2.x):t===_o.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Io(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new _l(i,a,r),new _l(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class bl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Ho(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new _l(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Fo(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function xl(t,e,i){var s,n;switch(e){case"linear":default:return Go(t,i);case"basis":return qo(t,i);case"monotoneX":return nl(t,i);case"monotoneY":return al(t,i);case"step":return hl(t,.5,i);case"stepClosed":return dl(t,.5,i);case"stepBefore":return hl(t,0,i);case"stepAfter":return hl(t,1,i);case"catmullRom":return vl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return yl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return pl(t,i)}}class Sl extends no{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new so(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([oo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([oo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([oo.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([oo.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([oo.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([oo.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([oo.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([oo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([oo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new bl(this);Mo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[oo.M]=t=>`M${t[1]} ${t[2]}`,t[oo.L]=t=>`L${t[1]} ${t[2]}`,t[oo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[oo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[oo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];Co(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[oo.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=fo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=xl(e,i);"x"===s?this.direction=_o.ROW:"y"===s?this.direction=_o.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[oo.M]=this.moveToTransform,t[oo.L]=this.lineToTransform,t[oo.Q]=this.quadraticCurveToTransform,t[oo.C]=this.bezierCurveToTransform,t[oo.AT]=this.arcToTransform,t[oo.E]=this.ellipseTransform,t[oo.R]=this.rectTransform,t[oo.A]=this.arcTransform,t[oo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Mo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===_o.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===_o.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),Kl=Object.assign(Object.assign({},jl),{points:[],cornerRadius:0,closePath:!0}),$l=Object.assign(Object.assign({},jl),{width:100,height:100,spikes:5,thickness:.5}),ql=Object.assign(Object.assign({},jl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Zl=Object.assign(Object.assign({},jl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},jl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Ql=Object.assign(Object.assign(Object.assign({},jl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),th=Object.assign(Object.assign(Object.assign({},jl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),eh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},jl),{fill:!0,cornerRadius:0,cornerType:"round"}),ih=Object.assign(Object.assign({},eh),{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});class sh{}const nh=Symbol.for("@visactor/vrender-core/application-state");function rh(){const t=globalThis;return t[nh]||(t[nh]={application:new sh}),t[nh]}const ah=rh().application;class oh{static GetImage(t,e){var i;const s=oh.cache.get(t);s?"fail"===s.loadState?ah.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):oh.loadImage(t,e)}static GetSvg(t,e){var i;let s=oh.cache.get(t);s?"fail"===s.loadState?ah.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"},oh.cache.set(t,s),s.dataPromise=ah.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=oh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},oh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=ah.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=ah.global.loadBlob(t):"json"===e&&(i.dataPromise=ah.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!oh.isLoading&&oh.toLoadAueue.length){oh.isLoading=!0;const t=oh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(oh.cache.set(i,n),n.dataPromise=ah.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()})).catch((t=>{console.error(t),oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()}))}}),0)}static loadImage(t,e){const i=lh(t,oh.toLoadAueue);if(-1!==i)return oh.toLoadAueue[i].marks.push(e),void oh.loading();oh.toLoadAueue.push({url:t,marks:[e]}),oh.loading()}static improveImageLoading(t){const e=lh(t,oh.toLoadAueue);if(-1!==e){const t=oh.toLoadAueue.splice(e,1);oh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function lh(t,e){for(let i=0;i{var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)ch[s]=t,i&&(i=!(null!==(e=ch[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ch[e]=!!t[e],i&&(i=!!ch[e]);else ch[0]=!1,ch[1]=!1,ch[2]=!1,ch[3]=!1;return{isFullStroke:i,stroke:ch}},uh=[0,0,0,0],ph=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(uh[0]=t[0],uh[2]=t[0],uh[1]=t[1],uh[3]=t[1],uh):t:t:0,gh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],fh=[1,2,3,0,1,2,3,0];function mh(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;gh[0].x=i,gh[1].y=i,gh[2].x=-i,gh[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Ut(t)*i,Xt(t)*i),s.add(Ut(e)*i,Xt(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}xh.TimeOut=1e3/60;const Sh=new xh,Ah=(t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,kh=(t,e)=>{const i=Ah(t,e);return isNaN(i)?i:Math.max(e,i)};class Ch{bounds(t,e){if(x(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function wh(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var Mh=new class extends Ch{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 wh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Th=new class extends Ch{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Eh=new class extends Ch{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Ph(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Ch{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Ph(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ph(t,this.parseSize(e)/2+n,i,s)}};function Rh(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Ih extends Ch{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 Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Ih;var Lh=new class extends Ih{constructor(){super(...arguments),this.type="triangle"}};const Fh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),zh=Math.sin(jt/10)*Fh,Hh=-Math.cos(jt/10)*Fh;function jh(t,e,i,s){const n=zh*e,r=Hh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Nh=new class extends Ch{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 jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return jh(t,this.parseSize(e)/2+n,i,s)}};const Vh=Kt(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Uh=new class extends Ch{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Gh(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 Yh=new class extends Ch{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Gh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Gh(t,this.parseSize(e)/2+n,i,s)}};function Xh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Kh=new class extends Ch{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Xh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Xh(t,this.parseSize(e)/2+n,i,s)}};const $h=-.5,qh=Kt(3)/2,Zh=1/Kt(12);function Jh(t,e,i,s){const n=e/2,r=e*Zh,a=n,o=e*Zh+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($h*n-qh*r+i,qh*n+$h*r+s),t.lineTo($h*a-qh*o+i,qh*a+$h*o+s),t.lineTo($h*l-qh*h+i,qh*l+$h*h+s),t.lineTo($h*n+qh*r+i,$h*r-qh*n+s),t.lineTo($h*a+qh*o+i,$h*o-qh*a+s),t.lineTo($h*l+qh*h+i,$h*h-qh*l+s),t.closePath(),!1}var Qh=new class extends Ch{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 Jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Jh(t,this.parseSize(e)/2+n,i,s)}};function tc(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ec=new class extends Ch{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 tc(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return tc(t,this.parseSize(e)/2,i,s,n)}};function ic(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var sc=new class extends Ch{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 ic(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ic(t,this.parseSize(e)/2,i,s,n)}};function nc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var rc=new class extends Ch{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 nc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return nc(t,this.parseSize(e)/2,i,s,n)}};const ac=Kt(3);function oc(t,e,i,s){const n=e*ac;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var lc=new class extends Ch{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return oc(t,this.parseSize(e)/2/ac,i,s)}drawOffset(t,e,i,s,n){return oc(t,this.parseSize(e)/2/ac+n,i,s)}};function hc(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 cc=new class extends Ch{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 hc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hc(t,this.parseSize(e)/4+n,i,s)}};function dc(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 uc=new class extends Ch{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 dc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return dc(t,this.parseSize(e)/4+n,i,s)}};function pc(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 gc=new class extends Ch{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 pc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pc(t,this.parseSize(e)/4+n,i,s)}};function fc(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 mc=new class extends Ch{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 fc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return fc(t,this.parseSize(e)/4+n,i,s)}};function vc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var yc=new class extends Ch{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return vc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function _c(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var bc=new class extends Ch{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return _c(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return _c(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function xc(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 Sc=new class extends Ch{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 xc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return xc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function Ac(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function kc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Cc=new class extends Ch{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return x(e)?kc(t,e,i,s):Ac(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?kc(t,e+2*n,i,s):Ac(t,[e[0]+2*n,e[1]+2*n],i,s)}};const wc=new Ve;class Mc{constructor(t,e,i=!1){this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Mo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Mo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{wc.x1=i.bounds.x1*t,wc.y1=i.bounds.y1*t,wc.x2=i.bounds.x2*t,wc.y2=i.bounds.y2*t,e.union(wc)}))}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 Tc=[Mh,Th,Eh,Oh,lc,Lh,Nh,Uh,Yh,Kh,Qh,ec,sc,Dh,rc,cc,uc,gc,mc,Cc,yc,bc,Sc],Bc={};Tc.forEach((t=>{Bc[t.type]=t}));const Ec={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Pc{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 Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Rc(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Rc(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Rc(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 Pc(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 Pc(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 Lc(t,e){return Fc(t)}function Fc(t,e){const i={};for(let e=0;e$c.set(t,!0)));const qc=new Map;function Zc(t){if($c.has(t))return!0;if(qc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Jc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>qc.set(t,!0)));const Qc=Yc(),td=Yc(),ed=Yc(),id=Yc(),sd=Yc(),nd=Yc(),rd=Yc(),ad=Yc(),od=Yc(),ld=Yc(),hd=Yc(),cd=Yc(),dd=Yc(),ud=Yc(),pd=Yc(),gd=Yc(),fd=Yc(),md=Symbol.for("GraphicService"),vd=Symbol.for("GraphicCreator"),yd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},_d=Object.keys(yd),bd={"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"},xd=Object.keys(bd),Sd={duration:200,easing:"cubicOut"},Ad=Symbol.for("CanvasFactory"),kd=Symbol.for("Context2dFactory");function Cd(t){return function(){var t,e;const i=null===(t=ah.global)||void 0===t?void 0:t.env,s=i?null===(e=ah.canvasFactory)||void 0===e?void 0:e.call(ah,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const wd=1e-4,Md=Math.sqrt(3),Td=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Pd(t){return"number"==typeof t&&Number.isFinite(t)}const Od=[0,0],Rd=[0,0],Id=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Ld(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Fd(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 zd(t){return(t%=Nt)<0&&(t+=Nt),t}function Hd(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function Vd(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(Bd(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 Gd=[-1,-1,-1],Yd=[-1,-1];function Xd(){const t=Yd[0];Yd[0]=Yd[1],Yd[1]=t}function Kd(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(Bd(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,Td):Math.pow(i,Td),s=s<0?-Math.pow(-s,Td):Math.pow(s,Td);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+Md*Math.sin(e)))/(3*a),h=(-o+i*(s-Md*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,Gd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Xd(),p=Fd(e,s,r,o,Yd[0]),u>1&&(g=Fd(e,s,r,o,Yd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Gd);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=Ld(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Gd[0]=-l,Gd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=Gd[0]+t&&a<=Gd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=Gd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function Zd(t){return Math.round(t/zt*1e8)/1e8%2*zt}function Jd(t,e){let i=Zd(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-Zd(i-n)):e&&i1&&(i||(h+=Oe(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;Qd[0]=S,Qd[1]=A,Jd(Qd,Boolean(a[6])),S=Qd[0],A=Qd[1];const k=S,C=A-S,w=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case oo.M:u=m,p=v,c=u,d=p;break;case oo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case oo.C:if(i){if(jd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=Kd(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case oo.Q:if(i){if(Hd(c,d,m,v,y,_,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case oo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Nd(m,v,y,k,k+C,w,e,M,n))return!0}else h+=qd(m,v,y,k,k+C,w,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case oo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case oo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class iu{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(iu.IsGradientStr(t))try{const e=eu(t)[0];if(e){if("linear"===e.type)return iu.ParseLinear(e);if("radial"===e.type)return iu.ParseRadial(e);if("conic"===e.type)return iu.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:iu.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:iu.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function ru(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function au(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];return 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}function ou(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];return 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}function lu(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];return 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,t}function hu(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 cu(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 du(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function uu(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 pu(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];return Math.abs(g-b)0&&(xu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(xu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ku),function(t,e,i){return tu(t,0,!1,e,i)}(this.path.commandList,ku.x,ku.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ku);const i=su(this,this.lineWidth,this.dpr);return function(t,e,i,s){return tu(t,e,!0,i,s)}(this.path.commandList,i,ku.x,ku.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Au,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>xu.free(t))),this.stack.length=0}}const wu={WIDTH:500,HEIGHT:500,DPR:1};class Mu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=wu.WIDTH,height:n=wu.HEIGHT,dpr:r=wu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Tu;Mu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Tu||(Tu={}));class Bu{static Get(t,e=Tu.Color1,i=[0,0,0,1]){if(e===Tu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Tu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Eu(t,e=!1){return Array.isArray(t)&&x(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Pu(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ou(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ou(t,e,i,s,n)}function Ou(t,e,i,s,n){if(!t||!e)return t&&Eu(t)||e&&Eu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Tu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Tu.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:Eu(a)})))});return o?Pu(r,l,i,s,n):Pu(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 Ru(s,n,i);if("radial"===s.gradient)return Iu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Eu(Lu(r,a,i),s)}function Ru(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Iu(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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]}function Fu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const zu=[0,0,0,0],Hu=[0,0,0,0];function ju(t,e,i){return Bu.Get(t,Tu.Color255,zu),Bu.Get(e,Tu.Color255,Hu),`rgba(${Math.round(zu[0]+(Hu[0]-zu[0])*i)},${Math.round(zu[1]+(Hu[1]-zu[1])*i)},${Math.round(zu[2]+(Hu[2]-zu[2])*i)},${zu[3]+(Hu[3]-zu[3])*i})`}class Nu{static GetCanvas(){try{return Nu.canvas||(Nu.canvas=ah.global.createCanvas({})),Nu.canvas}catch(t){return null}}static GetCtx(){if(!Nu.ctx){const t=Nu.GetCanvas();Nu.ctx=t.getContext("2d")}return Nu.ctx}}class Vu extends Ge{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Nu.GetCanvas(),s=Nu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Uu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Nt;for(;i>Nt;)i-=Nt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Pu(o.color,l.color,h,!1)}function Gu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Nu.GetCanvas(),d=Nu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Yu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Xu(t){return null==t?void 0:t}class Ku{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Xu(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Yu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Xu(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function $u(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function qu(t){if(!$u(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=qu(t[i])})),e}function Zu(t,e){var i;const s=null!==(i=qu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];$u(n)&&$u(i)?s[t]=Zu(n,i):s[t]=qu(i)})),s}class Ju{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=qu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];$u(r)&&$u(n)?t[i]=Zu(r,n):!$u(r)&&$u(a)&&$u(n)?t[i]=Zu(a,n):t[i]=qu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?Qu.PAINT|Qu.BOUNDS|Qu.PICK:Qu.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?Qu.PAINT|Qu.BOUNDS:Qu.PAINT}};class ip{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Sd;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:yo.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:yo.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:yo.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const sp=new Ku;function np(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,rp(t),!0)}function rp(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=sp.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function ap(t){if(t)return t.parentScope&&ap(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&rp(t),t}function op(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function lp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function hp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,lp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),op(null!=e?e:t.ownerStage))}const cp=new Ve,dp=new Ue,up=["lineWidth","scaleX","scaleY","angle","anchor","visible"],pp=["x","y"],gp=["scaleX","scaleY"],fp=["angle"],mp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),vp=new ne,yp=[],_p=Qu.PAINT|Qu.SHAPE|Qu.BOUNDS|Qu.TRANSFORM|Qu.LAYOUT;function bp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function xp(t){if(!bp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=bp(s)?xp(s):s})),i}function Sp(t,e){return t===e||!!(bp(t)||bp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function Ap(t,e){var i;const s=null!==(i=xp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];bp(n)&&bp(i)?s[t]=Ap(n,i):s[t]=xp(i)})),s}const kp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Cp extends Ua{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,lp(this.stage,this),op(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&ap(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:yo.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(ap(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new Ku).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=xp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&bp(n)&&bp(s)?e[t]=Ap(n,s):e[t]=xp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:xp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Sp(a,o)||(s.set(n,{prev:a,next:o}),t[n]=xp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ep[t];return n?n(e,i):null!==(s=tp[t])&&void 0!==s?s:Qu.PAINT}(e,i,s):null!==(n=tp[e])&&void 0!==n?n:Qu.PAINT;return r&Qu.PICK&&(r|=Qu.BOUNDS),r===Qu.PAINT&&this.needUpdateTag(e)&&(r=Qu.SHAPE|Qu.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&_p)!==_p?(t&Qu.SHAPE?this.addUpdateShapeAndBoundsTag():t&Qu.BOUNDS&&this.addUpdateBoundTag(),t&Qu.PAINT&&this.addUpdatePaintTag(),t&Qu.TRANSFORM&&this.addUpdatePositionTag(),t&Qu.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=Qu.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!bp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=bp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&mo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Tp.userSymbolMap[t],e)return e;if(!0===jc(t=Ec[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=y(i.path)?i.path:[i.path];cp.clear();const n=[];s.forEach((t=>{const e=(new Sl).fromString(t.d),i={};xd.forEach((e=>{t[e]&&(i[bd[e]]=t[e])})),n.push({path:e,attribute:i}),cp.union(e.bounds)}));const r=cp.width(),a=cp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new Mc(t,n,!0);return Tp.userSymbolMap[t]=l,l}const i=(new Sl).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Gt(s,n);i.transform(0,0,r,r);const a=new Mc(t,i);return Tp.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=ph(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new so(t);return Mo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&mo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&mo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&mo.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&mo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=mo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vo.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===yo.STATE||null!=i&&i>=yo.ANIMATE_BIND&&i<=yo.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===yo.STATE||null!=o&&o>=yo.ANIMATE_BIND&&o<=yo.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Sp(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:yp,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:yo.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Sd}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:yp,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?xp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:yo.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:yp,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:yp,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:yo.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:yo.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Pl.x,y:e=Pl.y,scaleX:i=Pl.scaleX,scaleY:s=Pl.scaleY,angle:n=Pl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ut(a),f=Xt(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,!0),ah.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Pl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:ah.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:yo.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:yo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=ah.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new Sl).fromString(t):this.pathProxy=new Sl,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:ah.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new $a(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ua.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:yo.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:yo.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||ah.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Cu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Cp.userSymbolMap={};const wp=Symbol.for("@visactor/vrender-core/graphic-class");function Mp(){var t;const e=globalThis;return null!==(t=e[wp])&&void 0!==t||(e[wp]={Graphic:Cp}),e[wp]}const Tp=Mp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!mp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Ip=Op();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Pp.forEach((t=>{this._defaultTheme[t]=Object.create(Ip[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Pp.forEach((s=>{const n=Object.create(Ip[s]);t&&t[s]&&Rp(n,t[s]),i[s]&&Rp(n,i[s]),e[s]&&Rp(n,e[s]),this.combinedTheme[s]=n})),e.common&&Pp.forEach((t=>{Rp(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 Lp=new Dp;function Fp(t,e){return t.glyphHost?Fp(t.glyphHost):e?(t.isContainer,e):zp(t)||t.attachedThemeGraphic&&Fp(t.attachedThemeGraphic)||Lp.getTheme()}function zp(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)):Lp.getTheme()}return null}const Hp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},jp=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...up];class Np extends Tp{constructor(t){super(t),this.type="arc",this.numberType=Qc}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=le(e),i=e+a,s&&Vt(a)>Ft&&Vt(a)Ft&&o>Ft)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Kt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*Xt(g)),n=qt(Number(l)/a*Xt(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Fp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);Hp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Nt-Ft?i.set(-s,-s,s,s):(mh(l,o,s,i),mh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,jp)}needUpdateTag(t){return super.needUpdateTag(t,jp)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Nt-Ft)n.moveTo(0+h*Ut(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Ut(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Ut(a),e=h*Xt(a),i=l*Ut(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Np(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Np.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Np(t)}Np.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);const Wp=["segments","points","curveType","curveTension",...up];class Up extends Tp{constructor(t){super(t),this.type="area",this.numberType=ed}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Fp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),ah.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Sl;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Gp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Yp=["radius","startAngle","endAngle",...up];class Xp extends Tp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Fp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-Ft?i.set(-r,-r,r,r):mh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Yp)}needUpdateTag(t){return super.needUpdateTag(t,Yp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Sl,s.arc(0,0,r,a,o),s}clone(){return new Xp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xp.NOWORK_ANIMATE_ATTR}}function Kp(t){return new Xp(t)}Xp.NOWORK_ANIMATE_ATTR=kp;class $p extends Tp{constructor(t){super(t),this.type="glyph",this.numberType=sd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Fp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new $p(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return $p.NOWORK_ANIMATE_ATTR}}function qp(t){return new $p(t)}var Zp;$p.NOWORK_ANIMATE_ATTR=kp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Zp||(Zp={}));let Jp=class t extends Tp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=nd,this._childUpdateTag=mo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(np(this.sharedStateScope,t),hp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vo.GLOBAL){const i=new ne(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&mo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Pl.x,y:e=Pl.y,dx:i=Pl.dx,dy:s=Pl.dy,scaleX:n=Pl.scaleX,scaleY:r=Pl.scaleY,angle:a=Pl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Fp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=mo.CLEAR_BOUNDS,this._childUpdateTag&=mo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&mo.UPDATE_BOUNDS||(this._childUpdateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:ah.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&mo.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=ah.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&np(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return rp({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function Qp(t){return new Jp(t)}Jp.NOWORK_ANIMATE_ATTR=kp;const tg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...up];class eg extends Tp{constructor(t){super(t),this.type="image",this.numberType=rd,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Fp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return eh[t]}needUpdateTags(t){return super.needUpdateTags(t,tg)}needUpdateTag(t){return super.needUpdateTag(t,tg)}clone(){return new eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return eg.NOWORK_ANIMATE_ATTR}}function ig(t){return new eg(t)}eg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},kp);const sg=["segments","points","curveType","curveTension",...up];let ng=class t extends Tp{constructor(t={}){super(t),this.type="line",this.numberType=ad}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=_h(i,s,e))}getGraphicTheme(){return Fp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),ah.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,sg)}needUpdateTag(t){return super.needUpdateTag(t,sg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Sl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function rg(t){return new ng(t)}ng.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const ag=["path","customPath",...up];class og extends Tp{constructor(t){super(t),this.type="path",this.numberType=od}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Sl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Sl?this.cache:t.path)}getGraphicTheme(){return Fp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Sl).fromString(t.path):t.customPath&&(this.cache=new Sl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,ag)}needUpdateTag(t){return super.needUpdateTag(t,ag)}toCustomPath(){return(new Sl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return og.NOWORK_ANIMATE_ATTR}}function lg(t){return new og(t)}og.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},kp);const hg=["points","cornerRadius",...up];class cg extends Tp{constructor(t){super(t),this.type="polygon",this.numberType=ld}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Fp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),ah.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,hg)}needUpdateTag(t){return super.needUpdateTag(t,hg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Sl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new cg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return cg.NOWORK_ANIMATE_ATTR}}function dg(t){return new cg(t)}cg.NOWORK_ANIMATE_ATTR=kp;const ug=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},pg=["width","x1","y1","height","cornerRadius",...up];class gg extends Tp{constructor(t){super(t),this.type="rect",this.numberType=cd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Fp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,pg)}needUpdateTag(t){return super.needUpdateTag(t,pg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=ug(e);return t=new Sl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new gg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return gg.NOWORK_ANIMATE_ATTR}}function fg(t){return new gg(t)}gg.NOWORK_ANIMATE_ATTR=kp;const mg=Symbol.for("EnvContribution"),vg=Symbol.for("VGlobal"),yg="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",_g={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"}},bg=!0,xg=!1,Sg=/\w|\(|\)|-/,Ag=/[.?!,;:/,。?!、;:]/,kg=/\S/,Cg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=ah.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=Mg(t,a)),a}function Mg(t,e,i=!1){let s=e;for(;Sg.test(t[s-1])&&Sg.test(t[s])||Ag.test(t[s]);)if(s--,s<=0)return i?Tg(t,e):e;return s}function Tg(t,e){let i=e;for(;Sg.test(t[i+1])&&Sg.test(t[i])||Ag.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=ah.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Eg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=_g[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Pg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Og{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=kh(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Pg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=wg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Rg extends eg{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=ph(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=ph(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=eh.width,height:e=eh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Ig{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Rg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=_g[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=kg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Rg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Rg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Rg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||xg;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,Cg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||bg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?nu(t,s,{AABBBounds:i}):s,Cg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Rg)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Rg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=_g[this.direction]}store(t){if(t instanceof Rg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Ig(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Rg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character,t.ascentDescentMode),new Og(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Lg=!1;try{Lg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Lg=!1}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...up];class zg extends Tp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ud,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:th.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:th.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:th.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:th.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:th.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:th.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:th.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:th.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Fp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&zg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&zg.splitText(t.text).length>1)))}static splitText(t){if(Lg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=zg.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),ah.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||ah.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!zg.AllSingleCharacter(y)&&(y=zg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),w=new Eg(0,0,(k?n:S?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&S,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(w);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&w.lines[w.lines.length-1].paragraphs.push(s)):M.deal(s,!0),w.lines.length!==t&&(t=w.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,w.lines[w.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===w.layoutDirection?k:C)){const t=w.getActualSizeWidthEllipsis();let e="horizontal"===w.layoutDirection?t.width:t.height;("horizontal"===w.layoutDirection?S:A)&&(e=Math.min(e,"horizontal"===w.layoutDirection?i:s)),w.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&w.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new zg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function Hg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},kp);class jg extends Jp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ng(t){return new jg(t)}const Vg=["symbolType","size",...up];let Wg=class t extends Tp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=gd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Fp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Uc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Sl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Sl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Ug(t){return new Wg(t)}function Gg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Yg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Xg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[li(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=li(s);d(t[s])||(e[n]=i(t[s]))})),u(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&v(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},kp);class Kg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Cl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=fd}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Fp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new qg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ce(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=ah.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Uc(n,o/Math.abs(r+a),!0,l),i.union(n)}return ah.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||ah.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Kg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new Kg(a,w,C),T=y(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=T.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=Gg(y,a),e=this.cache.verticalList.length*v,i=Yg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>Kc(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Xc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const S=Gg(y,a),A=x.verticalList.length*v,k=Yg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=kh(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=$g){return super.needUpdateTags(t,e)}needUpdateTag(t,e=$g){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return qg.baselineMapAlign}getAlignMapBaseline(){return qg.alignMapBaseline}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},kp),qg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},qg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Jg=["heightLimit","lineClamp"];class Qg extends qg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=kh(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new Kg(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),w=[],M=[0,0];let T=1/0;if(y>0&&(T=Math.max(Math.floor(y/x),1)),b&&(T=Math.min(T,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 df extends cf{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let uf=0;class pf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=ah.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++uf,t),this.tryRunAnimationFrameNextFrame(),uf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class gf{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var ff=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 mf extends gf{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new df(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new pf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new pf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return ff(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class vf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Cd(Object.assign({nativeCanvas:ah.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Cd(Object.assign({nativeCanvas:ah.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const yf=new vf,_f=Symbol.for("VWindow"),bf=Symbol.for("WindowHandlerContribution");function xf(t){const e=ah.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Sf extends gf{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(t=ah.global,e=xf){super(),this.handlerFactory=e,this.hooks={onChange:new df(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class Af{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=ah.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=yf.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=ah.windowFactory)||void 0===s?void 0:s.call(ah))&&void 0!==n?n:new Sf(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var kf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(kf||(kf={}));const Cf=new Ue;class wf{constructor(){this.matrix=new Ue}init(t){return this.mode=kf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=kf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Cf.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(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Cf.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(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}scale(t,e,i){return this.mode===kf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===kf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Cf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}translate(t,e){return this.mode===kf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===kf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const Mf=Symbol.for("@visactor/vrender-core/factory-state");function Tf(){const t=globalThis;return t[Mf]||(t[Mf]={pluginClasses:{}}),t[Mf]}class Bf{constructor(){this.global=ah.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ue(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new ne(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Ef=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 Pf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Of(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Pf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Pf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Lf{constructor(){this.time=xo.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Hf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Fp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Xf(t,e,i,s)}}const Ff=new Lf,zf=new Set(["top","center","bottom"]);function Hf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function jf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Nf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Nf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:jf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Uf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:zf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Gf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Yf(t){if(!t)return null;const e=Gf(t.naturalWidth,t.videoWidth,t.width),i=Gf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Xf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Yf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Uf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=yf.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),yf.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Kf{constructor(t){this.subRenderContribitions=t,this.time=xo.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)}))}}class $f{constructor(){this.time=xo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const qf=new $f;class Zf{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Jf=new Zf,Qf={getContributions:()=>[]};class tm{constructor(t=[],e=Qf,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Of(e,jl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ne,this.backupDirtyBounds=new Ne,this.global=null!==(s=i.global)&&void 0!==s?s:ah.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:ah.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:Qf,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,xu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=If(e,i,jl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=xu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),xu.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||function(){const t=ah.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class im{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class sm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class nm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const am={getContributions:()=>[]};class om{constructor(t=am,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new nm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class lm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class hm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=ah.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=ah.global.getRequestAnimationFrame();this.rafId=t((()=>{ah.global.devicePixelRatio!==this.dpr&&(this.dpr=ah.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=ah.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class cm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,ah.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const dm=new Ve;class um{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&mo.UPDATE_PAINT)||s._updateTag&mo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(dm.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(dm,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let pm;function gm(){if(null==pm)try{const t=document.createElement("canvas"),e=t.getContext("2d");pm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),pm&&(pm=!!document.createElement)}catch(t){pm=!1}}function fm(){gm();const t=ah.global&&ah.global.env;return t?"browser"===t:pm}function mm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle: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(ru(t),hu(t,t,[n+o,r+l,a+h]),hu(t,t,[y[0],y[1],y[2]]),au(t,t,g),ou(t,t,p),hu(t,t,[-y[0],-y[1],y[2]]),du(t,t,[c,d,u]),f){const i=Su.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]}hu(i,i,[s[0],s[1],0]),lu(i,i,f),hu(i,i,[-s[0],-s[1],0]),uu(t,t,i)}}function vm(t){const{alpha:e,beta:i}=t.attribute;return e||i}class ym{constructor(t=of){this.creator=t,this.hooks={onAttributeUpdate:new df(["graphic"]),onSetStage:new df(["graphic","stage"]),onRemove:new df(["graphic"]),onRelease:new df(["graphic"]),onAddIncremental:new df(["graphic","group","stage"]),onClearIncremental:new df(["graphic","group","stage"]),beforeUpdateAABBBounds:new df(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new df(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new df(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Yg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Gg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Uc(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;Uc(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const _m="white";class bm extends Jp{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:_m}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,y,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new df(["stage"]),afterRender:new df(["stage"]),afterClearScreen:new df(["stage"]),afterClearRect:new df(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:ah.global,!this.global.env&&fm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:ah.windowFactory)&&void 0!==n?n:()=>new Sf(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=ah.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=ah.renderServiceFactory)||void 0===h?void 0:h.call(ah))&&void 0!==c?c:ah.renderService)&&void 0!==d?d:new em,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=ah.pluginServiceFactory)||void 0===p?void 0:p.call(ah))&&void 0!==g?g:ah.pluginService)&&void 0!==f?f:new om,this.layerService=null!==(y=null!==(m=e.layerService)&&void 0!==m?m:ah.layerService)&&void 0!==y?y:new wm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:ah.graphicService)&&void 0!==b?b:new ym,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:_m,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,rp(s)),hp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new eo(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=km.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=km.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=km.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new lm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new hm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new cm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ne;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new um,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=km.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=km.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=km.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return rp({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class xm{constructor(t=bm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Sm extends Jp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{ah.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=>{ah.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)))}}class Am{constructor(t=Sm){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let km=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Cm(t){const e=ah.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}km._pluginClasses=Tf().pluginClasses;class wm{static GenerateLayerId(){return`${wm.idprefix}_${wm.prefix_count++}`}constructor(t=ah.global,e=new Am,i=Cm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:wm.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)}}wm.idprefix="visactor_layer",wm.prefix_count=0;const Mm=Symbol.for("TransformUtil"),Tm=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Em=Symbol.for("StaticLayerHandlerContribution"),Pm=Symbol.for("DynamicLayerHandlerContribution"),Om=Symbol.for("VirtualLayerHandlerContribution"),Rm=Symbol.for("@visactor/vrender-core/contribution-store-state");function Im(){const t=globalThis;return t[Rm]||(t[Rm]={store:new Map}),t[Rm]}const Dm=Symbol("ContributionProvider");class Lm{constructor(t,e){this.serviceIdentifier=t,this.container=e,jm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function Fm(t,e){return new Lm(t,e)}function zm(t,e){t(Dm).toDynamicValue((({container:t})=>Fm(e,t))).inSingletonScope().whenTargetNamed(e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>Fm(e,t))).whenTargetNamed(e)}class jm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}jm.store=Im().store;class Nm{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=Ql.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Mg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Mg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Nm{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Um({bind:t}){t(vg).toDynamicValue((({container:t})=>new mf(Fm(mg,t)))).inSingletonScope(),t(_f).to(Sf),t(Tm).toDynamicValue((({container:t})=>new Af(Fm(Vm,t)))).inSingletonScope(),t(Mm).to(wf).inSingletonScope(),t(Bm).to(wm).inSingletonScope()}const Gm=Symbol.for("RenderService"),Ym=Symbol.for("BeforeRenderConstribution");function Xm({bind:t}){t(Gm).to(em)}const Km=Symbol.for("GraphicPicker"),$m=Symbol.for("PickerService"),qm=Symbol.for("BoundsPicker"),Zm=Symbol.for("GlobalPickerService"),Jm=Symbol.for("PickItemInterceptor"),Qm=Symbol.for("PickServiceInterceptor"),tv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===td,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},ev=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class iv extends gg{constructor(t){super(t),this.type="rect3d",this.numberType=dd}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Yt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return Fp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,nv)}needUpdateTag(t){return super.needUpdateTag(t,nv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Sl,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new rv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rv.NOWORK_ANIMATE_ATTR}}function av(t){return new rv(t)}rv.NOWORK_ANIMATE_ATTR=kp;class ov extends Np{constructor(t){super(t),this.type="arc3d",this.numberType=td}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return ov.NOWORK_ANIMATE_ATTR}}function lv(t){return new ov(t)}ov.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);class hv extends cg{constructor(t){super(t),this.type="pyramid3d",this.numberType=hd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return hv.NOWORK_ANIMATE_ATTR}}function cv(t){return new hv(t)}let dv,uv;function pv(t){return dv||(dv=hf("text",{})),dv.initAttributes(t),dv.AABBBounds}function gv(t){return uv||(uv=hf("richtext",{})),uv.setAttributes(t),uv.AABBBounds}hv.NOWORK_ANIMATE_ATTR=kp;class fv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Fp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=xu.allocateByObj(a),u=new ne(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class vv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=tv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function _v({bind:t,isBound:e}){e($m)||(t(Zm).toSelf(),t($m).toService(Zm)),t(yv).toSelf().inSingletonScope(),t(Jm).toService(yv),t(mv).toSelf().inSingletonScope(),t(Jm).toService(mv),t(vv).toSelf().inSingletonScope(),t(Jm).toService(vv),zm(t,Jm),t(fv).toSelf().inSingletonScope(),t(Qm).toService(fv),zm(t,Qm)}function bv({bind:t}){t(md).to(ym),t(vd).toConstantValue(of)}const xv=Symbol.for("AutoEnablePlugins"),Sv=Symbol.for("PluginService");class Av{constructor(){this.type="static",this.offscreen=!1,this.global=ah.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Cd({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()}}function kv(t){(function({bind:t}){zm(t,mg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),zm(t,Vm)}({bind:t.bind}),function({bind:t}){t(Av).toSelf(),t(Em).toService(Av)}({bind:t.bind})}const Cv=zt/2;function wv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!$(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Cv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!$(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Cv,!1)}if(o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),!$(S,A)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Cv,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Cv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Mv(t,e){return!(!t&&!e)}function Tv(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Ev(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Pv(t,e){return t*e>0}function Ov(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Rv(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*uE*E+P*P&&(k=w,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Ut(c),k=n*Xt(c),C=s*Ut(u),w=s*Xt(u);let M,T,B,E;if((b>Ft||_>Ft)&&(M=n*Ut(d),T=n*Xt(d),B=s*Ut(p),E=s*Xt(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:B,yirs:E,xore:M,yore:T,xire:C,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Lv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Nt-Ft)e.moveTo(i+n*Ut(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Ut(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:w,innerDeltaAngle:M,innerEndAngle:T,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:O}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(y,m),o=Iv(g,f,u,p,n,t,Number(c)),l=Iv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Ut(Wt(l.y01,l.x01)),s+o.cy+m*Xt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ut(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Ut(C),s+n*Xt(C));if(!(r>Ft)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(w>Ft){const t=Yt(E,w),n=Yt(P,w),o=Iv(S,A,b,x,r,-n,Number(c)),l=Iv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ut(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,T,B,c):e.moveTo(i+r*Ut(B),s+r*Xt(B))}return a?a[3]&&e.lineTo(i+n*Ut(o),s+n*Xt(o)):e.closePath(),d}const Fv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class zv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=yf.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])),yf.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Nt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=yf.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Ug({}));const C=h.columns?v/h.columns:b,w=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,w-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:Fv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=yf.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),yf.free(l),c}yf.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const Hv=new zv;class jv{constructor(){this.time=xo.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,w-=m;const T=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:su(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:w-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Lv(t,e,i,s,M+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&T(u,"outerBorder"),f&&T(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:w,startAngle:y,endAngle:_})}}const Nv=new jv,Vv=Hv,Wv=Ff;class Uv{constructor(){this.time=xo.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:su(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Gv=new Uv,Yv=Hv,Xv=Ff;class Kv extends Lf{constructor(){super(...arguments),this.time=xo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Hf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const $v=new Kv;function qv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Zv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:k-i)||0,T=(null!=T?T:C-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:su(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,T-o*g)):(e.beginPath(),wv(e,u,p,M-o*g,T-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}class Jv{constructor(){this.time=xo.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;qv(p)&&(u.doStroke=!1)}}class Qv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,qv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return wv(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ty=new Zv,ey=Hv,iy=Ff;class sy extends Zv{constructor(){super(...arguments),this.time=xo.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)}}const ny=new sy,ry=Ff;class ay{constructor(){this.time=xo.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:su(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class oy{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const ly=new ay,hy=new oy,cy=Hv,dy=Ff,uy=Hv,py=Ff;class gy extends zv{constructor(){super(...arguments),this.time=xo.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:bh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:bh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:bh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:bh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class fy{constructor(t){this.groupRenderContribitions=t,this.numberType=nd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push($v)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Fp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:w=l.y}=t.attribute,M=Ev(p,m,g,f,c),T=Ov(p,v,g,f),B=Mv(c,u),E=Tv(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(M||T||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),wv(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push($v));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===xo.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o,P)})),h&&e.clip();const O=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,w-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,C-i,w-s,l),e.stroke()))};A?(R(),O()):(O(),R()),this._groupRenderContribitions.forEach((r=>{r.time===xo.afterFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=ah.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Fp(t,null==s?void 0:s.theme).group,i=Su.allocate(),n=Su.allocate();mm(n,t,e),uu(i,p||i,n),a.modelMatrix=i,Su.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Su.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var my,vy=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"}(my||(my={}));class yy extends tm{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=my.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new df([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return vy(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return vy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return vy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>vy(this,void 0,void 0,(function*(){if(2!==t.count)yield Rf(t,jl.zIndex,((i,s)=>{if(this.status===my.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return vy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return vy(this,void 0,void 0,(function*(){this.rendering&&(this.status=my.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=my.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 vy(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:()=>vy(this,void 0,void 0,(function*(){yield Rf(t,jl.zIndex,(t=>vy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const _y=Symbol.for("IncrementalDrawContribution"),by=Symbol.for("ArcRender"),xy=Symbol.for("Arc3dRender"),Sy=Symbol.for("AreaRender"),Ay=Symbol.for("CircleRender"),ky=Symbol.for("GraphicRender"),Cy=Symbol.for("GroupRender"),wy=Symbol.for("LineRender"),My=Symbol.for("PathRender"),Ty=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Ey=Symbol.for("Rect3DRender"),Py=Symbol.for("SymbolRender"),Oy=Symbol.for("TextRender"),Ry=Symbol.for("RichTextRender"),Iy=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Ly=Symbol.for("ImageRender"),Fy=Symbol.for("RenderSelector"),zy=Symbol.for("DrawContribution"),Hy=Symbol.for("StarRender"),jy=Symbol.for("DrawItemInterceptor"),Ny=new Ve,Vy=new Ve;class Wy{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){Ny.copy(s.dirtyBounds),Vy.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,xu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Ny),s.backupDirtyBounds.copy(Vy)),!0}}class Uy{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}}class Gy{constructor(){this.order=1,this.interceptors=[new Wy,new Xy,new Yy,new Uy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Su.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const Ky=Symbol.for("ArcRenderContribution"),$y=Symbol.for("AreaRenderContribution"),qy=Symbol.for("CircleRenderContribution"),Zy=Symbol.for("GroupRenderContribution"),Jy=Symbol.for("ImageRenderContribution"),Qy=Symbol.for("PathRenderContribution"),t_=Symbol.for("PolygonRenderContribution"),e_=Symbol.for("RectRenderContribution"),i_=Symbol.for("SymbolRenderContribution"),s_=Symbol.for("TextRenderContribution"),n_=Symbol.for("StarRenderContribution"),r_=Symbol.for("CommonRenderContribution"),a_=Symbol.for("InteractiveSubRenderContribution");function o_(t){!function({bind:t}){t(Lf).toSelf().inSingletonScope(),t(zv).toSelf().inSingletonScope(),t(zy).to(tm),t(_y).to(yy),t(Cy).toDynamicValue((({container:t})=>new fy(Fm(Zy,t)))).inSingletonScope(),t(ky).toService(Cy),zm(t,Zy),zm(t,a_),t(Kf).toDynamicValue((({container:t})=>new Kf(Fm(a_,t)))).inSingletonScope(),zm(t,ky),t(Gy).toSelf().inSingletonScope(),t(jy).toService(Gy),zm(t,jy)}({bind:t.bind})}class l_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class h_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new l_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function c_(){return new h_}const d_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const u_=function(){const t=globalThis;return t[d_]||(t[d_]={legacyBindingContext:c_(),preloaded:!1}),t[d_]}(),p_=u_.legacyBindingContext;function g_(){u_.preloaded||(u_.preloaded=!0,Um({bind:p_.bind}),bv({bind:p_.bind}),Xm({bind:p_.bind}),_v({bind:p_.bind,isBound:p_.isBound}),function({bind:t}){t(Sv).to(om),Hm(t,xv)}({bind:p_.bind}),kv(p_),o_(p_))}function f_(){return p_}function m_(t){g_();const[e]=p_.getAll(t);return e}function v_(t,e){return g_(),p_.getNamed(t,e)}function y_(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const __=y_((()=>m_(vg)));ah.global=__;class b_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?ah.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:ah.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Xg("text"===t.type&&t.attribute?t.attribute:Fp(t).text)}getTransformOfText(t){const e=Fp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const u=t.globalAABBBounds;let g=n.anchorType;if(d(g)&&(g="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===g&&(g="top-left"),"position"===g||u.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=Fe(u,g);l=t.x,h=t.y}const f=ah.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),y=e.viewBox,_=l+m.left-f.left+y.x1,b=h+m.top-f.top+y.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===g&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),c(n.style)){const e=n.style({top:b,left:_,width:u.width(),height:u.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else p(n.style)?o=Object.assign(Object.assign({},o),n.style):v(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));ah.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===ah.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{this.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&&ah.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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=d(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"===ah.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 x_=()=>{km.registerPlugin("HtmlAttributePlugin",b_)};class S_ extends b_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?ah.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&ah.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const A_=()=>{km.registerPlugin("ReactAttributePlugin",S_)};class k_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return k_.instance||(k_.instance=new k_),k_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function C_(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function w_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:M_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=C_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:M_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=C_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:w,customType:M,controlOptions:T}=t,B=e.animate();B.priority=k;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],O=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&O&&(i=null!==(h=P[O])&&void 0!==h?h:i),B.startAt(b);const R=i*x+E;R>0&&B.wait(R);let I=null,D=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.props),L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,M,L,D,_,m,f,T,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(B,e,p,D);let z=0;x&&(z=x*(s-i-1));const H=c(y)?y(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&B.wait(z),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,y,_,b;if(e&&i){i=C_(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(y=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:M_.builtInAnimateMap[r],m=t.custom?t.customType:C_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{w_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}M_.builtInAnimateMap={};const T_="appear",B_="disappear",E_="update",P_="highlight",O_="unhighlight";class R_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class I_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new M_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new M_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([T_],[{name:T_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyHighlightState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([O_],[{name:O_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new I_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new R_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class L_{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-L_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*L_.bounceIn(2*t):.5*L_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){L_[t]=e}}function F_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}L_.quadIn=L_.getPowIn(2),L_.quadOut=L_.getPowOut(2),L_.quadInOut=L_.getPowInOut(2),L_.cubicIn=L_.getPowIn(3),L_.cubicOut=L_.getPowOut(3),L_.cubicInOut=L_.getPowInOut(3),L_.quartIn=L_.getPowIn(4),L_.quartOut=L_.getPowOut(4),L_.quartInOut=L_.getPowInOut(4),L_.quintIn=L_.getPowIn(5),L_.quintOut=L_.getPowOut(5),L_.quintInOut=L_.getPowInOut(5),L_.backIn=L_.getBackIn(1.7),L_.backOut=L_.getBackOut(1.7),L_.backInOut=L_.getBackInOut(1.7),L_.elasticIn=L_.getElasticIn(1,.3),L_.elasticOut=L_.getElasticOut(1,.3),L_.elasticInOut=L_.getElasticInOut(1,.3*1.5),L_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),L_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},L_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)L_[`flicker${t}`]=e=>F_(e,t);for(let t=2;t<10;t++)L_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function z_(t,e,i){return t+(e-t)*i}const H_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=z_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=z_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=z_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=z_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=z_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=z_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=z_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=z_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=z_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Pu(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Fu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Pu(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Fu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=z_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=z_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=z_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=z_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=z_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=z_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=z_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=z_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=z_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=_h(e,i,s),r.addUpdateBoundTag()}}};function j_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:yo.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=L_[s])&&void 0!==n?n:L_.linear:L_.linear,"wait"===t&&(this.onUpdate=q_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=q_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=Bu.Get(i,Tu.Color255),r=Bu.Get(s,Tu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(H_["fill"===e?"fillPure":"strokePure"])}else H_[e]?t.push(H_[e]):t.push(j_)}else H_[e]?t.push(H_[e]):t.push(j_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class Q_ extends J_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();K_(this.target,t,yo.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class tb extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const eb=new tb;eb.isGlobal=!0;class ib extends J_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class sb extends ib{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class nb extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class rb extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){K_(this.target,this.from,yo.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ab(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class hb{constructor(t=Va.GenAutoIncrementId(),e=eb,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(lb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new J_(Tl.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new Q_(Tl.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new rb(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(lb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&K_(this.target,this._startProps,yo.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const cb=new pf;class db{constructor(){this.released=!1}tick(t,e){cb.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class ub extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ml.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ml.INITIAL,ah.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),ah.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new db;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ml.INITIAL&&(this.status=Ml.PAUSE,!0)}resume(){return this.status!==Ml.INITIAL&&(this.status=Ml.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ml.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ml.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ml.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ml.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ml.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ml.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,ah.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function gb(){U(Tp,D_),U(Tp,pb)}function fb(){lf("arc",Vp)}function mb(){lf("arc3d",lv)}function vb(){lf("area",Gp)}function yb(){lf("circle",Kp)}function _b(){lf("glyph",qp)}function bb(){lf("group",Qp)}function xb(){lf("image",ig)}function Sb(){lf("line",rg)}function Ab(){lf("path",lg)}function kb(){lf("polygon",dg)}function Cb(){lf("pyramid3d",cv)}function wb(){lf("rect",fg)}function Mb(){lf("rect3d",sv)}function Tb(){lf("richtext",Hg)}function Bb(){lf("shadowRoot",Ng)}function Eb(){lf("star",av)}function Pb(){lf("symbol",Ug)}function Ob(){lf("text",Zg)}function Rb(){lf("wrapText",tf)}function Ib(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Lb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(qf),e(Jf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===xo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===xo.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Fp(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=Bv(d,u,h),_=Pv(d,g),b=Mv(h),x=Tv(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Mo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Pv(o,c),g=Mv(n,r),f=Tv(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||vm(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Su.allocate(),n=Su.allocate();mm(n,t,e),uu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Su.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Su.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class Fb extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Qc,this.builtinContributions=[Nv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nFt){const t=Yt(b,_),r=Yt(x,_),a=Iv(v,y,f,m,n,t,Number(u)),o=Iv(A,k,C,w,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||T<.001)e.lineTo(i+C,s+w),p=!0;else if(M>Ft){const t=Yt(E,M),n=Yt(P,M),a=Iv(C,w,A,k,r,-n,Number(u)),o=Iv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Ut(B),s+r*Xt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Fp(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let w=0;const M=(h(S)&&S||S[0])&&"conical"===c.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Nt-Ft){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),T||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Uu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const zb=new WeakSet;function Hb({bind:t}){Ib(zb,t)||(t(Fb).toDynamicValue((({container:t})=>new Fb(Fm(Ky,t)))).inSingletonScope(),t(by).toService(Fb),t(ky).toService(by),t(Ky).toService(Kf),zm(t,Ky))}const jb=Hb;class Nb extends Lb{constructor(){super(...arguments),this.numberType=td}drawShape(t,e,i,s,n,r,a,o){var l;const h=Fp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Tu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},w={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Nt-Ft)e.moveTo(i+r*Ut(o),s+r*Xt(o),n),e.arc(i,s,r,o,l,!c,n),a>Ft&&(e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Ut(p),y=r*Xt(p),_=a*Ut(f),b=a*Xt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>Ft)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Nt,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=Ft)e.moveTo(i,s,n);else if(c>=Nt-Ft)e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Ut(h),s+a*Xt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Ut(c),f=a*Xt(c),m=a*Ut(p),v=a*Xt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Ib(Vb,t)||(t(Nb).toDynamicValue((()=>new Nb)).inSingletonScope(),t(xy).toService(Nb),t(ky).toService(xy))}const Ub=Wb;function Gb(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]=Lo(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 Yb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?_o.ROW:_o.COLUMN,Number.isFinite(c)||(o=_o.COLUMN),Number.isFinite(d)||(o=_o.ROW);const u=i*(o===_o.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Gb(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),Gb(t,l,1,s),o=!1):o=!0}t.closePath()}function Kb(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function $b(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Kb(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Gb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=_o.ROW:"y"===s?u=_o.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Zb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Jb=new gy,Qb=Ff;class tx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ed,this.builtinContributions=[Jb,Qb],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Fp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:w,points:M,segments:T}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===C&&!T&&!M.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,_,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=xl(E(t.points,x),B,{startPoint:e,curveTension:b});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=xl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=xl(e,B,{curveTension:b}),n=xl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Yt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=_o.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Vt(_.x-b.x),A=Vt(_.y-b.y);x=null==_.x1?_o.ROW:null==_.y1?_o.COLUMN:Number.isFinite(S+A)?S>A?_o.ROW:_o.COLUMN:_o.ROW,Yb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),$b(t,i[0]?e.top:e.bottom,l,x===_o.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ex=new WeakSet;function ix({bind:t}){Ib(ex,t)||(t(tx).toDynamicValue((({container:t})=>new tx(Fm($y,t)))).inSingletonScope(),t(Sy).toService(tx),t(ky).toService(Sy),t($y).toService(Kf),zm(t,$y))}const sx=ix;class nx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Gv,Xv,Yv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const rx=new WeakSet;function ax({bind:t}){Ib(rx,t)||(t(nx).toDynamicValue((({container:t})=>new nx(Fm(qy,t)))).inSingletonScope(),t(Ay).toService(nx),t(ky).toService(Ay),t(qy).toService(Kf),zm(t,qy))}const ox=ax;class lx{constructor(){this.numberType=sd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Fp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const hx=new WeakSet;function cx({bind:t}){Ib(hx,t)||(t(lx).toDynamicValue((()=>new lx)).inSingletonScope(),t(Dy).toService(lx),t(ky).toService(Dy))}const dx=cx,ux=["","repeat-x","repeat-y","repeat"];function px(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?ux[i]:"no-repeat"}function gx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=px(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const fx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function mx(t){return{backgroundMode:fx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function vx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=gx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function yx(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=gx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?mx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Xf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class _x extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=rd,this.builtinContributions=[ny,ry],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:_=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:w,doStroke:M}=A;if(!S||!t.resources)return;const T=t.resources.get(S);if("success"!==T.state)return;const B=t.width,E=t.height;e.beginPath();let P=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,B,E):(wv(e,i,s,B,E,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const O=()=>{w&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),yx(e,T.data,i,s,B,E,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x})))},R=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=vx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x}),D=P||I;g?(R(),D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore()):(D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore(),R()),this.afterRenderStep(t,e,i,s,w,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&v(s))return void oh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Fp(t).image;this._draw(t,a,!1,i)}}const bx=new WeakSet;function xx({bind:t}){Ib(bx,t)||(t(Ly).toDynamicValue((({container:t})=>new _x(Fm(Jy,t)))).inSingletonScope(),t(ky).toService(Ly),t(Jy).toService(Kf),zm(t,Jy))}const Sx=xx;class Ax extends Lb{constructor(){super(...arguments),this.numberType=ad}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();$b(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=xl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const kx=new WeakSet;function Cx({bind:t}){Ib(kx,t)||(t(Ax).toDynamicValue((()=>new Ax)).inSingletonScope(),t(wy).toService(Ax),t(ky).toService(wy))}const Mx=Cx,Tx=Hv,Bx=Ff;class Ex extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=od,this.builtinContributions=[Bx,Tx],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:Fp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Mo(t.pathShape.commandList,e,i,s,1,1,f);else{Mo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Px=new WeakSet;function Ox({bind:t}){Ib(Px,t)||(t(Ex).toDynamicValue((({container:t})=>new Ex(Fm(Qy,t)))).inSingletonScope(),t(My).toService(Ex),t(ky).toService(My),t(Qy).toService(Kf),zm(t,Qy))}const Rx=Ox;function Ix(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Ix(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Ix(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Lx(h,y,_,d,u),A=Lx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,w=Dx(k,C),M=Lx(h,Dx(y,v),w,k,C);let T=Math.atan2(S.y-M.y,S.x-M.x);const B=Math.atan2(A.y-M.y,A.x-M.x);let E=B-T;E<0&&(T=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const jx=new WeakSet;function Nx({bind:t}){Ib(jx,t)||(t(Ty).toDynamicValue((({container:t})=>new Hx(Fm(t_,t)))).inSingletonScope(),t(ky).toService(Ty),t(t_).toService(Kf),zm(t,t_))}const Vx=Nx;class Wx extends Lb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Tu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Ux extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=hd}drawShape(t,e,i,s,n,r,a,o){var l;const h=Fp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=Fp(t).polygon;this._draw(t,s,!1,i)}}const Gx=new WeakSet;function Yx({bind:t}){Ib(Gx,t)||(t(Ux).toDynamicValue((()=>new Ux)).inSingletonScope(),t(Iy).toService(Ux),t(ky).toService(Iy))}const Xx=Yx;class Kx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=cd,this.builtinContributions=[ty,iy,ey],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Fp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:M}=t.attribute;w=(null!=w?w:b-S)||0,M=(null!=M?M:x-A)||0;const T=Ev(g,f,w,M,h),B=Ov(g,v,w,M,C),E=Mv(h,c),P=Tv(d,m);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||B||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,M)):(e.beginPath(),wv(e,i,s,w,M,u,"bevel"!==p));const O={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,T,B,l,n,a,o,O),k?(this._runStroke(t,e,i,s,l,O,B,S,A,o),this._runFill(t,e,i,s,l,O,T,S,A,a)):(this._runFill(t,e,i,s,l,O,T,S,A,a),this._runStroke(t,e,i,s,l,O,B,S,A,o)),this.afterRenderStep(t,e,i,s,E,P,T,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const $x=new WeakSet;function qx({bind:t}){Ib($x,t)||(t(Kx).toDynamicValue((({container:t})=>new Kx(Fm(e_,t)))).inSingletonScope(),t(By).toService(Kx),t(ky).toService(By),t(Qv).toSelf(),t(Jv).toSelf(),t(e_).toService(Qv),t(e_).toService(Jv),t(e_).toService(Kf),zm(t,e_))}const Zx=qx;class Jx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=dd}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=Fp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,w=Ev(v,y,A,k,d),M=Ov(v,b,A,k,S),T=Mv(d),B=Tv(u,_);if(!t.valid||!x)return;if(!T&&!B)return;if(!(w||M||a||o))return;const{light:E}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,E,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=Fp(t).rect;this._draw(t,s,!1,i)}}const Qx=new WeakSet;function tS({bind:t}){Ib(Qx,t)||(t(Jx).toDynamicValue((()=>new Jx)).inSingletonScope(),t(Ey).toService(Jx),t(ky).toService(Ey))}const eS=tS;const iS=new class extends Lf{constructor(){super(...arguments),this.time=xo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:T=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:O=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let I,{background:D}=t.attribute;if(!D)return;const L=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=p(D)&&D.background?D:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(g=z.dx)&&void 0!==g?g:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),D=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=pv(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 i=t.resources.get(D);if(!i||"success"!==i.state||!i.data)return void L();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,O&&(e.beginPath(),R?wv(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:w,backgroundKeepAspectRatio:M,backgroundScale:T,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=D,R?(wv(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),L()}};class sS extends Lb{constructor(){super(),this.numberType=ud,this.builtinContributions=[iS],this.init()}drawShape(t,e,i,s,n){const r=Fp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Fp(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(),wv(e,i-t,s-n,v,y,f,!0)),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=Fp(t).richtext;this._draw(t,s,!1,i)}}const nS=new WeakSet;function rS({bind:t}){Ib(nS,t)||(t(sS).toDynamicValue((()=>new sS)).inSingletonScope(),t(Ry).toService(sS),t(ky).toService(Ry))}const aS=rS;class oS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=pd,this.builtinContributions=[py,uy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const lS=new WeakSet;function hS({bind:t}){Ib(lS,t)||(t(oS).toDynamicValue((({container:t})=>new oS(Fm(n_,t)))).inSingletonScope(),t(Hy).toService(oS),t(ky).toService(Hy),zm(t,n_))}const cS=hS;class dS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[ly,dy,cy,hy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Fp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,M=s,T=C;const B=e.camera;if(k&&B&&e.project){const t=e.project(i,s,C);e.camera=null,y(c)&&(c[0],c[1]),w=t.x,M=t.y,T=void 0}!1===A.draw(e,c,w,M,T,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const uS=new WeakSet;function pS({bind:t}){Ib(uS,t)||(t(dS).toDynamicValue((({container:t})=>new dS(Fm(i_,t)))).inSingletonScope(),t(Py).toService(dS),t(ky).toService(Py),t(i_).toService(Kf),zm(t,i_))}const gS=pS;class fS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[iS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Fp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=kh(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:w}=S,M=!f,T=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,w,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,T,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=xu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),xu.free(t)}w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,T))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,T))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,T),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,T)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,T),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,T,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,T,e),this.afterRenderStep(t,e,i,s,C,w,A,k,d,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:Gg(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const mS=new WeakSet;function vS({bind:t}){Ib(mS,t)||(t(Oy).toDynamicValue((({container:t})=>new fS(Fm(s_,t)))).inSingletonScope(),t(ky).toService(Oy),t(s_).toService(Kf),zm(t,s_))}const yS=vS,_S=fm();function bS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function xS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const SS=Symbol.for("MathPickerContribution"),AS=Symbol.for("MathArcPicker"),kS=Symbol.for("MathAreaPicker"),CS=Symbol.for("MathCirclePicker"),wS=Symbol.for("MathImagePicker"),MS=Symbol.for("MathLinePicker"),TS=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),ES=Symbol.for("MathSymbolPicker"),PS=Symbol.for("MathTextPicker"),OS=Symbol.for("MathPolygonPicker"),RS=Symbol.for("MathGlyphPicker"),IS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),LS=Symbol.for("CanvasArc3dPicker"),FS=Symbol.for("CanvasAreaPicker"),zS=Symbol.for("CanvasCirclePicker"),HS=Symbol.for("CanvasImagePicker"),jS=Symbol.for("CanvasGifImagePicker"),NS=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),US=Symbol.for("CanvasRectPicker"),GS=Symbol.for("CanvasRect3dPicker"),YS=Symbol.for("CanvasSymbolPicker"),XS=Symbol.for("CanvasTextPicker"),KS=Symbol.for("CanvasPolygonPicker"),$S=Symbol.for("CanvasPyramid3dPicker"),qS=Symbol.for("CanvasRichTextPicker"),ZS=Symbol.for("CanvasGlyphPicker"),JS=Symbol.for("CanvasGroupPicker"),QS=Symbol.for("CanvasStarPicker"),tA=Symbol.for("CanvasPickerContribution"),eA=f_(),iA=y_((()=>m_(Tm))),sA=y_((()=>m_(Mm))),nA=y_((()=>m_(md))),rA=y_((()=>m_(Bm)));function aA(){ah.global=__,ah.graphicUtil=iA,ah.transformUtil=sA,ah.graphicService=nA,ah.layerService=rA,ah.canvasFactory=t=>v_(Ad,t),ah.context2dFactory=t=>v_(kd,t),ah.windowFactory=()=>new Sf(ah.global),ah.windowHandlerFactory=t=>function(t){const e=v_(bf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),ah.renderServiceFactory=()=>m_(Gm),ah.renderService=y_((()=>m_(Gm))),ah.pluginServiceFactory=()=>m_(Sv),ah.pluginService=y_((()=>m_(Sv))),ah.pickerServiceFactory=()=>m_($m),ah.layerHandlerFactory=t=>m_("static"===t?Em:"dynamic"===t?Pm:Om),ah.incrementalDrawContributionFactory=()=>m_(_y)}aA();var oA=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 lA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return oA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class hA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class cA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Tu.Color1),this.ambient=i;const s=Kt(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=Yt(Gt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=v(e)?Bu.Get(e,Tu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const dA=()=>{km.registerPlugin("DirectionalLight",cA)};class uA{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=Su.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Su.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return pu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Su.allocate()),this._vp=uu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Su.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Su.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return gu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Su.allocate()),this._vp=uu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return fu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;fu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const pA=()=>{km.registerPlugin("OrthoCamera",uA)},gA={getContributions:()=>[]},fA={getContributions:()=>[]};class mA{constructor(t=gA,e=fA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:ah.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:gA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:fA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ue(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Fp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new ne(e.x,e.y);l.transformPoint(a,a);const o=Fp(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&&Su.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),xu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class vA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new im,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new sm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new rm,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new nm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new xm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new Am,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new ef}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new em(new tm([],(t=this.registry.contribution,e=jy,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class yA{constructor(t={}){this.context=new vA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function _A(t={}){return new yA(t)}class bA extends yA{}class xA extends yA{}class SA extends tx{constructor(){super(...arguments),this.numberType=ed}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=Fp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=Mv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=Fp(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=Bv(u,p,c),y=Pv(u,g),_=Mv(c),b=Tv(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{};function DA(){wA.preloaded||(wA.preloaded=!0,Um({bind:MA.bind}),bv({bind:MA.bind}),Xm({bind:MA.bind}),_v({bind:MA.bind,isBound:MA.isBound}),kv(MA),o_(MA))}function LA(t,e){const i=jA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function FA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function zA(t,e){let i=EA.get(t);i||(i=new Map,EA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function HA(t,e,i){const s=zA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function jA(){return DA(),MA}function NA(){jm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=wA.runtimeGlobal)&&void 0!==t||(wA.runtimeGlobal=new mf(Fm(mg,MA))),wA.runtimeGlobal}function WA(t){const e=jA(),i=VA();ah.global=i,ah.canvasFactory=t=>e.getNamed(Ad,t),ah.context2dFactory=t=>e.getNamed(kd,t),ah.windowHandlerFactory=t=>LA(bf,t),ah.windowFactory=()=>new Sf(i,(t=>LA(bf,t))),ah.pluginServiceFactory=()=>new om(Fm(xv,e),{pluginRegistry:t.context.registry.plugin}),ah.incrementalDrawContributionFactory=()=>new yy([],new AA,new SA(Fm($y,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,jy))}function UA(t){var e;const i=jA();NA();const s=i.getAll(ky),n=zA(t.registry.renderer,TA);HA(t.registry.renderer,TA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),FA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,TA)}function GA(t){var e;const i=jA();NA();const s=i.getAll(jy),n=null!==(e=PA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,jy,e)})),n.clear(),PA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(jy));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(jy,e),r.add(e)),n.add(e)}))}function YA(t,e){var i;const s=jA();NA();const n=s.getAll(e),r=zA(t.registry.picker,BA);HA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),FA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function XA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=OA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,IA,t.isBound,t.rebind),function(t,e){let i=OA.get(t);i||(i=new WeakSet,OA.set(t,i)),i.add(e)}(t,e))}function KA(t,{app:e,legacy:i=!0,targets:s}={}){XA(jA(),t),i&&(g_(),XA(f_(),t)),NA(),e&&function(t,e){const i=null!=e?e:RA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&GA(t),s&&UA(t),r.forEach((e=>{YA(t,e)}))}(e,s)}function $A(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function qA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function ZA(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 JA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ak(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=ug(t.attribute),n=lk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=lk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=lk(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{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;n{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return yk(l,e,h),h},gk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return uk(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 uk(t,e)}return[]};const fk=t=>t.map((t=>({x:t.x,y:t.y}))),mk=(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]},vk=t=>{const e=new Ne;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return mk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return mk(t,{x:e.x1,y:n},{x:e.x2,y:n})},yk=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=vk(t);yk(n[0],s,i),yk(n[1],e-s,i)}},_k=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:fk(i)}];const s=[];return yk(i,e,s),s},bk=(t,e)=>{const i=rk(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;rObject.assign({},t))):[]}function Sk(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:xk(t.touches),configurable:!0},changedTouches:{value:xk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Ak(t,e){try{return t[e]}catch(t){return}}function kk(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Sk(t),l=Ak(t,"target"),h=Ak(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Ck=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Tk(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:Mk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},wk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},wk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Ck(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=Mk(i,this.selectionStartCursorIdx),a=Mk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=wk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Tk(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),ah.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),ah.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Ek{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=Mk(i,Math.ceil(t)),n=Mk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=Mk(i.attribute.textConfig,a),h=Mk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Pk,[this.formatTextCommandCb]),this.commandCbs.set(Ok,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):p(t)&&e.forEach((e=>z(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),ah.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(ah.global.isMacOS()&&t.metaKey&&"c"===t.key||!ah.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return ah.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(ah.global.isMacOS()&&t.metaKey&&"a"===t.key||!ah.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},wk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=Hg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:gv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||fg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},wk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),ah.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=Qp({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Rk.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=rg({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=Qp({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=gv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=gv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(fg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(fg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(fg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=gv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=gv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:gv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Jk=new Zk;class Qk{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const tC=()=>{km.registerPlugin("ViewTransform3dPlugin",Qk)},eC=new Ve;class iC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Fp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&eC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(eC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const sC=()=>{km.registerPlugin("FlexLayoutPlugin",iC)};var nC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:nh,ARC3D_NUMBER_TYPE:td,ARC_NUMBER_TYPE:Qc,AREA_NUMBER_TYPE:ed,AbstractGraphicRender:class{},get AnimateMode(){return wl},get AnimateStatus(){return Bl},get AnimateStepType(){return Tl},AppContext:vA,Application:sh,Arc:Np,Arc3d:ov,Arc3dRender:xy,ArcRender:by,ArcRenderContribution:Ky,Area:Up,AreaRender:Sy,AreaRenderContribution:$y,get AttributeUpdateType(){return yo},AutoEnablePlugins:xv,Base3dRender:Wx,BaseCanvas:Mu,BaseEnvContribution:lA,BaseRender:Lb,get BaseRenderContributionTime(){return xo},BaseWindowHandlerContribution:hA,Basis:Ko,BeforeRenderConstribution:Ym,BoundsContext:so,BoundsPicker:qm,BrowserEntry:yA,CIRCLE_NUMBER_TYPE:id,CONTRIBUTION_STORE_STATE_SYMBOL:Rm,Canvas3DDrawItemInterceptor:Xy,Canvas3DPickItemInterceptor:yv,CanvasFactory:Ad,CanvasTextLayout:Kg,Circle:Xp,CircleRender:Ay,CircleRenderContribution:qy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Tu},CommonDrawItemInterceptorContribution:Gy,CommonRenderContribution:r_,Context2dFactory:kd,ContributionProvider:Dm,ContributionRegistry:rm,ContributionStore:jm,CubicBezierCurve:Fo,CurveContext:bl,get CurveTypeEnum(){return bo},CustomEvent:$a,CustomPath2D:Sl,CustomSymbolClass:Mc,DEFAULT_TEXT_FONT_FAMILY:yg,DebugDrawItemInterceptorContribution:Uy,DefaultArcAllocate:Fk,DefaultArcAttribute:Nl,DefaultArcRenderContribution:jv,DefaultAreaAllocate:Hk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:gy,DefaultAttribute:jl,DefaultBaseBackgroundRenderContribution:Lf,DefaultBaseClipRenderAfterContribution:Zf,DefaultBaseClipRenderBeforeContribution:$f,DefaultBaseInteractiveRenderContribution:Kf,DefaultBaseTextureRenderContribution:zv,DefaultCanvasAllocate:vf,DefaultCanvasArc3DRender:Nb,DefaultCanvasArcRender:Fb,DefaultCanvasAreaRender:tx,DefaultCanvasCircleRender:nx,DefaultCanvasGroupRender:fy,DefaultCanvasImageRender:_x,DefaultCanvasLineRender:Ax,DefaultCanvasPathRender:Ex,DefaultCanvasPolygonRender:Hx,DefaultCanvasPyramid3dRender:Ux,DefaultCanvasRect3dRender:Jx,DefaultCanvasRectRender:Kx,DefaultCanvasSymbolRender:dS,DefaultCanvasTextRender:fS,DefaultCircleAllocate:Nk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Uv,DefaultConnectAttribute:zl,DefaultDebugAttribute:Hl,DefaultFillStyle:Ol,DefaultGlobal:mf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Gl,DefaultGraphicAllocate:Ik,DefaultGraphicMemoryManager:Zk,DefaultGraphicService:ym,DefaultGraphicUtil:Af,DefaultGroupAttribute:Ul,DefaultGroupBackgroundRenderContribution:Kv,DefaultImageAttribute:eh,DefaultImageRenderContribution:sy,DefaultLayerService:wm,DefaultLayout:El,DefaultLineAllocate:Wk,DefaultLineAttribute:Yl,DefaultMat4Allocate:bu,DefaultMatrixAllocate:_u,DefaultPathAllocate:Gk,DefaultPathAttribute:Xl,DefaultPickService:mA,DefaultPickStyle:Ll,DefaultPolygonAttribute:Kl,DefaultRect3dAttribute:Zl,DefaultRectAllocate:Dk,DefaultRectAttribute:ql,DefaultRectRenderContribution:Zv,DefaultRenderService:em,DefaultRichTextAttribute:th,DefaultRichTextIconAttribute:ih,DefaultStarAttribute:$l,DefaultStrokeStyle:Il,DefaultStyle:Fl,DefaultSymbolAllocate:Xk,DefaultSymbolAttribute:Jl,DefaultSymbolClipRangeStrokeRenderContribution:oy,DefaultSymbolRenderContribution:ay,DefaultTextAllocate:$k,DefaultTextAttribute:Ql,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Pl,DefaultTransformUtil:wf,DefaultWindow:Sf,get Direction(){return _o},DirectionalLight:cA,DrawContribution:zy,DrawItemInterceptor:jy,DynamicLayerHandlerContribution:Pm,get Edge(){return hh},EditModule:Bk,EmptyContext2d:Cu,EnvContribution:mg,EventManager:Ja,EventSystem:eo,EventTarget:Qa,FACTORY_STATE_SYMBOL:Mf,FORMAT_ALL_TEXT_COMMAND:Ok,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Pk,Factory:km,FederatedEvent:Ga,FederatedMouseEvent:Ya,FederatedPointerEvent:Xa,FederatedWheelEvent:Ka,FlexLayoutPlugin:iC,GLYPH_NUMBER_TYPE:sd,GRAPHIC_CLASS_SYMBOL:wp,GRAPHIC_REGISTRY_SYMBOL:nf,GRAPHIC_UPDATE_TAG_KEY:up,GROUP_NUMBER_TYPE:nd,Generator:Va,GlobalPickerService:Zm,Glyph:$p,GlyphRender:Dy,GradientParser:iu,Graphic:Tp,GraphicCreator:vd,GraphicFactory:ef,GraphicPicker:Km,GraphicRender:ky,GraphicService:md,GraphicUtil:Tm,Group:Jp,GroupRender:Cy,GroupRenderContribution:Zy,get GroupUpdateAABBBoundsMode(){return Zp},HtmlAttributePlugin:b_,get IContainPointMode(){return vo},IMAGE_NUMBER_TYPE:rd,Image:eg,ImageRender:Ly,ImageRenderContribution:Jy,IncrementalDrawContribution:_y,InteractiveDrawItemInterceptorContribution:Yy,InteractivePickItemInterceptorContribution:vv,InteractiveSubRenderContribution:a_,LINE_NUMBER_TYPE:ad,Layer:Sm,LayerFactory:Am,LayerService:Bm,Line:ng,LineRender:wy,Linear:Uo,LinearClosed:ul,Mat4Allocate:vu,MatrixAllocate:mu,get MeasureModeEnum(){return Cl},MiniappEntry:xA,MonotoneX:el,MonotoneY:il,NOWORK_ANIMATE_ATTR:kp,Node:Ua,NodeEntry:bA,OrthoCamera:uA,PATH_NUMBER_TYPE:od,POLYGON_NUMBER_TYPE:ld,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:hd,Path:og,PathRender:My,PathRenderContribution:Qy,PerformanceRAF:pf,PickItemInterceptor:Jm,PickServiceInterceptor:Qm,PickerRegistry:sm,PickerService:$m,PluginRegistry:nm,PluginService:Sv,Polygon:cg,PolygonRender:Ty,PolygonRenderContribution:t_,Pyramid3d:hv,Pyramid3dRender:Iy,RECT3D_NUMBER_TYPE:dd,RECT_NUMBER_TYPE:cd,RICHTEXT_NUMBER_TYPE:ud,RUNTIME_INSTALLER_STATE_SYMBOL:kA,RafBasedSTO:xh,ReactAttributePlugin:S_,Rect:gg,Rect3DRender:Ey,Rect3d:iv,RectRender:By,RectRenderContribution:e_,ReflectSegContext:No,RenderSelector:Fy,RenderService:Gm,RendererRegistry:im,ResourceLoader:oh,RichText:zg,RichTextEditPlugin:Rk,RichTextRender:Ry,STAR_NUMBER_TYPE:pd,get STATUS(){return Ml},SVG_ATTRIBUTE_MAP:yd,SVG_ATTRIBUTE_MAP_KEYS:_d,SVG_PARSE_ATTRIBUTE_MAP:bd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:xd,SYMBOL_NUMBER_TYPE:gd,SegContext:jo,ShadowPickServiceInterceptorContribution:fv,ShadowRoot:jg,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:mv,SplitRectAfterRenderContribution:Qv,SplitRectBeforeRenderContribution:Jv,Stage:bm,StageFactory:xm,Star:rv,StarRender:Hy,StarRenderContribution:n_,StateDefinitionCompiler:Ku,StateEngine:Ju,StaticLayerHandlerContribution:Em,Step:ol,StepClosed:ll,Symbol:Wg,SymbolRender:Py,SymbolRenderContribution:i_,TEXT_NUMBER_TYPE:fd,Text:qg,get TextDirection(){return Xc},TextMeasureContribution:Vm,TextRender:Oy,TextRenderContribution:s_,Theme:Dp,TransformUtil:Mm,get UpdateTag(){return mo},VGlobal:vg,VWindow:_f,ViewTransform3dPlugin:Qk,VirtualLayerHandlerContribution:Om,WILDCARD:"*",WindowHandlerContribution:bf,WrapText:Qg,XMLParser:Vc,_calculateLineHeight:Ah,_interpolateColor:Ou,addArcToBezierPath:Co,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:nk,alignSubpath:JA,application:ah,applyTransformOnBezierCurves:ak,arc3dModule:Ub,arcModule:jb,areaModule:sx,bezier:Ao,bezierCurversToPath:ok,binarySplitPolygon:vk,bindArc3dRenderModule:Wb,bindArcRenderModule:Hb,bindAreaRenderModule:ix,bindCircleRenderModule:ax,bindContributionProvider:zm,bindContributionProviderNoSingletonScope:Hm,bindGlyphRenderModule:cx,bindImageRenderModule:xx,bindLineRenderModule:Cx,bindPathRenderModule:Ox,bindPolygonRenderModule:Nx,bindPyramid3dRenderModule:Yx,bindRect3dRenderModule:tS,bindRectRenderModule:qx,bindRichtextRenderModule:rS,bindStarRenderModule:hS,bindSymbolRenderModule:pS,bindTextRenderModule:vS,boundStroke:Uc,builtInSymbolStrMap:Ec,builtinSymbols:Tc,builtinSymbolsMap:Bc,calcLineCache:xl,calculateArcCornerRadius:Dv,calculateLineHeight:kh,canvasAllocate:yf,centroidOfSubpath:ek,circleBounds:mh,circleModule:ox,clock:qa,colorEqual:function(t,e){const i=ii.parseColorString(t),s=ii.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:ju,configureRuntimeApplicationForApp:WA,container:eA,cornerTangents:Iv,createApp:_A,createArc:Vp,createArc3d:lv,createArea:Gp,createBrowserApp:_A,createCanvasEventTransformer:function(t,e,i,s){return kk(t.parentElement,e,i,s)},createCircle:Kp,createColor:nu,createConicalGradient:Gu,createContributionProvider:Fm,createEventTransformer:kk,createGlyph:qp,createGraphic:hf,createGroup:Qp,createImage:ig,createLine:rg,createMat4:yu,createMiniappApp:function(t={}){return new xA(t)},createNodeApp:function(t={}){return new bA(t)},createPath:lg,createPolygon:dg,createPyramid3d:cv,createRect:fg,createRect3d:sv,createRectPath:wv,createRichText:Hg,createShadowRoot:Ng,createStage:function(t){return aA(),(new xm).create(t)},createStar:av,createSymbol:Ug,createText:Zg,createWrapText:tf,cubicCalc:Po,cubicLength:Eo,cubicPointAt:Oo,cubicSubdivide:ZA,defaultArcAllocate:zk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Nv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:jk,defaultBaseBackgroundRenderContribution:Ff,defaultBaseClipRenderAfterContribution:Jf,defaultBaseClipRenderBeforeContribution:qf,defaultBaseTextureRenderContribution:Hv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Xv,defaultCircleRenderContribution:Gv,defaultCircleTextureRenderContribution:Yv,defaultGraphicMemoryManager:Jk,defaultGroupBackgroundRenderContribution:$v,defaultImageBackgroundRenderContribution:ry,defaultImageRenderContribution:ny,defaultLineAllocate:Uk,defaultPathAllocate:Yk,defaultRectAllocate:Lk,defaultRectBackgroundRenderContribution:iy,defaultRectRenderContribution:ty,defaultRectTextureRenderContribution:ey,defaultStarBackgroundRenderContribution:py,defaultStarTextureRenderContribution:uy,defaultSymbolAllocate:Kk,defaultSymbolBackgroundRenderContribution:dy,defaultSymbolClipRangeStrokeRenderContribution:hy,defaultSymbolRenderContribution:ly,defaultSymbolTextureRenderContribution:cy,defaultTextAllocate:qk,diff:qA,divideCubic:Lo,drawArc:ko,drawArcPath:Lv,drawAreaSegments:Yb,drawBackgroundImage:Xf,drawImageWithLayout:yx,drawIncrementalAreaSegments:Zb,drawIncrementalSegments:qb,drawSegments:$b,enumCommandMap:oo,fillVisible:Bv,findBestMorphingRotation:sk,findConfigIndexByCursorIdx:Mk,findCursorIdxByConfigIndex:Tk,findNextGraphic:If,flatten_simplify:$A,foreach:Of,foreachAsync:Rf,genBasisSegments:qo,genBasisTypeSegments:$o,genLinearClosedSegments:pl,genLinearClosedTypeSegments:gl,genLinearSegments:Go,genLinearTypeSegments:Yo,genMonotoneXSegments:nl,genMonotoneXTypeSegments:sl,genMonotoneYSegments:al,genMonotoneYTypeSegments:rl,genNumberType:Yc,genStepClosedSegments:dl,genStepSegments:hl,genStepTypeSegments:cl,getApplicationState:rh,getAttributeFromDefaultAttrList:bh,getBackgroundImage:Hf,getConicGradientAt:Uu,getContributionStoreState:Im,getCurrentEnv:function(){return fm()?"browser":"node"},getDefaultCharacterConfig:wk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Gg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Su.allocate();return hu(o,o,[a[0],a[1],0]),n&&au(o,o,n),s&&ou(o,o,s),hu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Tf,getGraphicClassState:Mp,getGraphicRegistryState:rf,getLegacyBindingContext:f_,getModelMatrix:mm,getRichTextBounds:gv,getRuntimeInstallerBindingContext:jA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:CA,getScaledStroke:su,getTextBounds:pv,getTheme:Fp,getThemeFromGroup:zp,globalTheme:Lp,glyphModule:dx,graphicCreator:of,graphicService:nA,graphicUtil:iA,identityMat4:ru,imageModule:Sx,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:KA,installRuntimeDrawContributionsToApp:GA,installRuntimeGraphicRenderersToApp:UA,installRuntimePickersToApp:YA,interpolateColor:Pu,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Ru,interpolateGradientRadialColor:Iu,interpolatePureColorArray:Lu,interpolatePureColorArrayToStr:Fu,intersect:Rv,isBrowserEnv:fm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){gm();const t=ah.global&&ah.global.env;return t?"node"===t:!pm},isSvg:jc,isXML:Nc,layerService:rA,lineModule:Mx,lookAt:pu,mapToCanvasPointForCanvas:function(t){var e;if(Pd(t._canvasX)&&Pd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:cu,mat4Allocate:Su,matrixAllocate:xu,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:uu,newThemeObj:Op,ortho:gu,parsePadding:ph,parseStroke:dh,parseSvgPath:fo,pathModule:Rx,pathToBezierCurves:rk,point:Xo,pointEqual:vh,pointInterpolation:yh,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Zt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Zt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>vh(t,e[i]))):!Number.isNaN(t.x+t.y)&&vh(t,e))},pointsInterpolation:_h,polygonModule:Vx,preLoadAllModule:g_,pyramid3dModule:Xx,quadCalc:Ro,quadLength:Do,quadPointAt:Io,rafBasedSto:Sh,rect3dModule:eS,rectFillVisible:Ev,rectModule:Zx,rectStrokeVisible:Ov,recursiveCallBinarySplit:yk,refreshRuntimeInstallerContributions:NA,registerArc3dGraphic:mb,registerArcGraphic:fb,registerAreaGraphic:vb,registerCircleGraphic:yb,registerDirectionalLight:dA,registerFlexLayoutPlugin:sC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=kk(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:_b,registerGraphic:lf,registerGroupGraphic:bb,registerHtmlAttributePlugin:x_,registerImageGraphic:xb,registerLineGraphic:Sb,registerOrthoCamera:pA,registerPathGraphic:Ab,registerPolygonGraphic:kb,registerPyramid3dGraphic:Cb,registerReactAttributePlugin:A_,registerRect3dGraphic:Mb,registerRectGraphic:wb,registerRichtextGraphic:Tb,registerShadowRootGraphic:Bb,registerStarGraphic:Eb,registerSymbolGraphic:Pb,registerTextGraphic:Ob,registerViewTransform3dPlugin:tC,registerWindowEventTransformer:function(t,e,i,s,n){const r=kk(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Rb,renderCommandList:Mo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:mx,resolveBackgroundPosition:Uf,resolveBackgroundSizing:jf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:gx,resolveImageRepeatMode:px,resolveRenderableImageSize:Yf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:aS,rotateX:au,rotateY:ou,rotateZ:lu,runFill:Mv,runStroke:Tv,scaleMat4:du,segments:So,shouldClipImageByLayout:vx,shouldUseMat4:vm,snapLength:Bo,splitArc:ck,splitArea:pk,splitCircle:dk,splitLine:gk,splitPath:bk,splitPolygon:_k,splitRect:hk,splitToGrids:lk,starModule:cS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Pv,symbolModule:gS,textAttributesToStyle:Xg,textDrawOffsetX:Gg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Yg,textModule:yS,transformMat4:fu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:sA,translate:hu,verticalLayout:Kc,vglobal:__,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{ah.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)}))},wrapCanvas:Cd,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=ah.global)||void 0===t?void 0:t.env,s=i?null===(e=ah.context2dFactory)||void 0===e?void 0:e.call(ah,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=y(t)?t[0]:t,i=[];if(!e)return i;if(!0===Nc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Jc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Jc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class rC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:su(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class aC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Qc}}let oC=!1;function lC(t){oC||(oC=!0,t.bind(DS).toDynamicValue((()=>new aC(bS(t,by)))).inSingletonScope(),t.bind(tA).toService(DS))}class hC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Qc}}let cC=!1;function dC(t){cC||(cC=!0,t.bind(AS).toDynamicValue((()=>new hC(bS(t,by)))).inSingletonScope(),t.bind(SS).toService(AS))}function uC(){if(uC.__loaded)return;uC.__loaded=!0;const t=f_();fb(),jb({bind:t.bind}),_S?lC(t):dC(t)}uC.__loaded=!1;const pC=uC;class gC extends Lb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Su.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class fC extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=td,this.themeType="arc"}}let mC=!1;function vC(t){var e;mC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,xy))&&(mC=!0,t.bind(LS).toDynamicValue((()=>new fC(bS(t,xy)))).inSingletonScope(),t.bind(tA).toService(LS))}function yC(){if(yC.__loaded)return;yC.__loaded=!0;const t=f_();mb(),dA(),pA(),Ub({bind:t.bind}),vC(t)}yC.__loaded=!1;const _C=yC;class bC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ed}}let xC=!1;function SC(t){xC||(xC=!0,t.bind(FS).toDynamicValue((()=>new bC(bS(t,Sy)))).inSingletonScope(),t.bind(tA).toService(FS))}class AC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ed}}let kC=!1;function CC(t){kC||(kC=!0,t.bind(kS).toDynamicValue((()=>new AC(bS(t,Sy)))).inSingletonScope(),t.bind(SS).toService(kS))}function wC(){if(wC.__loaded)return;wC.__loaded=!0;const t=f_();vb(),sx({bind:t.bind}),_S?SC(t):CC(t)}wC.__loaded=!1;const MC=wC;class TC{constructor(){this.type="glyph",this.numberType=sd}contains(t,e,i){if(!t.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}}class BC extends TC{constructor(t){super(),this.canvasRenderer=t}}let EC=!1;function PC(t){EC||(EC=!0,t.bind(ZS).toDynamicValue((()=>new BC(bS(t,Dy)))).inSingletonScope(),t.bind(tA).toService(ZS))}class OC extends TC{constructor(t){super(),this.canvasRenderer=t}}let RC=!1;function IC(t){RC||(RC=!0,t.bind(RS).toDynamicValue((()=>new OC(bS(t,Dy)))).inSingletonScope(),t.bind(SS).toService(RS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=f_();_b(),dx({bind:t.bind}),_S?PC(t):IC(t)}DC.__loaded=!1;const LC=DC;function FC(){FC.__loaded||(FC.__loaded=!0,bb())}FC.__loaded=!1;const zC=FC;class HC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=rd}}let jC=!1;function NC(t){jC||(jC=!0,t.bind(HS).toDynamicValue((()=>new HC(bS(t,Ly)))).inSingletonScope(),t.bind(tA).toService(HS))}class VC{constructor(){this.type="image",this.numberType=rd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function UC(t){WC||(WC=!0,t.bind(wS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(SS).toService(wS))}function GC(){if(GC.__loaded)return;GC.__loaded=!0;const t=f_();xb(),Sx({bind:t.bind}),_S?NC(t):UC(t)}GC.__loaded=!1;const YC=GC;class XC extends Lb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:su(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Su.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class KC extends XC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ad}}let $C=!1;function qC(t){$C||($C=!0,t.bind(NS).toDynamicValue((()=>new KC(bS(t,wy)))).inSingletonScope(),t.bind(tA).toService(NS))}class ZC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ad}}let JC=!1;function QC(t){JC||(JC=!0,t.bind(MS).toDynamicValue((()=>new ZC(bS(t,wy)))).inSingletonScope(),t.bind(SS).toService(MS))}function tw(){if(tw.__loaded)return;tw.__loaded=!0;const t=f_();Sb(),Mx({bind:t.bind}),_S?qC(t):QC(t)}tw.__loaded=!1;const ew=tw;class iw extends XC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=od}}let sw=!1;function nw(t){sw||(sw=!0,t.bind(WS).toDynamicValue((()=>new iw(bS(t,My)))).inSingletonScope(),t.bind(tA).toService(WS))}class rw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=od}}let aw=!1;function ow(t){aw||(aw=!0,t.bind(TS).toDynamicValue((()=>new rw(bS(t,My)))).inSingletonScope(),t.bind(SS).toService(TS))}function lw(){if(lw.__loaded)return;lw.__loaded=!0;const t=f_();Ab(),Rx({bind:t.bind}),_S?nw(t):ow(t)}lw.__loaded=!1;const hw=lw;class cw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ld}}let dw=!1;function uw(t){dw||(dw=!0,t.bind(KS).toDynamicValue((()=>new cw(bS(t,Ty)))).inSingletonScope(),t.bind(tA).toService(KS))}class pw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ld}}let gw=!1;function fw(t){gw||(gw=!0,t.bind(OS).toDynamicValue((()=>new pw(bS(t,Ty)))).inSingletonScope(),t.bind(SS).toService(OS))}function mw(){if(mw.__loaded)return;mw.__loaded=!0;const t=f_();kb(),Vx({bind:t.bind}),_S?uw(t):fw(t)}mw.__loaded=!1;const vw=mw;class yw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=hd,this.themeType="polygon"}}let _w=!1;function bw(t){var e;_w||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Iy))&&(_w=!0,t.bind($S).toDynamicValue((()=>new yw(bS(t,Iy)))).inSingletonScope(),t.bind(tA).toService($S))}function xw(){if(xw.__loaded)return;xw.__loaded=!0;const t=f_();Cb(),dA(),pA(),Xx({bind:t.bind}),bw(t)}xw.__loaded=!1;const Sw=xw,Aw=new Ve;class kw{constructor(){this.type="rect",this.numberType=cd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||x(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:su(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;Aw.setValue(i.x1,i.y1,i.x2,i.y2),Aw.expand(-r/2),h=!Aw.containsPoint(e)}}return s.highPerformanceRestore(),h}}class Cw extends kw{constructor(t){super(),this.canvasRenderer=t}}let ww=!1;function Mw(t){ww||(ww=!0,t.bind(US).toDynamicValue((()=>new Cw(bS(t,By)))).inSingletonScope(),t.bind(tA).toService(US))}class Tw extends kw{constructor(t){super(),this.canvasRenderer=t}}let Bw=!1;function Ew(t){Bw||(Bw=!0,t.bind(BS).toDynamicValue((()=>new Tw(bS(t,By)))).inSingletonScope(),t.bind(SS).toService(BS))}function Pw(){if(Pw.__loaded)return;Pw.__loaded=!0;const t=f_();wb(),Zx({bind:t.bind}),_S?Mw(t):Ew(t)}Pw.__loaded=!1;const Ow=Pw;class Rw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=dd,this.themeType="rect"}}let Iw=!1;function Dw(t){var e;Iw||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ey))&&(Iw=!0,t.bind(GS).toDynamicValue((()=>new Rw(bS(t,Ey)))).inSingletonScope(),t.bind(tA).toService(GS))}function Lw(){if(Lw.__loaded)return;Lw.__loaded=!0;const t=f_();Mb(),eS({bind:t.bind}),Dw(t)}Lw.__loaded=!1;const Fw=Lw;class zw{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ud}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let Hw=!1;function jw(t){Hw||(Hw=!0,t.bind(qS).toDynamicValue((()=>new zw(bS(t,Ry)))).inSingletonScope(),t.bind(tA).toService(qS))}class Nw{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ud}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let Vw=!1;function Ww(t){Vw||(Vw=!0,t.bind(IS).toDynamicValue((()=>new Nw(bS(t,Ry)))).inSingletonScope(),t.bind(SS).toService(IS))}function Uw(){if(Uw.__loaded)return;Uw.__loaded=!0;const t=f_();Tb(),aS({bind:t.bind}),_S?jw(t):Ww(t)}Uw.__loaded=!1;const Gw=Uw;function Yw(){Yw.__loaded||(Yw.__loaded=!0,Bb())}Yw.__loaded=!1;const Xw=Yw;class Kw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=gd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:su(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Su.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let $w=!1;function qw(t){$w||($w=!0,t.bind(YS).toDynamicValue((()=>new Kw(bS(t,Py)))).inSingletonScope(),t.bind(tA).toService(YS))}class Zw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=gd}}let Jw=!1;function Qw(t){Jw||(Jw=!0,t.bind(ES).toDynamicValue((()=>new Zw(bS(t,Py)))).inSingletonScope(),t.bind(SS).toService(ES))}function tM(){if(tM.__loaded)return;tM.__loaded=!0;const t=f_();Pb(),gS({bind:t.bind}),_S?qw(t):Qw(t)}tM.__loaded=!1;const eM=tM;class iM extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Yg(a,u,n),v=Gg(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&&Su.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let sM=!1;function nM(t){sM||(sM=!0,t.bind(XS).toDynamicValue((()=>new iM(bS(t,Oy)))).inSingletonScope(),t.bind(tA).toService(XS))}class rM{constructor(){this.type="text",this.numberType=fd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let aM=!1;function oM(t){aM||(aM=!0,t.bind(PS).toDynamicValue((()=>new rM)).inSingletonScope(),t.bind(SS).toService(PS))}function lM(){if(lM.__loaded)return;lM.__loaded=!0;const t=f_();Ob(),yS({bind:t.bind}),_S?nM(t):oM(t)}lM.__loaded=!1;const hM=lM;function cM(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),pM=(t,e)=>(c(fM.warnHandler)&&fM.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),gM=(t,e,i)=>{if(!c(fM.errorHandler))throw new Error(t);fM.errorHandler.call(null,t,e)},fM={silent:!1,warnHandler:!1,errorHandler:!1},mM=fm(),vM=mM&&globalThis?globalThis.document:void 0;function yM(t){return("desktop-browser"===t||"mobile-browser"===t)&&mM}function _M(t){return bM(t)||"mobile-browser"===t}function bM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let xM=0;function SM(){return xM>=9999999&&(xM=0),xM++}function AM(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function kM(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&y(t[0].fields))}function CM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&CM(t,e)}))}const wM=t=>!d(t)&&!1!==t.visible;function MM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function TM(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 EM=["#ffffff","#000000"];function PM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return OM(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(...EM);for(const n of a)if(t!==n&&OM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function OM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?RM(t,e)>s:"largeText"===i?RM(t,e)>3:RM(t,e)>4.5}function RM(t,e){const i=IM(t),s=IM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function IM(t){const e=ni(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function DM(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 LM(t,e){return[t[0]*e,t[1]*e]}function FM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function zM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const HM=hf,jM={arc:t=>HM("arc",t),circle:t=>HM("circle",t),group:t=>HM("group",t),image:t=>HM("image",t),line:t=>HM("line",t),path:t=>HM("path",t),polygon:t=>HM("polygon",t),rect:t=>HM("rect",t),richtext:t=>HM("richtext",t),symbol:t=>HM("symbol",t),text:t=>HM("text",t)},NM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 UM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(UM||(UM={}));const GM={[UM.selectedReverse]:{},[UM.selected]:{},[UM.hover]:{},[UM.hoverReverse]:{}},YM={container:"",width:30,height:30,style:{}},XM="scrollDrag",KM=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:pv,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function $M(t,e,i={}){if(!t)return{width:0,height:0};const s=pv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 qM(t,e="type"){var i,s;return p(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function ZM(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function JM(t,e="type"){const i=qM(t,e);return"rich"===i?jM.richtext(ZM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),jM.text(t))}function QM(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 tT=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function eT(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 iT(t,e){const{dx:i,dy:s}=eT(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const sT={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},nT={size:8,stroke:"#000",lineWidth:1,zIndex:1};function rT(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Se(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Te(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const aT=Math.sin(Math.PI/10);function oT(t,e=aT){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function lT(t,e=aT){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function hT(t){const e={};return CM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function cT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function dT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return LM(r,(s?-1:1)*(n?-1:1)*t/FM(r))}function uT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function gT(t,e,i){var s;if(lT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>He(n,r)}function fT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function yT(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function _T(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function bT(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function xT(t,e){const i=bT(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 ST(t,e){const i=AT(t),s=AT(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 AT(t,e={x:0,y:0}){return re.distancePP(t,e)}function kT(t){return A(t.x)&&A(t.y)}function CT(t,e,i){let s=!1;if(e&&c(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function wT(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const MT=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function BT(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&BT(t[i],e)}}var ET;!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"}(ET||(ET={}));const PT={};function OT(t){switch(t){case ET.Linear:case ET.Log:case ET.Pow:case ET.Sqrt:case ET.Symlog:case ET.Time:return!0;default:return!1}}function RT(t){return!!PT[t]}function IT(t){switch(t){case ET.Ordinal:case ET.Point:case ET.Band:return!0;default:return!1}}function DT(t){return t}Object.values(ET).forEach((t=>{PT[t]=!0}));const LT=t=>-Math.log(-t),FT=t=>-Math.exp(-t),zT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,HT=t=>10===t?zT:t===Math.E?Math.exp:e=>Math.pow(t,e),jT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),NT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),VT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function WT(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 UT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function GT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function YT(t,e,i,s){return 1===i&&(i=0),GT(t,i,s)*(e/(1-i))}function XT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function KT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class qT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=XT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const ZT=Symbol("implicit");class JT extends qT{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=ET.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=ZT}clone(){const t=(new JT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==ZT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return QT(t,e,r,n)}class eB extends JT{constructor(t){super(),this.type=ET.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=YT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:tB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return tB(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&x(this._userBandwidth)}clone(){var t,e,i;return new eB(!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:iB}=ri;function sB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=iB(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof si?iB(t,e):e instanceof ii?iB(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class nB extends qT{constructor(t=DT,e=DT){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=DT,this._piecewise=UT,this._interpolate=sB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?KT:UT,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:DT),this.rescale(i)):this._clamp!==DT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const rB=Math.sqrt(50),aB=Math.sqrt(10),oB=Math.sqrt(2),lB=[1,2,5,10],hB=(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=pB(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),J(0,e).map((t=>n+t*s))):t>0?dB(0,-(e-1)/s,s):dB((e-1)/s,0,s)},cB=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 hB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return hB(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=dB(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=dB(t,e,l);return n&&r.reverse(),r})),pB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=lB[0];return i>=rB?s=lB[3]:i>=aB?s=lB[2]:i>=oB&&(s=lB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function gB(t,e,i){const s=(e-t)/Math.max(0,i);return pB(s)}function fB(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=gB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function vB(t,e){const i=x(e.forceMin),s=x(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const yB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),_B=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})),bB=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=uB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?yB(t,e,n):yB(t,e,$T(n)),h=yB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),xB=mt(((t,e,i,s,n)=>fB(s(t),s(e),i).map((t=>$T(n(t))))));class SB extends nB{constructor(){super(...arguments),this.type=ET.Linear}clone(){var t;const e=new SB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return cB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=uB(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return fB(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function kB(t){return e=>-t(-e)}function CB(t=Number.EPSILON){return e=>Math.max(e,t)}class wB extends nB{constructor(){super(jT(10),HT(10)),this.type=ET.Log,this._limit=CB(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new wB).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=jT(this._base),s=HT(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=kB(i),this._pows=kB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=LT,this.untransformer=FT):(this._logs=i,this._pows=s,this._limit=CB(),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 DT}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return _B(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return bB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return xB(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(wB,AB);class MB extends SB{constructor(){super(NT(1),VT(1)),this.type=ET.Symlog,this._const=1}clone(){return(new MB).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=NT(t),this.untransformer=VT(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return _B(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return bB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(MB,AB);class TB{constructor(){this.type=ET.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new TB).domain(this._domain).range(this._range).unknown(this._unknown)}}var BB,EB,PB;function OB(t){var e,i;const{type:s}=t;return s===EB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BB||(BB={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(EB||(EB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(PB||(PB={}));const RB={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},IB={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DB(t,e){var i;if(!t)return[];const s=VB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?jB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>HB(i)?FB(t,i,e):i)).filter(u)}))):i.map((i=>HB(i)?FB(t,i,e):i)).filter(u):[]}return[]}function LB(t,e){var i,s;return jB(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function FB(t,e,i){var s;const n=VB(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=RB[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=IB[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ii(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Xe(t,i,s),a=Ye(n,r,e.l),l=new ii(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const zB=(t,e)=>{if(e&&HB(t)){const i=FB(e,t);if(i)return i}return t};function HB(t){return t&&"palette"===t.type&&!!t.key}function jB(t){return!(!y(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function NB(t){return y(t)?{dataScheme:t}:t}function VB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=OB(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 WB extends JT{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!jB(this._range))return void super.range(this._range);const t=LB(this._range,this._domain);super.range(t)}}const UB={linear:SB,band:eB,point:class extends eB{constructor(t){super(!1),this.type=ET.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:JT,threshold:TB,colorOrdinal:WB};function GB(t){const e=UB[t];return e?new e:null}function YB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function XB(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function KB(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function $B(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function qB(t){return!!v(t)&&(!!t.endsWith("%")&&AM(t.substring(0,t.length-1)))}function ZB(t){return!!p(t)&&("percent"in t||"offset"in t)}function JB(t,e,i,s=0){var n,r;return x(t)?t:qB(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function QB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=JB(t[s],e.size,i)}))})),o}function tE(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function eE(t){let e={};return y(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||qB(t)||c(t)||ZB(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function iE(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const sE=(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},nE=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function rE(t,e){return t&&e.key in t?t[e.key]:e.default}function aE(t){return t&&"token"===t.type&&!!t.key}const oE={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%"},lE={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:nE,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:oE,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},hE={name:"dark",colorScheme:{default:{dataScheme:nE,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},cE=(t,e)=>t===e||!c(t)&&!c(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>cE(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>cE(t[i],e[i])))),dE=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),dE(t[s],e.slice(1),i))},uE=t=>t instanceof Fa||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function pE(t,e=["data"]){return I(t,uE,e)}function gE(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=NB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}_E._charts=yE.charts,_E._series=yE.series,_E._components=yE.components,_E._graphicComponents=yE.graphicComponents,_E._marks=yE.marks,_E._regions=yE.regions,_E._animations=yE.animations,_E._implements=yE.implements,_E._chartPlugin=yE.chartPlugin,_E._vChartPlugin=yE.vChartPlugin,_E._componentPlugin=yE.componentPlugin,_E.transforms=yE.transforms,_E.dataParser=yE.dataParser,_E._layout=yE.layout,_E._grammarTransforms=yE.grammarTransforms,_E._stageEventPlugins=yE.stageEventPlugins,_E.registerStageEventPlugin=(t,e)=>{_E._stageEventPlugins[t]=e},_E.getStageEventPlugin=t=>_E._stageEventPlugins[t],_E._interactionTriggers=yE.interactionTriggers,_E.registerInteractionTrigger=(t,e)=>{_E._interactionTriggers[t]=e},_E._composedEventMap=yE.composedEventMap,_E.registerComposedEvent=(t,e)=>{_E._composedEventMap[t]=e},_E._tooltipProcessors=yE.tooltipProcessors,_E.registerTooltipProcessor=(t,e)=>{_E._tooltipProcessors[t]=e},_E.createTooltipProcessor=(t,e)=>{const i=_E._tooltipProcessors[t];return i?new i(e):null},_E._runtimePluginInstallers=yE.runtimePluginInstallers,_E.registerRuntimePluginInstaller=(t,e)=>{_E._runtimePluginInstallers[t]=e},_E.getRuntimePluginInstaller=t=>_E._runtimePluginInstallers[t];const SE=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}},conversionArrow:{line:{style:{stroke:"black"}},symbol:{style:{fill:"black"}},text:{style:{fontSize:12,fill:"#606773"}}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},AE=SE(),kE={[lE.name]:lE},CE=lE.name,wE=new Map(Object.keys(kE).map((t=>[t,kE[t]]))),ME=new Map,TE=new Map(Object.keys(kE).map((t=>[t,t===CE]))),BE=(t,e)=>{if(!t)return;const i=RE(e);wE.set(t,i),TE.set(t,!0)},EE=(t=CE)=>(TE.has(t)&&!TE.get(t)&&BE(t,wE.get(t)),wE.get(t)),PE=t=>wE.delete(t)&&ME.delete(t)&&TE.delete(t),OE=t=>!!v(t)&&wE.has(t),RE=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:CE;return bE({},EE(i),t)};class IE{static registerInstance(t){IE.instances.set(t.id,t)}static unregisterInstance(t){IE.instances.delete(t.id)}static getInstance(t){return IE.instances.get(t)}static instanceExist(t){return IE.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return IE.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}IE.instances=new Map;class DE{static registerTheme(t,e){BE(t,e)}static getTheme(t,e=!1){return EE(t)}static removeTheme(t){return PE(t)}static themeExist(t){return OE(t)}static getDefaultTheme(){return DE.themes.get(CE)}static setCurrentTheme(t){DE.themeExist(t)&&(DE._currentThemeName=t,IE.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return DE.getTheme(DE._currentThemeName,t)}static getCurrentThemeName(){return DE._currentThemeName}}function LE(t){return v(t)?DE.themeExist(t)?DE.getTheme(t):{}:p(t)?t:{}}DE.themes=wE,DE._currentThemeName=CE;const FE=["animationThreshold","colorScheme","name","padding"];function zE(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];FE.includes(n)?s[n]=r:f(r)?HB(r)?s[n]=zB(r,e):aE(r)?s[n]=rE(i,r):s[n]=zE(r,e,i):s[n]=r})),s}function HE(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]=HE(t[s],e)}return i}return y(t)?t.map((t=>HE(t,e))):t}function jE(t,e){var i;if(!t)return t;if(v(t))return null!==(i=e.getFunction(t))&&void 0!==i?i:t;if(f(t)){const i={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=jE(t[s],e));return i}return y(t)?t.map((t=>jE(t,e))):t}function NE(t,...e){return c(t)?t(...e):t}const VE=(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:oE.fontFamily,fontSize:oE.fontSize}))(e,i,s).measure(t),WE="__VCHART",UE=500,GE=500,YE=`${WE}_MEASURE_CANVAS_ID`,XE=`${WE}_DEFAULT_DATA_INDEX`,KE=`${WE}_DEFAULT_DATA_KEY`,$E=`${WE}_DEFAULT_DATA_SERIES_FIELD`,qE=`${WE}_DEFAULT_SERIES_STYLE_NAME`,ZE=`${WE}_STACK_KEY`,JE=`${WE}_STACK_START`,QE=`${WE}_STACK_END`,tP=`${WE}_STACK_START_PERCENT`,eP=`${WE}_STACK_END_PERCENT`,iP=`${WE}_STACK_START_OffsetSilhouette`,sP=`${WE}_STACK_END_OffsetSilhouette`,nP=`${WE}_STACK_TOTAL`,rP=`${WE}_STACK_TOTAL_PERCENT`,aP=`${WE}_STACK_TOTAL_TOP`,oP=`${WE}_STACK_TOTAL_BOTTOM`,lP=`${WE}_MOSAIC_VALUE_START_PERCENT`,hP=`${WE}_MOSAIC_VALUE_END_PERCENT`,cP=`${WE}_MOSAIC_CAT_START_PERCENT`,dP=`${WE}_MOSAIC_CAT_END_PERCENT`,uP=`${WE}_SEGMENT_START`,pP=`${WE}_SEGMENT_END`,gP=`${WE}_KEY`,fP=`${WE}_MAP_LOOK_UP_KEY`;function mP(t,e){for(let i=0;it.key===e))}function yP(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 _P(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},kP(t,a,n[o],l,e,r))})),s?bP(n):n}function bP(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))):bP(t[e].nodes);return t}function xP(t,e){if("values"in t&&t.values.length){const i=_T(t.values,e),s=yT(t.values,eP);t.values.forEach((t=>{t[nP]=i,t[rP]=s}))}else for(const i in t.nodes)xP(t.nodes[i],e)}function SP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][QE]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)AP(t.nodes[r],e,i,s,n)}function kP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[QE]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),kP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const CP=(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]=MP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function TP(t){return!c(t)&&!E(t)&&Object.keys(t).some((e=>c(t[e])))}function BP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(c(t))return RP(t(r,i,s,n));if(TP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{c(e[t])&&(e[t]=e[t](r,i,s,n))})),RP(e)}return RP(t)}function EP(t={}){const e=Object.assign({},t);if(c(t.style)||TP(t.style)?e.style=(e,i,s,n)=>BP(t.style,e,i,s,n):E(t.style)||(e.style=RP(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])||TP(t.state[e])?i[e]=(i,s,n,r)=>BP(t.state[e],i,s,n,r):E(t.state[e])||(i[e]=RP(t.state[e]))})),e.state=i}return e}function PP(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RP(t[i](e,s,n,r)):E(t[i])||(e[i]=RP(t[i]))})),e}function OP(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),RP(i)}function RP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const IP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},DP=t=>"line"===t||"area"===t,LP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return DP(i)?e:null==e?void 0:e[0]},FP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let zP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=_E.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(_E.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var HP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(HP||(HP={}));const jP=["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 NP,VP,WP;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(NP||(NP={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(VP||(VP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(WP||(WP={}));const UP=[WP.mark,WP.model,WP.chart,WP.vchart];class GP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(WP.vchart,[]),this._levelNodes.set(WP.chart,[]),this._levelNodes.set(WP.model,[]),this._levelNodes.set(WP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const YP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class XP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>LP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||VP.chart);o.get(t)||o.set(t,new GP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||VP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||VP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||VP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?UP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[VP.chart,VP.window,VP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return YP[a]&&(a=YP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?WP.model:WP.vchart:WP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=VP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==WP.model&&s!==WP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=WP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case VP.chart:return this._viewBubbles;case VP.window:return this._windowBubbles;case VP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case VP.chart:return this._viewListeners;case VP.window:return this._windowListeners;case VP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return jP.includes(t)||Object.values(HP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&_E.hasInteractionTrigger(e)}}function KP(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function $P(t,e,i){t.getParser(e)||t.registerParser(e,i)}const qP=new Map;let ZP;function JP(){ZP||(ZP=new La,$P(ZP,"geojson",Ea),$P(ZP,"topojson",Oa),KP(ZP,"simplify",Xr))}function QP(t,e,i={type:"geojson",centroid:!0}){qP.has(t)&&pM(`map type of '${t}' already exists, will be overwritten.`),JP();const s=new Fa(ZP),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):p(r)&&s.transform({type:"simplify",options:r}),qP.set(t,s)}function tO(t){qP.has(t)?qP.delete(t):pM(`map type of '${t}' does not exists.`)}function eO(t,e=!1){let i=e;return t.latestData instanceof Fa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const iO=(t,e)=>0===t.length?[]:1===t.length?eO(t[0],null==e?void 0:e.deep):t.map((t=>eO(t,null==e?void 0:e.deep)));function sO(t,e,i){KP(e=e instanceof La?e:t.dataSet,"copyDataView",iO);const s=new Fa(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:aO.copyDataView}),s}function nO(t,e,i=[]){var s;if(t instanceof Fa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Fa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return pM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return pM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),pM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function rO(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var aO,oO,lO,hO;!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"}(aO||(aO={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(oO||(oO={})),function(t){t.data="data",t.mark="mark"}(lO||(lO={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(hO||(hO={}));const cO=["line","area","trail"];function dO(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(gP,i?t.slice().sort(i):t.slice()),{keys:[gP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const uO=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function pO(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{pO(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function fO(t,e,i,s){const n=dO(t,(t=>i(t))),r=dO(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const mO=`${WE}_BuiltIn_CallBack_Disappear`;var vO;!function(t){t.render="render",t.disappear="disappear"}(vO||(vO={}));const yO=[0,0,0];class _O{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ol),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Il),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xu.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&&(xu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(xu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Nt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(fu(yO,[e,i,s],this.modelMatrix),e=yO[0],i=yO[1],s=yO[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=nu(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:su(this,a,this.dpr),r.strokeStyle=nu(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>xu.free(t))),this.stack.length=0}}_O.env="browser";class bO extends Mu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=ah.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new _O(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 xO(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,Ad,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,kd,e.env));r||i.bind(Ad).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(kd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}bO.env="browser";const SO=xO(bO,_O);class AO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}AO.env="feishu";class kO extends Mu{constructor(t){super(t)}init(){this._context=new AO(this,this._dpr)}release(...t){}}kO.env="feishu";const CO=xO(kO,AO);class wO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:su(this,l,this.dpr),r.strokeStyle=nu(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=ah.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,ah.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}wO.env="harmony";class MO extends Mu{constructor(t){super(t)}init(){this._context=new wO(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}MO.env="harmony";const TO=xO(MO,wO);class BO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:su(this,l,this.dpr),r.strokeStyle=nu(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=ah.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,ah.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}BO.env="lynx";class EO extends Mu{constructor(t){super(t)}init(){this._context=new BO(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}EO.env="lynx";const PO=xO(EO,BO);class OO extends _O{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}OO.env="node";class RO extends Mu{constructor(t){super(t)}init(){this._context=new OO(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}}RO.env="node";const IO=xO(RO,OO);class DO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(nu(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:su(this,l,this.dpr)),r.setStrokeStyle(nu(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}DO.env="taro";class LO extends Mu{constructor(t){super(t)}init(){this._context=new DO(this,this._dpr)}release(...t){}}LO.env="taro";const FO=xO(LO,DO);class zO extends AO{}zO.env="tt";class HO extends Mu{constructor(t){super(t)}init(){this._context=new zO(this,this._dpr)}release(...t){}}HO.env="tt";const jO=xO(HO,zO);class NO extends _O{draw(){}createPattern(t,e){return null}}NO.env="wx";class VO extends Mu{constructor(t){super(t)}init(){this._context=new NO(this,this._dpr)}release(...t){}}VO.env="wx";const WO=xO(VO,NO);class UO extends mA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=yf.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;nnew XO(bS(t,Ay)))).inSingletonScope(),t.bind(tA).toService(zS))}class qO extends kw{constructor(t){super(),this.canvasRenderer=t}}let ZO=!1;class JO extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=pd}}let QO=!1;function tR(t){var e;QO||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Hy))&&(QO=!0,t.bind(QS).toDynamicValue((()=>new JO(bS(t,Hy)))).inSingletonScope(),t.bind(tA).toService(QS))}const eR=Yc();Yc();class iR{constructor(){this.type="gif-image",this.numberType=eR}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let sR=!1;function nR(t){sR||(sR=!0,t.bind(jS).toDynamicValue((()=>new iR)).inSingletonScope(),t.bind(tA).toService(jS))}function rR(t){t.isBound(UO)||t.bind(UO).toDynamicValue((()=>new UO(xS(tA,t),bS(t,zy),xS(Jm,t),xS(Qm,t)))).inSingletonScope(),t.isBound($m)?t.rebind($m).toService(UO):t.bind($m).toService(UO)}function aR(t){(function(t){YO||(YO=!0,t.bind(JS).toDynamicValue((()=>new GO)).inSingletonScope(),t.bind(tA).toService(JS),zm(t.bind.bind(t),tA))})(t),lC(t),vC(t),SC(t),$O(t),PC(t),NC(t),qC(t),function(t){ZO||(ZO=!0,t.bind(VS).toDynamicValue((()=>new qO(bS(t,By)))).inSingletonScope(),t.bind(tA).toService(VS))}(t),nw(t),uw(t),bw(t),Mw(t),Dw(t),jw(t),tR(t),qw(t),nM(t),nR(t),rR(t)}class oR extends hA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${oR.idprefix}_${oR.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=ah.global,this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:oR.GenerateCanvasId(),canvasControled:!0};this.canvas=new bO(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new bO({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function lR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,oR))||t.bind(oR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,oR.env))||t.bind(bf).toService(oR).whenTargetNamed(oR.env)}oR.env="browser",oR.idprefix="visactor_window",oR.prefix_count=0;var hR=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 cR{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 dR(t,e=!1){const i=document.createElement("img");if(ah.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class uR extends lA{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new cR(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return dR(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return dR(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return hR(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function pR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uR))||(t.bind(uR).toSelf().inSingletonScope(),t.bind(mg).toService(uR))}function gR(t=f_(),e=!0){gR.__loaded||(gR.__loaded=!0,pR(t),SO(t),lR(t),e&&aR(t))}gR.__loaded=!1;class fR extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new kO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 kO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fR))||t.bind(fR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,fR.env))||t.bind(bf).toService(fR).whenTargetNamed(fR.env)}fR.env="feishu";class vR extends mA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Cu(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}}let yR=!1;class _R extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=id}}let bR=!1;function xR(t){bR||(bR=!0,t.bind(CS).toDynamicValue((()=>new _R(bS(t,Ay)))).inSingletonScope(),t.bind(SS).toService(CS))}function SR(t){(function(t){yR||(yR=!0,zm(t.bind.bind(t),SS))})(t),function(t){t.isBound(vR)||t.bind(vR).toDynamicValue((()=>new vR(xS(SS,t),xS(Jm,t),xS(Qm,t)))).inSingletonScope(),t.isBound($m)?t.rebind($m).toService(vR):t.bind($m).toService(vR)}(t),dC(t),CC(t),xR(t),IC(t),UC(t),QC(t),fw(t),ow(t),Ew(t),Ww(t),Qw(t),oM(t)}class AR{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class kR{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function CR(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function wR(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new AR(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function MR(t,e,i,s){const n=CR(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new kR(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function TR(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function BR(t,e=TR(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class ER extends lA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=TR(i),n=null!==(e=t.dpr)&&void 0!==e?e:BR(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return BR(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function PR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,ER))||(t.bind(ER).toSelf().inSingletonScope(),t.bind(mg).toService(ER))}function OR(t=f_(),e=!0){OR.__loaded||(OR.__loaded=!0,PR(t),CO(t),mR(t),e&&SR(t))}OR.__loaded=!1;function RR(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function IR(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new MO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 MO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return RR(t,"target",s),RR(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=IR(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=IR(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&DR(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),DR(t,"x",_),DR(t,"y",b),DR(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),DR(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),DR(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),DR(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),DR(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),DR(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function FR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,LR))||t.bind(LR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,LR.env))||t.bind(bf).toService(LR).whenTargetNamed(LR.env)}LR.env="harmony";const zR="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function HR(t){return"number"==typeof t&&Number.isFinite(t)}function jR(...t){for(let e=0;e({width:i,height:s})),new kR(t,l,n,i,s,e)}function GR(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=WR(e*s,i*s);if(t)return t}throw new Error(zR)}class YR extends lA{constructor(){super(),this.type="harmony",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,this.rafSTO=new xh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=NR(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=NR(s),r=null!==(i=t.dpr)&&void 0!==i?i:VR(s),a=function(t,e){if(!HR(t)||!HR(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=UR(GR(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=UR(GR(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return VR(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=jR(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=jR(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function XR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,YR))||(t.bind(YR).toSelf().inSingletonScope(),t.bind(mg).toService(YR))}function KR(t=f_(),e=!0){KR.__loaded||(KR.__loaded=!0,XR(t),TO(t),FR(t),e&&SR(t))}KR.__loaded=!1;function $R(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function qR(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new EO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 EO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return $R(t,"target",s),$R(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=qR(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=qR(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&ZR(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),ZR(t,"x",_),ZR(t,"y",b),ZR(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),ZR(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),ZR(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),ZR(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),ZR(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),ZR(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function QR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,JR))||t.bind(JR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,JR.env))||t.bind(bf).toService(JR).whenTargetNamed(JR.env)}JR.env="lynx";function tI(t){return"number"==typeof t&&Number.isFinite(t)}function eI(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=sI(r),o=null!==(i=t.dpr)&&void 0!==i?i:nI(r,a),l=aI(t.width,t.height),h=oI(lI(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=sI(a),l=null!==(n=t.dpr)&&void 0!==n?n:nI(a,o),h=aI(t.width,t.height),c=Math.random().toString(),d=oI(lI(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return nI(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=eI(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=eI(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function cI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,hI))||(t.bind(hI).toSelf().inSingletonScope(),t.bind(mg).toService(hI))}function dI(t=f_(),e=!0){dI.__loaded||(dI.__loaded=!0,cI(t),PO(t),QR(t),e&&SR(t))}dI.__loaded=!1;class uI extends hA{get container(){return null}constructor(t=ah.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new RO(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new RO({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function pI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,uI))||t.bind(uI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,uI.env))||t.bind(bf).toService(uI).whenTargetNamed(uI.env)}uI.env="node";class gI extends lA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function fI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,gI))||(t.bind(gI).toSelf().inSingletonScope(),t.bind(mg).toService(gI))}function mI(t=f_(),e=!0){mI.__loaded||(mI.__loaded=!0,fI(t),IO(t),pI(t))}mI.__loaded=!1;class vI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new LO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 LO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function yI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,vI))||t.bind(vI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,vI.env))||t.bind(bf).toService(vI).whenTargetNamed(vI.env)}vI.env="taro";class _I extends lA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=MR(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=wR(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function bI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,_I))||(t.bind(_I).toSelf().inSingletonScope(),t.bind(mg).toService(_I))}function xI(t=f_(),e=!0){xI.__loaded||(xI.__loaded=!0,bI(t),FO(t),yI(t),e&&SR(t))}xI.__loaded=!1;class SI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new HO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 HO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function AI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,SI))||t.bind(SI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,SI.env))||t.bind(bf).toService(SI).whenTargetNamed(SI.env)}SI.env="tt";function kI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function CI(t,e=kI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class wI extends lA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=kI(i),n=null!==(e=t.dpr)&&void 0!==e?e:CI(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return CI(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function MI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,wI))||(t.bind(wI).toSelf().inSingletonScope(),t.bind(mg).toService(wI))}function TI(t=f_(),e=!0){TI.__loaded||(TI.__loaded=!0,MI(t),jO(t),AI(t),e&&SR(t))}TI.__loaded=!1;class BI{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={}}}function EI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class PI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="wx",this.eventManager=new BI}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new VO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 VO({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return EI(t,"target",o),EI(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function OI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,PI))||t.bind(PI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,PI.env))||t.bind(bf).toService(PI).whenTargetNamed(PI.env)}PI.env="wx";function RI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function II(t,e=RI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class DI extends lA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=RI(i),n=null!==(e=t.dpr)&&void 0!==e?e:II(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return II(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function LI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,DI))||(t.bind(DI).toSelf().inSingletonScope(),t.bind(mg).toService(DI))}function FI(t=f_(),e=!0){FI.__loaded||(FI.__loaded=!0,LI(t),WO(t),OI(t),e&&SR(t))}FI.__loaded=!1;var zI={},HI={},jI={};Object.defineProperty(jI,"__esModule",{value:!0}),jI.loop=jI.conditional=jI.parse=void 0;jI.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};jI.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};jI.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var NI={};Object.defineProperty(NI,"__esModule",{value:!0}),NI.readBits=NI.readArray=NI.readUnsigned=NI.readString=NI.peekBytes=NI.readBytes=NI.peekByte=NI.readByte=NI.buildStream=void 0;NI.buildStream=function(t){return{data:t,pos:0}};var VI=function(){return function(t){return t.data[t.pos++]}};NI.readByte=VI;NI.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var WI=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};NI.readBytes=WI;NI.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};NI.readString=function(t){return function(e){return Array.from(WI(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};NI.readUnsigned=function(t){return function(e){var i=WI(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};NI.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=WI(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=QI(t),i=XI(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=QI(this.attribute.gifImage),e=XI(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=ah.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=ah.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function iD(t){return new eD(t)}class sD extends _x{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=eR,this._renderContribitions=void 0,this.builtinContributions=[nD],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=Fp(t).image;this._draw(t,n,!1,i)}}const nD=new class extends Zv{constructor(){super(...arguments),this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let rD=!1;function aD(t){rD||(rD=!0,t.bind(sD).toDynamicValue((()=>new sD(xS(Jy,t)))).inSingletonScope(),t.bind(ky).toService(sD))}function oD(){of.RegisterGraphicCreator("gif",iD)}function lD(){if(lD.__loaded)return;lD.__loaded=!0;const t=f_();oD(),aD(t),nR(t)}lD.__loaded=!1;const hD=lD,cD=[{register:fb,bindModule:jb},{register:mb,bindModule:Ub},{register:vb,bindModule:sx},{register:yb,bindModule:ox},{register:_b,bindModule:dx},{register:bb},{register:xb,bindModule:Sx},{register:Sb,bindModule:Mx},{register:Ab,bindModule:Rx},{register:kb,bindModule:Vx},{register:Cb,bindModule:Xx},{register:wb,bindModule:Zx},{register:Mb,bindModule:eS},{register:Tb,bindModule:aS},{register:Bb},{register:Eb,bindModule:cS},{register:Pb,bindModule:gS},{register:Ob,bindModule:yS},{register:Rb},{register:oD}];let dD=!1;const uD=[lC,vC,SC,$O,PC,NC,qC,nw,uw,bw,Mw,Dw,jw,tR,qw,nM,nR];function pD(t){return{getContributions:t}}function gD(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function fD(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=jA();i(a),s(a),n(a),NA(),gD(e,{envParams:r,force:!0})}function mD(t,e){fD(t,"browser",{bindEnv:pR,bindCanvasModules:SO,bindWindowContribution:lR},e)}function vD(t,e){fD(t,"node",{bindEnv:fI,bindCanvasModules:IO,bindWindowContribution:pI},e)}function yD(t){WA(t),function(){if(dD)return;const t=jA();dD=!0,cD.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),aD(t),NA()}(),GA(t),UA(t)}function _D(t){WA(t);const e=jA();uD.forEach((t=>t(e))),rR(e),YA(t,tA),function(t){const e=jA(),i=pD((()=>t.registry.picker.getAll())),s=pD((()=>e.isBound(Jm)?e.getAll(Jm):[])),n=pD((()=>e.isBound(Qm)?e.getAll(Qm):[])),r=VA();ah.pickerServiceFactory=()=>new UO(i,{},s,n),ah.global=r}(t)}function bD(t){WA(t);SR(jA()),YA(t,SS),function(t){const e=jA(),i=pD((()=>t.registry.picker.getAll())),s=pD((()=>e.isBound(Jm)?e.getAll(Jm):[])),n=pD((()=>e.isBound(Qm)?e.getAll(Qm):[]));ah.pickerServiceFactory=()=>new vR(i,s,n)}(t)}function xD(){if(xD.__loaded)return;xD.__loaded=!0;const t=f_();yb(),ox({bind:t.bind}),_S?$O(t):xR(t)}xD.__loaded=!1;const SD=xD;function AD(){if(AD.__loaded)return;AD.__loaded=!0;const t=f_();Eb(),cS({bind:t.bind}),tR(t)}AD.__loaded=!1;const kD=AD;function CD(){CD.__loaded||(CD.__loaded=!0,Rb())}CD.__loaded=!1;const wD=CD;class MD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,K_(this.target,i,yo.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class ED extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class PD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class OD extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const RD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class ID extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){Y_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){Y_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class DD extends ID{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=RD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r),this.determineUpdateFunction()}}class LD extends ID{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class FD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class zD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const HD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class jD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=HD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ND extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const VD=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class WD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(Y_(this.target,{points:r.map(((t,i)=>yh(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class UD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:VD(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class GD extends WD{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:VD(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const YD=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class XD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:YD(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class KD extends WD{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:YD(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const $D=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class qD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:$D(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class ZD extends WD{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:$D(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const JD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class QD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class tL extends QD{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=JD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}}class eL extends QD{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const iL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class sL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=iL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aL extends rL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&A(m.x)?m.x:g,b=u.includes("y")?y:m&&A(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}}class oL extends rL{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,y=v&&A(v.x)?v.x:f,_=v&&A(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class lL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,K_(this.target,{text:n})}}class hL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class cL extends hL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}}class dL extends hL{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class uL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),w=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,T=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,B=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,E=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(T){case"x":A={scaleX:null!==(g=null!=B?B:w.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=E?E:w.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=B?B:w.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=E?E:w.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&$_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),Y_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class pL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class gL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const fL={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function mL(t,e){for(let i=0;ifL[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&w_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(Y_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class yL{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new M_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function _L(t){return new yL(t)}class bL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;K_(this.target,{text:o})}}class xL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if($_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),$_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),$_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),$_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;$_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:bL});const i=s._titleBottom.attribute.text;$_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:bL})}else $_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),$_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;$_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());$_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class SL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class AL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if($_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:bL}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:bL}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class kL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class CL extends nb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=__.createCanvas({width:t.width,height:t.height,dpr:__.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=__.createCanvas({width:t.width,height:t.height,dpr:__.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CL.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class wL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==ML.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==ML.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TL{static createTempCanvas(t,e,i){return __.createCanvas({width:t,height:e,dpr:i||__.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=TL.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TL.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TL.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(TL.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(TL.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(TL.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(TL.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(TL.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class PL extends ML{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class DL extends ML{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=TL.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class LL extends CL{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=__.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=__.createCanvas({width:i,height:s,dpr:__.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class FL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}K_(this.target,{textConfig:o})}}class zL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),K_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),K_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class HL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),K_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),K_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function WL(t,e){Y_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class UL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,$_(this.target,m)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class GL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,$_(this.target,d)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class YL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,$_(this.target,p)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class XL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,$_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),K_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class KL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,$_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),K_(this.target,n)}}class $L extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new M_(this.target);a.execute({type:"custom",custom:UL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:GL,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class qL extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new M_(this.target);a.execute({type:"custom",custom:UL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:YL,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class ZL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class JL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class QL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class tF extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new M_(this.target);n.execute({type:"custom",custom:JL,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class eF extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new M_(this.target);n.execute({type:"custom",custom:QL,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class iF extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),Y_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Pu(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Pu(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class sF extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=ah.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Sl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=ah.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Lo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Lo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function cF(t){var e,i;const s=null!==(e=f_().getAll(ky))&&void 0!==e?e:[],n=lF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;hF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=oF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function dF(t,e){var i,s;const n=null!==(i=f_().getAll(e))&&void 0!==i?i:[],r=lF(t.registry.picker,"vrender:legacy-picker"),a=new Set;hF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=oF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const uF=mD,pF=vD,gF={taro:{installEnv:function(t,e){fD(t,"taro",{bindEnv:bI,bindCanvasModules:FO,bindWindowContribution:yI},e)},loadEnv:xI},feishu:{installEnv:function(t,e){fD(t,"feishu",{bindEnv:PR,bindCanvasModules:CO,bindWindowContribution:mR},e)},loadEnv:OR},tt:{installEnv:function(t,e){fD(t,"tt",{bindEnv:MI,bindCanvasModules:jO,bindWindowContribution:AI},e)},loadEnv:TI},wx:{installEnv:function(t,e){fD(t,"wx",{bindEnv:LI,bindCanvasModules:WO,bindWindowContribution:OI},e)},loadEnv:FI},lynx:{installEnv:function(t,e){fD(t,"lynx",{bindEnv:cI,bindCanvasModules:PO,bindWindowContribution:QR},e)},loadEnv:dI},harmony:{installEnv:function(t,e){fD(t,"harmony",{bindEnv:XR,bindCanvasModules:TO,bindWindowContribution:FR},e)},loadEnv:KR}},fF=[sC,tC,x_,A_,dA,pA],mF=[()=>{M_.registerBuiltInAnimate("increaseCount",lL),M_.registerBuiltInAnimate("fromTo",rb),M_.registerBuiltInAnimate("scaleIn",uL),M_.registerBuiltInAnimate("scaleOut",pL),M_.registerBuiltInAnimate("growHeightIn",jD),M_.registerBuiltInAnimate("growHeightOut",ND),M_.registerBuiltInAnimate("growWidthIn",sL),M_.registerBuiltInAnimate("growWidthOut",nL),M_.registerBuiltInAnimate("growCenterIn",FD),M_.registerBuiltInAnimate("growCenterOut",zD),M_.registerBuiltInAnimate("clipIn",BD),M_.registerBuiltInAnimate("clipOut",ED),M_.registerBuiltInAnimate("fadeIn",PD),M_.registerBuiltInAnimate("fadeOut",OD),M_.registerBuiltInAnimate("growPointsIn",UD),M_.registerBuiltInAnimate("growPointsOut",GD),M_.registerBuiltInAnimate("growPointsXIn",XD),M_.registerBuiltInAnimate("growPointsXOut",KD),M_.registerBuiltInAnimate("growPointsYIn",qD),M_.registerBuiltInAnimate("growPointsYOut",ZD),M_.registerBuiltInAnimate("growAngleIn",DD),M_.registerBuiltInAnimate("growAngleOut",LD),M_.registerBuiltInAnimate("growRadiusIn",tL),M_.registerBuiltInAnimate("growRadiusOut",eL),M_.registerBuiltInAnimate("moveIn",aL),M_.registerBuiltInAnimate("moveOut",oL),M_.registerBuiltInAnimate("rotateIn",cL),M_.registerBuiltInAnimate("rotateOut",dL),M_.registerBuiltInAnimate("update",vL),M_.registerBuiltInAnimate("state",gL),M_.registerBuiltInAnimate("labelItemAppear",xL),M_.registerBuiltInAnimate("labelItemDisappear",SL),M_.registerBuiltInAnimate("poptipAppear",AL),M_.registerBuiltInAnimate("poptipDisappear",kL),M_.registerBuiltInAnimate("inputText",bL),M_.registerBuiltInAnimate("inputRichText",FL),M_.registerBuiltInAnimate("outputRichText",zL),M_.registerBuiltInAnimate("slideRichText",jL),M_.registerBuiltInAnimate("slideOutRichText",HL),M_.registerBuiltInAnimate("slideIn",UL),M_.registerBuiltInAnimate("growIn",GL),M_.registerBuiltInAnimate("spinIn",YL),M_.registerBuiltInAnimate("moveScaleIn",$L),M_.registerBuiltInAnimate("moveRotateIn",qL),M_.registerBuiltInAnimate("strokeIn",XL),M_.registerBuiltInAnimate("slideOut",ZL),M_.registerBuiltInAnimate("growOut",JL),M_.registerBuiltInAnimate("spinOut",QL),M_.registerBuiltInAnimate("moveScaleOut",tF),M_.registerBuiltInAnimate("moveRotateOut",eF),M_.registerBuiltInAnimate("strokeOut",KL),M_.registerBuiltInAnimate("pulse",iF),M_.registerBuiltInAnimate("MotionPath",NL),M_.registerBuiltInAnimate("streamLight",sF),M_.registerBuiltInAnimate("dissolve",EL),M_.registerBuiltInAnimate("grayscale",IL),M_.registerBuiltInAnimate("distortion",PL),M_.registerBuiltInAnimate("particle",DL),M_.registerBuiltInAnimate("glitch",RL),M_.registerBuiltInAnimate("gaussianBlur",OL),M_.registerBuiltInAnimate("pixelation",LL)},gb],vF=[pC,_C,MC,SD,LC,hD,zC,YC,ew,hw,vw,Sw,Ow,Fw,Gw,Xw,eM,hM,wD,kD];function yF(){fF.forEach((t=>t())),mF.forEach((t=>t()))}function _F(t,e){if(!aF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==__?void 0:__.env)?__.envParams:void 0}(e);return void 0===i?vD(t):pF(t,i),yD(t),bD(t),mI(),vF.forEach((t=>t())),cF(t),dF(t,SS),yF(),t}function bF(t,e,i){if(!aF(t,e))return t;const s=gF[e];return s.installEnv(t,i),yD(t),function(t){bD(t)}(t),s.loadEnv(),vF.forEach((t=>t())),cF(t),dF(t,SS),yF(),t}const xF=Symbol.for("visactor.vrender.sharedAppRegistry");function SF(){var t;const e=globalThis,i=null!==(t=e[xF])&&void 0!==t?t:new Map;return e[xF]=i,i}function AF(t,e){const i=SF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function kF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=SF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function CF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=AF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(kF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>kF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=AF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&kF(t,i,s))}}}(t,s,r,o)}const wF=KA,MF=[];function TF(t){MF.forEach((({module:e,options:i})=>{wF(e,Object.assign(Object.assign({},i),{app:t}))}))}var BF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),cF(t),dF(t,tA),yF(),t):t}(_A(BF(t,["envParams"])),e);return TF(i),i}var PF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(t){case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony";case s.lynx:return"lynx";default:return"browser"}},zF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},HF=(t,e)=>{const i=FF(t),s=zF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},jF=(t,e)=>{const i=CF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,LF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},NF="poptipForText";class VF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(NP.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(NP.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(NP.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(NF))&&this._dedupeStagePlugin(NF)}initView(){var t,e,i,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:g,autoPreventDefault:f,background:m}=this._option,v=HF(l,h);__.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const s=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=FF(i.mode),n=HF(i.mode,i.modeParams);return jF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=s.releaseAppRef,null===(t=this._option.runtimePluginInstallers)||void 0===t||t.forEach((t=>t(s.app)));try{this._stage=(_=s.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:g,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:u(a)?a:!u(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=Qp({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(u(c)?c:_M(l))&&!1!==d&&_E.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,p(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=hO.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!y(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!yM(this._option.mode))return!1;return!1===(u(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:__.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(__.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=__.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>pO(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>pO(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{pO(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===hO.before;(e||i)&&(uM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=hO.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=hO.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),uM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=gO(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=fO(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=fO(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=dO(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=dO(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:mO,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{pO(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===oO.appear))?oO.appear:e.every((t=>t===oO.disappear))?oO.disappear:oO.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===VP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=IP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=IP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:LP(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===VP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===VP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===VP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===VP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===VP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{pO(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=gO(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return yM(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{__.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{pO(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=__.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){__.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function WF(t,i){var s;return e(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==i?void 0:i.onError)&&void 0!==s?s:gM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const UF={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}},GF={poptip:z({},UF)};function YF(t){t.crosshair=G(t.crosshair||{}).map((e=>gE({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function XF(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=oi(l,i.width,i.height);a=t,o=e}else if(h&&yM(e.mode)){let t;t=v(h)?__.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(bM(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}}const KF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function $F(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function qF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function ZF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;KF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function JF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}const QF=9,tz=0,ez=-1;var iz,sz,nz,rz,az,oz;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(iz||(iz={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(sz||(sz={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(nz||(nz={}));class lz{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},lz.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}lz.defaultMarkInfo={};class hz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class cz{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=>gE({},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 dz extends hz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=cz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new lz,this._lastLayoutRect=null,this.id=SM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new zP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${WE}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=_E.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return P(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class uz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=sz.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=QB(eE(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:JB(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:JB(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:JB(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:JB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:JB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:JB(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=JB(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=JB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=JB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(tE(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class pz extends dz{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new uz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class gz extends cz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class fz extends pz{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=gz,this.modelType="region",this.specKey="region",this.type=fz.type,this._series=[],this.layoutType="region",this.layoutZIndex=iz.Region,this.seriesDataFilterOver=()=>{this.event.emit(NP.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",iz.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",nz.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:iz.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:iz.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",nz.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",nz.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",nz.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",nz.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",nz.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function mz(t){const e=[],i=[],s=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function vz(t,e,i){e?t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function yz(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 _z(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=Az(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),yz(d,!0,p,l),s&&vz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function bz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=Az(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=Az(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),yz(d,!1,p,o),s&&vz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function Sz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=Az(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=Az(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&_z(n,e,i,!1,"left",s),r.length&&_z(r,e,i,!0,"left",s),a.length&&bz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&xz(n,e,i,!1,"top",s),r.length&&xz(r,e,i,!0,"top",s),a.length&&Sz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&_z(n,e,i,!1,"right",s),r.length&&_z(r,e,i,!0,"right",s),a.length&&bz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&xz(n,e,i,!1,"bottom",s),r.length&&xz(r,e,i,!0,"bottom",s),a.length&&Sz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=Az(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=Az(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:gM)("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}}}kz.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(rz||(rz={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(az||(az={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(oz||(oz={}));const Cz=["linear","radial","conical"],wz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Mz={};Object.values(az).forEach((t=>{Mz[t]=!0})),az.STATE_HOVER,az.STATE_HOVER_REVERSE,az.STATE_SELECTED,az.STATE_SELECTED_REVERSE,az.STATE_DIMENSION_HOVER,az.STATE_DIMENSION_HOVER_REVERSE;class Tz extends hz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class Bz extends Tz{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];u(s.domain)&&(n.domain=s.domain),u(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,cO.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Mz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(WE)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(WE))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(OT(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class Ez extends hz{constructor(){super(...arguments),this.id=SM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=_E.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Pz extends Ez{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Oz=1e3,Rz="quadInOut",Iz=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Dz=(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=Pu(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Lz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?rk(t):[],n=rk(e);i&&s&&(i.fromTransform&&ak(s,i.fromTransform.clone().getInverse()),ak(s,i.toTransfrom));const[r,a]=nk(s,n);return t?sk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},zz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Hz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!zz.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Tu.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class jz extends ib{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Lz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Dz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):K_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Nz=(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=Fz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Hz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new jz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Oz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Rz);return c.play(d),c};class Vz extends ib{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Lz(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&&Dz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Wz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Iz.includes(t))(i)||(e[i]=t[i])})),e},Uz=(t,e,i)=>{const s=Wz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=ah.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Gz=(t,e,i)=>{const s=[],n=i?null:Wz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Wz(t.attribute);if("rect"===t.type)hk(t,e).forEach((t=>{s.push(ah.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)ck(t,e).forEach((t=>{s.push(ah.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)dk(t,e).forEach((t=>{s.push(ah.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=gk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(ah.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?_k(t,e).forEach((t=>{s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?pk(t,e).forEach((t=>{s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&bk(t,e).forEach((t=>{"path"in t?s.push(ah.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Uz(t,s,e),s},Xz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Kz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Xz(l.delay,n,a,o),d=Xz(l.duration,n,a,o),u=Xz(l.oneByOne,n,a,o),p=Xz(l.splitPath,n,a,o),g=A(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Gz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Yz)(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);Nz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Gz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Yz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Fz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Hz(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:yo.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 jz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Oz,null!==(l=i.easing)&&void 0!==l?l:Rz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:yo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Vz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Oz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Rz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Nz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},$z=(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))))},qz=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},Zz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},Jz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];Zz(t,a,s)},Qz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));Zz(t,r,i)},tH=Symbol("statesClearedBeforeReInit");class eH extends Ez{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Pz(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Qp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:iz.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Sl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===rz.enter||t.context.diffState===rz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&Zz(t,r,e)},this.name=t,this.model=e.model,this.key=e.key,this.state=new Bz(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(t){return[nz.User_Mark,nz.User_Series,nz.User_Chart,nz.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&gE(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(RT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=GB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):Cz.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):RT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",nz.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,nz.User_Mark)}else this.setStyle(i,t,nz.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=LB(DB(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},wz[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ii.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)Cz.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=LB(DB(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return dO(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return _E.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[KE],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=dO(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===oO.appear))?oO.appear:t.every((t=>t===oO.disappear))?oO.disappear:t[0];return null!=e?e:oO.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{qz(t),s.push(...t.getGraphics())})),e.forEach((t=>{qz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Kz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=$z(e,n),r=$z(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===oO.exit?oO.exit:i===oO.update?oO.update:oO.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===rz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===rz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=rz.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=rz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=rz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=oO.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=oO.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return uO(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=uO(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||c(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!c(r)&&(!Cz.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!RT(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);d(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,FP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===az.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=_E.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=_E.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===hO.before||(this._product||this._initProduct(),uM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[tH],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?Jz(i,t,!0,a):Qz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[tH]=e:delete s[tH]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===rz.exit&&!e.isExiting)if(e.context.animationState===rz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===rz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:rz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Qp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[tH]=t.currentStates.slice())}))}}var iH;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(iH||(iH={}));class sH extends eH{constructor(){super(...arguments),this.type=sH.type,this._marks=[],this._diffState=rz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(pM("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?(pM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return pO(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===rz.update){const t=this.hasAnimation(),e=FP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=rz.update}render(){this._isCommited&&(uM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}sH.type="group";const nH={measureText:VE};class rH{static instance(){return rH.instance_||(rH.instance_=new rH),rH.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 aH{constructor(){this.id=SM(),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))?pM("不要重复添加相同的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 oH extends aH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const lH=(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"},hH=(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 cH extends o{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=qa.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=qa.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||lH(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=hH(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=qa.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=hH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=lH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=qa.now()-i>this.config.press.time&&hH(s[0],t){ah.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:yo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class uH extends dH{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 C=ah.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,M;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},M={startAngle:x}):(w={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?w:M,"in"===b?M:w,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class pH extends dH{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=ah.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 gH extends ib{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&w_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(Y_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=yh(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));K_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const fH={type:"fadeIn"};function mH(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 fH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class vH extends nb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const yH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},_H={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},bH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},xH=()=>{_E.registerAnimation("scaleInOut",(()=>_H))},SH=()=>{_E.registerAnimation("fadeInOut",(()=>bH))},AH=(t,e)=>({appear:mH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:gH,duration:yH.update.duration,easing:yH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),kH=()=>{_E.registerAnimation("line",AH)},CH=()=>{M_.registerBuiltInAnimate("growPointsIn",UD),M_.registerBuiltInAnimate("growPointsOut",GD),M_.registerBuiltInAnimate("growPointsXIn",XD),M_.registerBuiltInAnimate("growPointsXOut",KD),M_.registerBuiltInAnimate("growPointsYIn",qD),M_.registerBuiltInAnimate("growPointsYOut",ZD),M_.registerBuiltInAnimate("clipIn",BD),M_.registerBuiltInAnimate("clipOut",ED)},wH=()=>{gb(),M_.registerBuiltInAnimate("scaleIn",uL),M_.registerBuiltInAnimate("scaleOut",pL),M_.registerBuiltInAnimate("fadeIn",PD),M_.registerBuiltInAnimate("fadeOut",OD),M_.registerBuiltInAnimate("moveIn",aL),M_.registerBuiltInAnimate("moveOut",oL),M_.registerBuiltInAnimate("rotateIn",cL),M_.registerBuiltInAnimate("rotateOut",dL),M_.registerBuiltInAnimate("update",vL),M_.registerBuiltInAnimate("state",gL),M_.registerBuiltInAnimate("fromTo",rb),M_.registerBuiltInAnimate(mO,vH)},MH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};az.STATE_HIGHLIGHT,az.STATE_BLUR;class TH{constructor(t){this._markSet=new lz,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const BH={highlightState:az.STATE_HIGHLIGHT,blurState:az.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class EH extends TH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},BH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Qz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}EH.type="element-highlight",EH.defaultOptions=BH;const PH=()=>{_E.registerInteractionTrigger(EH.type,EH)},OH={state:az.STATE_SELECTED,trigger:"click"};class RH extends TH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},OH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),Jz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Qz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}RH.type="element-select",RH.defaultOptions=OH;const IH=()=>{_E.registerInteractionTrigger(RH.type,RH)};class DH extends aH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const LH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},FH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...FH(t))})),s},zH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(LH(t,r),!1)};class HH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>_E.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>_E.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>_E.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return _E.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>_E.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){_E.registerTransform(t,e)}static registerFunction(t,e){t&&e&&rH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&rH.instance().unregisterFunction(t)}static getFunction(t){return t?rH.instance().getFunction(t):null}static getFunctionList(){return rH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=_E.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=_E.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,qP.get(e);var e}static registerSVG(t,e,i){const s=_E.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=_E.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){IE.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=SM(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=vO.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=ZF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{var n;if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?_E.getSeriesBuiltInTheme(e):_E.getComponentBuiltInTheme(e);i=i?gE({},s,i[e]):s}s===t.length-1&&u(i)&&(i=zE({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e],(null===(n=this.getFunctionList())||void 0===n?void 0:n.length)&&(i=jE(i,this)))})),this._cachedProcessedTheme[e]=i,i},BT(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:y,stage:_,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=yM(y);if(S?gR(eA):"node"===y&&mI(eA),S&&f&&(this._container=v(f)?__.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==y&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=DE.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=_E.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===e.type&&A.push("scrollbar");const C=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new VF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new XP(this,this._compiler),this._event=new zP(this._eventDispatcher,y),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),IE.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=gE({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=HE(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;HH.getFunctionList()&&HH.getFunctionList().length&&(t=jE(t,HH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=_E.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=_E.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=_E.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(NP.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(NP.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return XF(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:UE,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:GE})}_initDataSet(t){this._dataSet=t instanceof La?t:new La,$P(this._dataSet,"dataview",Ra),$P(this._dataSet,"array",i),KP(this._dataSet,"copyDataView",iO);for(const t in _E.transforms)KP(this._dataSet,t,_E.transforms[t]);for(const t in _E.dataParser)$P(this._dataSet,t,_E.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),$F(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(NP.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?oO.none:oO.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,IE.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{LH(t)})),this._exitingVRenderComponents.clear())}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Fa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=nO(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?gE({},t[n][e.index],i):i):t[n]=s?gE({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?gE({},t[n][r],i):i)}else t.id===e&&(t[n]=s?gE({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=gE({},t.getSpec(),e));const r=t.updateSpec(e),a=$F(r),o=qF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(NP.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=bE({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=LE(this._currentThemeName),this._currentTheme=o(a,l);else{const t=bE({},LE(p(r)&&r.type?r.type:p(n)&&n.type?n.type:this._currentThemeName),LE(n),LE(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(GF.poptip,UF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!yM(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return LE(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!DE.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=u(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield WF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!yM(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(u(this._container))return this._container;let e;return e=v(this._canvas)?__.getElementById(this._canvas):this._canvas,u(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?iE(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return pM("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?iE(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(pM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return rH.instance().getFunction(t)}registerFunction(t,e){t&&e&&rH.instance().registerFunction(t,e)}unregisterFunction(t){t&&rH.instance().unregisterFunction(t)}getFunctionList(){return rH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=_E.getChartPlugins();t.length>0&&(this._chartPlugin=new oH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=_E.getVChartPlugins();e.length>0&&(this._vChartPlugin=new DH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=vO.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=vO.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}HH.InstanceManager=IE,HH.ThemeManager=DE,HH.globalConfig={uniqueTooltip:!0},HH.Utils=nH,HH.vglobal=__;_E.registerRegion("region",fz),_E.registerLayout("base",kz),Xw(),zC(),_E.registerMark(sH.type,sH),_E.registerStageEventPlugin("gesture",cH),PH(),IH(),BE(hE.name,hE);const jH="monotone",NH="linear",VH="bevel";var WH;!function(t){t.vertical="vertical",t.horizontal="horizontal"}(WH||(WH={}));class UH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}class GH extends ub{constructor(t){super(t),this.lastFrameTime=0,this.status=Ml.RUNNING}setupTickHandler(){const t=new UH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ml.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ml.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ml.RUNNING,!0}}function YH(t,e){return e("component",t)}function XH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=_E.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const KH=(t,e,i,s)=>{if(d(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},$H=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,c(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],p=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(c(e.set))g=function(t){const i=p.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=p.get(`${e[a]}`);if(d(i))for(let i=0;i(g(t),t)))},qH="2.1.4",ZH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},JH=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=XH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},QH=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const tj=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function ej(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=sj(JH(h,r,a,c),p,g),o.value=sj(JH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=JH(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function ij(t,e,i,s,n,r,a){if(c(e)){ej(t,e(n,a),i,s,r,a)}else e&&ej(t,e,i,s,r,a)}const sj=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=vi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class nj{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(u(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{ij(a,t,e,i,s,n,r)})):c(t)?ij(a,t,e,i,s,n,r):t&&ej(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:JH(r.visible,t,n),value:sj(JH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:JH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=JH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&tj(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const rj={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},aj=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=mP([],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 oj(a,n,o)},oj=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{AM(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{AM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=rj[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},lj=(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=>{AM(t[e])||(t[e]=0)}))})),t},hj=`${WE}_HIERARCHY_DEPTH`,cj=`${WE}_HIERARCHY_ROOT`,dj=`${WE}_HIERARCHY_ROOT_INDEX`;function uj(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function pj(t,e,i){t&&(i.needDefaultSeriesField&&(t[$E]=i.defaultSeriesField),t[XE]=e,t[KE]=i.getKey(t,e,i))}function gj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function fj(t,e,i,s=0,n,r){void 0===r&&(r=e),pj(t,e,i),t[hj]=s,t[cj]=n||t[i.categoryField],t[dj]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>fj(e,s,i,t[hj]+1,t[cj],r)))}const mj={label:{name:"label",type:"text"}},vj=`${WE}_rect_x`,yj=`${WE}_rect_x1`,_j=`${WE}_rect_y`,bj=`${WE}_rect_y1`,xj={data:!0},Sj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},Aj=[...Object.keys(yH),"normal"];function kj(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 Bj(n)&&delete n.type,n.oneByOne&&(n=wj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Mj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=gE({},o[e],a);return Bj(n)&&delete n.type,n.oneByOne&&(n=wj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Mj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function Cj(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),Ej(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function wj(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=c(n)?n(t,i,a):A(n)?n:0,h=c(r)?r(t,i,a):A(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):A(n)?n:0,d=c(a)?a(t,r,o):A(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function Mj(t,e){var i;return null!==(i=null==t?void 0:t[XE])&&void 0!==i?i:e.context.graphicIndex}function Tj(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 Bj(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function Ej(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),Ej(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),Ej(t[s],e,i))}function Pj(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Oj extends cz{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=OB(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=_E.getSeriesMarkMap(o)?function(t,e,i){const s=_E.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=gE({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return gE({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=gE({},i,s,t),n=i.label;return n&&p(n)&&y(e.label)&&(e.label=e.label.map((t=>gE({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Rj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(Sj[e]||(t[e]=!0),t)),{}),Ij={compileOnlyKeys:Sj,dataRelatedKeys:Rj,seriesOnlyKeys:{tooltip:!0}},Dj={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Lj=t=>(t=>p(t)&&!y(t)&&!c(t))(t)?t:d(t)?{}:null,Fj=(t,e,i)=>{const s=Lj(t),n=Lj(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function zj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class Hj extends dz{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${WE}_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=Oj,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=iz.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(NP.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Pj(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(NP.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),u(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(KP(this._rawData.dataSet,"invalidTravel",lj),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=nO(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=sO(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=sO(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Pz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=oj(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){KP(this._dataSet,"dimensionStatistics",aj);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Fa(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&&mP(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){KP(this._dataSet,"dimensionStatistics",aj);const s=new Fa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=mP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&mP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Fa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:v(t)?e=>e[t]:y(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(KP(this._rawData.dataSet,"addVChartProperty",ZH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uj.bind(this),call:pj}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(NP.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(NP.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(NP.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(NP.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=kj({},Cj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:_M(i)||bM(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=gE(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=gE(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=MH(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=MH(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:az.STATE_HOVER_REVERSE,highlightState:az.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:az.STATE_SELECTED_REVERSE,state:az.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=MH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:$E;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:qE,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,qE,nz.User_SeriesStyle)}))}afterInitMark(){this.event.emit(NP.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",nz.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(_E.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new nj(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,zj(i))}_getSpecUpdatePolicy(){return Ij}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},xj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(G(t.label),G(e.label),l),!l.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Fj(t[i],e[i],Dj)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Fj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?zj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&zj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Fa||rO(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Pj(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:$E,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DB(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:$E}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,u=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${u}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,gE({},p,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:KE}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${d(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==QE&&t!==eP&&t!==JE&&t!==tP||(t=this.getStackValueField()),null!==(e=yP(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>AM(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:$E]}}function jj(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();OT(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 Nj(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}}}Hj.mark=mj,Hj.transformerConstructor=Oj;class Vj extends Hj{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);OT(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:`${WE}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(QE),this.setFieldX2(JE)):(this.setFieldY(QE),this.setFieldY2(JE))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(eP),this.setFieldX2(tP)):(this.setFieldY(eP),this.setFieldY2(tP))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(sP),this.setFieldX2(iP)):(this.setFieldY(sP),this.setFieldY2(iP))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),u(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(NP.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)&&(jj("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Wj(t){return"bottom"===t||"top"===t}function Uj(t){return"left"===t||"right"===t}function Gj(t){return"z"===t}function Yj(t,e){return $B(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Xj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Kj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Wj(t)?"linear":"band":Wj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const $j=(t,e,i)=>{var s;const n=null!==(s="band"===e?YH("axisBand",i):["linear","log","symlog"].includes(e)?YH("axisLinear",i):{})&&void 0!==s?s:{},r=Wj(t)?YH("axisX",i):Uj(t)?YH("axisY",i):YH("axisZ",i);return gE({},YH("axis",i),n,r)};class qj{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:gM)("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:gM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>IT(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Wj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Zj extends qj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Jj=(t,e)=>{var i,s;return t===e||!d(t)&&!d(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},Qj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return A(s)?[-s,s]:s},tN=(t,e,i,s)=>{var n;const r=e.getScale(),a=IT(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:eN(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,iN=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class sN extends qj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Jj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:VP.canvas}),callback:this.onMouseOut}),_M(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),_M(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var nN;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(nN||(nN={}));const rN={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},aN={sampling:!0,samplingFactor:!0};class oN{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(rN.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:VH,curveType:NH,closePath:!0},"normal",nz.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===jH?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",nz.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",nz.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(rN.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:Tj(this._spec,rN.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Fa(this._option.dataSet,{name:`${WE}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(nN.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:nz.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:az.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",nz.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",nz.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[rN.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(nN.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,gE({},this._spec[rN.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:az.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",nz.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",nz.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const lN=Object.assign(Object.assign({},mj),rN),hN=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>hN(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},cN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class dN extends eH{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return cN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(RT(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?hN(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:rz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[KE]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const uN=new Uint32Array(33),pN=new Uint32Array(33);pN[0]=0,uN[0]=~pN[0];for(let t=1;t<=32;++t)pN[t]=pN[t-1]<<1|1,uN[t]=~pN[t];function gN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&uN[31&o]&pN[1+(31&l)])return!0}else{if(i[h]&uN[31&o])return!0;if(i[c]&pN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,uN[31&o]&pN[1+(31&l)]);else for(s(h,uN[31&o]),s(c,pN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,pN[31&a]|uN[1+(31&o)]);else for(n(l,pN[31&a]),n(h,uN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function fN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function mN(t,e,i=!1){return i?fN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function vN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=mN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=fN(t,r)),e.getRange(r)))}function yN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return yN(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return yN(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return yN(t,e,n,s,h,d)}return!1}const bN=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],xN=["top","inside-top","inside"];function SN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const AN={mode:"same-time",duration:300,easing:"linear"};function kN(t){return 3===t||4===t}function CN(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 wN=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 MN(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)}}class TN extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class BN extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const EN=(t,e)=>Math.ceil(t)>Math.floor(e),PN=([t,e],[i,s])=>s>t&&e>i;function ON(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const RN=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class IN extends Jp{constructor(t,e){super(t),this._skipRenderAttributes=RN,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{FN(t,e,i)})),e}function zN(t,e){e&&(null==t||t.onComplete.push(e))}function HN(t){t.forEach((t=>{t()}))}function jN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var NN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(UM.hover,!0),CM(this,(t=>{t===e||E(t.states)||t.addState(UM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(CM(this,(t=>{E(t.states)||(t.removeState(UM.hoverReverse),t.removeState(UM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void CM(this,(t=>{E(t.states)||(t.removeState(UM.selectedReverse),t.removeState(UM.selected))}));E(e.states)||(e.addState(UM.selected,!0),CM(this,(t=>{t===e||E(t.states)||t.addState(UM.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)===yo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===yo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Se(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[MN(g,f,c,d,a,o),MN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=jM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Sl)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),HN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,zN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(AN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=FN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=FN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},jN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(c(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=c(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!h(t)&&c(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}c(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return JM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=c(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&EN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&EN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(ON([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!PN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(mN(i,e,!0))}))),h.length>0&&h.forEach((t=>{v(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(mN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(mN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;LN(i,null==n?void 0:n.attribute),LN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{WN[t]=e};var GN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};YN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const XN=()=>{UN("line",YN),UN("area",YN)};var KN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}$N.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const qN=()=>{UN("symbol",$N),UN("line-data",$N)};class ZN extends dN{constructor(){super(...arguments),this.type=ZN.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)===EB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}ZN.type="line";const JN=()=>{_E.registerMark(ZN.type,ZN),Xw(),ew(),XN(),qN(),CH(),_E.registerGraphicComponent("line",rg)};class QN extends eH{constructor(){super(...arguments),this.type=QN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}QN.type="symbol";const tV=()=>{_E.registerMark(QN.type,QN),Xw(),eM(),qN(),_E.registerGraphicComponent("symbol",Ug)};class eV extends Oj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function iV(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function sV(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function nV(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 rV(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 aV(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 oV(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 lV=t=>t.map(((t,e)=>({index:e,value:t}))),hV=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},cV=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=KM(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return lV(v)};class pV{constructor(t){this.id=SM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class gV extends pV{constructor(){super(gV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!OT(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(NP.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&iV(c)&&iV(d)))return;const u=sV(t,c),p=sV(e,d);if(!0===u.break&&!0===p.break)return;const{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(!rV(u,p))return}else if(0===_&&0===b){if(!rV(p,u))return}else if(y||A)if(y&&!A){if(!nV(u,p))return}else if(A&&!y){if(!nV(p,u))return}else{if(f===b)return;if(f>b){if(!aV(u,p))return}else if(!aV(p,u))return}else{if(0===f&&0===_){if(!oV(u,p))return}else if(0===b&&0===g&&!oV(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){KP(e.getOption().dataSet,"tickAlign",uV);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}gV.pluginType="component",gV.type="AxisSyncPlugin";const fV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function mV(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 vV(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 yV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const _V=t=>"band"===t||"ordinal"===t||"point"===t;function bV(t,e){return{id:t,label:t,value:e,rawValue:t}}function xV(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class SV extends aH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const AV=`${WE}_ARC_TRANSFORM_VALUE`,kV=`${WE}_ARC_RATIO`,CV=`${WE}_ARC_START_ANGLE`,wV=`${WE}_ARC_END_ANGLE`,MV=`${WE}_ARC_K`,TV=`${WE}_ARC_MIDDLE_ANGLE`,BV=`${WE}_ARC_QUADRANT`,EV=`${WE}_ARC_RADIAN`,PV=-Math.PI/2,OV=3*Math.PI/2,RV=.6,IV=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},DV=(t,e,i)=>{var s;const n=null!==(s="band"===e?YH("axisBand",i):"linear"===e?YH("axisLinear",i):{})&&void 0!==s?s:{},r=YH("angle"===t?"axisAngle":"axisRadius",i);return gE({},YH("axis",i),n,r)};function LV(t,e,i,s){switch(t){case n.cartesianBandAxis:return $j(Yj(i,["z"]),"band",e);case n.cartesianLinearAxis:return $j(Yj(i,["z"]),"linear",e);case n.cartesianLogAxis:return $j(Yj(i,["z"]),"log",e);case n.cartesianSymlogAxis:return $j(Yj(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return $j(Yj(i),void 0,e);case n.polarBandAxis:return DV(i.orient,"band",e);case n.polarLinearAxis:return DV(i.orient,"linear",e);case n.polarAxis:return DV(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=YH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>Wj(t.orient)));let g;g=u(p)?gE({},_V(p.type)?a:o,l):l;const f=r.find((t=>Uj(t.orient)));let m;return m=u(f)?gE({},IT(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=YH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?gE({},_V(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?gE({},IT(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return FV(i,YH(t,e));default:return YH(t,e)}}const FV=(t,e)=>{var i;const s=gE({},e,e[Xj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class zV extends cz{getTheme(t,e){return LV(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({},eE(e)),{[s]:0}))}}class HV extends pz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=zV,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof $a||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:VP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new SV(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;LH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=FH(t),s=zH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}LH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var jV,NV;HV.transformerConstructor=zV,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(jV||(jV={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(NV||(NV={}));class VV extends eH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=zH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?LH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(LH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?(this._component.setAttributes(i),this._product&&this._component.parent!==this._product&&this._product.appendChild(this._component)):(this._component=_E.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(HP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}VV.type="component";const WV=()=>{_E.registerMark(VV.type,VV)};var UV,GV;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(UV||(UV={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(GV||(GV={}));const YV={[GV.selectedReverse]:{},[GV.selected]:{},[GV.hover]:{},[GV.hoverReverse]:{}},XV=t=>t,KV={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class $V extends HV{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?jV.circleAxis:jV.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?NV.circleAxisGrid:NV.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:iz.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(this._syncComponentVisibility(),(null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=kj(null===(l=_E.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=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||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Pz(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&CT(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=y(a)?OT(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!OT(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return CT(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;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(NP.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=wT(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),CT(this._regions,(t=>{t.event.on(NP.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(NP.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):CT(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(CT(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;tV(null==e?void 0:e[i],null==t?void 0:t[i])||KV[i]))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=EP(s=e.domainLine)).startSymbol=EP(s.startSymbol),s.endSymbol=EP(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=H(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return RP(gE({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:RP(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RP(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=RP(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return RP(gE({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:RP(e.tick.style)),e.tick.state&&(i.tick.state=PP(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return RP(gE({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:RP(e.subTick.style)),e.subTick.state&&(i.subTick.state=PP(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=fV[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:gE({},u,RP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:RP(h.style)}),h.state&&(i.title.state.shape=PP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:RP(o.style)}),o.state&&(i.title.state.background=PP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=PP(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=RP(e.background.style)),e.background.state&&(i.panel.state=PP(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:NE(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return RP(gE({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:RP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:NE(t.subGrid.alternateColor),style:RP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=XH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){$P(this._option.dataSet,"scale",XV);const i=this.registerTicksTransform();return new Fa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===UV.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}$V.specKey="axes";const qV=()=>{WV(),_E.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},ZV=[gV];class JV extends $V{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=iz.Axis,this.layoutLevel=sz.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),CT(this._regions,(t=>{const e=this.getOrient();Wj(e)?xV(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Uj(e)?xV(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Gj(e)&&xV(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._clearContinuousBarBandwidthCache=()=>{this._continuousBarBandwidthCache=void 0},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=gE({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(gE({x:e.x,y:e.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Wj(this.getOrient()),n=t=>{var e;return(s?!Wj(t.getOrient()):Wj(t.getOrient()))&&OT(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Yj(e,["z"]),Gj(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!yV(e))return null;const{axisType:t,componentName:s}=Kj(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=>Uj(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(!yV(t))return;const{axisType:s,componentName:n}=Kj(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=_E.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Wj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Gj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(ZV.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Wj(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!Wj(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Gj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Uj(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=JB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=JB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Wj(this.getOrient())?t.fieldX:Gj(this.getOrient())?t.fieldZ:t.fieldY,OT(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:OT(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getBandwidth:(t=0)=>this._getContinuousBarBandwidth(t),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}_getContinuousBarBandwidth(t=0){if(0!==t||!OT(this._scale.type))return;const e=this._scales[0],i=e.domain(),s=e.range(),n=+(null==i?void 0:i[0]),r=+(null==i?void 0:i[i.length-1]),a=+(null==s?void 0:s[0]),o=+(null==s?void 0:s[s.length-1]);if(!(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(a)&&Number.isFinite(o)&&n!==r))return;const l=this._continuousBarBandwidthCache;if(l&&l.scale===e&&l.domainStart===n&&l.domainEnd===r&&l.rangeStart===a&&l.rangeEnd===o)return l.bandWidth;const h=new Set,c=this.getOrient();CT(this._regions,(t=>{var e,i,s,n;if(t.type!==EB.bar)return;const r=t,a=Wj(c)&&"vertical"===r.direction?r.fieldX[0]:Uj(c)&&"horizontal"===r.direction?r.fieldY[0]:void 0,o=a?null===(n=null===(s=null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.latestData)||void 0===s?void 0:s[a])||void 0===n?void 0:n.values:void 0;null==o||o.forEach((t=>{const e=+t;Number.isFinite(e)&&h.add(e)}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const d=Array.from(h).sort(((t,e)=>t-e));if(d.length<2)return;let u=1/0,p=d[0];for(let t=1;t0&&i{if(t===this._axisMark&&!1===this._isLayout&&(Wj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Wj(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return CT(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]:Wj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Gj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();CT(this._regions,(e=>{Wj(t)?xV(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Uj(t)?xV(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Gj(t)&&xV(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Wj(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=Wj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=gE(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ne).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Wj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return bV(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:OT(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),CT(this._regions,(t=>{var e,i;null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i||i.target.addListener("change",this._clearContinuousBarBandwidthCache)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._specVisible&&(this.event.on(NP.layoutEnd,this._updateAxisLayout),this.event.on(NP.layoutEnd,this._fixAxisOnZero),this.event.on(NP.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}JV.type=n.cartesianAxis,JV.specKey="axes";class QV{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Pz(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(NP.scaleDomainUpdate,{model:this}),this.event.emit(NP.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(n.push(r),o){const e=bV(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=>bV(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(NP.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const tW=(t,e,i,s)=>{const n=dV(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},eW=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,iW=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?lV([s[s.length-1]]):lV([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=X(g);if(s.length<=f/n){const i=tW(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=nW(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=tW(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!eW(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?iW(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function aW(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=pT(t,!!n),o=pT(r,!!n);const h=re.distancePP(s,l),c=re.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=rW(e,t,!1,!!n),o=rW(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=pT(t,!!n),o=pT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class oW extends IN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&hT(this._innerView),this.removeAllChild(!0),this._innerView=jM.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 cT(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?`${UV.grid}-sub`:`${UV.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=pT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=rW(t,o,!1,!!a)}const u=jM.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:oW.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=pT(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=jM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:oW.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}oW.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class lW{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=FM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return LM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class hW extends sb{onBind(){var t;const e=_L(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;LN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class cW extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;LN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function dW(){zC(),ew(),Gw(),hM(),M_.registerBuiltInAnimate("axisEnter",hW),M_.registerBuiltInAnimate("axisUpdate",cW)}zC(),hw();class uW extends oW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},oW.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NM,endAngle:r=VM}=this.attribute;i=uT(t,s,re.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function pW(){zC(),ew(),vw(),eM()}function gW(){zC(),ew(),pC(),eM()}U(uW,lW),pW();class fW extends IN{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fW.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=jM.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),E(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=jM.line;G(i)[0].cornerRadius&&(t=jM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=jM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:Z(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}fW.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}}},gW();class mW extends fW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fW.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=jM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function vW(){zC(),Ow(),eM(),Gw(),hM()}var yW=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nc&&(w=c,R.setAttribute("maxLineWidth",c-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=w,A&&A.setAttribute("x",(A.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):j>0&&S.setAttribute("x",b[3]):(k-=w/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const N="right"===_||"end"===_,V="left"===_||"start"===_,W=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:G(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=w-b[1]-b[3],e=I+B,i=1===j?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(V&&1!==j){const t=w-b[1]-b[3],e=0===j?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=w-b[1]-b[3],e=0===j?t/2+B/2:t;if(W(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-D/2),S.setAttribute("y",-b[2])):"top"===H&&(S.setAttribute("y",b[0]),A&&A.setAttribute("y",D/2)),E(null==m?void 0:m.text)||(R.states=m.text);const{visible:U}=a,Y=yW(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:M,x:k,y:C}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Sl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},_W.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}_W.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const bW=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(UM.hover,!0),CM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(UM.hoverReverse,!0)})),s):i},xW=(t,e,i)=>i?(CM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(UM.hoverReverse),t.removeState(UM.hover))})),null):i,SW=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(UM.selected)?(CM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(UM.selectedReverse),t.removeState(UM.selected))})),null):s.name&&!E(s.states)?(s.addState(UM.selected,!0),CM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(UM.selectedReverse,!0)})),s):i},AW={type:"default",duration:300,easing:"linear"};class kW extends DN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=bW(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=xW(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=SW(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=jM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),HN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,zN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(CM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=FN(this),{delay:a=0,duration:o=AW.duration,easing:l=AW.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};LN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=FN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},jN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&hT(this._innerView),this.removeAllChild(!0),this._innerView=jM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(AW)}_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=jM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=UV.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=jM.group({x:0,y:0,pickable:!1});t.name=UV.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=jM.group({x:0,y:0,pickable:!1});i.name=UV.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=jM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=UV.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=GM;else{const t=this.data[s],e=z({},GM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=jM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=UV.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=GM;else{const i=z({},GM,s.state);Object.keys(i).forEach((s=>{c(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=jM.group({x:0,y:0,pickable:!1});return r.name=`${UV.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=JM(this._getLabelAttribute(t,e,n,i));if(a.name=UV.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=GM;else{const s=z({},GM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new _W(Object.assign({},e));i.name=UV.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return cT(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&c(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=c(y)?z({},sT.label.style,y(t,e,i,s)):y;y=z(this.getLabelAlign(m,o,y.angle),y),c(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return c(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},CM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=I(r.attribute),a=I(e.attribute),o=qA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},LN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const CW={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&&gT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function wW(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function MW(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:CW[n]||CW.parity;if(s.length>=3&&fT(s,r)){do{s=a(s,r)}while(s.length>=3&&fT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);gT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),MW(l,s,n,(t=>gT(t,l,r))),MW(h,s,o,(t=>gT(t,h,r)||!(!n||t===l)&&gT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function BW(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},OW(t,e.attribute.angle)),{angle:PW(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({},RW(t,e.attribute.angle)),{angle:PW(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Ce({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function PW(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function OW(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=PW(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 RW(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=PW(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 IW(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=lT(h),m=oT(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function DW(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var LW=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=jM.group({zIndex:999});e.name=UV.axisBreak,e.id=this._getNodeId(`${UV.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},nT,s),a=null!==(e=r.size)&&void 0!==e?e:nT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=jM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=UV.axisBreakSymbol;const h=jM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=UV.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=jM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=UV.background,n.id=this._getNodeId("background"),n.states=z({},YV,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new _W(Object.assign({},t));e.name=UV.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=LW(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},YV,l),symbol:z({},YV,l)});const d=new fW(c);d.name=UV.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=LW(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),k=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let w,M,{angle:T}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(T)&&o){T=zM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else w=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(T&&0!==T){const t=Math.abs(Math.sin(T));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},k),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:M},a),state:{text:z({},YV,c.text),shape:z({},YV,c.shape),panel:z({},YV,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=LW(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=zM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return OW(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return RW(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=Y(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=ae(e)})),EW(i,t),!BW(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=lT(a),l=oT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=DW(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Yt(c,i))}}else{if(l){const i=DW(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Yt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);IW(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&TW(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=jM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=UV.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=$M(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}FW.defaultAttributes=sT,U(FW,lW);const zW={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},HW={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}}},jW={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}}},NW={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}}};class VW extends JV{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new eB}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,sW),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=YT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),p=e=>{const i=t===n?a:0;if(d(r)||t{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),qV(),_E.registerComponent(VW.type,VW,!1)},UW=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function GW(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,XW=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function KW(t,e,i="count"){const s=XW(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const $W=Math.sqrt(50),qW=Math.sqrt(10),ZW=Math.sqrt(2);class JW{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=vV(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=Wj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!c(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(Y(e)-e[0]);i<=1||A(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(YW),e.sort(YW),{domain:GW(t,e),scope:KW(t,e,i)}}(r,cM(t),this._spec.breaks[0].scopeType);e=cM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=vV(this._spec);if(u(e)||u(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=$W?10:n>=qW?5:n>=ZW?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(NP.scaleDomainUpdate,{model:this}),this.event.emit(NP.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(NP.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function QW(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function tU(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!OT(t.type))return lV(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return lV([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(u(h))m=QW(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=QW(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=QW(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=dV(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=dV(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?iU.greedy:iU.parity;for(;l.length>=3&&fT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;gT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),tU(t,l,a,(e=>gT(e,t,i))),tU(n,l,o,(e=>gT(e,n,i)||!(!a||e===t)&&gT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return lV(m)},iU={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&gT(i,t,e)||(i=t,0))))}},sU={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class nU extends JV{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new SB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Gj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Wj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=qB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=cM(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,eU),t}}nU.type=n.cartesianLinearAxis,nU.specKey="axes",nU.builtInTheme={axis:HW,axisLinear:sU,axisX:jW,axisY:NW},U(nU,JW);const rU=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),qV(),_E.registerComponent(nU.type,nU)},aU=`${WE}_hide_`;function oU(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const lU=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[aU]&&(oU(t,!0),t[aU]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[aU]=!0,oU(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},hU=()=>{_E.registerGrammarTransform("symbolOverlap",{transform:lU,runType:"afterEncode"})},cU={min:K,max:X,average:bT,sum:_T};function dU(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function uU(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 pU(t,e,i,s){return uU(t,e,i,"min",s)}function gU(t,e,i,s){return uU(t,e,i,"max",s)}function fU(t,e,i,s){return uU(t,e,i,"average",s)}function mU(t,e,i,s){return uU(t,e,i,"sum",s)}const vU=(t,e)=>{let i=c(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=dU;if("min"===n?l=pU:"max"===n?l=gU:"average"===n?l=fU:"sum"===n&&(l=mU),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[]},yU=()=>{_E.registerGrammarTransform("dataSampling",{transform:vU})};class _U extends Vj{constructor(){super(...arguments),this.type=EB.line,this.transformerConstructor=eV,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),aN)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(kj(null===(i=_E.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),Cj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Nj(this);this._symbolMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Cj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}_U.type=EB.line,_U.mark=lN,_U.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},_U.transformerConstructor=eV,U(_U,oN);class bU{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{rO(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Fa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];pM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];pM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class xU{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)=>{kM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{mP(e,[{key:t,operations:OT(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&&mP(e,[{key:i.field,operations:OT(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?GB("colorOrdinal"):GB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(kM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),kM(s.domain)?e.reRender=!0:V(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(!kM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=OT(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=OT(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;OT(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(OT(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=OT(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)));OT(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class SU{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Jz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Qz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Qz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Jz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&Jz(t,i,!0,l):a&&Jz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&Jz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Qz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Qz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const AU={[n.markPoint]:!0,[n.markLine]:!0,[n.markArea]:!0},kU={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class CU extends hz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=SM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:UE,height:GE},this._viewRect={width:UE,height:GE},this._viewBox={x1:0,y1:0,x2:UE,y2:GE},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>u(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(kU).some((t=>!d(e[t])))},this._paddingSpec=eE(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new zP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new bU(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new SU;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=_E.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(kj({},Cj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=_E.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:iz.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=_E.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(NP.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(NP.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(NP.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof dz)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 eH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof eH)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&rO(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=XF(this._spec,this._option,{width:UE,height:GE})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DB(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new xU(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){ZF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DB(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=eE(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{ZF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},r={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===n.label||l.type===n.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));r[l.type]&&(r[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(y(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);qF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),ZF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);qF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),ZF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(r).forEach((e=>{if(r[e]){const i=this._spec[e];(y(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(AU[t]&&y(e)&&y(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return AU[t]&&y(e)&&e.length>0&&y(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!AU[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;AU[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];ZF(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=QB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(NP.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(az.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(az.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(az.STATE_SELECTED)}clearHovered(){this.clearState(az.STATE_HOVER)}_initEvent(){[NP.dataZoomChange,NP.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(HP.AFTER_MARK_RENDER_END,e)};this._event.on(HP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:LP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(DP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===nN.dimensionHover||s===nN.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>IT(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>IT(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const wU=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)},MU={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class TU{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},MU),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):dE(t,a,c.spec),dE(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=wU(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=wU(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(_E.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(_E.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=_E.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=_E.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=_E.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):KH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=KH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class BU extends TU{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&gE(i,JF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class EU extends BU{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),YF(t)}}const PU=(t,e)=>{const i={nodes:{}},{fields:s}=c(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=_P(t,!0);for(const e in o)for(const i in o[e].nodes)AP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)SP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&xP(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(NP.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class RU{_beforeInit(){this._dataSet&&KP(this._dataSet,"stackSplit",PU)}_initStack(){this._stack=new OU(this),this._stack.init()}}const IU={state:az.STATE_DIMENSION_HOVER,reverseState:az.STATE_DIMENSION_HOVER_REVERSE,trigger:nN.dimensionHover};class DU extends TH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},IU,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=LP(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}DU.type="dimension-hover",DU.defaultOptions=IU;const LU=()=>{_E.registerInteractionTrigger(DU.type,DU)},FU=()=>{_E.registerComposedEvent(nN.dimensionHover,sN),_E.registerComposedEvent(nN.dimensionClick,Zj)},zU=t=>t.fieldX[0],HU=t=>t.fieldY[0],jU=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},NU=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},VU=(t,e)=>t?e?zU:jU:e?HU:NU,WU=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=iN(t,(t=>Wj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=iN(t,(t=>Uj(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{IT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=UU(t,i,VU(e,IT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=UU(t,i,VU(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},UU=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:GU(t,s,i)},GU=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=tN(e,t,"cartesian",null!=i?i:Wj(t.getOrient())?zU:HU);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},YU=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(IT(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(OT(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=mV(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};KU(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&XU(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),XU=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=XH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},KU=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},$U=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=qU(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},qU=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},ZU=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return YU(c,r,e),c.xField.cacheInfo?$U(c.xField):c.yField.cacheInfo?$U(c.yField):void 0},JU=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],QU=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&JU.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(tG(s).every((t=>{var e;return!tj("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},tG=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},eG={dom:`${WE}_TOOLTIP_HANDLER_DOM`,canvas:`${WE}_TOOLTIP_HANDLER_CANVAS`},iG={key:"其他",value:"..."};var sG;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(sG||(sG={}));class nG{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(NP.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=QU(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},iG),t):iG;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&tj(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class rG extends nG{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!IT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const aG=()=>{_E.registerTooltipProcessor("dimension",rG)};class oG extends nG{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,vo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(LP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const lG=()=>{_E.registerTooltipProcessor("mark",oG)};class hG extends nG{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const cG=()=>{_E.registerTooltipProcessor("group",hG)};class dG extends CU{constructor(){super(...arguments),this.transformerConstructor=EU,this.type="line",this.seriesType=EB.line}_setModelOption(){this._modelOption.getDimensionInfo=WU,this._modelOption.getDimensionInfoByValue=GU,this._modelOption.getRectByDimensionData=ZU}}dG.type="line",dG.seriesType=EB.line,dG.transformerConstructor=EU,U(dG,RU);const uG=[...cN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class pG extends dN{constructor(){super(...arguments),this.type=pG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return uG}_getIgnoreAttributes(){return[]}}pG.type="area";const gG=()=>{_E.registerMark(pG.type,pG),Xw(),MC(),XN(),qN(),CH(),_E.registerGraphicComponent("area",Gp)};class fG extends nj{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),u(e))return e}return i}}}const mG=Object.assign(Object.assign(Object.assign({},mj),rN),{area:{name:"area",type:"area"}}),vG=()=>{_E.registerAnimation("area",AH),kH(),xH()};class yG extends eV{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||p&&!d)&&(g=h,f=l),l.style=gE({},f.style,g.style),l.state=gE({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function _G(){zC(),Ow()}function bG(){return"browser"===__.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const xG={debounce:xt,throttle:St};_G();let SG=class t extends IN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=bG(),a="browser"===__.env?__:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=vt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:xG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(XM,{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",xG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(yt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ai(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ai(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=vt(t[0],0,1),c=vt(t[1],0,1),d=vt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=bG(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};SG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class AG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ne).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=AG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(XM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new SG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),D.setAttribute("x",D.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),D.setAttribute("y",D.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}OG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class RG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,OG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new OG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,z(e,GF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class IG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class DG extends IG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class LG extends IG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function FG(t){t.isBound(RG)||(t.bind(RG).toSelf().inSingletonScope(),t.bind(a_).toService(RG)),t.isBound(DG)||(t.bind(DG).toSelf(),t.bind(xv).toService(DG)),t.isBound(LG)||(t.bind(LG).toSelf(),t.bind(xv).toService(LG))}class zG extends IN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zC(),ew();class HG extends zG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HG.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})}}HG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zC(),Ow();class jG extends zG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jG.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})}}jG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zC(),pC();class NG extends zG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}NG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zC(),pC();class VG extends zG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},VG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NM,endAngle:s=VM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}VG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zC(),hw();class WG extends zG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},WG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=he(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}WG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class UG{isInValidValue(t){const{startAngle:e=NM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return dT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function GG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=GG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var KG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=uT(n,l,c,e,i);h=jM.path(Object.assign(Object.assign({},a.style),{path:pT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=jM.circle(t)}h.name=UV.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},YV,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=KG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;d(_)&&(_=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:y,textAlign:"center"},l),state:{text:z({},YV,u.text),shape:z({},YV,u.shape),panel:z({},YV,u.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=GG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&YG(e,c,i)}else e.AABBBounds.width()>r&&YG(e,r,i)}else o>a.x&&h.x2>n.x2?(YG(e,n.x2-o,i),r&&XG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}$G.defaultAttributes=sT,U($G,UG);const qG=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=cT(r,dT(s,r,e,n));return o=a,l=dT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(pt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return lV(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=qG(t,i,e),r=K(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=JG(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return lV(d)},JG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&hV(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var QG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=ge(h.endAngle-d/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new iY(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):kN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=kN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=kN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(ft(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=kN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?kN(t.quadrant)?"left":"right":kN(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(kN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(pt(l/2,u))g=0,f=1,m=-p;else if(pt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),HN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,zN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}rY.defaultAttributes={pickable:!1};var aY,oY,lY,hY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(cY,UG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(aY||(aY={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(oY||(oY={})),function(t){t.dataZoomChange="dataZoomChange"}(lY||(lY={}));const dY="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",uY={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:dY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:dY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},pY={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}},gY=0,fY=1,mY=2,vY=3,yY=4,_Y=5,bY=5,xY=999,SY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var AY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:mY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:mY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:gY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,w;const{orient:M,middleHandlerStyle:T={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:O,end:R}=this._getState(),{position:I,width:D,height:L}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(T.visible){const t=(null===(i=T.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+O*D,y:I.y-t,width:(R-O)*D,height:t,zIndex:_Y},null===(s=T.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=T.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(O+R)/2*D,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=T.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:_Y},T.icon),{pickable:!P&&(null===(h=T.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*D,y:I.y+L/2,size:L,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},pY.horizontal),{zIndex:_Y}),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*D,y:I.y+L/2,size:L,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},pY.horizontal),{zIndex:_Y}),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+O*D-t/2,y:I.y+L/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:xY},pY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+R*D-g/2,y:I.y+L/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:xY},pY.horizontal),{pickable:!P}),"rect")}else{if(T.visible){const t=(null===(g=T.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+D,y:I.y+O*L,width:t,height:(R-O)*L,zIndex:_Y},null===(f=T.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=T.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+D+t/2,y:I.y+(O+R)/2*L,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=T.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:_Y},T.icon),{pickable:!P&&(null===(S=null===(x=T.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+O*L,size:D,symbolType:null!==(A=B.symbolType)&&void 0!==A?A:"square"},pY.vertical),{zIndex:_Y}),B),{pickable:!P&&(null===(k=B.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+R*L,size:D,symbolType:null!==(C=E.symbolType)&&void 0!==C?C:"square",zIndex:_Y},pY.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+D/2+t/2,y:I.y+O*L-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:xY},pY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+D/2+i/2,y:I.y+R*L-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:xY},pY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:vY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:vY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:fY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:yY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return $A(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ne).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=AY(c,["formatMethod"]),{formatMethod:g}=d,f=AY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,w,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},w={textAlign:SY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:SY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:SY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:SY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:bY}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:bY}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new _W(e),s.name=i,t.add(s)),s}}const CY={debounce:xt,throttle:St};class wY extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=aY.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=aY.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=aY.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=aY.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=aY.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===__.env?__:this.stage,s=bG();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===aY.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===aY.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===aY.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===aY.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(oY.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(oY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(oY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===aY.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(oY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(oY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:CY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===__.env?__:this.stage,e=bG();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:vt(e+t,0,1),end:vt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=aY.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}vW(),Ow(),eM(),MC(),ew();let MY=class t extends IN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new kY(this._getRendererAttrs()),this._interaction=new wY(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(oY.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(oY.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(lY.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(oY.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(lY.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var TY,BY,EY,PY;function OY(){zC(),vW(),gb()}MY.defaultAttributes=uY,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"}(TY||(TY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(BY||(BY={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(EY||(EY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(PY||(PY={}));class RY extends IN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=bW(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=xW(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=SW(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=jM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=jM.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=jM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),HN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,zN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=FN(this);this.markerAnimate("exit");const n=FN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},jN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function IY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function DY(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;LN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function LY(t,e,i,s){t&&(DY(t.startSymbol,e,i,s),IY(t).forEach((t=>DY(t,e,i,s))),DY(t.endSymbol,e,i,s))}function FY(t,e,i,s){t&&(DY(t.getTextShape(),e,i,s),DY(t.getBgRect(),e,i,s))}function zY(t,e,i,s){var n,r,a,o;t&&(LN(t,{fillOpacity:0,strokeOpacity:0},{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 HY(t,e,i,s){t&&(zY(t.startSymbol,e,i,s),IY(t).forEach((t=>zY(t,e,i,s))),zY(t.endSymbol,e,i,s))}function jY(t,e,i,s){t&&(zY(t.getTextShape(),e,i,s),zY(t.getBgRect(),e,i,s))}function NY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;DY(t.startSymbol,s,r,n);const h=IY(t);h.forEach((t=>LN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),DY(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;DY(t.getTextShape(),e,l,n),DY(t.getBgRect(),e,l,n)}))}function VY(t,e,i,s,n){LY(t,s,i,n),G(e).forEach((t=>{FY(t,s,i,n)}))}function WY(t,e,i,s,n){DY(t,s,i,n),G(e).forEach((t=>{FY(t,s,i,n)}))}function UY(t,e,i,s,n){DY(t,s,i,n),G(e).forEach((t=>{FY(t,s,i,n)}))}function GY(t,e,i,s,n,r){var a;LY(t,n,s,r),DY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?FY(i,n,s,r):DY(i,n,s,r)}function YY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;DY(t.startSymbol,n,o,r);const u=IY(t);u.forEach((t=>LN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),DY(e,n+o+l,h,r),DY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(DY(i.getTextShape(),n+o+l+h+c,d,r),DY(i.getBgRect(),n+o+l+c,d,r)):DY(i,n+o+l+c,d,r)}function XY(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?NY(t,e,s,r,a):"fadeIn"===i&&VY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?NY(t,e,s,n,a):"fadeIn"===i&&VY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){HY(t,s,i,n),G(e).forEach((t=>{jY(t,s,i,n)}))}(t,e,i,s,n)}}function KY(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&&WY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&WY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){zY(t,s,i,n),G(e).forEach((t=>{jY(t,s,i,n)}))}(t,e,i,s,n)}}function $Y(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&&UY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&UY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){zY(t,s,i,n),G(e).forEach((t=>{jY(t,s,i,n)}))}(t,e,i,s,n)}}function qY(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?GY(n,r,e,i,s,o):"callIn"===t&&YY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?GY(n,r,e,i,s,a):"callIn"===t&&YY(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;HY(t,n,s,r),zY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?jY(i,n,s,r):zY(i,n,s,r)}(n,r,e,t,i,s)}}const ZY={type:"clipIn",duration:500,easing:"linear",delay:0},JY={type:"fadeIn",duration:500,easing:"linear",delay:0},QY={type:"callIn",duration:500,easing:"linear",delay:0},tX={type:"fadeOut",duration:500,easing:"linear",delay:0};class eX{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new _W(Object.assign(Object.assign({},h),{state:{panel:z({},GM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},GM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},GM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},GM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class iX extends RY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=ZY,this.defaultExitAnimation=tX}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;iT(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(iX,eX);const sX=.001,nX={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:TY.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]}},rX={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"}}},aX={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:EY.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]}},oX={interactive:!0,label:{position:BY.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}},lX={interactive:!0,label:{autoRotate:!0,position:EY.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}},hX={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"}},cX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},dX={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 uX(){pX._animate=XY}OY(),pW(),gb();class pX extends iX{markerAnimate(t){pX._animate&&this._animationConfig&&pX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(MM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return TM(Math.abs(e),Math.PI/2,sX)||TM(Math.abs(e),3*Math.PI/2,sX)?BM(i,e,t):MM(e)?rX.postiveXAxis[t]:rX.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new fW({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},GM,null==a?void 0:a.line),startSymbol:z({},GM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},GM,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({},GM,null==a?void 0:a.line),startSymbol:z({},GM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},GM,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=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",pX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(pX.defaultAttributes.label)}}function gX(){fX._animate=KY}pX.defaultAttributes=nX,OY(),vw(),gb();class fX extends RY{markerAnimate(t){fX._animate&&this._animationConfig&&fX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=JY,this.defaultExitAnimation=tX}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},cX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;iT(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=jM.polygon(Object.assign({points:e},i));n.states=z({},GM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",fX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},GM,null==i?void 0:i.area)),this._updateMarkLabels(fX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}fX.defaultAttributes=oX,U(fX,eX),OY(),gW(),gb();class mX extends iX{markerAnimate(t){mX._animate&&this._animationConfig&&mX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case EY.arcInnerStart:l=n;case EY.arcOuterStart:l=n;break;case EY.arcInnerEnd:l=r;case EY.arcOuterEnd:l=r;break;case EY.center:case EY.arcInnerMiddle:case EY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return hX[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new mW({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},GM,null==o?void 0:o.line),startSymbol:z({},GM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},GM,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({},GM,null==o?void 0:o.line),startSymbol:z({},GM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},GM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",mX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(mX.defaultAttributes.label)}}mX.defaultAttributes=aX,OY(),pC(),gb();class vX extends RY{markerAnimate(t){vX._animate&&this._animationConfig&&vX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},vX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=JY,this.defaultExitAnimation=tX}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case EY.center:h=(s+n)/2,c=(r+a)/2;break;case EY.arcInnerStart:h=s,c=r;break;case EY.arcOuterStart:h=n,c=r;break;case EY.arcInnerEnd:h=s,c=a;break;case EY.arcOuterEnd:h=n,c=a;break;case EY.arcInnerMiddle:h=s,c=(r+a)/2;break;case EY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},hX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;iT(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=jM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},GM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",vX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},GM,null==o?void 0:o.area)),this._updateMarkLabels(vX.defaultAttributes.label)}isValidPoints(){return!0}}function yX(){_X._animate=qY}vX.defaultAttributes=lX,U(vX,eX),OY(),pW(),gW(),eM(),YC(),ew(),gb();class _X extends RY{markerAnimate(t){_X._animate&&this._animationConfig&&_X._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},_X.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=QY,this.defaultExitAnimation=tX,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return TM(Math.abs(s),Math.PI/2,sX)||TM(Math.abs(s),3*Math.PI/2,sX)?BM(t,s,n):MM(s)?dX.postiveXAxis[n]:dX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=PY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},GM,null==p?void 0:p.textBackground),text:z({},GM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},GM,null==p?void 0:p.itemContent));const v=MM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=jM.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"text"===n?o=new _W(Object.assign(Object.assign({},i),{state:{panel:z({},GM,null==s?void 0:s.textBackground),text:z({},GM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=jM.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"image"===n?(o=jM.image(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},GM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=TM(c,0,sX)||TM(d,0,sX),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=tT(e-u,t-d),o=tT(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(TX.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(TX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===TX.focus||"focus"===o){const s=a.hasState(wX.focus);a.toggleState(wX.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[wX.unSelected,wX.unSelectedHover,wX.focus],t),this._setLegendItemState(e,wX.selected,t)})):(this._setLegendItemState(a,wX.selected,t),this._removeLegendItemState(a,[wX.unSelected,wX.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[wX.selected,wX.selectedHover,wX.focus],t),this._setLegendItemState(e,wX.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(wX.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(wX.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(MX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[wX.selected,wX.selectedHover],t),this._setLegendItemState(a,wX.unSelected,t)):(this._setLegendItemState(a,wX.selected,t),this._removeLegendItemState(a,[wX.unSelected,wX.unSelectedHover],t))}else this._setLegendItemState(a,wX.selected,t),this._removeLegendItemState(a,[wX.unSelected,wX.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[wX.selected,wX.selectedHover],t),this._setLegendItemState(e,wX.unSelected,t))}))}this._dispatchLegendEvent(MX.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,wX.selected),this._removeLegendItemState(e,[wX.unSelected,wX.unSelectedHover])):(this._removeLegendItemState(e,[wX.selected,wX.selectedHover]),this._setLegendItemState(e,wX.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=AX,spaceRow:l=kX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,w=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=w+l,w=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,w=Math.max(w,m),M.push(i)):(u(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=jM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=K(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:p,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:_,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),C=this._handleStyle(x,t,e,i,s),w=ai(c);let M;!1===x.visible?(M=jM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,TX.item,t,M)):(M=jM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,TX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?wX.selected:wX.unSelected);const T=jM.group({x:0,y:0,pickable:!1});M.add(T);let B,E=0,O=0,R=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);O=y(i)?i[0]||0:i,R=P(v,"space",8);const s=jM.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,TX.itemShape,t,M,S.state),s.addState(e?wX.selected:wX.unSelected),T.add(s)}let I=0;if(p){const e=P(g,"size",10);B=jM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,TX.focus,t,M),I=e}const D=_.formatMethod?_.formatMethod(o,t,i):o,L=JM(Object.assign(Object.assign({x:O/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:D,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(L,TX.itemLabel,t,M,A.state),L.addState(e?wX.selected:wX.unSelected),T.add(L);const F=P(_,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=JM(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,TX.itemValue,t,M,k.state),r.addState(e?wX.selected:wX.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-O-R-F-I-s;this._autoEllipsis(m,t,L,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2))}else r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),T.add(r)}else this._itemWidthByUser?(L.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-O-R-I),E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2)):E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2);B&&(B.setAttribute("x",E),T.add(B));const z=T.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;T.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=z.height(),N=u(this.attribute.item.width)?this.attribute.item.width:H+w[1]+w[3],V=this._itemHeightByUser||j+w[0]+w[2];return M.setAttributes({width:N,height:V}),B&&B.setAttribute("visible",!1),T.translateTo(-z.x1+w[3],-z.y1+w[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new SX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new SX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new SG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new SG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=AX,spaceRow:o=kX}=n,l=this._itemsContainer,{space:h=CX,defaultCurrent:c=1}=r,d=OX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=jM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=AX,spaceRow:a=kX}=s,o=this._itemsContainer,{space:l=CX,defaultCurrent:h=1}=n,c=OX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=jM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=jM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(wX.selected)?this._setLegendItemState(t,wX.selectedHover,e):this._setLegendItemState(t,wX.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===TX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(MX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(wX.unSelectedHover)||t.hasState(wX.selectedHover))&&(i=!0),t.removeState(wX.unSelectedHover),t.removeState(wX.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(wX.unSelectedHover)&&!t.hasState(wX.selectedHover)||(i=!0),t.removeState(wX.unSelectedHover),t.removeState(wX.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===TX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(MX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(MX.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!==TX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(MX.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!==TX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(MX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(wX.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},RX,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(wX.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var DX;function LX(t){return y(t)?t:[t,t]}function FX(t){return t?"ew-resize":"ns-resize"}IX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:AX,spaceRow:kX,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:CX,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"}(DX||(DX={})),EX();class zX extends IN{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({},zX.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=bG(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=bG(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(u(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=G(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:LX(p)[0],endValue:LX(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=jM.group({x:0,y:0});f.name=DX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=jM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=DX.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=jM.group({x:g?v:0,y:g?0:v});f.add(y);const _=jM.group({x:0,y:0});let b;if(_.name=DX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=jM.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=DX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=jM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=DX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=LX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":FX(p)},r));if(v.name=DX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=DX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":FX(p)},r));if(i.name=DX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=DX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=yt(h,i,s);c=t[0],u=t[1]}else c=i,u=vt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=jM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=DX.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":FX(g);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(u,e?"end":"start"),b=jM.rect(Object.assign({x:g?Math.min(y,_):0,y:g?0:Math.min(y,_),width:g?Math.abs(_-y):r,height:g?n:Math.abs(_-y),cursor:v},a));b.name=DX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return jM.symbol(t)}_renderHandlerText(t,e){return jM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return c(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":FX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=jM.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=jM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=bG(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===DX.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===DX.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===DX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===DX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}zX.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}}},PX(),EX();class HX extends BX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 jX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}HX.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"}}},PX(),EX(),hw();class NX extends BX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NX.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=jM.group({x:0,y:0});this._innerView.add(x);const S=new zX({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:jX(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 C=jM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}NX.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)"}},zC(),hM(),Gw();let VX=class t extends IN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:w,subtextStyle:M={},width:T,height:B,minWidth:E,maxWidth:P,minHeight:O,maxHeight:R,align:I,verticalAlign:D,padding:L=0}=this.attribute,F=ai(L),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||u(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:T)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},YM),C),x:h,y:c,width:null!==(s=null!=t?t:T)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:T,heightLimit:null!==(a=C.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,R-j);if("rich"===k||u(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:T)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:w},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:w},YM),M),x:n,y:r,width:null!==(c=null!=t?t:T)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(w)?w:[w],whiteSpace:"normal"},M),{maxLineWidth:null!==(p=M.maxLineWidth)&&void 0!==p?p:T,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const V=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(N,W),G=j+(null!==(f=M.height)&&void 0!==f?f:V);if(u(T)&&(U=T),u(B)&&(G=B),u(E)&&UP&&(U=P),u(O)&&GR&&(G=R),z.setAttributes({width:U,height:G,boundsPadding:F}),this._mainTitle){if(u(I)||u(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:U;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:D,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(_=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==_?_:U;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:D,e=this._mainTitle?u(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};VX.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 WX={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"}}};zC(),hM(),Gw();let UX=class extends IN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(WX,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=JM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const p=$M(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",u(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;A(_)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",u(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class GX extends Wg{constructor(t){super(t)}}var YX,XX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(YX||(YX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(XX||(XX={}));class KX extends IN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},KX.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"},KX.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"},KX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},KX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},KX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{d(this._playController)&&(this._playController=new GX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new GX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new GX(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(YX.OnPlay)},this.pause=()=>{this._dispatchEvent(YX.OnPause)},this.forward=()=>{this._dispatchEvent(YX.OnForward)},this.backward=()=>{this._dispatchEvent(YX.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()}}KX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},KX.defaultAttributes={[XX.Start]:{},[XX.Pause]:{},[XX.Backward]:{},[XX.Forward]:{}};const $X={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},qX=[200,10];var ZX,JX;!function(t){t.Default="default",t.Reverse="reverse"}(ZX||(ZX={})),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"}(JX||(JX={}));const QX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===ZX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===ZX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),tK=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===ZX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===ZX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),eK=t=>"top"===t||"bottom"===t;class iK extends IN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},iK.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(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(eK(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:qX[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:qX[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 zX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=eK(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new KX(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=eK(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:qX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(eK(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:eK(this._orient)?t+s:(this._size.width-r)/2,y:eK(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:eK(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:eK(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:eK(this._orient)?t+s:(this._size.width-r)/2,y:eK(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function sK(){EX(),zC(),eM()}iK.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({},$X),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},$X),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},$X),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},$X),{key:"backward",position:"start"})}},sK();class nK extends iK{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:ZX.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(YX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(YX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(YX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(YX.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(JX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(QX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||tK({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===ZX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(JX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=__.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(JX.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(JX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=__.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(),__.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(JX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(JX.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(JX.change),this.dispatchCustomEvent(JX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var rK,aK=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())}))};sK();class oK extends iK{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(YX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(YX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(YX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(YX.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(JX.change))},this.play=()=>aK(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(JX.play),this._rafId=__.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=__.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(JX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(JX.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(JX.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(JX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(rK||(rK={}));const lK={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},hK=5;const cK={debounce:xt,throttle:St};zC(),vw();let dK=class t extends IN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=lK.updateTrigger,endTrigger:i=lK.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(G(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:cK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(rK.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=lK.trigger,resetTrigger:i=lK.resetTrigger}=this.attribute;G(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),G(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(rK.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(rK.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=hK}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(rK.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(rK.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(rK.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=hK}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(rK.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(rK.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),G(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=lK.updateTrigger,endTrigger:s=lK.endTrigger}=this.attribute;G(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),G(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=jM.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};dK.defaultAttributes=lK;const uK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},pK=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},gK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},fK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zC(),Ow(),eM(),hM(),Gw();let mK=class t extends IN{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=ai(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:wM(p)&&wM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:wM(p)&&wM(p.value)},pK(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:wM(p)&&wM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:wM(p)&&wM(p.value)},pK(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},YM),p.value),visible:wM(p)&&wM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=wM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const y=wM(p)?p.height+p.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!wM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let p="right"===c?(o?d:0)+(wM(n.key)?r+n.key.spacing:0)+(wM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(QM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:wM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),QM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(wM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=kh(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(wM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},pK(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},pK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(wM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},pK(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},pK(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=>fK.includes(t)))?(this._mergeAttributes(e,s),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&wM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=wM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=KM(d),y=KM(u);let _=0;if(wM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(wM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return uK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return uK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};mK.defaultAttributes=gK;class vK extends nU{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),CT(this._regions,(t=>{Wj(this.getOrient())?xV(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):xV(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=gE({},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 Fa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Pz(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=vi.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=>bV(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=>bV(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,eU),t}transformScaleDomain(){}}vK.type=n.cartesianTimeAxis,vK.specKey="axes",vK.builtInTheme={axis:HW,axisX:jW,axisY:NW};const yK=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),qV(),_E.registerComponent(vK.type,vK)};class _K extends nU{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new wB}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,eU),t}transformScaleDomain(){}}_K.type=n.cartesianLogAxis,_K.specKey="axes",_K.builtInTheme={axis:HW,axisLinear:sU,axisX:jW,axisY:NW},U(_K,JW);const bK=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),qV(),_E.registerComponent(_K.type,_K)};class xK extends nU{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new MB}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,eU),t}transformScaleDomain(){}}xK.type=n.cartesianSymlogAxis,xK.specKey="axes",xK.builtInTheme={axis:HW,axisLinear:sU,axisX:jW,axisY:NW},U(xK,JW);const SK=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),qV(),_E.registerComponent(xK.type,xK)};class AK extends Vj{constructor(){super(...arguments),this.type=EB.area,this.transformerConstructor=yG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),aN)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(AK.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===jH?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return YB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",nz.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return YB(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",nz.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[QE]},"normal",nz.Series),this.setMarkStyle(o,{curveType:a},"normal",nz.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(kj(null===(e=_E.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),Cj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(kj(null===(i=_E.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),Cj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Nj(this);this._symbolMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Cj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new fG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}AK.type=EB.area,AK.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},AK.mark=mG,AK.transformerConstructor=yG,U(AK,oN);class kK extends BU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),YF(t)}}class CK extends CU{constructor(){super(...arguments),this.transformerConstructor=kK,this.type="area",this.seriesType=EB.area}_setModelOption(){this._modelOption.getDimensionInfo=WU,this._modelOption.getDimensionInfoByValue=GU,this._modelOption.getRectByDimensionData=ZU}}CK.type="area",CK.seriesType=EB.area,CK.transformerConstructor=kK,U(CK,RU);function wK(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 MK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:wK(t,e)}),TK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:wK(t,e)}),BK={type:"fadeIn"},EK={type:"growCenterIn"};function PK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return BK;case"scaleIn":return EK;default:return MK(t)}}class OK extends eH{constructor(){super(...arguments),this.type=OK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}OK.type="rect";const RK=()=>{Xw(),Ow(),UN("rect",tY),_E.registerMark(OK.type,OK),M_.registerBuiltInAnimate("growHeightIn",jD),M_.registerBuiltInAnimate("growHeightOut",ND),M_.registerBuiltInAnimate("growWidthIn",sL),M_.registerBuiltInAnimate("growWidthOut",nL),M_.registerBuiltInAnimate("growCenterIn",FD),M_.registerBuiltInAnimate("growCenterOut",zD),_E.registerGraphicComponent("rect",fg)},IK=Object.assign(Object.assign({},mj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function DK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=sE(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):YB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[yj]):YB(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=YB(this._dataToPosX(t),e,i),n=YB(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[_j]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):YB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[bj]):YB(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=YB(this._dataToPosY(t),e,i),n=YB(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),zK)})}getStatisticFields(){var t;const e=super.getStatisticFields(),i="horizontal"===this.direction?this.getYAxisHelper():this.getXAxisHelper(),s="horizontal"===this.direction?this._fieldY:this._fieldX,n=null===(t=null==i?void 0:i.getScale)||void 0===t?void 0:t.call(i,0);return n&&OT(n.type)&&s.forEach((t=>{const i=e.find((e=>e.key===t));i?i.operations.includes("values")||i.operations.push("values"):e.push({key:t,operations:["values"]})})),e}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},HK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:Tj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(HK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",nz.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===n.cartesianBandAxis));let r;if(KP(this._option.dataSet,"addVChartProperty",ZH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};KP(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Fa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:uj.bind(this),call:pj}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new Pz(this._option,r)}init(t){super.init(t),this.initRectMarkStyle()}_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=bj,s=_j,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=yj,s=vj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=_P(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)DK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=YB(this[r](t),l,i),u=YB(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!XB(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",nz.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",nz.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&d(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,d=!1,p=1/0,g=-1/0;i.values.forEach((e=>{const i=e[JE],n=e[QE],r=e[tP],c=e[eP];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?_j:vj],i=e[a?bj:yj];l=Math.min(l,t,i),h=Math.max(h,t,i)}u(r)&&u(c)&&(d=!0,p=Math.min(p,r,c),g=Math.max(g,r,c))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[JE]:s,[QE]:o}),d?{[tP]:p,[eP]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(fg(Object.assign(Object.assign({},m),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>YB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",nz.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",nz.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>YB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",nz.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",nz.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",nz.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",nz.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Nj(this);this._barMark.setAnimationConfig(kj(null===(e=_E.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),Cj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i;const s=this._groups?this._groups.fields.length:1,n=d(e)?s:Math.min(s,e),r=u(this._spec.barWidth)&&n===s,a=r&&"number"==typeof this._spec.barWidth&&"string"!=typeof this._spec.barMinWidth&&"string"!=typeof this._spec.barMaxWidth||null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,n-1),o=null!=a?a:6,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=!t.isContinuous||d(a)||r?o:.5*o;return r&&(c=sE(this._spec.barWidth,o)),l&&(c=Math.max(c,sE(this._spec.barMinWidth,o))),h&&(c=Math.min(c,sE(this._spec.barMaxWidth,o))),c}_getPosition(t,e,i,s){var n,r,a,o,l,h;let c,p,g;"horizontal"===t?(c=this.getYAxisHelper(),p="height",g="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(c=this.getXAxisHelper(),p="width",g="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const f=c.getScale(0),m=this._groups?this._groups.fields.length:1,v=d(i)?m:Math.min(m,i),y=null!==(r=null===(n=c.getBandwidth)||void 0===n?void 0:n.call(c,v-1))&&void 0!==r?r:6,_=v===m?this._barMark.getAttribute(p,e):y;if(v>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const h=t[r],d=null!==(o=null===(a=c.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=sE(null!==(l=i[r-1])&&void 0!==l?l:Y(i),y),g=d.indexOf(e[h]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return f.scale(e[t[0]])+(null!==(h=c.getBandwidth(0))&&void 0!==h?h:y)/2-s/2+n}const b=OT(f.type||"band");return g(e,v)+.5*(y-_)+(b?-y/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}HK.type=EB.bar,HK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},HK.mark=IK,HK.transformerConstructor=FK;const jK=()=>{yU(),RK(),_E.registerAnimation("bar",((t,e)=>({appear:PK(t,e),enter:MK(t,!1),exit:TK(t,!1),disappear:{duration:yH.disappear.duration}}))),WW(),rU(),_E.registerSeries(HK.type,HK)};class NK extends BU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),YF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=p(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class VK extends CU{constructor(){super(...arguments),this.transformerConstructor=NK,this.type="bar",this.seriesType=EB.bar}_setModelOption(){this._modelOption.getDimensionInfo=WU,this._modelOption.getDimensionInfoByValue=GU,this._modelOption.getRectByDimensionData=ZU}}VK.type="bar",VK.seriesType=EB.bar,VK.transformerConstructor=NK,U(VK,RU);const WK=[10,20],UK=ET.Linear,GK="circle",YK=ET.Ordinal,XK=["circle","square","triangle","diamond","star"],KK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},$K=Object.assign(Object.assign({},mj),{point:{name:"point",type:"symbol"}});class qK extends Oj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const ZK={sizeField:!0};class JK extends Vj{constructor(){super(...arguments),this.type=EB.scatter,this.transformerConstructor=qK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),ZK)})}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(c(e))return e;if(y(e)){if(d(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${WE}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${WE}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:UK,defaultRange:WK},"size")}getShapeAttribute(t,e){return d(e)?GK:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:YK,defaultRange:XK},"shape")}initMark(){this._symbolMark=this._createMark(JK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Tj(this._spec,JK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Nj(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(kj(null===(i=_E.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),Cj("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:GK},az.STATE_NORMAL,nz.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},az.STATE_NORMAL,nz.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},az.STATE_NORMAL,nz.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",nz.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",nz.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},az.STATE_NORMAL,nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},az.STATE_NORMAL,nz.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ue});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}JK.type=EB.scatter,JK.mark=$K,JK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},JK.transformerConstructor=qK;const QK=()=>{tV(),_E.registerAnimation("scatter",((t,e)=>Object.assign({appear:KK(0,e)},_H))),WW(),rU(),_E.registerSeries(JK.type,JK)};class t$ extends BU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class e$ extends CU{constructor(){super(...arguments),this.transformerConstructor=t$,this.type="scatter",this.seriesType=EB.scatter}_setModelOption(){this._modelOption.getDimensionInfo=WU,this._modelOption.getDimensionInfoByValue=GU,this._modelOption.getRectByDimensionData=ZU}}e$.type="scatter",e$.seriesType=EB.scatter,e$.transformerConstructor=t$,U(e$,RU);const i$=()=>{aG(),lG(),FU(),LU(),QK(),_E.registerChart(e$.type,e$)};class s$ extends Hj{constructor(){super(...arguments),this.type=EB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return d(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${WE}_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 n$=(t,e)=>{const i=c(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[XE]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[fP]=a||r})),s};class r$ extends nj{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 a$ extends eH{constructor(){super(...arguments),this.type=a$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}a$.type="path";const o$=()=>{_E.registerMark(a$.type,a$),Xw(),hw(),_E.registerGraphicComponent("path",lg)},l$=Object.assign(Object.assign({},mj),{area:{name:"area",type:"path"}});class h${constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Na(i,e):Ha[i]?(za[i]||(za[i]=Na(i,Ha[i])),za[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class c${parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class d${constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function u$(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:c$}:_M(t)||bM(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:d$}:null}const p$={debounce:xt,throttle:St};class g${constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=_M(this._renderMode)||bM(this._renderMode),u$(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return u$(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:WP.chart,consume:!1}];l.on(...c,p$[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,p$[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||u$(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||u$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return d(r)&&d(a)?s:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:WP.chart,consume:!1}];l.on(...c,p$[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,p$[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){u$(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||u$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:WP.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:WP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||u$(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||u$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=p$[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=p$[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:WP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp)}))}}class f$ extends HV{constructor(){var t,e;super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=iz.Mark,this._projectionSpec={name:(t=this.type,e=this.id,`${WE}_${e}_${t}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:n.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=gE(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(NP.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new h$(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===EB.map||e.type===EB.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),CT(this._regions,(t=>{var e;if(t.type===EB.map||t.type===EB.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==EB.map&&e.type!==EB.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[fP],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}f$.type=n.geoCoordinate,U(f$,g$);const m$=()=>{_E.registerComponent(f$.type,f$)};class v$ extends Oj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class y$ extends s${constructor(){super(...arguments),this.type=EB.map,this.transformerConstructor=v$,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 !`),qP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),KP(this._dataSet,"copyDataView",iO),KP(this._dataSet,"map",n$),KP(this._dataSet,"lookup",$H);const i=qP.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Fa(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:aO.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:fP,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 Pz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(y$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:Tj(this._spec,y$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:$E])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:$E]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",nz.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",nz.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(kj(null===(t=_E.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),Cj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new r$(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[XE]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[XE],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(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 XE}getActiveMarks(){return[this._pathMark]}}y$.type=EB.map,y$.mark=l$,y$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},y$.transformerConstructor=v$;const _$=`${WE}_waterfall_default_seriesField`,b$=(t,e)=>{if(!t||0===t.length)return t;const i=c(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let d=Array.from(l[s]);"decrease"===a&&(d=d.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return d.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[aP]=!0:delete t[aP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===d.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=x$([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}=S$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>se(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=ie(y,e)):(t[c]=+_,_=ie(_,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,d,e,i,a),void o.push(s)}u=x$(r,t,s,o,u,d,e,i),o.push(s)})),o};function x$(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=S$(t,i,s,n,u);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(d(p)||p===_$)&&(t[_$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function S$(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?pM("total.collectCountField error"):n=e[a].start;o<0?pM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ie(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const A$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=c(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},k$={type:"fadeIn"},C$={type:"growCenterIn"};function w$(t,e){switch(e){case"fadeIn":return k$;case"scaleIn":return C$;default:return MK(t,!1)}}class M$ extends eH{constructor(){super(...arguments),this.type=M$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return rg(t)}}M$.type="rule";const T$=()=>{_E.registerMark(M$.type,M$),Xw(),ew(),_E.registerGraphicComponent("line",rg)},B$=Object.assign(Object.assign({},IK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),E$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:P$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function P$(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)=>P$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class O${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 Fa(e instanceof La?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),KP(e,"dimensionTree",E$),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 R$ extends FK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const I$={rect:j$,symbol:z$,arc:V$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=z$(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:W$,line:U$,area:U$,rect3d:j$,arc3d:V$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function D$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=I$[t])&&void 0!==i?i:I$.point;return e.series.type===EB.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=F$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:G$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function L$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==EB.sankey){const{formatFunc:t,args:n}=XH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function F$(t){return c(t)?e=>t(e.data):t}function z$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=F$(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:H$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function H$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function j$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=F$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:N$(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function N$(t){const e=[{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"]}}];return e}function V$(t){var e;const{labelSpec:i}=t,s=null!==(e=F$(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function W$(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=L$(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),Zg(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function U$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[$E]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function G$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const Y$={calculationMode:!0};class X$ extends HK{constructor(){super(...arguments),this.type=EB.waterfall,this.transformerConstructor=R$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&xP(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Y$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new O$(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],d(this._seriesField)&&(this._seriesField=_$)}getSeriesKeys(){return this._seriesField===_$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),KP(this._dataSet,"waterfallFillTotal",A$),KP(this._dataSet,"waterfall",b$),(d(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=sO(this.getViewData(),this._dataSet,{name:`${WE}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Pz(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:JE,endAs:QE,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Nj(this);this._barMark.setAnimationConfig(kj(null===(i=_E.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),Cj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Cj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(X$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return W$(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?YB(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):YB(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,y1:e=>this.totalPositionY(e,"index",this._getLeaderLineCategoryPos(!1,t))},"normal",nz.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,x1:e=>this.totalPositionX(e,"index",this._getLeaderLineCategoryPos(!1,t)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",nz.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&XB([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}X$.type=EB.waterfall,X$.mark=B$,X$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},X$.transformerConstructor=R$;const K$=()=>{T$(),RK(),_E.registerAnimation("waterfall",((t,e)=>({appear:w$(t,e),enter:MK(t,!1),exit:TK(t,!1),disappear:{duration:yH.disappear.duration}}))),SH(),WW(),rU(),_E.registerSeries(X$.type,X$)},$$=`${WE}_BOX_PLOT_OUTLIER_VALUE`;var q$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(q$||(q$={}));const Z$=(t,e)=>{const i=[],s=c(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=y(e)?e:[e];i.push(...s.map((e=>{const i={[$$]:e};return r.forEach((e=>{i[e]=t[e]})),u(a)&&(i[a]=t[a]),i})))})),i};class J$ extends nj{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===q$.OUTLIER)return this.series.getOutliersField();if(t===q$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case q$.MIN:return this.series.getMinField();case q$.MAX:return this.series.getMaxField();case q$.MEDIAN:return this.series.getMedianField();case q$.Q1:return this.series.getQ1Field();case q$.Q3:return this.series.getQ3Field();case q$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===q$.OUTLIER)return e[$$];if(t===q$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case q$.MIN:return e[this.series.getMinField()];case q$.MAX:return e[this.series.getMaxField()];case q$.MEDIAN:return e[this.series.getMedianField()];case q$.Q1:return e[this.series.getQ1Field()];case q$.Q3:return e[this.series.getQ3Field()];case q$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[$$])}getDefaultContentList(t){return[{key:this.getContentKey(q$.OUTLIER),value:this.getContentValue(q$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(q$.MAX),value:this.getContentValue(q$.MAX)},{key:this.getContentKey(q$.Q3),value:this.getContentValue(q$.Q3)},{key:this.getContentKey(q$.MEDIAN),value:this.getContentValue(q$.MEDIAN)},{key:this.getContentKey(q$.Q1),value:this.getContentValue(q$.Q1)},{key:this.getContentKey(q$.MIN),value:this.getContentValue(q$.MIN)},{key:this.getContentKey(q$.SERIES_FIELD),value:this.getContentValue(q$.SERIES_FIELD)}]}}const Q$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class tq extends eH{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==rz.enter&&t.context.diffState!==rz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{Q$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?z(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=qp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=_E.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const eq=()=>{_E.registerGraphicComponent("glyph",qp),Xw(),LC()},iq=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],sq=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class nq extends tq{constructor(){super(...arguments),this.type=nq.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=iq,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=sq,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}nq.type="boxPlot";const rq=Object.assign(Object.assign({},mj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),aq=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.from.min=o,f.to.min=c),A(d)&&(f.from.max=o,f.to.max=d),A(u)&&(f.from.q1=o,f.to.q1=u),A(p)&&(f.from.q3=o,f.to.q3=p),A(g)&&(f.from.median=o,f.to.median=g),f},oq=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.to.min=o,f.from.min=c),A(d)&&(f.to.max=o,f.from.max=d),A(u)&&(f.to.q1=o,f.from.q1=u),A(p)&&(f.to.q3=o,f.from.q3=p),A(g)&&(f.to.median=o,f.from.median=g),f},lq=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),hq=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,k,C;if(i&&A(i.center))return i.center;let w,M,T,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=lq(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=lq(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,T=null===(p=null===(u=null===(d=null===(c=lq(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=lq(t,"box").attribute.width,i=lq(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=lq(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=lq(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,T=null===(C=null===(k=null===(S=null===(x=lq(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===k?void 0:k[0])||void 0===C?void 0:C.y;const e=lq(t,"box").attribute.height,i=lq(t,"box").attribute.y;B=i,E=i+e}return A(w)?w:A(B)&&A(E)?(B+E)/2:A(M)&&A(T)?(M+T)/2:A(T)?T:A(M)?M:NaN},cq=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(A(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=lq(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=lq(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=lq(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=lq(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=lq(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=lq(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=lq(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=lq(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=lq(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=lq(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return A(v)?v:A(b)&&A(x)?(b+x)/2:A(y)&&A(_)?(y+_)/2:A(_)?_:A(y)?y:NaN};class dq extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return aq(hq)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class uq extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return oq(hq)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class pq extends dq{computeAttribute(){return aq(cq)(this.target,this.params,this.params.options)}}class gq extends uq{computeAttribute(){return oq(cq)(this.target,this.params,this.params.options)}}class fq extends Oj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const mq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class vq extends Vj{constructor(){super(...arguments),this.type=EB.boxPlot,this.transformerConstructor=fq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),mq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(vq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(vq.mark.outlier,{key:XE,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,az.STATE_NORMAL,nz.Series),this.setMarkStyle(a,s,az.STATE_NORMAL,nz.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},az.STATE_NORMAL,nz.Series),this.initBoxPlotMarkStyle()}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>YB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>YB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>YB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>YB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>YB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},az.STATE_NORMAL,nz.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>YB(t(this.getDatumPositionValues(e,$$),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>YB(t(this.getDatumPositionValues(e,$$),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,az.STATE_NORMAL,nz.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;KP(this._dataSet,"foldOutlierData",Z$),KP(this._dataSet,"addVChartProperty",ZH);const t=new Fa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${WE}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:uj.bind(this),call:pj}},!1),this._outlierData=new Pz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return u(this._spec.boxWidth)&&(r=sE(this._spec.boxWidth,n)),u(this._spec.boxMinWidth)&&(r=Math.max(r,sE(this._spec.boxMinWidth,n))),u(this._spec.boxMaxWidth)&&(r=Math.min(r,sE(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),p=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,p-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(p>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=sE(null!==(a=i[o-1])&&void 0!==a?a:Y(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=OT(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Nj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=_E.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(Cj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(kj(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(kj(null===(a=_E.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new J$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}vq.type=EB.boxPlot,vq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},vq.mark=rq,vq.transformerConstructor=fq;const yq=()=>{eq(),ew(),Ow(),_E.registerGraphicComponent("line",(t=>rg(t))),_E.registerGraphicComponent("rect",(t=>fg(t))),_E.registerMark(nq.type,nq),tV(),xH(),WW(),rU(),M_.registerBuiltInAnimate("boxplotScaleIn",dq),M_.registerBuiltInAnimate("boxplotScaleOut",uq),M_.registerBuiltInAnimate("barBoxplotScaleIn",pq),M_.registerBuiltInAnimate("barBoxplotScaleOut",gq),_E.registerSeries(vq.type,vq)};class _q extends eH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=_q.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Hg(t):Zg(t)}}_q.type="text";const bq=()=>{_E.registerMark(_q.type,_q),Xw(),hM(),Gw(),_E.registerGraphicComponent("text",Zg),_E.registerGraphicComponent("richtext",Hg)};class xq extends nj{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const Sq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),Aq={type:"fadeIn"},kq=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function Cq(t,e){return"fadeIn"===e?Aq:Sq(t)}const wq=Object.assign(Object.assign({},IK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class Mq extends FK{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 Tq extends HK{constructor(){super(...arguments),this.type=EB.rangeColumn,this._barMarkType="rect",this._barName=EB.bar,this.transformerConstructor=Mq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(Tq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Tj(this._spec,Tq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(Tq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(Tq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",nz.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Nj(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(kj(null===(i=_E.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),Cj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Cj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(kj(null===(n=_E.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),Cj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new xq(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)}}Tq.type=EB.rangeColumn,Tq.mark=wq,Tq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},Tq.transformerConstructor=Mq;const Bq=()=>{RK(),bq(),_E.registerAnimation("rangeColumn",((t,e)=>({appear:Cq(t,e),enter:Sq(t),exit:kq(t),disappear:{duration:yH.disappear.duration}}))),SH(),WW(),rU(),_E.registerSeries(Tq.type,Tq)};var Eq,Pq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(Eq||(Eq={})),function(t){t.middle="middle",t.start="start",t.end="end"}(Pq||(Pq={}));class Oq extends nj{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const Rq=Object.assign({},mG);class Iq extends AK{constructor(){super(...arguments),this.type=EB.rangeArea}initMark(){this._areaMark=this._createMark(Iq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",nz.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",nz.Series),this.setMarkStyle(t,{stroke:!1},"normal",nz.Series))}initTooltip(){this._tooltipHelper=new Oq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}Iq.type=EB.rangeArea,Iq.mark=Rq;class Dq extends Hj{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=RV,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};OT(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:[]};OT(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(NP.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)&&jj(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Lq(t){return AM(t)?Number.parseFloat(t):0}const Fq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&zq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[AV],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[AV]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},zq=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===Lq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Lq(i[e])),0)));function Hq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const jq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Hq(t,!0,oO.appear)}),Nq={type:"fadeIn"},Vq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Hq(t,!0,oO.enter)}),Wq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Hq(t,!0,oO.exit)});function Uq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Nq;case"growRadius":return jq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return jq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Gq extends eH{constructor(t,e){super(t,e),this.type=Yq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[TV])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Yq extends Gq{constructor(){super(...arguments),this.type=Yq.type}}Yq.type="arc";const Xq=()=>{Xw(),pC(),UN("arc",sY),M_.registerBuiltInAnimate("growRadiusIn",tL),M_.registerBuiltInAnimate("growRadiusOut",eL),M_.registerBuiltInAnimate("growAngleIn",DD),M_.registerBuiltInAnimate("growAngleOut",LD),_E.registerGraphicComponent("arc",Vp),_E.registerMark(Yq.type,Yq)},Kq=Object.assign(Object.assign({},mj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class $q extends Oj{_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=gE({},this._theme,i,t);const n=(t,e)=>gE({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const qq=`${WE}_LABEL_VISIBLE`,Zq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},Jq={outerRadius:!0};class Qq extends Dq{constructor(){super(...arguments),this.transformerConstructor=$q,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:JB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:JB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=PV,this._endAngle=OV,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[TV];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(u(this._spec.startAngle)?ae(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?ae(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;KP(this._dataSet,"pie",Fq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:CV,asEndAngle:wV,asRatio:kV,asMiddleAngle:TV,asRadian:EV,asQuadrant:BV,asK:MV,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Fa(this._dataSet,{name:`${WE}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Pz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Qq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:KE,groupKey:this._seriesField,isSeriesMark:!0},{morph:Tj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return TT(CV)(t)}endAngleScale(t){return TT(wV)(t)}_computeLayoutRadius(){return IV((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:KB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:KB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",nz.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",nz.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,nz.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",nz.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:TT(qq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(NP.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Jq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Zq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[TV];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===oO.appear)return this._startAngle;if(i===oO.disappear)return this._endAngle;const r=[oO.disappear,oO.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[XE];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[TV]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[TV]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[TV]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[TV]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=kj(null===(i=_E.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Qq.transformerConstructor=$q,Qq.mark=Kq,Qq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class tZ extends Qq{constructor(){super(...arguments),this.type=EB.pie}}tZ.type=EB.pie;const eZ=()=>{Xq(),_E.registerAnimation("pie",((t,e)=>({appear:Uq(t,e),enter:Vq(t),exit:Wq(t),disappear:{duration:yH.disappear.duration}}))),_E.registerAnimation("emptyCircle",((t,e)=>({appear:Uq(t,e)}))),_E.registerSeries(tZ.type,tZ)};function iZ(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const sZ=t=>({type:iZ(t.growField),options:{overall:!0}}),nZ={type:"fadeIn"},rZ=t=>({type:iZ(t.growField)}),aZ=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function oZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return nZ;case"growAngle":return sZ(Object.assign(Object.assign({},t),{growField:"angle"}));default:return sZ(Object.assign(Object.assign({},t),{growField:"radius"}))}}const lZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class hZ extends Dq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),lZ)})}getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(QE),this.setInnerRadiusField(JE)}setValueFieldToPercent(){this.setRadiusField(eP),this.setInnerRadiusField(tP)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const cZ=Object.assign(Object.assign({},mj),{rose:{name:"rose",type:"arc"}});class dZ extends Oj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class uZ extends $V{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=_E.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=iz.Axis,this._tick=void 0,this._center=null,this._startAngle=PV,this._endAngle=OV,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),CT(this._regions,(t=>{"radius"===this.getOrient()?xV(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):xV(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:JB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:JB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:mV(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){CT(this._regions,(t=>{"radius"===this.getOrient()?xV(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):xV(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return OT(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:OT(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>bV(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=re.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return IV((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=RV,e=0;const i=this.getChart().getSpec();return CT(this.getRegions(),(s=>{const n=s;if(r=n.type,[EB.rose,EB.radar,EB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(gE({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(gE({},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)}}uZ.type=n.polarAxis,uZ.specKey="axes";const pZ={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},gZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class fZ extends uZ{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new SB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,eU),t}}fZ.type=n.polarLinearAxis,fZ.specKey="axes",fZ.builtInTheme={axis:HW,axisLinear:sU,axisAngle:gZ,axisRadius:pZ},U(fZ,JW);const mZ=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),_E.registerGraphicComponent(jV.circleAxis,((t,e)=>new $G(t,e))),_E.registerGraphicComponent(NV.circleAxisGrid,((t,e)=>new cY(t,e))),qV(),_E.registerComponent(fZ.type,fZ)};class vZ extends uZ{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new eB}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,ZG),t}transformScaleDomain(){}}vZ.type=n.polarBandAxis,vZ.specKey="axes",vZ.builtInTheme={axis:HW,axisBand:zW,axisAngle:gZ,axisRadius:pZ},U(vZ,QV);const yZ=()=>{_E.registerGraphicComponent(jV.lineAxis,((t,e)=>new FW(t,e))),_E.registerGraphicComponent(NV.lineAxisGrid,((t,e)=>new uW(t,e))),_E.registerGraphicComponent(jV.circleAxis,((t,e)=>new $G(t,e))),_E.registerGraphicComponent(NV.circleAxisGrid,((t,e)=>new cY(t,e))),qV(),_E.registerComponent(vZ.type,vZ)};class _Z extends hZ{constructor(){super(...arguments),this.type=EB.rose,this.transformerConstructor=dZ,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(_Z.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Tj(this._spec,_Z.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>YB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=YB(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(kj(null===(i=_E.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),Cj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}_Z.type=EB.rose,_Z.mark=cZ,_Z.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},_Z.transformerConstructor=dZ;const bZ=()=>{_E.registerSeries(_Z.type,_Z),Xq(),_E.registerAnimation("rose",((t,e)=>({appear:oZ(t,e),enter:rZ(t),exit:aZ(t),disappear:{duration:yH.disappear.duration}}))),yZ(),mZ()};class xZ extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,mT(this._fromAngle,this._toAngle)&&mT(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class SZ extends gH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!kT(t)&&!kT(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new ne(s,n,r,a);return o.defined=e.defined,o}}const AZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function kZ(t,e,i){return"fadeIn"===e?AZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function CZ(t,e,i){return"fadeIn"===e?AZ(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 wZ=(t,e)=>({custom:uH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),MZ=Object.assign(Object.assign(Object.assign({},mj),rN),{area:{name:"area",type:"area"}});class TZ extends hZ{constructor(){super(...arguments),this.type=EB.radar,this.transformerConstructor=eV,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(TZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:NH,closePath:!0},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:u(this._spec.startAngle)?ae(this._spec.startAngle):PV},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(kj(null===(s=_E.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),Cj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=_E.getAnimationInKey(e);t.setAnimationConfig(kj(null==i?void 0:i(n,r),Cj(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}}}TZ.type=EB.radar,TZ.mark=MZ,TZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},TZ.transformerConstructor=eV,U(TZ,oN);const BZ=()=>{_E.registerSeries(TZ.type,TZ),gG(),JN(),tV(),_E.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:kZ(t,e,"in"),enter:kZ(t,e,"in"),exit:kZ(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:yH.disappear.duration},update:[{channel:["points","center"],custom:SZ,customParameters:t,duration:yH.update.duration,easing:yH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),_E.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:CZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:yH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:xZ,customParameters:t,duration:yH.update.duration,easing:yH.update.easing}]}))),_E.registerAnimation("radarGroup",((t,e)=>({appear:wZ(t,"in"),disappear:{duration:yH.disappear.duration}}))),pC(),yZ(),mZ()};class EZ extends nj{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>vi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const PZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(WE)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[XE]:r,[KE]:`${s}_${e}`})),r++}))})),n},OZ={fill:"#bbb",fillOpacity:.2},RZ=Object.assign(Object.assign({},mj),{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"}}),IZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},DZ={grid:{background:!0}};class LZ extends Vj{constructor(){super(...arguments),this.type=EB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),IZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),DZ)})}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),KP(this._option.dataSet,"objFlat",PZ),KP(this._option.dataSet,"copyDataView",iO),$P(this._option.dataSet,"dataview",Ra),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:aO.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(gE(OZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(LZ.mark.group),this._containerMark=this._createMark(LZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(LZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(LZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(LZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(LZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(LZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(LZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",nz.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",nz.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",nz.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",nz.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",nz.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",nz.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",nz.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",nz.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",nz.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:$E}}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 WB).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:$E}}initTooltip(){this._tooltipHelper=new EZ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}LZ.type=EB.dot,LZ.mark=RZ,LZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class FZ extends nj{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>vi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const zZ=Object.assign(Object.assign({},mj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),HZ=(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 jZ extends Vj{constructor(){super(...arguments),this.type=EB.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),KP(this._option.dataSet,"linkDotInfo",HZ),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:aO.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(jZ.mark.group),this._containerMark=this._createMark(jZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(jZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(jZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",nz.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",nz.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",nz.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",nz.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:$E}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new FZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}jZ.type=EB.link,jZ.mark=zZ,jZ.builtInTheme={link:{arrow:{style:{size:10}}}};const NZ=Object.assign(Object.assign({},mj),{group:{name:"group",type:"group"}}),VZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class WZ extends Dq{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()?JE:uP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle);let o;if(u(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return d(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?QE:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),VZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=u(n)?ae(n):PV;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?ae(r):OV,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||u(null==s?void 0:s.startAngle)||u(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=YB(this.angleAxisHelper.dataToPosition([t[JE]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=YB(this.angleAxisHelper.dataToPosition([t[QE]]),this.angleAxisHelper.getScale(0));if(A(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?YB(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(WZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",nz.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[fg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const XZ=()=>{_E.registerAnimation("circularProgress",((t,e)=>({appear:YZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:yH.disappear.duration}})))};class KZ extends Oj{constructor(){super(...arguments),this._supportStack=!0}}const $Z={cornerRadius:!0,roundCap:!0};class qZ extends WZ{constructor(){super(...arguments),this.type=EB.circularProgress,this.transformerConstructor=KZ,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(A(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(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),$Z)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(qZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:Tj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",nz.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(qZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?JE:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?QE: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",nz.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(kj(null===(i=_E.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),Cj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Cj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}qZ.type=EB.circularProgress,qZ.mark=UZ,qZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},qZ.transformerConstructor=KZ;const ZZ=()=>{_E.registerSeries(qZ.type,qZ),Xq(),XZ(),SH(),yZ(),mZ()};function JZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const QZ={type:"fadeIn"};function tJ(t,e="grow"){return!1===e?{}:"fadeIn"===e?QZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:JZ(t)}))(t)}class eJ extends nj{enableByType(t){return"dimension"!==t}}const iJ=Object.assign(Object.assign({},mj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),sJ={bandWidth:!0,cornerRadius:!0,clamp:!0},nJ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class rJ extends Vj{constructor(){super(...arguments),this.type=EB.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),sJ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),nJ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(rJ.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return YB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?YB(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",nz.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return YB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?YB(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",nz.Series)}}_initTrackMark(){return this._trackMark=this._createMark(rJ.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",nz.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return YB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",nz.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(kj(null===(i=_E.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),Cj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(kj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Cj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new eJ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}rJ.type=EB.linearProgress,rJ.mark=iJ,rJ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const aJ=()=>{RK(),_E.registerAnimation("linearProgress",((t,e)=>({appear:tJ(t,e),enter:tJ(t),disappear:{duration:yH.disappear.duration}}))),SH(),_E.registerSeries(rJ.type,rJ)},oJ=[0],lJ=[20,40],hJ=[200,500],cJ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},dJ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class uJ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const pJ=`${WE}_WORD_CLOUD_TEXT`,gJ=Object.assign(Object.assign({},mj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),fJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class mJ extends Hj{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=lJ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:hJ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:oJ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?pJ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:cJ},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||yM(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:oJ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!dJ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new uJ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(mJ.mark.word,{key:KE,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(mJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:iz.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",nz.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",nz.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",nz.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(kj(_E.getAnimationInKey("wordCloud")(n,s),Cj("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 WB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:$E])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new SB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new SB).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[XE])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,NP.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:KE,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:__.createCanvas.bind(__),getTextBounds:pv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:ig,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}mJ.mark=gJ,mJ.builtInTheme={wordCloud:fJ};function vJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||yH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=yJ(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,Ct(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Ct(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},_J=(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=_J(t.children,e,t,n))})),s},bJ=(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=bJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},xJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):xJ(t.children,e,i)))})),e};function SJ(t,e){let i,s;if(CJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function CJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*w*T))/(2*w):T/M);return{x:s+S+A*B,y:n+k+C*B,radius:B}}function BJ(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 EJ(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 PJ(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 OJ(t){return{_:t,next:null,prev:null}}function RJ(t,e){const i=(t=G(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];BJ(n,s,r);let a,o,l,h,c,d,u,p=OJ(s),g=OJ(n),f=OJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=yJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:FJ.defaultOpionts.nodeSort;_J([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)_J([o],IJ(h)),bJ([o],DJ(this._getPadding,.5,a)),_J([o],LJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);_J([o],IJ(FJ.defaultOpionts.setRadius)),bJ([o],DJ(Ot,1,a)),d&&bJ([o],DJ(this._getPadding,o.radius/t,a)),_J([o],LJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}FJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const zJ=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=zJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function HJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){zJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:Ct(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Ct(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function jJ(t){return t.depth}function NJ(t,e){return e-1-t.endDepth}const VJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),WJ=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},UJ={left:jJ,right:NJ,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:jJ,end:NJ},GJ=_t(0,1);class YJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>VJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>VJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},YJ.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):UJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return HJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!d(r.source),l=!d(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&d(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[WJ(s[t.source]),WJ(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(v(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*GJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}d(this.options.nodeSortBy)&&n.sort(VJ),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(VJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];XJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),KJ);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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},$J.defaultOpionts,t):Object.assign({},$J.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,u=h?a.map((t=>Pt(t,n))):Pt(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Pt(r,n),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(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=yJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=he({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function qJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:XJ,slice:qJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?qJ:XJ)(t,e,i,s,n)}};class QJ{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({},QJ.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Et(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?ZJ(this.options.aspectRatio):null!==(e=JJ[this.options.splitType])&&void 0!==e?e:JJ.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=yJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function tQ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+di?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=tQ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ii(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=eQ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function lQ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*hQ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},dQ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||sQ,s=e.lossFunction||iQ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ui(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:cQ(f),arcs:f})}))},uQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:pQ,triangle:pQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function pQ(){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 gQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const fQ=t=>uQ[t]?uQ[t]():uQ.circle(),mQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function vQ(t){return c(t)?t:function(){return t}}class yQ{constructor(t){var e,i;switch(this.options=z({},yQ.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=fQ(this.options.shape),this.getText=null!==(e=vQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=vQ(this.options.fontWeight),this.getTextFontSize=vQ(this.options.fontSize),this.getTextFontStyle=vQ(this.options.fontStyle),this.getTextFontFamily=vQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>mQ(10,50);break;case"random-light":this.getTextColor=()=>mQ(50,90);break;default:this.getTextColor=vQ(this.options.color)}if(d(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=c(this.options.rotate)?t=>{var e;return ae(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():wt(e);return ae(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!d(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class bQ extends yQ{constructor(t){var e;super(z({},bQ.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<=bQ.defaultOptions.minFontSize&&(this.options.minFontSize=bQ.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=_Q[this.options.spiral])&&void 0!==e?e:_Q.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=vQ(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}=gQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(kQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(AQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}kQ(p,this._size)&&(p=CQ(p,this._size))}else if(kQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||SQ(p,i))&&(!i||!xQ(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 xQ(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 SQ(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,kQ=(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 CQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},MQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},TQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},BQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=gQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=fQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)TQ(n,MQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)TQ(n,MQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)TQ(n,MQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)TQ(n,MQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)TQ(n,MQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=MQ({x:l,y:h},o,-Math.PI/2,5),e=MQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);TQ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ diff --git a/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js b/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js index b6ab0baccc..cd29b8d5b1 100644 --- a/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js +++ b/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var y=t=>Array.isArray?Array.isArray(t):l(t,"Array");var _=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>x(t)&&Number.isFinite(t);var k=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var C=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 M=Object.prototype;var T=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||M)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(_(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(T(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&y(t[a])?F(t,a,n[a]):L(t,e,a,i,s)}}}}function L(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(_(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function j(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function V(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(j(t)!==j(e))return!1;if(c(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(!V(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function et(t){return Number(t)}function it(t,e,i=et){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&x(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(t=rt.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),it(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var vt=function(t,e,i){return ti?i:t};var yt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Ct(t){if(A(t))return t;const e=+t;return A(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const Mt=4294967296;const Tt=t=>e=>P(e,t),Bt=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Et=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Pt=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Ot=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Zt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class re{static distancePP(t,e){return Kt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Kt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function he(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ce(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ue(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ge(t){return(t=ue(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const be=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function xe(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ce({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?ae(t.angle):t.angle,s=we(t);return[Ce({x:t.x1,y:t.y1},i,s),Ce({x:t.x2,y:t.y1},i,s),Ce({x:t.x2,y:t.y2},i,s),Ce({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=Me(t,i),n=Me(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+Ht;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Ee(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Le{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const Fe=(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}},ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),He=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ne{}class We extends Ne{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ce({x:this.x1,y:this.y1},this.angle,t),Ce({x:this.x2,y:this.y1},this.angle,t),Ce({x:this.x1,y:this.y2},this.angle,t),Ce({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ue,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ue;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=oe(r.rotateDeg),r}}class Ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ye(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Xe(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 Ke=/^#([0-9a-f]{3,8})$/,$e={transparent:4294967040},qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return x(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Ke.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u($e[t]))return function(t){return x(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}($e[t]);if(u(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Xe(this.color.r,this.color.g,this.color.b),r=Ye(d(t)?n.h:vt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new si(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Xe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new si(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Xe});function ai(t){if(A(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(p(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const li=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function hi(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 ci(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const di=1e-10;function ui(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+di)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=mi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=pi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-di,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function pi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function gi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return pi(t,t-(i*i-e*e+t*t)/(2*i))+pi(e,s)}function fi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function mi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let _i;function bi(t,e){const i=yi(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 xi{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Si=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ai(t){let e;if(e=Si.exec(t))return new xi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const ki=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ci{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 Ci.instance||(Ci.instance=new Ci),Ci.instance}newFormat(t){const e=Ai(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"):wi[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=wi[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?ki[8+_i/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 C=S.length+k.length+A.length,w=C>1)+S+k+A+w.slice(C);break;default:k=w+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Ai(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=yi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=ki[8+n/3];return function(t){return s(r*t)+a}}}const wi={"%":(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)=>bi(100*t,e),r:bi,s:function(t,e){const i=yi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+yi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Pi(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Pi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ii(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Li(){return new Fi}function Fi(){this.reset()}Fi.prototype={constructor:Fi,reset:function(){this.s=this.t=0},add:function(t){Hi(zi,t,this.t),Hi(this,zi.s,this.s),this.s?this.t+=zi.t:this.s=zi.t},valueOf:function(){return this.s}};var zi=new Fi;function Hi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var ji=1e-6,Ni=Math.PI,Vi=Ni/2,Wi=Ni/4,Ui=2*Ni,Gi=180/Ni,Yi=Ni/180,Xi=Math.abs,Ki=Math.atan,$i=Math.atan2,qi=Math.cos,Zi=Math.exp,Ji=Math.log,Qi=Math.pow,ts=Math.sin,es=Math.sign||function(t){return t>0?1:t<0?-1:0},is=Math.sqrt,ss=Math.tan;function ns(t){return t>1?0:t<-1?Ni:Math.acos(t)}function rs(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function as(){}function os(t,e){t&&hs.hasOwnProperty(t.type)&&hs[t.type](t,e)}var ls={Feature:function(t,e){os(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sNi?t+Math.round(-t/Ui)*Ui:t,e]}function Ss(t,e,i){return(t%=Ui)?e||i?bs(ks(t),Cs(e,i)):ks(t):e||i?Cs(e,i):xs}function As(t){return function(e,i){return[(e+=t)>Ni?e-Ui:e<-Ni?e+Ui:e,i]}}function ks(t){var e=As(t);return e.invert=As(-t),e}function Cs(t,e){var i=qi(t),s=ts(t),n=qi(e),r=ts(e);function a(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),rs(c*n+l*r)]}return a.invert=function(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),rs(c*i-o*s)]},a}function ws(t,e){(e=gs(e))[0]-=t,_s(e);var i=ns(-e[1]);return((-e[2]<0?-i:i)+Ui-ji)%Ui}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:as,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Xi(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 Ps(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Fs(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 zs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Fs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=ts(s),r=[ts(i),-qi(i),0],a=0,o=0;Is.reset(),1===n?s=Vi+ji:-1===n&&(s=-Vi-ji);for(var l=0,h=t.length;l=0?1:-1,C=k*A,w=C>Ni,M=f*x;if(Is.add($i(M*k*ts(C),m*S+M*qi(C))),a+=w?A+k*Ui:A,w^p>=i^_>=i){var T=ms(gs(u),gs(y));_s(T);var B=ms(r,T);_s(B);var E=(w^A>=0?-1:1)*rs(B[2]);(s>E||s===E&&(T[0]||T[1]))&&(o+=w^A>=0?1:-1)}}return(a<-ji||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(Hs))}return u}}function Hs(t){return t.length>1}function js(t,e){return((t=t.x)[0]<0?t[1]-Vi-ji:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-ji:Vi-e[1])}1===(Os=Ls).length&&(Rs=Os,Os=function(t,e){return Ls(Rs(t),e)});var Ns=zs((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?Ni:-Ni,l=Xi(r-i);Xi(l-Ni)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ni&&(Xi(i-n)ji?Ki((ts(e)*(r=qi(s))*ts(i)-ts(s)*(n=qi(e))*ts(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*Vi,s.point(-Ni,n),s.point(0,n),s.point(Ni,n),s.point(Ni,0),s.point(Ni,-n),s.point(0,-n),s.point(-Ni,-n),s.point(-Ni,0),s.point(-Ni,n);else if(Xi(t[0]-e[0])>ji){var r=t[0]0,n=Xi(e)>ji;function r(t,i){return qi(t)*qi(i)>e}function a(t,i,s){var n=[1,0,0],r=ms(gs(t),gs(i)),a=fs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ms(n,r),u=ys(n,h);vs(u,ys(r,c));var p=d,g=fs(u,p),f=fs(p,p),m=g*g-f*(fs(u,u)-1);if(!(m<0)){var v=is(m),y=ys(p,(-g-v)/f);if(vs(y,u),y=ps(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Xi(y[0]-b)Ni^(b<=y[0]&&y[0]<=x)){var w=ys(p,(-g+v)/f);return vs(w,u),[y,ps(w)]}}}function o(e,i){var n=s?t:Ni-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return zs(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?Ni:-Ni),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=qi(e),o=ts(e),l=s*i;null==n?(n=e+s*Ui,r=e-l/2):(n=ws(a,n),r=ws(a,r),(s>0?nr)&&(n+=s*Ui));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 Xi(s[0]-t)0?0:3:Xi(s[0]-i)0?2:1:Xi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,y,_=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&_.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=Fs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Es(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(Us,Math.min(Ws,g)),f=Math.max(Us,Math.min(Ws,f))],b=[r=Math.max(Us,Math.min(Ws,r)),a=Math.max(Us,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&&(_.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 Ys(t){return t}var Xs,Ks,$s,qs,Zs=Li(),Js=Li(),Qs={point:as,lineStart:as,lineEnd:as,polygonStart:function(){Qs.lineStart=tn,Qs.lineEnd=nn},polygonEnd:function(){Qs.lineStart=Qs.lineEnd=Qs.point=as,Zs.add(Xi(Js)),Js.reset()},result:function(){var t=Zs/2;return Zs.reset(),t}};function tn(){Qs.point=en}function en(t,e){Qs.point=sn,Xs=$s=t,Ks=qs=e}function sn(t,e){Js.add(qs*t-$s*e),$s=t,qs=e}function nn(){sn(Xs,Ks)}var rn=Qs,an=1/0,on=an,ln=-an,hn=ln;var cn,dn,un,pn,gn={point:function(t,e){tln&&(ln=t);ehn&&(hn=e)},lineStart:as,lineEnd:as,polygonStart:as,polygonEnd:as,result:function(){var t=[[an,on],[ln,hn]];return ln=hn=-(on=an=1/0),t}},fn=0,mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn={point:Cn,lineStart:wn,lineEnd:Bn,polygonStart:function(){kn.lineStart=En,kn.lineEnd=Pn},polygonEnd:function(){kn.point=Cn,kn.lineStart=wn,kn.lineEnd=Bn},result:function(){var t=An?[xn/An,Sn/An]:bn?[yn/bn,_n/bn]:vn?[fn/vn,mn/vn]:[NaN,NaN];return fn=mn=vn=yn=_n=bn=xn=Sn=An=0,t}};function Cn(t,e){fn+=t,mn+=e,++vn}function wn(){kn.point=Mn}function Mn(t,e){kn.point=Tn,Cn(un=t,pn=e)}function Tn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,Cn(un=t,pn=e)}function Bn(){kn.point=Cn}function En(){kn.point=On}function Pn(){Rn(cn,dn)}function On(t,e){kn.point=Rn,Cn(cn=un=t,dn=pn=e)}function Rn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,xn+=(n=pn*t-un*e)*(un+t),Sn+=n*(pn+e),An+=3*n,Cn(un=t,pn=e)}var In=kn;function Dn(t){this._context=t}Dn.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,Ui)}},result:as};var Ln,Fn,zn,Hn,jn,Nn=Li(),Vn={point:as,lineStart:function(){Vn.point=Wn},lineEnd:function(){Ln&&Un(Fn,zn),Vn.point=as},polygonStart:function(){Ln=!0},polygonEnd:function(){Ln=null},result:function(){var t=+Nn;return Nn.reset(),t}};function Wn(t,e){Vn.point=Un,Fn=Hn=t,zn=jn=e}function Un(t,e){Hn-=t,jn-=e,Nn.add(is(Hn*Hn+jn*jn)),Hn=t,jn=e}var Gn=Vn;function Yn(){this._string=[]}function Xn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Kn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),us(t,i(s))),s.result()}return r.area=function(t){return us(t,i(rn)),rn.result()},r.measure=function(t){return us(t,i(Gn)),Gn.result()},r.bounds=function(t){return us(t,i(gn)),gn.result()},r.centroid=function(t){return us(t,i(In)),In.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ys):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Yn):new Dn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function $n(t){return function(e){var i=new qn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function qn(){}function Zn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),us(i,t.stream(gn)),e(gn.result()),null!=s&&t.clipExtent(s),t}function Jn(t,e,i){return Zn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Qn(t,e,i){return Jn(t,[[0,0],e],i)}function tr(t,e,i){return Zn(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 er(t,e,i){return Zn(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)}Yn.prototype={_radius:4.5,_circle:Xn(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=Xn(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}},qn.prototype={constructor:qn,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 ir=16,sr=qi(30*Yi);function nr(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=is(b*b+x*x+S*S),k=rs(S/=A),C=Xi(Xi(S)-1)e||Xi((v*B+y*E)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Yi:0,B()):[m*Gi,v*Gi,y*Gi]},M.angle=function(t){return arguments.length?(_=t%360*Yi,B()):_*Gi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},M.precision=function(t){return arguments.length?(a=nr(o,w=t*t),E()):is(w)},M.fitExtent=function(t,e){return Jn(M,t,e)},M.fitSize=function(t,e){return Qn(M,t,e)},M.fitWidth=function(t,e){return tr(M,t,e)},M.fitHeight=function(t,e){return er(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&T,B()}}function cr(t){var e=0,i=Ni/3,s=hr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Yi,i=t[1]*Yi):[e*Gi,i*Gi]},n}function dr(t,e){var i=ts(t),s=(i+ts(e))/2;if(Xi(s)2?t[2]*Yi:0),e.invert=function(e){return(e=t.invert(e[0]*Yi,e[1]*Yi))[0]*=Gi,e[1]*=Gi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===yr?[[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 br(t){return ss((Vi+t)/2)}function xr(t,e){var i=qi(t),s=t===e?ts(t):Ji(i/qi(e))/Ji(br(e)/br(t)),n=i*Qi(br(t),s)/s;if(!s)return yr;function r(t,e){n>0?e<-Vi+ji&&(e=-Vi+ji):e>Vi-ji&&(e=Vi-ji);var i=n/Qi(br(e),s);return[i*ts(s*t),n-i*qi(s*t)]}return r.invert=function(t,e){var i=n-e,r=es(s)*is(t*t+i*i),a=$i(t,Xi(i))*es(i);return i*s<0&&(a-=Ni*es(t)*es(i)),[a/s,2*Ki(Qi(n/r,1/s))-Vi]},r}function Sr(t,e){return[t,e]}function Ar(t,e){var i=qi(t),s=t===e?ts(t):(i-qi(e))/(e-t),n=i/s+t;if(Xi(s)ji&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Or.invert=fr(rs),Rr.invert=fr((function(t){return 2*Ki(t)})),Ir.invert=function(t,e){return[-e,2*Ki(Zi(t))-Vi]};var Fr={exports:{}},zr=function(t,e){this.p1=t,this.p2=e};zr.prototype.rise=function(){return this.p2[1]-this.p1[1]},zr.prototype.run=function(){return this.p2[0]-this.p1[0]},zr.prototype.slope=function(){return this.rise()/this.run()},zr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},zr.prototype.isVertical=function(){return!isFinite(this.slope())},zr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},zr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},zr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},zr.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)},zr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Hr=zr,jr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Hr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=jr(t.slice(0,s),e),o=jr(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},Nr=jr;!function(t){var e=Nr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Yr,e),{tolerance:s}=i;return Vr(t,s)};var Kr;!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"}(Kr||(Kr={}));const $r=(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},qr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(A(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let C=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/C:0,w.push(_[t])}return w},Jr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],T=M.length?M:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:T});if(!w.length)return Zr(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...M,...w];return Zr(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",T=null!==(l=k.q1)&&void 0!==l?l:"q1",B=null!==(h=k.median)&&void 0!==h?h:"median",E=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(u=k.iqr)&&void 0!==u?u:"iqr",O=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",D=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",L=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),y(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}y(S)&&(S=[vt(Math.min.apply(null,S),0,1),vt(Math.max.apply(null,S),0,1)]);const V=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[M]=o,f[T]=l,f[B]=h,f[E]=c,f[P]=d,f[O]=n,f[R]=r,f[I]=u,f[D]=p,f[L]=g,A&&(f[F]=H.get(t)||[]),V.push(f)}return V};var ta={},ea={};function ia(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function sa(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function na(t,e){var i=t+"",s=i.length;return s9999?"+"+na(e,6):na(e,4))+"-"+na(t.getUTCMonth()+1,2)+"-"+na(t.getUTCDate(),2)+(r?"T"+na(i,2)+":"+na(s,2)+":"+na(n,2)+"."+na(r,3)+"Z":n?"T"+na(i,2)+":"+na(s,2)+":"+na(n,2)+"Z":s||i?"T"+na(i,2)+":"+na(s,2)+"Z":"")}function aa(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 ea;if(h)return h=!1,ta;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=Kr.DSV;const s=Wr(ha,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return aa(n).parse(t)},da=(t,e={},i)=>(i.type=Kr.DSV,oa(t)),ua=(t,e={},i)=>(i.type=Kr.DSV,la(t));function pa(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return ga(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 ga(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ma(t);default:throw new Error("unknown GeoJSON type")}}function ga(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=fa(t.properties),e.geometry=ma(t.geometry),e}function fa(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]=fa(s):e[i]=s})),e):e}function ma(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return ma(t)})),e):(e.coordinates=va(t.coordinates),e)}function va(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return va(t)}))}function ya(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 _a(t){for(var e,i,s=ya(t),n=0,r=1;r0}function ba(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=pa(t));var r=[];switch(t.type){case"GeometryCollection":return xa(t,(function(t){Aa(t,s)})),t;case"FeatureCollection":return ba(t,(function(t){ba(Aa(t,s),(function(t){r.push(t)}))})),ci(r)}return Aa(t,s)}function Aa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return xa(t,(function(t){Aa(t,e)})),t;case"LineString":return ka(ya(t),e),t;case"Polygon":return Ca(ya(t),e),t;case"MultiLineString":return ya(t).forEach((function(t){ka(t,e)})),t;case"MultiPolygon":return ya(t).forEach((function(t){Ca(t,e)})),t;case"Point":case"MultiPoint":return t}}function ka(t,e){_a(t)===e&&t.reverse()}function Ca(t,e){_a(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=wa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Ea=(t,e={},i)=>{i.type=Kr.GEO;const s=Wr(Ta,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Sa(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=Ma.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=Ma.bounds(t);t.bbox=e}})),t.features=l,t},Pa={},Oa=(t,e,i)=>{i.type=Kr.GEO;const s=Wr(Ta,Pa,e),{object:n}=s;if(!v(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Lr(a,t)}))}:Lr(a,o));var a,o;return Ea(r,s,i)},Ra=(t,e,i)=>{const s=!h(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 Ia=0;function Da(t="dataset"){return Ia>1e8&&(Ia=0),t+"_"+Ia++}class La{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Fa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Fa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",qr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Kn();const za={},Ha={albers:pr,albersusa:function(){var t,e,i,s,n,r,a=pr(),o=ur().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=ur().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)}},ja=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Na(t,e){return function i(){const s=e();return s.type=t,s.path=Kn().projection(s),s.copy=s.copy||function(){const t=i();return ja.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ua extends o{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=qa.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Za(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(Za(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,Za(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Za(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 Ka))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=qa.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Ja(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Xa,this.rootWheelEvent=new Ka,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&v(t)&&!R(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const io=jt-1e-8;class so{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>io)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ro=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ao={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},oo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let lo,ho,co,uo,po,go;function fo(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tgo){let t,e=co;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),w=.5*(b+S)+k*(x-_),M=Math.atan2(b-w,_-C);let T=Math.atan2(S-w,x-C)-M;T<0&&1===r?T+=jt:T>0&&0===r&&(T-=jt);const B=Math.ceil(Math.abs(T/(Ht+.001))),E=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 Mo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Lo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function zo(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new Ho(i,n),new Ho(n,s)]}class Ho extends To{constructor(t,e){super(),this.type=bo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===_o.ROW?Vt(this.p0.x-this.p1.x):t===_o.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class jo{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Fo(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Ho(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===_o.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===_o.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class No extends jo{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 Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?_o.ROW:_o.COLUMN;return"monotoneY"===t?new No(t,s):new jo(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 Go(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Yo(new Uo(n,s),t),n}function Yo(t,e){return Vo(t,e,1)}function Xo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Ko{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Xo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Xo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function $o(t,e){return Vo(t,e,2)}function qo(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("basis",i,t);return $o(new Ko(n,s),t),n}function Zo(t){return t<0?-1:1}function Jo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Zo(r)+Zo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Qo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class el{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:tl(this,this._t0,Qo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,tl(this,Qo(this,e=Jo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:tl(this,this._t0,e=Jo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class il extends el{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function sl(t,e){return Vo(t,e,2)}function nl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("monotoneX",i,t);return sl(new el(n,s),t),n}function rl(t,e){return Vo(t,e,2)}function al(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("monotoneY",i,t);return rl(new il(n,s),t),n}let ol=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class ll extends ol{lineEnd(){this.context.closePath()}}function hl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new jo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?_o.ROW:_o.COLUMN);return cl(new ol(r,e,n),t),r}function cl(t,e){return Vo(t,e,1)}function dl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new jo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?_o.ROW:_o.COLUMN);return cl(new ll(r,e,n),t),r}class ul extends Uo{lineEnd(){this.context.closePath()}}function pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return gl(new ul(n,s),t),n}function gl(t,e){return Vo(t,e,1)}function fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ft){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function ml(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Go(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const vl=ml("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const yl=ml("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class _l extends To{constructor(t,e,i){super(),this.type=bo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Io(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===_o.ROW?Vt(this.p0.x-this.p2.x):t===_o.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Io(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new _l(i,a,r),new _l(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class bl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Ho(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new _l(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Fo(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function xl(t,e,i){var s,n;switch(e){case"linear":default:return Go(t,i);case"basis":return qo(t,i);case"monotoneX":return nl(t,i);case"monotoneY":return al(t,i);case"step":return hl(t,.5,i);case"stepClosed":return dl(t,.5,i);case"stepBefore":return hl(t,0,i);case"stepAfter":return hl(t,1,i);case"catmullRom":return vl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return yl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return pl(t,i)}}class Sl extends no{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new so(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([oo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([oo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([oo.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([oo.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([oo.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([oo.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([oo.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([oo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([oo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new bl(this);Mo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[oo.M]=t=>`M${t[1]} ${t[2]}`,t[oo.L]=t=>`L${t[1]} ${t[2]}`,t[oo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[oo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[oo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];Co(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[oo.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=fo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=xl(e,i);"x"===s?this.direction=_o.ROW:"y"===s?this.direction=_o.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[oo.M]=this.moveToTransform,t[oo.L]=this.lineToTransform,t[oo.Q]=this.quadraticCurveToTransform,t[oo.C]=this.bezierCurveToTransform,t[oo.AT]=this.arcToTransform,t[oo.E]=this.ellipseTransform,t[oo.R]=this.rectTransform,t[oo.A]=this.arcTransform,t[oo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Mo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===_o.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===_o.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),Kl=Object.assign(Object.assign({},jl),{points:[],cornerRadius:0,closePath:!0}),$l=Object.assign(Object.assign({},jl),{width:100,height:100,spikes:5,thickness:.5}),ql=Object.assign(Object.assign({},jl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Zl=Object.assign(Object.assign({},jl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},jl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Ql=Object.assign(Object.assign(Object.assign({},jl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),th=Object.assign(Object.assign(Object.assign({},jl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),eh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},jl),{fill:!0,cornerRadius:0,cornerType:"round"}),ih=Object.assign(Object.assign({},eh),{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});class sh{}const nh=Symbol.for("@visactor/vrender-core/application-state");function rh(){const t=globalThis;return t[nh]||(t[nh]={application:new sh}),t[nh]}const ah=rh().application;class oh{static GetImage(t,e){var i;const s=oh.cache.get(t);s?"fail"===s.loadState?ah.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):oh.loadImage(t,e)}static GetSvg(t,e){var i;let s=oh.cache.get(t);s?"fail"===s.loadState?ah.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"},oh.cache.set(t,s),s.dataPromise=ah.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=oh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},oh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=ah.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=ah.global.loadBlob(t):"json"===e&&(i.dataPromise=ah.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!oh.isLoading&&oh.toLoadAueue.length){oh.isLoading=!0;const t=oh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(oh.cache.set(i,n),n.dataPromise=ah.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()})).catch((t=>{console.error(t),oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()}))}}),0)}static loadImage(t,e){const i=lh(t,oh.toLoadAueue);if(-1!==i)return oh.toLoadAueue[i].marks.push(e),void oh.loading();oh.toLoadAueue.push({url:t,marks:[e]}),oh.loading()}static improveImageLoading(t){const e=lh(t,oh.toLoadAueue);if(-1!==e){const t=oh.toLoadAueue.splice(e,1);oh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function lh(t,e){for(let i=0;i{var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)ch[s]=t,i&&(i=!(null!==(e=ch[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ch[e]=!!t[e],i&&(i=!!ch[e]);else ch[0]=!1,ch[1]=!1,ch[2]=!1,ch[3]=!1;return{isFullStroke:i,stroke:ch}},uh=[0,0,0,0],ph=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(uh[0]=t[0],uh[2]=t[0],uh[1]=t[1],uh[3]=t[1],uh):t:t:0,gh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],fh=[1,2,3,0,1,2,3,0];function mh(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;gh[0].x=i,gh[1].y=i,gh[2].x=-i,gh[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Ut(t)*i,Xt(t)*i),s.add(Ut(e)*i,Xt(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}xh.TimeOut=1e3/60;const Sh=new xh,Ah=(t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,kh=(t,e)=>{const i=Ah(t,e);return isNaN(i)?i:Math.max(e,i)};class Ch{bounds(t,e){if(x(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function wh(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var Mh=new class extends Ch{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 wh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Th=new class extends Ch{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Eh=new class extends Ch{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Ph(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Ch{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Ph(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ph(t,this.parseSize(e)/2+n,i,s)}};function Rh(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Ih extends Ch{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 Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Ih;var Lh=new class extends Ih{constructor(){super(...arguments),this.type="triangle"}};const Fh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),zh=Math.sin(jt/10)*Fh,Hh=-Math.cos(jt/10)*Fh;function jh(t,e,i,s){const n=zh*e,r=Hh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Nh=new class extends Ch{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 jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return jh(t,this.parseSize(e)/2+n,i,s)}};const Vh=Kt(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Uh=new class extends Ch{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Gh(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 Yh=new class extends Ch{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Gh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Gh(t,this.parseSize(e)/2+n,i,s)}};function Xh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Kh=new class extends Ch{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Xh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Xh(t,this.parseSize(e)/2+n,i,s)}};const $h=-.5,qh=Kt(3)/2,Zh=1/Kt(12);function Jh(t,e,i,s){const n=e/2,r=e*Zh,a=n,o=e*Zh+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($h*n-qh*r+i,qh*n+$h*r+s),t.lineTo($h*a-qh*o+i,qh*a+$h*o+s),t.lineTo($h*l-qh*h+i,qh*l+$h*h+s),t.lineTo($h*n+qh*r+i,$h*r-qh*n+s),t.lineTo($h*a+qh*o+i,$h*o-qh*a+s),t.lineTo($h*l+qh*h+i,$h*h-qh*l+s),t.closePath(),!1}var Qh=new class extends Ch{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 Jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Jh(t,this.parseSize(e)/2+n,i,s)}};function tc(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ec=new class extends Ch{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 tc(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return tc(t,this.parseSize(e)/2,i,s,n)}};function ic(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var sc=new class extends Ch{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 ic(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ic(t,this.parseSize(e)/2,i,s,n)}};function nc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var rc=new class extends Ch{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 nc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return nc(t,this.parseSize(e)/2,i,s,n)}};const ac=Kt(3);function oc(t,e,i,s){const n=e*ac;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var lc=new class extends Ch{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return oc(t,this.parseSize(e)/2/ac,i,s)}drawOffset(t,e,i,s,n){return oc(t,this.parseSize(e)/2/ac+n,i,s)}};function hc(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 cc=new class extends Ch{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 hc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hc(t,this.parseSize(e)/4+n,i,s)}};function dc(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 uc=new class extends Ch{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 dc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return dc(t,this.parseSize(e)/4+n,i,s)}};function pc(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 gc=new class extends Ch{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 pc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pc(t,this.parseSize(e)/4+n,i,s)}};function fc(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 mc=new class extends Ch{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 fc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return fc(t,this.parseSize(e)/4+n,i,s)}};function vc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var yc=new class extends Ch{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return vc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function _c(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var bc=new class extends Ch{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return _c(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return _c(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function xc(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 Sc=new class extends Ch{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 xc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return xc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function Ac(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function kc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Cc=new class extends Ch{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return x(e)?kc(t,e,i,s):Ac(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?kc(t,e+2*n,i,s):Ac(t,[e[0]+2*n,e[1]+2*n],i,s)}};const wc=new Ve;class Mc{constructor(t,e,i=!1){this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Mo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Mo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{wc.x1=i.bounds.x1*t,wc.y1=i.bounds.y1*t,wc.x2=i.bounds.x2*t,wc.y2=i.bounds.y2*t,e.union(wc)}))}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 Tc=[Mh,Th,Eh,Oh,lc,Lh,Nh,Uh,Yh,Kh,Qh,ec,sc,Dh,rc,cc,uc,gc,mc,Cc,yc,bc,Sc],Bc={};Tc.forEach((t=>{Bc[t.type]=t}));const Ec={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Pc{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 Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Rc(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Rc(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Rc(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 Pc(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 Pc(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 Lc(t,e){return Fc(t)}function Fc(t,e){const i={};for(let e=0;e$c.set(t,!0)));const qc=new Map;function Zc(t){if($c.has(t))return!0;if(qc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Jc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>qc.set(t,!0)));const Qc=Yc(),td=Yc(),ed=Yc(),id=Yc(),sd=Yc(),nd=Yc(),rd=Yc(),ad=Yc(),od=Yc(),ld=Yc(),hd=Yc(),cd=Yc(),dd=Yc(),ud=Yc(),pd=Yc(),gd=Yc(),fd=Yc(),md=Symbol.for("GraphicService"),vd=Symbol.for("GraphicCreator"),yd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},_d=Object.keys(yd),bd={"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"},xd=Object.keys(bd),Sd={duration:200,easing:"cubicOut"},Ad=Symbol.for("CanvasFactory"),kd=Symbol.for("Context2dFactory");function Cd(t){return function(){var t,e;const i=null===(t=ah.global)||void 0===t?void 0:t.env,s=i?null===(e=ah.canvasFactory)||void 0===e?void 0:e.call(ah,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const wd=1e-4,Md=Math.sqrt(3),Td=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Pd(t){return"number"==typeof t&&Number.isFinite(t)}const Od=[0,0],Rd=[0,0],Id=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Ld(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Fd(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 zd(t){return(t%=Nt)<0&&(t+=Nt),t}function Hd(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function Vd(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(Bd(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 Gd=[-1,-1,-1],Yd=[-1,-1];function Xd(){const t=Yd[0];Yd[0]=Yd[1],Yd[1]=t}function Kd(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(Bd(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,Td):Math.pow(i,Td),s=s<0?-Math.pow(-s,Td):Math.pow(s,Td);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+Md*Math.sin(e)))/(3*a),h=(-o+i*(s-Md*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,Gd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Xd(),p=Fd(e,s,r,o,Yd[0]),u>1&&(g=Fd(e,s,r,o,Yd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Gd);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=Ld(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Gd[0]=-l,Gd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=Gd[0]+t&&a<=Gd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=Gd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function Zd(t){return Math.round(t/zt*1e8)/1e8%2*zt}function Jd(t,e){let i=Zd(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-Zd(i-n)):e&&i1&&(i||(h+=Oe(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;Qd[0]=S,Qd[1]=A,Jd(Qd,Boolean(a[6])),S=Qd[0],A=Qd[1];const k=S,C=A-S,w=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case oo.M:u=m,p=v,c=u,d=p;break;case oo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case oo.C:if(i){if(jd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=Kd(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case oo.Q:if(i){if(Hd(c,d,m,v,y,_,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case oo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Nd(m,v,y,k,k+C,w,e,M,n))return!0}else h+=qd(m,v,y,k,k+C,w,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case oo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case oo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class iu{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(iu.IsGradientStr(t))try{const e=eu(t)[0];if(e){if("linear"===e.type)return iu.ParseLinear(e);if("radial"===e.type)return iu.ParseRadial(e);if("conic"===e.type)return iu.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:iu.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:iu.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function ru(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function au(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];return 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}function ou(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];return 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}function lu(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];return 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,t}function hu(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 cu(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 du(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function uu(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 pu(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];return Math.abs(g-b)0&&(xu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(xu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ku),function(t,e,i){return tu(t,0,!1,e,i)}(this.path.commandList,ku.x,ku.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ku);const i=su(this,this.lineWidth,this.dpr);return function(t,e,i,s){return tu(t,e,!0,i,s)}(this.path.commandList,i,ku.x,ku.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Au,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>xu.free(t))),this.stack.length=0}}const wu={WIDTH:500,HEIGHT:500,DPR:1};class Mu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=wu.WIDTH,height:n=wu.HEIGHT,dpr:r=wu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Tu;Mu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Tu||(Tu={}));class Bu{static Get(t,e=Tu.Color1,i=[0,0,0,1]){if(e===Tu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Tu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Eu(t,e=!1){return Array.isArray(t)&&x(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Pu(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ou(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ou(t,e,i,s,n)}function Ou(t,e,i,s,n){if(!t||!e)return t&&Eu(t)||e&&Eu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Tu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Tu.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:Eu(a)})))});return o?Pu(r,l,i,s,n):Pu(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 Ru(s,n,i);if("radial"===s.gradient)return Iu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Eu(Lu(r,a,i),s)}function Ru(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Iu(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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]}function Fu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const zu=[0,0,0,0],Hu=[0,0,0,0];function ju(t,e,i){return Bu.Get(t,Tu.Color255,zu),Bu.Get(e,Tu.Color255,Hu),`rgba(${Math.round(zu[0]+(Hu[0]-zu[0])*i)},${Math.round(zu[1]+(Hu[1]-zu[1])*i)},${Math.round(zu[2]+(Hu[2]-zu[2])*i)},${zu[3]+(Hu[3]-zu[3])*i})`}class Nu{static GetCanvas(){try{return Nu.canvas||(Nu.canvas=ah.global.createCanvas({})),Nu.canvas}catch(t){return null}}static GetCtx(){if(!Nu.ctx){const t=Nu.GetCanvas();Nu.ctx=t.getContext("2d")}return Nu.ctx}}class Vu extends Ge{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Nu.GetCanvas(),s=Nu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Uu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Nt;for(;i>Nt;)i-=Nt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Pu(o.color,l.color,h,!1)}function Gu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Nu.GetCanvas(),d=Nu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Yu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Xu(t){return null==t?void 0:t}class Ku{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Xu(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Yu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Xu(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function $u(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function qu(t){if(!$u(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=qu(t[i])})),e}function Zu(t,e){var i;const s=null!==(i=qu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];$u(n)&&$u(i)?s[t]=Zu(n,i):s[t]=qu(i)})),s}class Ju{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=qu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];$u(r)&&$u(n)?t[i]=Zu(r,n):!$u(r)&&$u(a)&&$u(n)?t[i]=Zu(a,n):t[i]=qu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?Qu.PAINT|Qu.BOUNDS|Qu.PICK:Qu.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?Qu.PAINT|Qu.BOUNDS:Qu.PAINT}};class ip{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Sd;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:yo.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:yo.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:yo.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const sp=new Ku;function np(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,rp(t),!0)}function rp(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=sp.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function ap(t){if(t)return t.parentScope&&ap(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&rp(t),t}function op(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function lp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function hp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,lp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),op(null!=e?e:t.ownerStage))}const cp=new Ve,dp=new Ue,up=["lineWidth","scaleX","scaleY","angle","anchor","visible"],pp=["x","y"],gp=["scaleX","scaleY"],fp=["angle"],mp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),vp=new ne,yp=[],_p=Qu.PAINT|Qu.SHAPE|Qu.BOUNDS|Qu.TRANSFORM|Qu.LAYOUT;function bp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function xp(t){if(!bp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=bp(s)?xp(s):s})),i}function Sp(t,e){return t===e||!!(bp(t)||bp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function Ap(t,e){var i;const s=null!==(i=xp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];bp(n)&&bp(i)?s[t]=Ap(n,i):s[t]=xp(i)})),s}const kp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Cp extends Ua{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,lp(this.stage,this),op(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&ap(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:yo.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(ap(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new Ku).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=xp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&bp(n)&&bp(s)?e[t]=Ap(n,s):e[t]=xp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:xp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Sp(a,o)||(s.set(n,{prev:a,next:o}),t[n]=xp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ep[t];return n?n(e,i):null!==(s=tp[t])&&void 0!==s?s:Qu.PAINT}(e,i,s):null!==(n=tp[e])&&void 0!==n?n:Qu.PAINT;return r&Qu.PICK&&(r|=Qu.BOUNDS),r===Qu.PAINT&&this.needUpdateTag(e)&&(r=Qu.SHAPE|Qu.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&_p)!==_p?(t&Qu.SHAPE?this.addUpdateShapeAndBoundsTag():t&Qu.BOUNDS&&this.addUpdateBoundTag(),t&Qu.PAINT&&this.addUpdatePaintTag(),t&Qu.TRANSFORM&&this.addUpdatePositionTag(),t&Qu.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=Qu.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!bp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=bp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&mo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Tp.userSymbolMap[t],e)return e;if(!0===jc(t=Ec[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=y(i.path)?i.path:[i.path];cp.clear();const n=[];s.forEach((t=>{const e=(new Sl).fromString(t.d),i={};xd.forEach((e=>{t[e]&&(i[bd[e]]=t[e])})),n.push({path:e,attribute:i}),cp.union(e.bounds)}));const r=cp.width(),a=cp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new Mc(t,n,!0);return Tp.userSymbolMap[t]=l,l}const i=(new Sl).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Gt(s,n);i.transform(0,0,r,r);const a=new Mc(t,i);return Tp.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=ph(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new so(t);return Mo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&mo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&mo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&mo.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&mo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=mo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vo.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===yo.STATE||null!=i&&i>=yo.ANIMATE_BIND&&i<=yo.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===yo.STATE||null!=o&&o>=yo.ANIMATE_BIND&&o<=yo.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Sp(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:yp,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:yo.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Sd}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:yp,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?xp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:yo.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:yp,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:yp,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:yo.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:yo.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Pl.x,y:e=Pl.y,scaleX:i=Pl.scaleX,scaleY:s=Pl.scaleY,angle:n=Pl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ut(a),f=Xt(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,!0),ah.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Pl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:ah.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:yo.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:yo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=ah.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new Sl).fromString(t):this.pathProxy=new Sl,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:ah.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new $a(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ua.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:yo.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:yo.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||ah.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Cu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Cp.userSymbolMap={};const wp=Symbol.for("@visactor/vrender-core/graphic-class");function Mp(){var t;const e=globalThis;return null!==(t=e[wp])&&void 0!==t||(e[wp]={Graphic:Cp}),e[wp]}const Tp=Mp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!mp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Ip=Op();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Pp.forEach((t=>{this._defaultTheme[t]=Object.create(Ip[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Pp.forEach((s=>{const n=Object.create(Ip[s]);t&&t[s]&&Rp(n,t[s]),i[s]&&Rp(n,i[s]),e[s]&&Rp(n,e[s]),this.combinedTheme[s]=n})),e.common&&Pp.forEach((t=>{Rp(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 Lp=new Dp;function Fp(t,e){return t.glyphHost?Fp(t.glyphHost):e?(t.isContainer,e):zp(t)||t.attachedThemeGraphic&&Fp(t.attachedThemeGraphic)||Lp.getTheme()}function zp(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)):Lp.getTheme()}return null}const Hp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},jp=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...up];class Np extends Tp{constructor(t){super(t),this.type="arc",this.numberType=Qc}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=le(e),i=e+a,s&&Vt(a)>Ft&&Vt(a)Ft&&o>Ft)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Kt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*Xt(g)),n=qt(Number(l)/a*Xt(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Fp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);Hp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Nt-Ft?i.set(-s,-s,s,s):(mh(l,o,s,i),mh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,jp)}needUpdateTag(t){return super.needUpdateTag(t,jp)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Nt-Ft)n.moveTo(0+h*Ut(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Ut(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Ut(a),e=h*Xt(a),i=l*Ut(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Np(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Np.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Np(t)}Np.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);const Wp=["segments","points","curveType","curveTension",...up];class Up extends Tp{constructor(t){super(t),this.type="area",this.numberType=ed}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Fp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),ah.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Sl;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Gp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Yp=["radius","startAngle","endAngle",...up];class Xp extends Tp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Fp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-Ft?i.set(-r,-r,r,r):mh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Yp)}needUpdateTag(t){return super.needUpdateTag(t,Yp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Sl,s.arc(0,0,r,a,o),s}clone(){return new Xp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xp.NOWORK_ANIMATE_ATTR}}function Kp(t){return new Xp(t)}Xp.NOWORK_ANIMATE_ATTR=kp;class $p extends Tp{constructor(t){super(t),this.type="glyph",this.numberType=sd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Fp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new $p(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return $p.NOWORK_ANIMATE_ATTR}}function qp(t){return new $p(t)}var Zp;$p.NOWORK_ANIMATE_ATTR=kp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Zp||(Zp={}));let Jp=class t extends Tp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=nd,this._childUpdateTag=mo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(np(this.sharedStateScope,t),hp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vo.GLOBAL){const i=new ne(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&mo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Pl.x,y:e=Pl.y,dx:i=Pl.dx,dy:s=Pl.dy,scaleX:n=Pl.scaleX,scaleY:r=Pl.scaleY,angle:a=Pl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Fp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=mo.CLEAR_BOUNDS,this._childUpdateTag&=mo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&mo.UPDATE_BOUNDS||(this._childUpdateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:ah.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&mo.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=ah.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&np(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return rp({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function Qp(t){return new Jp(t)}Jp.NOWORK_ANIMATE_ATTR=kp;const tg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...up];class eg extends Tp{constructor(t){super(t),this.type="image",this.numberType=rd,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Fp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return eh[t]}needUpdateTags(t){return super.needUpdateTags(t,tg)}needUpdateTag(t){return super.needUpdateTag(t,tg)}clone(){return new eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return eg.NOWORK_ANIMATE_ATTR}}function ig(t){return new eg(t)}eg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},kp);const sg=["segments","points","curveType","curveTension",...up];let ng=class t extends Tp{constructor(t={}){super(t),this.type="line",this.numberType=ad}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=_h(i,s,e))}getGraphicTheme(){return Fp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),ah.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,sg)}needUpdateTag(t){return super.needUpdateTag(t,sg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Sl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function rg(t){return new ng(t)}ng.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const ag=["path","customPath",...up];class og extends Tp{constructor(t){super(t),this.type="path",this.numberType=od}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Sl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Sl?this.cache:t.path)}getGraphicTheme(){return Fp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Sl).fromString(t.path):t.customPath&&(this.cache=new Sl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,ag)}needUpdateTag(t){return super.needUpdateTag(t,ag)}toCustomPath(){return(new Sl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return og.NOWORK_ANIMATE_ATTR}}function lg(t){return new og(t)}og.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},kp);const hg=["points","cornerRadius",...up];class cg extends Tp{constructor(t){super(t),this.type="polygon",this.numberType=ld}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Fp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),ah.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,hg)}needUpdateTag(t){return super.needUpdateTag(t,hg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Sl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new cg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return cg.NOWORK_ANIMATE_ATTR}}function dg(t){return new cg(t)}cg.NOWORK_ANIMATE_ATTR=kp;const ug=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},pg=["width","x1","y1","height","cornerRadius",...up];class gg extends Tp{constructor(t){super(t),this.type="rect",this.numberType=cd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Fp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,pg)}needUpdateTag(t){return super.needUpdateTag(t,pg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=ug(e);return t=new Sl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new gg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return gg.NOWORK_ANIMATE_ATTR}}function fg(t){return new gg(t)}gg.NOWORK_ANIMATE_ATTR=kp;const mg=Symbol.for("EnvContribution"),vg=Symbol.for("VGlobal"),yg="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",_g={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"}},bg=!0,xg=!1,Sg=/\w|\(|\)|-/,Ag=/[.?!,;:/,。?!、;:]/,kg=/\S/,Cg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=ah.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=Mg(t,a)),a}function Mg(t,e,i=!1){let s=e;for(;Sg.test(t[s-1])&&Sg.test(t[s])||Ag.test(t[s]);)if(s--,s<=0)return i?Tg(t,e):e;return s}function Tg(t,e){let i=e;for(;Sg.test(t[i+1])&&Sg.test(t[i])||Ag.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=ah.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Eg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=_g[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Pg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Og{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=kh(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Pg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=wg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Rg extends eg{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=ph(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=ph(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=eh.width,height:e=eh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Ig{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Rg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=_g[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=kg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Rg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Rg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Rg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||xg;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,Cg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||bg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?nu(t,s,{AABBBounds:i}):s,Cg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Rg)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Rg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=_g[this.direction]}store(t){if(t instanceof Rg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Ig(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Rg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character,t.ascentDescentMode),new Og(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Lg=!1;try{Lg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Lg=!1}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...up];class zg extends Tp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ud,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:th.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:th.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:th.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:th.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:th.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:th.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:th.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:th.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Fp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&zg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&zg.splitText(t.text).length>1)))}static splitText(t){if(Lg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=zg.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),ah.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||ah.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!zg.AllSingleCharacter(y)&&(y=zg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),w=new Eg(0,0,(k?n:S?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&S,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(w);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&w.lines[w.lines.length-1].paragraphs.push(s)):M.deal(s,!0),w.lines.length!==t&&(t=w.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,w.lines[w.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===w.layoutDirection?k:C)){const t=w.getActualSizeWidthEllipsis();let e="horizontal"===w.layoutDirection?t.width:t.height;("horizontal"===w.layoutDirection?S:A)&&(e=Math.min(e,"horizontal"===w.layoutDirection?i:s)),w.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&w.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new zg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function Hg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},kp);class jg extends Jp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ng(t){return new jg(t)}const Vg=["symbolType","size",...up];let Wg=class t extends Tp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=gd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Fp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Uc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Sl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Sl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Ug(t){return new Wg(t)}function Gg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Yg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Xg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[li(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=li(s);d(t[s])||(e[n]=i(t[s]))})),u(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&v(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},kp);class Kg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Cl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=fd}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Fp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new qg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ce(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=ah.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Uc(n,o/Math.abs(r+a),!0,l),i.union(n)}return ah.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||ah.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Kg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new Kg(a,w,C),T=y(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=T.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=Gg(y,a),e=this.cache.verticalList.length*v,i=Yg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>Kc(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Xc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const S=Gg(y,a),A=x.verticalList.length*v,k=Yg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=kh(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=$g){return super.needUpdateTags(t,e)}needUpdateTag(t,e=$g){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return qg.baselineMapAlign}getAlignMapBaseline(){return qg.alignMapBaseline}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},kp),qg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},qg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Jg=["heightLimit","lineClamp"];class Qg extends qg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=kh(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new Kg(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),w=[],M=[0,0];let T=1/0;if(y>0&&(T=Math.max(Math.floor(y/x),1)),b&&(T=Math.min(T,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 df extends cf{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let uf=0;class pf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=ah.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++uf,t),this.tryRunAnimationFrameNextFrame(),uf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class gf{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var ff=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 mf extends gf{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new df(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new pf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new pf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return ff(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class vf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Cd(Object.assign({nativeCanvas:ah.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Cd(Object.assign({nativeCanvas:ah.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const yf=new vf,_f=Symbol.for("VWindow"),bf=Symbol.for("WindowHandlerContribution");function xf(t){const e=ah.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Sf extends gf{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(t=ah.global,e=xf){super(),this.handlerFactory=e,this.hooks={onChange:new df(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class Af{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=ah.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=yf.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=ah.windowFactory)||void 0===s?void 0:s.call(ah))&&void 0!==n?n:new Sf(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var kf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(kf||(kf={}));const Cf=new Ue;class wf{constructor(){this.matrix=new Ue}init(t){return this.mode=kf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=kf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Cf.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(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Cf.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(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}scale(t,e,i){return this.mode===kf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===kf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Cf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}translate(t,e){return this.mode===kf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===kf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const Mf=Symbol.for("@visactor/vrender-core/factory-state");function Tf(){const t=globalThis;return t[Mf]||(t[Mf]={pluginClasses:{}}),t[Mf]}class Bf{constructor(){this.global=ah.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ue(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new ne(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Ef=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 Pf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Of(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Pf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Pf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Lf{constructor(){this.time=xo.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Hf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Fp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Xf(t,e,i,s)}}const Ff=new Lf,zf=new Set(["top","center","bottom"]);function Hf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function jf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Nf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Nf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:jf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Uf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:zf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Gf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Yf(t){if(!t)return null;const e=Gf(t.naturalWidth,t.videoWidth,t.width),i=Gf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Xf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Yf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Uf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=yf.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),yf.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Kf{constructor(t){this.subRenderContribitions=t,this.time=xo.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)}))}}class $f{constructor(){this.time=xo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const qf=new $f;class Zf{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Jf=new Zf,Qf={getContributions:()=>[]};class tm{constructor(t=[],e=Qf,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Of(e,jl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ne,this.backupDirtyBounds=new Ne,this.global=null!==(s=i.global)&&void 0!==s?s:ah.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:ah.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:Qf,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,xu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=If(e,i,jl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=xu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),xu.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||function(){const t=ah.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class im{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class sm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class nm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const am={getContributions:()=>[]};class om{constructor(t=am,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new nm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class lm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class hm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=ah.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=ah.global.getRequestAnimationFrame();this.rafId=t((()=>{ah.global.devicePixelRatio!==this.dpr&&(this.dpr=ah.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=ah.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class cm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,ah.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const dm=new Ve;class um{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&mo.UPDATE_PAINT)||s._updateTag&mo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(dm.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(dm,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let pm;function gm(){if(null==pm)try{const t=document.createElement("canvas"),e=t.getContext("2d");pm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),pm&&(pm=!!document.createElement)}catch(t){pm=!1}}function fm(){gm();const t=ah.global&&ah.global.env;return t?"browser"===t:pm}function mm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle: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(ru(t),hu(t,t,[n+o,r+l,a+h]),hu(t,t,[y[0],y[1],y[2]]),au(t,t,g),ou(t,t,p),hu(t,t,[-y[0],-y[1],y[2]]),du(t,t,[c,d,u]),f){const i=Su.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]}hu(i,i,[s[0],s[1],0]),lu(i,i,f),hu(i,i,[-s[0],-s[1],0]),uu(t,t,i)}}function vm(t){const{alpha:e,beta:i}=t.attribute;return e||i}class ym{constructor(t=of){this.creator=t,this.hooks={onAttributeUpdate:new df(["graphic"]),onSetStage:new df(["graphic","stage"]),onRemove:new df(["graphic"]),onRelease:new df(["graphic"]),onAddIncremental:new df(["graphic","group","stage"]),onClearIncremental:new df(["graphic","group","stage"]),beforeUpdateAABBBounds:new df(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new df(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new df(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Yg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Gg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Uc(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;Uc(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const _m="white";class bm extends Jp{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:_m}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,y,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new df(["stage"]),afterRender:new df(["stage"]),afterClearScreen:new df(["stage"]),afterClearRect:new df(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:ah.global,!this.global.env&&fm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:ah.windowFactory)&&void 0!==n?n:()=>new Sf(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=ah.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=ah.renderServiceFactory)||void 0===h?void 0:h.call(ah))&&void 0!==c?c:ah.renderService)&&void 0!==d?d:new em,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=ah.pluginServiceFactory)||void 0===p?void 0:p.call(ah))&&void 0!==g?g:ah.pluginService)&&void 0!==f?f:new om,this.layerService=null!==(y=null!==(m=e.layerService)&&void 0!==m?m:ah.layerService)&&void 0!==y?y:new wm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:ah.graphicService)&&void 0!==b?b:new ym,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:_m,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,rp(s)),hp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new eo(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=km.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=km.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=km.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new lm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new hm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new cm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ne;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new um,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=km.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=km.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=km.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return rp({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class xm{constructor(t=bm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Sm extends Jp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{ah.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=>{ah.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)))}}class Am{constructor(t=Sm){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let km=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Cm(t){const e=ah.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}km._pluginClasses=Tf().pluginClasses;class wm{static GenerateLayerId(){return`${wm.idprefix}_${wm.prefix_count++}`}constructor(t=ah.global,e=new Am,i=Cm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:wm.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)}}wm.idprefix="visactor_layer",wm.prefix_count=0;const Mm=Symbol.for("TransformUtil"),Tm=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Em=Symbol.for("StaticLayerHandlerContribution"),Pm=Symbol.for("DynamicLayerHandlerContribution"),Om=Symbol.for("VirtualLayerHandlerContribution"),Rm=Symbol.for("@visactor/vrender-core/contribution-store-state");function Im(){const t=globalThis;return t[Rm]||(t[Rm]={store:new Map}),t[Rm]}const Dm=Symbol("ContributionProvider");class Lm{constructor(t,e){this.serviceIdentifier=t,this.container=e,jm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function Fm(t,e){return new Lm(t,e)}function zm(t,e){t(Dm).toDynamicValue((({container:t})=>Fm(e,t))).inSingletonScope().whenTargetNamed(e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>Fm(e,t))).whenTargetNamed(e)}class jm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}jm.store=Im().store;class Nm{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=Ql.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Mg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Mg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Nm{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Um({bind:t}){t(vg).toDynamicValue((({container:t})=>new mf(Fm(mg,t)))).inSingletonScope(),t(_f).to(Sf),t(Tm).toDynamicValue((({container:t})=>new Af(Fm(Vm,t)))).inSingletonScope(),t(Mm).to(wf).inSingletonScope(),t(Bm).to(wm).inSingletonScope()}const Gm=Symbol.for("RenderService"),Ym=Symbol.for("BeforeRenderConstribution");function Xm({bind:t}){t(Gm).to(em)}const Km=Symbol.for("GraphicPicker"),$m=Symbol.for("PickerService"),qm=Symbol.for("BoundsPicker"),Zm=Symbol.for("GlobalPickerService"),Jm=Symbol.for("PickItemInterceptor"),Qm=Symbol.for("PickServiceInterceptor"),tv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===td,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},ev=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class iv extends gg{constructor(t){super(t),this.type="rect3d",this.numberType=dd}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Yt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return Fp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,nv)}needUpdateTag(t){return super.needUpdateTag(t,nv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Sl,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new rv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rv.NOWORK_ANIMATE_ATTR}}function av(t){return new rv(t)}rv.NOWORK_ANIMATE_ATTR=kp;class ov extends Np{constructor(t){super(t),this.type="arc3d",this.numberType=td}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return ov.NOWORK_ANIMATE_ATTR}}function lv(t){return new ov(t)}ov.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);class hv extends cg{constructor(t){super(t),this.type="pyramid3d",this.numberType=hd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return hv.NOWORK_ANIMATE_ATTR}}function cv(t){return new hv(t)}let dv,uv;function pv(t){return dv||(dv=hf("text",{})),dv.initAttributes(t),dv.AABBBounds}function gv(t){return uv||(uv=hf("richtext",{})),uv.setAttributes(t),uv.AABBBounds}hv.NOWORK_ANIMATE_ATTR=kp;class fv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Fp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=xu.allocateByObj(a),u=new ne(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class vv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=tv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function _v({bind:t,isBound:e}){e($m)||(t(Zm).toSelf(),t($m).toService(Zm)),t(yv).toSelf().inSingletonScope(),t(Jm).toService(yv),t(mv).toSelf().inSingletonScope(),t(Jm).toService(mv),t(vv).toSelf().inSingletonScope(),t(Jm).toService(vv),zm(t,Jm),t(fv).toSelf().inSingletonScope(),t(Qm).toService(fv),zm(t,Qm)}function bv({bind:t}){t(md).to(ym),t(vd).toConstantValue(of)}const xv=Symbol.for("AutoEnablePlugins"),Sv=Symbol.for("PluginService");class Av{constructor(){this.type="static",this.offscreen=!1,this.global=ah.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Cd({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()}}function kv(t){(function({bind:t}){zm(t,mg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),zm(t,Vm)}({bind:t.bind}),function({bind:t}){t(Av).toSelf(),t(Em).toService(Av)}({bind:t.bind})}const Cv=zt/2;function wv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!$(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Cv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!$(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Cv,!1)}if(o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),!$(S,A)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Cv,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Cv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Mv(t,e){return!(!t&&!e)}function Tv(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Ev(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Pv(t,e){return t*e>0}function Ov(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Rv(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*uE*E+P*P&&(k=w,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Ut(c),k=n*Xt(c),C=s*Ut(u),w=s*Xt(u);let M,T,B,E;if((b>Ft||_>Ft)&&(M=n*Ut(d),T=n*Xt(d),B=s*Ut(p),E=s*Xt(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:B,yirs:E,xore:M,yore:T,xire:C,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Lv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Nt-Ft)e.moveTo(i+n*Ut(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Ut(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:w,innerDeltaAngle:M,innerEndAngle:T,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:O}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(y,m),o=Iv(g,f,u,p,n,t,Number(c)),l=Iv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Ut(Wt(l.y01,l.x01)),s+o.cy+m*Xt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ut(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Ut(C),s+n*Xt(C));if(!(r>Ft)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(w>Ft){const t=Yt(E,w),n=Yt(P,w),o=Iv(S,A,b,x,r,-n,Number(c)),l=Iv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ut(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,T,B,c):e.moveTo(i+r*Ut(B),s+r*Xt(B))}return a?a[3]&&e.lineTo(i+n*Ut(o),s+n*Xt(o)):e.closePath(),d}const Fv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class zv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=yf.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])),yf.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Nt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=yf.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Ug({}));const C=h.columns?v/h.columns:b,w=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,w-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:Fv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=yf.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),yf.free(l),c}yf.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const Hv=new zv;class jv{constructor(){this.time=xo.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,w-=m;const T=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:su(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:w-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Lv(t,e,i,s,M+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&T(u,"outerBorder"),f&&T(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:w,startAngle:y,endAngle:_})}}const Nv=new jv,Vv=Hv,Wv=Ff;class Uv{constructor(){this.time=xo.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:su(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Gv=new Uv,Yv=Hv,Xv=Ff;class Kv extends Lf{constructor(){super(...arguments),this.time=xo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Hf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const $v=new Kv;function qv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Zv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:k-i)||0,T=(null!=T?T:C-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:su(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,T-o*g)):(e.beginPath(),wv(e,u,p,M-o*g,T-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}class Jv{constructor(){this.time=xo.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;qv(p)&&(u.doStroke=!1)}}class Qv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,qv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return wv(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ty=new Zv,ey=Hv,iy=Ff;class sy extends Zv{constructor(){super(...arguments),this.time=xo.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)}}const ny=new sy,ry=Ff;class ay{constructor(){this.time=xo.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:su(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class oy{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const ly=new ay,hy=new oy,cy=Hv,dy=Ff,uy=Hv,py=Ff;class gy extends zv{constructor(){super(...arguments),this.time=xo.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:bh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:bh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:bh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:bh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class fy{constructor(t){this.groupRenderContribitions=t,this.numberType=nd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push($v)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Fp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:w=l.y}=t.attribute,M=Ev(p,m,g,f,c),T=Ov(p,v,g,f),B=Mv(c,u),E=Tv(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(M||T||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),wv(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push($v));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===xo.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o,P)})),h&&e.clip();const O=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,w-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,C-i,w-s,l),e.stroke()))};A?(R(),O()):(O(),R()),this._groupRenderContribitions.forEach((r=>{r.time===xo.afterFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=ah.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Fp(t,null==s?void 0:s.theme).group,i=Su.allocate(),n=Su.allocate();mm(n,t,e),uu(i,p||i,n),a.modelMatrix=i,Su.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Su.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var my,vy=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"}(my||(my={}));class yy extends tm{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=my.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new df([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return vy(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return vy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return vy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>vy(this,void 0,void 0,(function*(){if(2!==t.count)yield Rf(t,jl.zIndex,((i,s)=>{if(this.status===my.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return vy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return vy(this,void 0,void 0,(function*(){this.rendering&&(this.status=my.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=my.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 vy(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:()=>vy(this,void 0,void 0,(function*(){yield Rf(t,jl.zIndex,(t=>vy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const _y=Symbol.for("IncrementalDrawContribution"),by=Symbol.for("ArcRender"),xy=Symbol.for("Arc3dRender"),Sy=Symbol.for("AreaRender"),Ay=Symbol.for("CircleRender"),ky=Symbol.for("GraphicRender"),Cy=Symbol.for("GroupRender"),wy=Symbol.for("LineRender"),My=Symbol.for("PathRender"),Ty=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Ey=Symbol.for("Rect3DRender"),Py=Symbol.for("SymbolRender"),Oy=Symbol.for("TextRender"),Ry=Symbol.for("RichTextRender"),Iy=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Ly=Symbol.for("ImageRender"),Fy=Symbol.for("RenderSelector"),zy=Symbol.for("DrawContribution"),Hy=Symbol.for("StarRender"),jy=Symbol.for("DrawItemInterceptor"),Ny=new Ve,Vy=new Ve;class Wy{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){Ny.copy(s.dirtyBounds),Vy.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,xu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Ny),s.backupDirtyBounds.copy(Vy)),!0}}class Uy{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}}class Gy{constructor(){this.order=1,this.interceptors=[new Wy,new Xy,new Yy,new Uy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Su.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const Ky=Symbol.for("ArcRenderContribution"),$y=Symbol.for("AreaRenderContribution"),qy=Symbol.for("CircleRenderContribution"),Zy=Symbol.for("GroupRenderContribution"),Jy=Symbol.for("ImageRenderContribution"),Qy=Symbol.for("PathRenderContribution"),t_=Symbol.for("PolygonRenderContribution"),e_=Symbol.for("RectRenderContribution"),i_=Symbol.for("SymbolRenderContribution"),s_=Symbol.for("TextRenderContribution"),n_=Symbol.for("StarRenderContribution"),r_=Symbol.for("CommonRenderContribution"),a_=Symbol.for("InteractiveSubRenderContribution");function o_(t){!function({bind:t}){t(Lf).toSelf().inSingletonScope(),t(zv).toSelf().inSingletonScope(),t(zy).to(tm),t(_y).to(yy),t(Cy).toDynamicValue((({container:t})=>new fy(Fm(Zy,t)))).inSingletonScope(),t(ky).toService(Cy),zm(t,Zy),zm(t,a_),t(Kf).toDynamicValue((({container:t})=>new Kf(Fm(a_,t)))).inSingletonScope(),zm(t,ky),t(Gy).toSelf().inSingletonScope(),t(jy).toService(Gy),zm(t,jy)}({bind:t.bind})}class l_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class h_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new l_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function c_(){return new h_}const d_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const u_=function(){const t=globalThis;return t[d_]||(t[d_]={legacyBindingContext:c_(),preloaded:!1}),t[d_]}(),p_=u_.legacyBindingContext;function g_(){u_.preloaded||(u_.preloaded=!0,Um({bind:p_.bind}),bv({bind:p_.bind}),Xm({bind:p_.bind}),_v({bind:p_.bind,isBound:p_.isBound}),function({bind:t}){t(Sv).to(om),Hm(t,xv)}({bind:p_.bind}),kv(p_),o_(p_))}function f_(){return p_}function m_(t){g_();const[e]=p_.getAll(t);return e}function v_(t,e){return g_(),p_.getNamed(t,e)}function y_(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const __=y_((()=>m_(vg)));ah.global=__;class b_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?ah.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:ah.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Xg("text"===t.type&&t.attribute?t.attribute:Fp(t).text)}getTransformOfText(t){const e=Fp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const u=t.globalAABBBounds;let g=n.anchorType;if(d(g)&&(g="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===g&&(g="top-left"),"position"===g||u.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=Fe(u,g);l=t.x,h=t.y}const f=ah.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),y=e.viewBox,_=l+m.left-f.left+y.x1,b=h+m.top-f.top+y.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===g&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),c(n.style)){const e=n.style({top:b,left:_,width:u.width(),height:u.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else p(n.style)?o=Object.assign(Object.assign({},o),n.style):v(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));ah.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===ah.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{this.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&&ah.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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=d(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"===ah.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 x_=()=>{km.registerPlugin("HtmlAttributePlugin",b_)};class S_ extends b_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?ah.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&ah.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const A_=()=>{km.registerPlugin("ReactAttributePlugin",S_)};class k_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return k_.instance||(k_.instance=new k_),k_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function C_(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function w_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:M_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=C_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:M_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=C_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:w,customType:M,controlOptions:T}=t,B=e.animate();B.priority=k;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],O=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&O&&(i=null!==(h=P[O])&&void 0!==h?h:i),B.startAt(b);const R=i*x+E;R>0&&B.wait(R);let I=null,D=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.props),L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,M,L,D,_,m,f,T,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(B,e,p,D);let z=0;x&&(z=x*(s-i-1));const H=c(y)?y(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&B.wait(z),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,y,_,b;if(e&&i){i=C_(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(y=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:M_.builtInAnimateMap[r],m=t.custom?t.customType:C_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{w_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}M_.builtInAnimateMap={};const T_="appear",B_="disappear",E_="update",P_="highlight",O_="unhighlight";class R_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class I_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new M_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new M_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([T_],[{name:T_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyHighlightState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([O_],[{name:O_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new I_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new R_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class L_{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-L_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*L_.bounceIn(2*t):.5*L_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){L_[t]=e}}function F_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}L_.quadIn=L_.getPowIn(2),L_.quadOut=L_.getPowOut(2),L_.quadInOut=L_.getPowInOut(2),L_.cubicIn=L_.getPowIn(3),L_.cubicOut=L_.getPowOut(3),L_.cubicInOut=L_.getPowInOut(3),L_.quartIn=L_.getPowIn(4),L_.quartOut=L_.getPowOut(4),L_.quartInOut=L_.getPowInOut(4),L_.quintIn=L_.getPowIn(5),L_.quintOut=L_.getPowOut(5),L_.quintInOut=L_.getPowInOut(5),L_.backIn=L_.getBackIn(1.7),L_.backOut=L_.getBackOut(1.7),L_.backInOut=L_.getBackInOut(1.7),L_.elasticIn=L_.getElasticIn(1,.3),L_.elasticOut=L_.getElasticOut(1,.3),L_.elasticInOut=L_.getElasticInOut(1,.3*1.5),L_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),L_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},L_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)L_[`flicker${t}`]=e=>F_(e,t);for(let t=2;t<10;t++)L_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function z_(t,e,i){return t+(e-t)*i}const H_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=z_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=z_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=z_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=z_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=z_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=z_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=z_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=z_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=z_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Pu(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Fu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Pu(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Fu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=z_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=z_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=z_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=z_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=z_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=z_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=z_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=z_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=z_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=_h(e,i,s),r.addUpdateBoundTag()}}};function j_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:yo.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=L_[s])&&void 0!==n?n:L_.linear:L_.linear,"wait"===t&&(this.onUpdate=q_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=q_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=Bu.Get(i,Tu.Color255),r=Bu.Get(s,Tu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(H_["fill"===e?"fillPure":"strokePure"])}else H_[e]?t.push(H_[e]):t.push(j_)}else H_[e]?t.push(H_[e]):t.push(j_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class Q_ extends J_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();K_(this.target,t,yo.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class tb extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const eb=new tb;eb.isGlobal=!0;class ib extends J_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class sb extends ib{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class nb extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class rb extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){K_(this.target,this.from,yo.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ab(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class hb{constructor(t=Va.GenAutoIncrementId(),e=eb,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(lb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new J_(Tl.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new Q_(Tl.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new rb(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(lb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&K_(this.target,this._startProps,yo.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const cb=new pf;class db{constructor(){this.released=!1}tick(t,e){cb.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class ub extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ml.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ml.INITIAL,ah.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),ah.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new db;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ml.INITIAL&&(this.status=Ml.PAUSE,!0)}resume(){return this.status!==Ml.INITIAL&&(this.status=Ml.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ml.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ml.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ml.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ml.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ml.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ml.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,ah.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function gb(){U(Tp,D_),U(Tp,pb)}function fb(){lf("arc",Vp)}function mb(){lf("arc3d",lv)}function vb(){lf("area",Gp)}function yb(){lf("circle",Kp)}function _b(){lf("glyph",qp)}function bb(){lf("group",Qp)}function xb(){lf("image",ig)}function Sb(){lf("line",rg)}function Ab(){lf("path",lg)}function kb(){lf("polygon",dg)}function Cb(){lf("pyramid3d",cv)}function wb(){lf("rect",fg)}function Mb(){lf("rect3d",sv)}function Tb(){lf("richtext",Hg)}function Bb(){lf("shadowRoot",Ng)}function Eb(){lf("star",av)}function Pb(){lf("symbol",Ug)}function Ob(){lf("text",Zg)}function Rb(){lf("wrapText",tf)}function Ib(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Lb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(qf),e(Jf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===xo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===xo.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Fp(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=Bv(d,u,h),_=Pv(d,g),b=Mv(h),x=Tv(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Mo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Pv(o,c),g=Mv(n,r),f=Tv(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||vm(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Su.allocate(),n=Su.allocate();mm(n,t,e),uu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Su.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Su.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class Fb extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Qc,this.builtinContributions=[Nv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nFt){const t=Yt(b,_),r=Yt(x,_),a=Iv(v,y,f,m,n,t,Number(u)),o=Iv(A,k,C,w,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||T<.001)e.lineTo(i+C,s+w),p=!0;else if(M>Ft){const t=Yt(E,M),n=Yt(P,M),a=Iv(C,w,A,k,r,-n,Number(u)),o=Iv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Ut(B),s+r*Xt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Fp(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let w=0;const M=(h(S)&&S||S[0])&&"conical"===c.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Nt-Ft){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),T||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Uu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const zb=new WeakSet;function Hb({bind:t}){Ib(zb,t)||(t(Fb).toDynamicValue((({container:t})=>new Fb(Fm(Ky,t)))).inSingletonScope(),t(by).toService(Fb),t(ky).toService(by),t(Ky).toService(Kf),zm(t,Ky))}const jb=Hb;class Nb extends Lb{constructor(){super(...arguments),this.numberType=td}drawShape(t,e,i,s,n,r,a,o){var l;const h=Fp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Tu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},w={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Nt-Ft)e.moveTo(i+r*Ut(o),s+r*Xt(o),n),e.arc(i,s,r,o,l,!c,n),a>Ft&&(e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Ut(p),y=r*Xt(p),_=a*Ut(f),b=a*Xt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>Ft)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Nt,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=Ft)e.moveTo(i,s,n);else if(c>=Nt-Ft)e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Ut(h),s+a*Xt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Ut(c),f=a*Xt(c),m=a*Ut(p),v=a*Xt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Ib(Vb,t)||(t(Nb).toDynamicValue((()=>new Nb)).inSingletonScope(),t(xy).toService(Nb),t(ky).toService(xy))}const Ub=Wb;function Gb(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]=Lo(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 Yb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?_o.ROW:_o.COLUMN,Number.isFinite(c)||(o=_o.COLUMN),Number.isFinite(d)||(o=_o.ROW);const u=i*(o===_o.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Gb(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),Gb(t,l,1,s),o=!1):o=!0}t.closePath()}function Kb(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function $b(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Kb(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Gb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=_o.ROW:"y"===s?u=_o.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Zb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Jb=new gy,Qb=Ff;class tx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ed,this.builtinContributions=[Jb,Qb],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Fp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:w,points:M,segments:T}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===C&&!T&&!M.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,_,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=xl(E(t.points,x),B,{startPoint:e,curveTension:b});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=xl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=xl(e,B,{curveTension:b}),n=xl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Yt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=_o.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Vt(_.x-b.x),A=Vt(_.y-b.y);x=null==_.x1?_o.ROW:null==_.y1?_o.COLUMN:Number.isFinite(S+A)?S>A?_o.ROW:_o.COLUMN:_o.ROW,Yb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),$b(t,i[0]?e.top:e.bottom,l,x===_o.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ex=new WeakSet;function ix({bind:t}){Ib(ex,t)||(t(tx).toDynamicValue((({container:t})=>new tx(Fm($y,t)))).inSingletonScope(),t(Sy).toService(tx),t(ky).toService(Sy),t($y).toService(Kf),zm(t,$y))}const sx=ix;class nx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Gv,Xv,Yv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const rx=new WeakSet;function ax({bind:t}){Ib(rx,t)||(t(nx).toDynamicValue((({container:t})=>new nx(Fm(qy,t)))).inSingletonScope(),t(Ay).toService(nx),t(ky).toService(Ay),t(qy).toService(Kf),zm(t,qy))}const ox=ax;class lx{constructor(){this.numberType=sd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Fp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const hx=new WeakSet;function cx({bind:t}){Ib(hx,t)||(t(lx).toDynamicValue((()=>new lx)).inSingletonScope(),t(Dy).toService(lx),t(ky).toService(Dy))}const dx=cx,ux=["","repeat-x","repeat-y","repeat"];function px(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?ux[i]:"no-repeat"}function gx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=px(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const fx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function mx(t){return{backgroundMode:fx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function vx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=gx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function yx(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=gx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?mx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Xf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class _x extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=rd,this.builtinContributions=[ny,ry],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:_=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:w,doStroke:M}=A;if(!S||!t.resources)return;const T=t.resources.get(S);if("success"!==T.state)return;const B=t.width,E=t.height;e.beginPath();let P=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,B,E):(wv(e,i,s,B,E,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const O=()=>{w&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),yx(e,T.data,i,s,B,E,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x})))},R=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=vx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x}),D=P||I;g?(R(),D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore()):(D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore(),R()),this.afterRenderStep(t,e,i,s,w,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&v(s))return void oh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Fp(t).image;this._draw(t,a,!1,i)}}const bx=new WeakSet;function xx({bind:t}){Ib(bx,t)||(t(Ly).toDynamicValue((({container:t})=>new _x(Fm(Jy,t)))).inSingletonScope(),t(ky).toService(Ly),t(Jy).toService(Kf),zm(t,Jy))}const Sx=xx;class Ax extends Lb{constructor(){super(...arguments),this.numberType=ad}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();$b(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=xl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const kx=new WeakSet;function Cx({bind:t}){Ib(kx,t)||(t(Ax).toDynamicValue((()=>new Ax)).inSingletonScope(),t(wy).toService(Ax),t(ky).toService(wy))}const Mx=Cx,Tx=Hv,Bx=Ff;class Ex extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=od,this.builtinContributions=[Bx,Tx],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:Fp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Mo(t.pathShape.commandList,e,i,s,1,1,f);else{Mo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Px=new WeakSet;function Ox({bind:t}){Ib(Px,t)||(t(Ex).toDynamicValue((({container:t})=>new Ex(Fm(Qy,t)))).inSingletonScope(),t(My).toService(Ex),t(ky).toService(My),t(Qy).toService(Kf),zm(t,Qy))}const Rx=Ox;function Ix(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Ix(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Ix(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Lx(h,y,_,d,u),A=Lx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,w=Dx(k,C),M=Lx(h,Dx(y,v),w,k,C);let T=Math.atan2(S.y-M.y,S.x-M.x);const B=Math.atan2(A.y-M.y,A.x-M.x);let E=B-T;E<0&&(T=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const jx=new WeakSet;function Nx({bind:t}){Ib(jx,t)||(t(Ty).toDynamicValue((({container:t})=>new Hx(Fm(t_,t)))).inSingletonScope(),t(ky).toService(Ty),t(t_).toService(Kf),zm(t,t_))}const Vx=Nx;class Wx extends Lb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Tu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Ux extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=hd}drawShape(t,e,i,s,n,r,a,o){var l;const h=Fp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=Fp(t).polygon;this._draw(t,s,!1,i)}}const Gx=new WeakSet;function Yx({bind:t}){Ib(Gx,t)||(t(Ux).toDynamicValue((()=>new Ux)).inSingletonScope(),t(Iy).toService(Ux),t(ky).toService(Iy))}const Xx=Yx;class Kx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=cd,this.builtinContributions=[ty,iy,ey],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Fp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:M}=t.attribute;w=(null!=w?w:b-S)||0,M=(null!=M?M:x-A)||0;const T=Ev(g,f,w,M,h),B=Ov(g,v,w,M,C),E=Mv(h,c),P=Tv(d,m);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||B||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,M)):(e.beginPath(),wv(e,i,s,w,M,u,"bevel"!==p));const O={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,T,B,l,n,a,o,O),k?(this._runStroke(t,e,i,s,l,O,B,S,A,o),this._runFill(t,e,i,s,l,O,T,S,A,a)):(this._runFill(t,e,i,s,l,O,T,S,A,a),this._runStroke(t,e,i,s,l,O,B,S,A,o)),this.afterRenderStep(t,e,i,s,E,P,T,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const $x=new WeakSet;function qx({bind:t}){Ib($x,t)||(t(Kx).toDynamicValue((({container:t})=>new Kx(Fm(e_,t)))).inSingletonScope(),t(By).toService(Kx),t(ky).toService(By),t(Qv).toSelf(),t(Jv).toSelf(),t(e_).toService(Qv),t(e_).toService(Jv),t(e_).toService(Kf),zm(t,e_))}const Zx=qx;class Jx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=dd}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=Fp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,w=Ev(v,y,A,k,d),M=Ov(v,b,A,k,S),T=Mv(d),B=Tv(u,_);if(!t.valid||!x)return;if(!T&&!B)return;if(!(w||M||a||o))return;const{light:E}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,E,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=Fp(t).rect;this._draw(t,s,!1,i)}}const Qx=new WeakSet;function tS({bind:t}){Ib(Qx,t)||(t(Jx).toDynamicValue((()=>new Jx)).inSingletonScope(),t(Ey).toService(Jx),t(ky).toService(Ey))}const eS=tS;const iS=new class extends Lf{constructor(){super(...arguments),this.time=xo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:T=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:O=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let I,{background:D}=t.attribute;if(!D)return;const L=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=p(D)&&D.background?D:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(g=z.dx)&&void 0!==g?g:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),D=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=pv(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 i=t.resources.get(D);if(!i||"success"!==i.state||!i.data)return void L();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,O&&(e.beginPath(),R?wv(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:w,backgroundKeepAspectRatio:M,backgroundScale:T,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=D,R?(wv(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),L()}};class sS extends Lb{constructor(){super(),this.numberType=ud,this.builtinContributions=[iS],this.init()}drawShape(t,e,i,s,n){const r=Fp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Fp(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(),wv(e,i-t,s-n,v,y,f,!0)),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=Fp(t).richtext;this._draw(t,s,!1,i)}}const nS=new WeakSet;function rS({bind:t}){Ib(nS,t)||(t(sS).toDynamicValue((()=>new sS)).inSingletonScope(),t(Ry).toService(sS),t(ky).toService(Ry))}const aS=rS;class oS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=pd,this.builtinContributions=[py,uy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const lS=new WeakSet;function hS({bind:t}){Ib(lS,t)||(t(oS).toDynamicValue((({container:t})=>new oS(Fm(n_,t)))).inSingletonScope(),t(Hy).toService(oS),t(ky).toService(Hy),zm(t,n_))}const cS=hS;class dS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[ly,dy,cy,hy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Fp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,M=s,T=C;const B=e.camera;if(k&&B&&e.project){const t=e.project(i,s,C);e.camera=null,y(c)&&(c[0],c[1]),w=t.x,M=t.y,T=void 0}!1===A.draw(e,c,w,M,T,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const uS=new WeakSet;function pS({bind:t}){Ib(uS,t)||(t(dS).toDynamicValue((({container:t})=>new dS(Fm(i_,t)))).inSingletonScope(),t(Py).toService(dS),t(ky).toService(Py),t(i_).toService(Kf),zm(t,i_))}const gS=pS;class fS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[iS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Fp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=kh(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:w}=S,M=!f,T=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,w,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,T,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=xu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),xu.free(t)}w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,T))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,T))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,T),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,T)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,T),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,T,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,T,e),this.afterRenderStep(t,e,i,s,C,w,A,k,d,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:Gg(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const mS=new WeakSet;function vS({bind:t}){Ib(mS,t)||(t(Oy).toDynamicValue((({container:t})=>new fS(Fm(s_,t)))).inSingletonScope(),t(ky).toService(Oy),t(s_).toService(Kf),zm(t,s_))}const yS=vS,_S=fm();function bS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function xS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const SS=Symbol.for("MathPickerContribution"),AS=Symbol.for("MathArcPicker"),kS=Symbol.for("MathAreaPicker"),CS=Symbol.for("MathCirclePicker"),wS=Symbol.for("MathImagePicker"),MS=Symbol.for("MathLinePicker"),TS=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),ES=Symbol.for("MathSymbolPicker"),PS=Symbol.for("MathTextPicker"),OS=Symbol.for("MathPolygonPicker"),RS=Symbol.for("MathGlyphPicker"),IS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),LS=Symbol.for("CanvasArc3dPicker"),FS=Symbol.for("CanvasAreaPicker"),zS=Symbol.for("CanvasCirclePicker"),HS=Symbol.for("CanvasImagePicker"),jS=Symbol.for("CanvasGifImagePicker"),NS=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),US=Symbol.for("CanvasRectPicker"),GS=Symbol.for("CanvasRect3dPicker"),YS=Symbol.for("CanvasSymbolPicker"),XS=Symbol.for("CanvasTextPicker"),KS=Symbol.for("CanvasPolygonPicker"),$S=Symbol.for("CanvasPyramid3dPicker"),qS=Symbol.for("CanvasRichTextPicker"),ZS=Symbol.for("CanvasGlyphPicker"),JS=Symbol.for("CanvasGroupPicker"),QS=Symbol.for("CanvasStarPicker"),tA=Symbol.for("CanvasPickerContribution"),eA=f_(),iA=y_((()=>m_(Tm))),sA=y_((()=>m_(Mm))),nA=y_((()=>m_(md))),rA=y_((()=>m_(Bm)));function aA(){ah.global=__,ah.graphicUtil=iA,ah.transformUtil=sA,ah.graphicService=nA,ah.layerService=rA,ah.canvasFactory=t=>v_(Ad,t),ah.context2dFactory=t=>v_(kd,t),ah.windowFactory=()=>new Sf(ah.global),ah.windowHandlerFactory=t=>function(t){const e=v_(bf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),ah.renderServiceFactory=()=>m_(Gm),ah.renderService=y_((()=>m_(Gm))),ah.pluginServiceFactory=()=>m_(Sv),ah.pluginService=y_((()=>m_(Sv))),ah.pickerServiceFactory=()=>m_($m),ah.layerHandlerFactory=t=>m_("static"===t?Em:"dynamic"===t?Pm:Om),ah.incrementalDrawContributionFactory=()=>m_(_y)}aA();var oA=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 lA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return oA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class hA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class cA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Tu.Color1),this.ambient=i;const s=Kt(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=Yt(Gt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=v(e)?Bu.Get(e,Tu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const dA=()=>{km.registerPlugin("DirectionalLight",cA)};class uA{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=Su.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Su.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return pu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Su.allocate()),this._vp=uu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Su.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Su.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return gu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Su.allocate()),this._vp=uu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return fu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;fu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const pA=()=>{km.registerPlugin("OrthoCamera",uA)},gA={getContributions:()=>[]},fA={getContributions:()=>[]};class mA{constructor(t=gA,e=fA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:ah.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:gA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:fA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ue(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Fp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new ne(e.x,e.y);l.transformPoint(a,a);const o=Fp(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&&Su.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),xu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class vA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new im,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new sm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new rm,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new nm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new xm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new Am,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new ef}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new em(new tm([],(t=this.registry.contribution,e=jy,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class yA{constructor(t={}){this.context=new vA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function _A(t={}){return new yA(t)}class bA extends yA{}class xA extends yA{}class SA extends tx{constructor(){super(...arguments),this.numberType=ed}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=Fp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=Mv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=Fp(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=Bv(u,p,c),y=Pv(u,g),_=Mv(c),b=Tv(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{};function DA(){wA.preloaded||(wA.preloaded=!0,Um({bind:MA.bind}),bv({bind:MA.bind}),Xm({bind:MA.bind}),_v({bind:MA.bind,isBound:MA.isBound}),kv(MA),o_(MA))}function LA(t,e){const i=jA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function FA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function zA(t,e){let i=EA.get(t);i||(i=new Map,EA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function HA(t,e,i){const s=zA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function jA(){return DA(),MA}function NA(){jm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=wA.runtimeGlobal)&&void 0!==t||(wA.runtimeGlobal=new mf(Fm(mg,MA))),wA.runtimeGlobal}function WA(t){const e=jA(),i=VA();ah.global=i,ah.canvasFactory=t=>e.getNamed(Ad,t),ah.context2dFactory=t=>e.getNamed(kd,t),ah.windowHandlerFactory=t=>LA(bf,t),ah.windowFactory=()=>new Sf(i,(t=>LA(bf,t))),ah.pluginServiceFactory=()=>new om(Fm(xv,e),{pluginRegistry:t.context.registry.plugin}),ah.incrementalDrawContributionFactory=()=>new yy([],new AA,new SA(Fm($y,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,jy))}function UA(t){var e;const i=jA();NA();const s=i.getAll(ky),n=zA(t.registry.renderer,TA);HA(t.registry.renderer,TA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),FA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,TA)}function GA(t){var e;const i=jA();NA();const s=i.getAll(jy),n=null!==(e=PA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,jy,e)})),n.clear(),PA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(jy));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(jy,e),r.add(e)),n.add(e)}))}function YA(t,e){var i;const s=jA();NA();const n=s.getAll(e),r=zA(t.registry.picker,BA);HA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),FA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function XA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=OA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,IA,t.isBound,t.rebind),function(t,e){let i=OA.get(t);i||(i=new WeakSet,OA.set(t,i)),i.add(e)}(t,e))}function KA(t,{app:e,legacy:i=!0,targets:s}={}){XA(jA(),t),i&&(g_(),XA(f_(),t)),NA(),e&&function(t,e){const i=null!=e?e:RA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&GA(t),s&&UA(t),r.forEach((e=>{YA(t,e)}))}(e,s)}function $A(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function qA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function ZA(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 JA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ak(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=ug(t.attribute),n=lk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=lk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=lk(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{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;n{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return yk(l,e,h),h},gk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return uk(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 uk(t,e)}return[]};const fk=t=>t.map((t=>({x:t.x,y:t.y}))),mk=(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]},vk=t=>{const e=new Ne;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return mk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return mk(t,{x:e.x1,y:n},{x:e.x2,y:n})},yk=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=vk(t);yk(n[0],s,i),yk(n[1],e-s,i)}},_k=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:fk(i)}];const s=[];return yk(i,e,s),s},bk=(t,e)=>{const i=rk(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;rObject.assign({},t))):[]}function Sk(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:xk(t.touches),configurable:!0},changedTouches:{value:xk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Ak(t,e){try{return t[e]}catch(t){return}}function kk(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Sk(t),l=Ak(t,"target"),h=Ak(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Ck=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Tk(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:Mk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},wk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},wk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Ck(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=Mk(i,this.selectionStartCursorIdx),a=Mk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=wk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Tk(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),ah.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),ah.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Ek{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=Mk(i,Math.ceil(t)),n=Mk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=Mk(i.attribute.textConfig,a),h=Mk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Pk,[this.formatTextCommandCb]),this.commandCbs.set(Ok,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):p(t)&&e.forEach((e=>z(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),ah.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(ah.global.isMacOS()&&t.metaKey&&"c"===t.key||!ah.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return ah.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(ah.global.isMacOS()&&t.metaKey&&"a"===t.key||!ah.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},wk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=Hg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:gv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||fg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},wk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),ah.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=Qp({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Rk.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=rg({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=Qp({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=gv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=gv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(fg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(fg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(fg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=gv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=gv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:gv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Jk=new Zk;class Qk{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const tC=()=>{km.registerPlugin("ViewTransform3dPlugin",Qk)},eC=new Ve;class iC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Fp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&eC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(eC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const sC=()=>{km.registerPlugin("FlexLayoutPlugin",iC)};var nC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:nh,ARC3D_NUMBER_TYPE:td,ARC_NUMBER_TYPE:Qc,AREA_NUMBER_TYPE:ed,AbstractGraphicRender:class{},get AnimateMode(){return wl},get AnimateStatus(){return Bl},get AnimateStepType(){return Tl},AppContext:vA,Application:sh,Arc:Np,Arc3d:ov,Arc3dRender:xy,ArcRender:by,ArcRenderContribution:Ky,Area:Up,AreaRender:Sy,AreaRenderContribution:$y,get AttributeUpdateType(){return yo},AutoEnablePlugins:xv,Base3dRender:Wx,BaseCanvas:Mu,BaseEnvContribution:lA,BaseRender:Lb,get BaseRenderContributionTime(){return xo},BaseWindowHandlerContribution:hA,Basis:Ko,BeforeRenderConstribution:Ym,BoundsContext:so,BoundsPicker:qm,BrowserEntry:yA,CIRCLE_NUMBER_TYPE:id,CONTRIBUTION_STORE_STATE_SYMBOL:Rm,Canvas3DDrawItemInterceptor:Xy,Canvas3DPickItemInterceptor:yv,CanvasFactory:Ad,CanvasTextLayout:Kg,Circle:Xp,CircleRender:Ay,CircleRenderContribution:qy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Tu},CommonDrawItemInterceptorContribution:Gy,CommonRenderContribution:r_,Context2dFactory:kd,ContributionProvider:Dm,ContributionRegistry:rm,ContributionStore:jm,CubicBezierCurve:Fo,CurveContext:bl,get CurveTypeEnum(){return bo},CustomEvent:$a,CustomPath2D:Sl,CustomSymbolClass:Mc,DEFAULT_TEXT_FONT_FAMILY:yg,DebugDrawItemInterceptorContribution:Uy,DefaultArcAllocate:Fk,DefaultArcAttribute:Nl,DefaultArcRenderContribution:jv,DefaultAreaAllocate:Hk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:gy,DefaultAttribute:jl,DefaultBaseBackgroundRenderContribution:Lf,DefaultBaseClipRenderAfterContribution:Zf,DefaultBaseClipRenderBeforeContribution:$f,DefaultBaseInteractiveRenderContribution:Kf,DefaultBaseTextureRenderContribution:zv,DefaultCanvasAllocate:vf,DefaultCanvasArc3DRender:Nb,DefaultCanvasArcRender:Fb,DefaultCanvasAreaRender:tx,DefaultCanvasCircleRender:nx,DefaultCanvasGroupRender:fy,DefaultCanvasImageRender:_x,DefaultCanvasLineRender:Ax,DefaultCanvasPathRender:Ex,DefaultCanvasPolygonRender:Hx,DefaultCanvasPyramid3dRender:Ux,DefaultCanvasRect3dRender:Jx,DefaultCanvasRectRender:Kx,DefaultCanvasSymbolRender:dS,DefaultCanvasTextRender:fS,DefaultCircleAllocate:Nk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Uv,DefaultConnectAttribute:zl,DefaultDebugAttribute:Hl,DefaultFillStyle:Ol,DefaultGlobal:mf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Gl,DefaultGraphicAllocate:Ik,DefaultGraphicMemoryManager:Zk,DefaultGraphicService:ym,DefaultGraphicUtil:Af,DefaultGroupAttribute:Ul,DefaultGroupBackgroundRenderContribution:Kv,DefaultImageAttribute:eh,DefaultImageRenderContribution:sy,DefaultLayerService:wm,DefaultLayout:El,DefaultLineAllocate:Wk,DefaultLineAttribute:Yl,DefaultMat4Allocate:bu,DefaultMatrixAllocate:_u,DefaultPathAllocate:Gk,DefaultPathAttribute:Xl,DefaultPickService:mA,DefaultPickStyle:Ll,DefaultPolygonAttribute:Kl,DefaultRect3dAttribute:Zl,DefaultRectAllocate:Dk,DefaultRectAttribute:ql,DefaultRectRenderContribution:Zv,DefaultRenderService:em,DefaultRichTextAttribute:th,DefaultRichTextIconAttribute:ih,DefaultStarAttribute:$l,DefaultStrokeStyle:Il,DefaultStyle:Fl,DefaultSymbolAllocate:Xk,DefaultSymbolAttribute:Jl,DefaultSymbolClipRangeStrokeRenderContribution:oy,DefaultSymbolRenderContribution:ay,DefaultTextAllocate:$k,DefaultTextAttribute:Ql,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Pl,DefaultTransformUtil:wf,DefaultWindow:Sf,get Direction(){return _o},DirectionalLight:cA,DrawContribution:zy,DrawItemInterceptor:jy,DynamicLayerHandlerContribution:Pm,get Edge(){return hh},EditModule:Bk,EmptyContext2d:Cu,EnvContribution:mg,EventManager:Ja,EventSystem:eo,EventTarget:Qa,FACTORY_STATE_SYMBOL:Mf,FORMAT_ALL_TEXT_COMMAND:Ok,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Pk,Factory:km,FederatedEvent:Ga,FederatedMouseEvent:Ya,FederatedPointerEvent:Xa,FederatedWheelEvent:Ka,FlexLayoutPlugin:iC,GLYPH_NUMBER_TYPE:sd,GRAPHIC_CLASS_SYMBOL:wp,GRAPHIC_REGISTRY_SYMBOL:nf,GRAPHIC_UPDATE_TAG_KEY:up,GROUP_NUMBER_TYPE:nd,Generator:Va,GlobalPickerService:Zm,Glyph:$p,GlyphRender:Dy,GradientParser:iu,Graphic:Tp,GraphicCreator:vd,GraphicFactory:ef,GraphicPicker:Km,GraphicRender:ky,GraphicService:md,GraphicUtil:Tm,Group:Jp,GroupRender:Cy,GroupRenderContribution:Zy,get GroupUpdateAABBBoundsMode(){return Zp},HtmlAttributePlugin:b_,get IContainPointMode(){return vo},IMAGE_NUMBER_TYPE:rd,Image:eg,ImageRender:Ly,ImageRenderContribution:Jy,IncrementalDrawContribution:_y,InteractiveDrawItemInterceptorContribution:Yy,InteractivePickItemInterceptorContribution:vv,InteractiveSubRenderContribution:a_,LINE_NUMBER_TYPE:ad,Layer:Sm,LayerFactory:Am,LayerService:Bm,Line:ng,LineRender:wy,Linear:Uo,LinearClosed:ul,Mat4Allocate:vu,MatrixAllocate:mu,get MeasureModeEnum(){return Cl},MiniappEntry:xA,MonotoneX:el,MonotoneY:il,NOWORK_ANIMATE_ATTR:kp,Node:Ua,NodeEntry:bA,OrthoCamera:uA,PATH_NUMBER_TYPE:od,POLYGON_NUMBER_TYPE:ld,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:hd,Path:og,PathRender:My,PathRenderContribution:Qy,PerformanceRAF:pf,PickItemInterceptor:Jm,PickServiceInterceptor:Qm,PickerRegistry:sm,PickerService:$m,PluginRegistry:nm,PluginService:Sv,Polygon:cg,PolygonRender:Ty,PolygonRenderContribution:t_,Pyramid3d:hv,Pyramid3dRender:Iy,RECT3D_NUMBER_TYPE:dd,RECT_NUMBER_TYPE:cd,RICHTEXT_NUMBER_TYPE:ud,RUNTIME_INSTALLER_STATE_SYMBOL:kA,RafBasedSTO:xh,ReactAttributePlugin:S_,Rect:gg,Rect3DRender:Ey,Rect3d:iv,RectRender:By,RectRenderContribution:e_,ReflectSegContext:No,RenderSelector:Fy,RenderService:Gm,RendererRegistry:im,ResourceLoader:oh,RichText:zg,RichTextEditPlugin:Rk,RichTextRender:Ry,STAR_NUMBER_TYPE:pd,get STATUS(){return Ml},SVG_ATTRIBUTE_MAP:yd,SVG_ATTRIBUTE_MAP_KEYS:_d,SVG_PARSE_ATTRIBUTE_MAP:bd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:xd,SYMBOL_NUMBER_TYPE:gd,SegContext:jo,ShadowPickServiceInterceptorContribution:fv,ShadowRoot:jg,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:mv,SplitRectAfterRenderContribution:Qv,SplitRectBeforeRenderContribution:Jv,Stage:bm,StageFactory:xm,Star:rv,StarRender:Hy,StarRenderContribution:n_,StateDefinitionCompiler:Ku,StateEngine:Ju,StaticLayerHandlerContribution:Em,Step:ol,StepClosed:ll,Symbol:Wg,SymbolRender:Py,SymbolRenderContribution:i_,TEXT_NUMBER_TYPE:fd,Text:qg,get TextDirection(){return Xc},TextMeasureContribution:Vm,TextRender:Oy,TextRenderContribution:s_,Theme:Dp,TransformUtil:Mm,get UpdateTag(){return mo},VGlobal:vg,VWindow:_f,ViewTransform3dPlugin:Qk,VirtualLayerHandlerContribution:Om,WILDCARD:"*",WindowHandlerContribution:bf,WrapText:Qg,XMLParser:Vc,_calculateLineHeight:Ah,_interpolateColor:Ou,addArcToBezierPath:Co,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:nk,alignSubpath:JA,application:ah,applyTransformOnBezierCurves:ak,arc3dModule:Ub,arcModule:jb,areaModule:sx,bezier:Ao,bezierCurversToPath:ok,binarySplitPolygon:vk,bindArc3dRenderModule:Wb,bindArcRenderModule:Hb,bindAreaRenderModule:ix,bindCircleRenderModule:ax,bindContributionProvider:zm,bindContributionProviderNoSingletonScope:Hm,bindGlyphRenderModule:cx,bindImageRenderModule:xx,bindLineRenderModule:Cx,bindPathRenderModule:Ox,bindPolygonRenderModule:Nx,bindPyramid3dRenderModule:Yx,bindRect3dRenderModule:tS,bindRectRenderModule:qx,bindRichtextRenderModule:rS,bindStarRenderModule:hS,bindSymbolRenderModule:pS,bindTextRenderModule:vS,boundStroke:Uc,builtInSymbolStrMap:Ec,builtinSymbols:Tc,builtinSymbolsMap:Bc,calcLineCache:xl,calculateArcCornerRadius:Dv,calculateLineHeight:kh,canvasAllocate:yf,centroidOfSubpath:ek,circleBounds:mh,circleModule:ox,clock:qa,colorEqual:function(t,e){const i=ii.parseColorString(t),s=ii.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:ju,configureRuntimeApplicationForApp:WA,container:eA,cornerTangents:Iv,createApp:_A,createArc:Vp,createArc3d:lv,createArea:Gp,createBrowserApp:_A,createCanvasEventTransformer:function(t,e,i,s){return kk(t.parentElement,e,i,s)},createCircle:Kp,createColor:nu,createConicalGradient:Gu,createContributionProvider:Fm,createEventTransformer:kk,createGlyph:qp,createGraphic:hf,createGroup:Qp,createImage:ig,createLine:rg,createMat4:yu,createMiniappApp:function(t={}){return new xA(t)},createNodeApp:function(t={}){return new bA(t)},createPath:lg,createPolygon:dg,createPyramid3d:cv,createRect:fg,createRect3d:sv,createRectPath:wv,createRichText:Hg,createShadowRoot:Ng,createStage:function(t){return aA(),(new xm).create(t)},createStar:av,createSymbol:Ug,createText:Zg,createWrapText:tf,cubicCalc:Po,cubicLength:Eo,cubicPointAt:Oo,cubicSubdivide:ZA,defaultArcAllocate:zk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Nv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:jk,defaultBaseBackgroundRenderContribution:Ff,defaultBaseClipRenderAfterContribution:Jf,defaultBaseClipRenderBeforeContribution:qf,defaultBaseTextureRenderContribution:Hv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Xv,defaultCircleRenderContribution:Gv,defaultCircleTextureRenderContribution:Yv,defaultGraphicMemoryManager:Jk,defaultGroupBackgroundRenderContribution:$v,defaultImageBackgroundRenderContribution:ry,defaultImageRenderContribution:ny,defaultLineAllocate:Uk,defaultPathAllocate:Yk,defaultRectAllocate:Lk,defaultRectBackgroundRenderContribution:iy,defaultRectRenderContribution:ty,defaultRectTextureRenderContribution:ey,defaultStarBackgroundRenderContribution:py,defaultStarTextureRenderContribution:uy,defaultSymbolAllocate:Kk,defaultSymbolBackgroundRenderContribution:dy,defaultSymbolClipRangeStrokeRenderContribution:hy,defaultSymbolRenderContribution:ly,defaultSymbolTextureRenderContribution:cy,defaultTextAllocate:qk,diff:qA,divideCubic:Lo,drawArc:ko,drawArcPath:Lv,drawAreaSegments:Yb,drawBackgroundImage:Xf,drawImageWithLayout:yx,drawIncrementalAreaSegments:Zb,drawIncrementalSegments:qb,drawSegments:$b,enumCommandMap:oo,fillVisible:Bv,findBestMorphingRotation:sk,findConfigIndexByCursorIdx:Mk,findCursorIdxByConfigIndex:Tk,findNextGraphic:If,flatten_simplify:$A,foreach:Of,foreachAsync:Rf,genBasisSegments:qo,genBasisTypeSegments:$o,genLinearClosedSegments:pl,genLinearClosedTypeSegments:gl,genLinearSegments:Go,genLinearTypeSegments:Yo,genMonotoneXSegments:nl,genMonotoneXTypeSegments:sl,genMonotoneYSegments:al,genMonotoneYTypeSegments:rl,genNumberType:Yc,genStepClosedSegments:dl,genStepSegments:hl,genStepTypeSegments:cl,getApplicationState:rh,getAttributeFromDefaultAttrList:bh,getBackgroundImage:Hf,getConicGradientAt:Uu,getContributionStoreState:Im,getCurrentEnv:function(){return fm()?"browser":"node"},getDefaultCharacterConfig:wk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Gg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Su.allocate();return hu(o,o,[a[0],a[1],0]),n&&au(o,o,n),s&&ou(o,o,s),hu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Tf,getGraphicClassState:Mp,getGraphicRegistryState:rf,getLegacyBindingContext:f_,getModelMatrix:mm,getRichTextBounds:gv,getRuntimeInstallerBindingContext:jA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:CA,getScaledStroke:su,getTextBounds:pv,getTheme:Fp,getThemeFromGroup:zp,globalTheme:Lp,glyphModule:dx,graphicCreator:of,graphicService:nA,graphicUtil:iA,identityMat4:ru,imageModule:Sx,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:KA,installRuntimeDrawContributionsToApp:GA,installRuntimeGraphicRenderersToApp:UA,installRuntimePickersToApp:YA,interpolateColor:Pu,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Ru,interpolateGradientRadialColor:Iu,interpolatePureColorArray:Lu,interpolatePureColorArrayToStr:Fu,intersect:Rv,isBrowserEnv:fm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){gm();const t=ah.global&&ah.global.env;return t?"node"===t:!pm},isSvg:jc,isXML:Nc,layerService:rA,lineModule:Mx,lookAt:pu,mapToCanvasPointForCanvas:function(t){var e;if(Pd(t._canvasX)&&Pd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:cu,mat4Allocate:Su,matrixAllocate:xu,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:uu,newThemeObj:Op,ortho:gu,parsePadding:ph,parseStroke:dh,parseSvgPath:fo,pathModule:Rx,pathToBezierCurves:rk,point:Xo,pointEqual:vh,pointInterpolation:yh,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Zt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Zt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>vh(t,e[i]))):!Number.isNaN(t.x+t.y)&&vh(t,e))},pointsInterpolation:_h,polygonModule:Vx,preLoadAllModule:g_,pyramid3dModule:Xx,quadCalc:Ro,quadLength:Do,quadPointAt:Io,rafBasedSto:Sh,rect3dModule:eS,rectFillVisible:Ev,rectModule:Zx,rectStrokeVisible:Ov,recursiveCallBinarySplit:yk,refreshRuntimeInstallerContributions:NA,registerArc3dGraphic:mb,registerArcGraphic:fb,registerAreaGraphic:vb,registerCircleGraphic:yb,registerDirectionalLight:dA,registerFlexLayoutPlugin:sC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=kk(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:_b,registerGraphic:lf,registerGroupGraphic:bb,registerHtmlAttributePlugin:x_,registerImageGraphic:xb,registerLineGraphic:Sb,registerOrthoCamera:pA,registerPathGraphic:Ab,registerPolygonGraphic:kb,registerPyramid3dGraphic:Cb,registerReactAttributePlugin:A_,registerRect3dGraphic:Mb,registerRectGraphic:wb,registerRichtextGraphic:Tb,registerShadowRootGraphic:Bb,registerStarGraphic:Eb,registerSymbolGraphic:Pb,registerTextGraphic:Ob,registerViewTransform3dPlugin:tC,registerWindowEventTransformer:function(t,e,i,s,n){const r=kk(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Rb,renderCommandList:Mo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:mx,resolveBackgroundPosition:Uf,resolveBackgroundSizing:jf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:gx,resolveImageRepeatMode:px,resolveRenderableImageSize:Yf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:aS,rotateX:au,rotateY:ou,rotateZ:lu,runFill:Mv,runStroke:Tv,scaleMat4:du,segments:So,shouldClipImageByLayout:vx,shouldUseMat4:vm,snapLength:Bo,splitArc:ck,splitArea:pk,splitCircle:dk,splitLine:gk,splitPath:bk,splitPolygon:_k,splitRect:hk,splitToGrids:lk,starModule:cS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Pv,symbolModule:gS,textAttributesToStyle:Xg,textDrawOffsetX:Gg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Yg,textModule:yS,transformMat4:fu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:sA,translate:hu,verticalLayout:Kc,vglobal:__,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{ah.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)}))},wrapCanvas:Cd,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=ah.global)||void 0===t?void 0:t.env,s=i?null===(e=ah.context2dFactory)||void 0===e?void 0:e.call(ah,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=y(t)?t[0]:t,i=[];if(!e)return i;if(!0===Nc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Jc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Jc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class rC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:su(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class aC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Qc}}let oC=!1;function lC(t){oC||(oC=!0,t.bind(DS).toDynamicValue((()=>new aC(bS(t,by)))).inSingletonScope(),t.bind(tA).toService(DS))}class hC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Qc}}let cC=!1;function dC(t){cC||(cC=!0,t.bind(AS).toDynamicValue((()=>new hC(bS(t,by)))).inSingletonScope(),t.bind(SS).toService(AS))}function uC(){if(uC.__loaded)return;uC.__loaded=!0;const t=f_();fb(),jb({bind:t.bind}),_S?lC(t):dC(t)}uC.__loaded=!1;const pC=uC;class gC extends Lb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Su.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class fC extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=td,this.themeType="arc"}}let mC=!1;function vC(t){var e;mC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,xy))&&(mC=!0,t.bind(LS).toDynamicValue((()=>new fC(bS(t,xy)))).inSingletonScope(),t.bind(tA).toService(LS))}function yC(){if(yC.__loaded)return;yC.__loaded=!0;const t=f_();mb(),dA(),pA(),Ub({bind:t.bind}),vC(t)}yC.__loaded=!1;const _C=yC;class bC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ed}}let xC=!1;function SC(t){xC||(xC=!0,t.bind(FS).toDynamicValue((()=>new bC(bS(t,Sy)))).inSingletonScope(),t.bind(tA).toService(FS))}class AC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ed}}let kC=!1;function CC(t){kC||(kC=!0,t.bind(kS).toDynamicValue((()=>new AC(bS(t,Sy)))).inSingletonScope(),t.bind(SS).toService(kS))}function wC(){if(wC.__loaded)return;wC.__loaded=!0;const t=f_();vb(),sx({bind:t.bind}),_S?SC(t):CC(t)}wC.__loaded=!1;const MC=wC;class TC{constructor(){this.type="glyph",this.numberType=sd}contains(t,e,i){if(!t.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}}class BC extends TC{constructor(t){super(),this.canvasRenderer=t}}let EC=!1;function PC(t){EC||(EC=!0,t.bind(ZS).toDynamicValue((()=>new BC(bS(t,Dy)))).inSingletonScope(),t.bind(tA).toService(ZS))}class OC extends TC{constructor(t){super(),this.canvasRenderer=t}}let RC=!1;function IC(t){RC||(RC=!0,t.bind(RS).toDynamicValue((()=>new OC(bS(t,Dy)))).inSingletonScope(),t.bind(SS).toService(RS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=f_();_b(),dx({bind:t.bind}),_S?PC(t):IC(t)}DC.__loaded=!1;const LC=DC;function FC(){FC.__loaded||(FC.__loaded=!0,bb())}FC.__loaded=!1;const zC=FC;class HC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=rd}}let jC=!1;function NC(t){jC||(jC=!0,t.bind(HS).toDynamicValue((()=>new HC(bS(t,Ly)))).inSingletonScope(),t.bind(tA).toService(HS))}class VC{constructor(){this.type="image",this.numberType=rd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function UC(t){WC||(WC=!0,t.bind(wS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(SS).toService(wS))}function GC(){if(GC.__loaded)return;GC.__loaded=!0;const t=f_();xb(),Sx({bind:t.bind}),_S?NC(t):UC(t)}GC.__loaded=!1;const YC=GC;class XC extends Lb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:su(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Su.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class KC extends XC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ad}}let $C=!1;function qC(t){$C||($C=!0,t.bind(NS).toDynamicValue((()=>new KC(bS(t,wy)))).inSingletonScope(),t.bind(tA).toService(NS))}class ZC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ad}}let JC=!1;function QC(t){JC||(JC=!0,t.bind(MS).toDynamicValue((()=>new ZC(bS(t,wy)))).inSingletonScope(),t.bind(SS).toService(MS))}function tw(){if(tw.__loaded)return;tw.__loaded=!0;const t=f_();Sb(),Mx({bind:t.bind}),_S?qC(t):QC(t)}tw.__loaded=!1;const ew=tw;class iw extends XC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=od}}let sw=!1;function nw(t){sw||(sw=!0,t.bind(WS).toDynamicValue((()=>new iw(bS(t,My)))).inSingletonScope(),t.bind(tA).toService(WS))}class rw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=od}}let aw=!1;function ow(t){aw||(aw=!0,t.bind(TS).toDynamicValue((()=>new rw(bS(t,My)))).inSingletonScope(),t.bind(SS).toService(TS))}function lw(){if(lw.__loaded)return;lw.__loaded=!0;const t=f_();Ab(),Rx({bind:t.bind}),_S?nw(t):ow(t)}lw.__loaded=!1;const hw=lw;class cw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ld}}let dw=!1;function uw(t){dw||(dw=!0,t.bind(KS).toDynamicValue((()=>new cw(bS(t,Ty)))).inSingletonScope(),t.bind(tA).toService(KS))}class pw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ld}}let gw=!1;function fw(t){gw||(gw=!0,t.bind(OS).toDynamicValue((()=>new pw(bS(t,Ty)))).inSingletonScope(),t.bind(SS).toService(OS))}function mw(){if(mw.__loaded)return;mw.__loaded=!0;const t=f_();kb(),Vx({bind:t.bind}),_S?uw(t):fw(t)}mw.__loaded=!1;const vw=mw;class yw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=hd,this.themeType="polygon"}}let _w=!1;function bw(t){var e;_w||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Iy))&&(_w=!0,t.bind($S).toDynamicValue((()=>new yw(bS(t,Iy)))).inSingletonScope(),t.bind(tA).toService($S))}function xw(){if(xw.__loaded)return;xw.__loaded=!0;const t=f_();Cb(),dA(),pA(),Xx({bind:t.bind}),bw(t)}xw.__loaded=!1;const Sw=xw,Aw=new Ve;class kw{constructor(){this.type="rect",this.numberType=cd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||x(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:su(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;Aw.setValue(i.x1,i.y1,i.x2,i.y2),Aw.expand(-r/2),h=!Aw.containsPoint(e)}}return s.highPerformanceRestore(),h}}class Cw extends kw{constructor(t){super(),this.canvasRenderer=t}}let ww=!1;function Mw(t){ww||(ww=!0,t.bind(US).toDynamicValue((()=>new Cw(bS(t,By)))).inSingletonScope(),t.bind(tA).toService(US))}class Tw extends kw{constructor(t){super(),this.canvasRenderer=t}}let Bw=!1;function Ew(t){Bw||(Bw=!0,t.bind(BS).toDynamicValue((()=>new Tw(bS(t,By)))).inSingletonScope(),t.bind(SS).toService(BS))}function Pw(){if(Pw.__loaded)return;Pw.__loaded=!0;const t=f_();wb(),Zx({bind:t.bind}),_S?Mw(t):Ew(t)}Pw.__loaded=!1;const Ow=Pw;class Rw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=dd,this.themeType="rect"}}let Iw=!1;function Dw(t){var e;Iw||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ey))&&(Iw=!0,t.bind(GS).toDynamicValue((()=>new Rw(bS(t,Ey)))).inSingletonScope(),t.bind(tA).toService(GS))}function Lw(){if(Lw.__loaded)return;Lw.__loaded=!0;const t=f_();Mb(),eS({bind:t.bind}),Dw(t)}Lw.__loaded=!1;const Fw=Lw;class zw{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ud}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let Hw=!1;function jw(t){Hw||(Hw=!0,t.bind(qS).toDynamicValue((()=>new zw(bS(t,Ry)))).inSingletonScope(),t.bind(tA).toService(qS))}class Nw{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ud}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let Vw=!1;function Ww(t){Vw||(Vw=!0,t.bind(IS).toDynamicValue((()=>new Nw(bS(t,Ry)))).inSingletonScope(),t.bind(SS).toService(IS))}function Uw(){if(Uw.__loaded)return;Uw.__loaded=!0;const t=f_();Tb(),aS({bind:t.bind}),_S?jw(t):Ww(t)}Uw.__loaded=!1;const Gw=Uw;function Yw(){Yw.__loaded||(Yw.__loaded=!0,Bb())}Yw.__loaded=!1;const Xw=Yw;class Kw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=gd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:su(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Su.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let $w=!1;function qw(t){$w||($w=!0,t.bind(YS).toDynamicValue((()=>new Kw(bS(t,Py)))).inSingletonScope(),t.bind(tA).toService(YS))}class Zw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=gd}}let Jw=!1;function Qw(t){Jw||(Jw=!0,t.bind(ES).toDynamicValue((()=>new Zw(bS(t,Py)))).inSingletonScope(),t.bind(SS).toService(ES))}function tM(){if(tM.__loaded)return;tM.__loaded=!0;const t=f_();Pb(),gS({bind:t.bind}),_S?qw(t):Qw(t)}tM.__loaded=!1;const eM=tM;class iM extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Yg(a,u,n),v=Gg(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&&Su.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let sM=!1;function nM(t){sM||(sM=!0,t.bind(XS).toDynamicValue((()=>new iM(bS(t,Oy)))).inSingletonScope(),t.bind(tA).toService(XS))}class rM{constructor(){this.type="text",this.numberType=fd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let aM=!1;function oM(t){aM||(aM=!0,t.bind(PS).toDynamicValue((()=>new rM)).inSingletonScope(),t.bind(SS).toService(PS))}function lM(){if(lM.__loaded)return;lM.__loaded=!0;const t=f_();Ob(),yS({bind:t.bind}),_S?nM(t):oM(t)}lM.__loaded=!1;const hM=lM;function cM(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),pM=(t,e)=>(c(fM.warnHandler)&&fM.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),gM=(t,e,i)=>{if(!c(fM.errorHandler))throw new Error(t);fM.errorHandler.call(null,t,e)},fM={silent:!1,warnHandler:!1,errorHandler:!1},mM=fm(),vM=mM&&globalThis?globalThis.document:void 0;function yM(t){return("desktop-browser"===t||"mobile-browser"===t)&&mM}function _M(t){return bM(t)||"mobile-browser"===t}function bM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let xM=0;function SM(){return xM>=9999999&&(xM=0),xM++}function AM(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function kM(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&y(t[0].fields))}function CM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&CM(t,e)}))}const wM=t=>!d(t)&&!1!==t.visible;function MM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function TM(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 EM=["#ffffff","#000000"];function PM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return OM(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(...EM);for(const n of a)if(t!==n&&OM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function OM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?RM(t,e)>s:"largeText"===i?RM(t,e)>3:RM(t,e)>4.5}function RM(t,e){const i=IM(t),s=IM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function IM(t){const e=ni(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function DM(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 LM(t,e){return[t[0]*e,t[1]*e]}function FM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function zM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const HM=hf,jM={arc:t=>HM("arc",t),circle:t=>HM("circle",t),group:t=>HM("group",t),image:t=>HM("image",t),line:t=>HM("line",t),path:t=>HM("path",t),polygon:t=>HM("polygon",t),rect:t=>HM("rect",t),richtext:t=>HM("richtext",t),symbol:t=>HM("symbol",t),text:t=>HM("text",t)},NM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 UM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(UM||(UM={}));const GM={[UM.selectedReverse]:{},[UM.selected]:{},[UM.hover]:{},[UM.hoverReverse]:{}},YM={container:"",width:30,height:30,style:{}},XM="scrollDrag",KM=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:pv,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function $M(t,e,i={}){if(!t)return{width:0,height:0};const s=pv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 qM(t,e="type"){var i,s;return p(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function ZM(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function JM(t,e="type"){const i=qM(t,e);return"rich"===i?jM.richtext(ZM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),jM.text(t))}function QM(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 tT=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function eT(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 iT(t,e){const{dx:i,dy:s}=eT(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const sT={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},nT={size:8,stroke:"#000",lineWidth:1,zIndex:1};function rT(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Se(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Te(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const aT=Math.sin(Math.PI/10);function oT(t,e=aT){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function lT(t,e=aT){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function hT(t){const e={};return CM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function cT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function dT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return LM(r,(s?-1:1)*(n?-1:1)*t/FM(r))}function uT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function gT(t,e,i){var s;if(lT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>He(n,r)}function fT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function yT(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function _T(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function bT(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function xT(t,e){const i=bT(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 ST(t,e){const i=AT(t),s=AT(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 AT(t,e={x:0,y:0}){return re.distancePP(t,e)}function kT(t){return A(t.x)&&A(t.y)}function CT(t,e,i){let s=!1;if(e&&c(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function wT(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const MT=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function BT(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&BT(t[i],e)}}var ET;!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"}(ET||(ET={}));const PT={};function OT(t){switch(t){case ET.Linear:case ET.Log:case ET.Pow:case ET.Sqrt:case ET.Symlog:case ET.Time:return!0;default:return!1}}function RT(t){return!!PT[t]}function IT(t){switch(t){case ET.Ordinal:case ET.Point:case ET.Band:return!0;default:return!1}}function DT(t){return t}Object.values(ET).forEach((t=>{PT[t]=!0}));const LT=t=>-Math.log(-t),FT=t=>-Math.exp(-t),zT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,HT=t=>10===t?zT:t===Math.E?Math.exp:e=>Math.pow(t,e),jT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),NT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),VT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function WT(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 UT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function GT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function YT(t,e,i,s){return 1===i&&(i=0),GT(t,i,s)*(e/(1-i))}function XT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function KT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class qT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=XT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const ZT=Symbol("implicit");class JT extends qT{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=ET.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=ZT}clone(){const t=(new JT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==ZT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return QT(t,e,r,n)}class eB extends JT{constructor(t){super(),this.type=ET.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=YT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:tB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return tB(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&x(this._userBandwidth)}clone(){var t,e,i;return new eB(!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:iB}=ri;function sB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=iB(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof si?iB(t,e):e instanceof ii?iB(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class nB extends qT{constructor(t=DT,e=DT){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=DT,this._piecewise=UT,this._interpolate=sB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?KT:UT,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:DT),this.rescale(i)):this._clamp!==DT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const rB=Math.sqrt(50),aB=Math.sqrt(10),oB=Math.sqrt(2),lB=[1,2,5,10],hB=(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=pB(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),J(0,e).map((t=>n+t*s))):t>0?dB(0,-(e-1)/s,s):dB((e-1)/s,0,s)},cB=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 hB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return hB(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=dB(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=dB(t,e,l);return n&&r.reverse(),r})),pB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=lB[0];return i>=rB?s=lB[3]:i>=aB?s=lB[2]:i>=oB&&(s=lB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function gB(t,e,i){const s=(e-t)/Math.max(0,i);return pB(s)}function fB(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=gB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function vB(t,e){const i=x(e.forceMin),s=x(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const yB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),_B=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})),bB=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=uB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?yB(t,e,n):yB(t,e,$T(n)),h=yB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),xB=mt(((t,e,i,s,n)=>fB(s(t),s(e),i).map((t=>$T(n(t))))));class SB extends nB{constructor(){super(...arguments),this.type=ET.Linear}clone(){var t;const e=new SB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return cB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=uB(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return fB(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function kB(t){return e=>-t(-e)}function CB(t=Number.EPSILON){return e=>Math.max(e,t)}class wB extends nB{constructor(){super(jT(10),HT(10)),this.type=ET.Log,this._limit=CB(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new wB).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=jT(this._base),s=HT(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=kB(i),this._pows=kB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=LT,this.untransformer=FT):(this._logs=i,this._pows=s,this._limit=CB(),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 DT}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return _B(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return bB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return xB(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(wB,AB);class MB extends SB{constructor(){super(NT(1),VT(1)),this.type=ET.Symlog,this._const=1}clone(){return(new MB).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=NT(t),this.untransformer=VT(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return _B(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return bB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(MB,AB);class TB{constructor(){this.type=ET.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new TB).domain(this._domain).range(this._range).unknown(this._unknown)}}var BB,EB,PB;function OB(t){var e,i;const{type:s}=t;return s===EB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BB||(BB={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(EB||(EB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(PB||(PB={}));const RB={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},IB={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DB(t,e){var i;if(!t)return[];const s=VB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?jB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>HB(i)?FB(t,i,e):i)).filter(u)}))):i.map((i=>HB(i)?FB(t,i,e):i)).filter(u):[]}return[]}function LB(t,e){var i,s;return jB(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function FB(t,e,i){var s;const n=VB(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=RB[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=IB[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ii(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Xe(t,i,s),a=Ye(n,r,e.l),l=new ii(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const zB=(t,e)=>{if(e&&HB(t)){const i=FB(e,t);if(i)return i}return t};function HB(t){return t&&"palette"===t.type&&!!t.key}function jB(t){return!(!y(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function NB(t){return y(t)?{dataScheme:t}:t}function VB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=OB(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 WB extends JT{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!jB(this._range))return void super.range(this._range);const t=LB(this._range,this._domain);super.range(t)}}const UB={linear:SB,band:eB,point:class extends eB{constructor(t){super(!1),this.type=ET.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:JT,threshold:TB,colorOrdinal:WB};function GB(t){const e=UB[t];return e?new e:null}function YB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function XB(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function KB(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function $B(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function qB(t){return!!v(t)&&(!!t.endsWith("%")&&AM(t.substring(0,t.length-1)))}function ZB(t){return!!p(t)&&("percent"in t||"offset"in t)}function JB(t,e,i,s=0){var n,r;return x(t)?t:qB(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function QB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=JB(t[s],e.size,i)}))})),o}function tE(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function eE(t){let e={};return y(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||qB(t)||c(t)||ZB(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function iE(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const sE=(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},nE=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function rE(t,e){return t&&e.key in t?t[e.key]:e.default}function aE(t){return t&&"token"===t.type&&!!t.key}const oE={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%"},lE={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:nE,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:oE,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},hE={name:"dark",colorScheme:{default:{dataScheme:nE,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},cE=(t,e)=>t===e||!c(t)&&!c(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>cE(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>cE(t[i],e[i])))),dE=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),dE(t[s],e.slice(1),i))},uE=t=>t instanceof Fa||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function pE(t,e=["data"]){return I(t,uE,e)}function gE(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=NB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}_E._charts=yE.charts,_E._series=yE.series,_E._components=yE.components,_E._graphicComponents=yE.graphicComponents,_E._marks=yE.marks,_E._regions=yE.regions,_E._animations=yE.animations,_E._implements=yE.implements,_E._chartPlugin=yE.chartPlugin,_E._vChartPlugin=yE.vChartPlugin,_E._componentPlugin=yE.componentPlugin,_E.transforms=yE.transforms,_E.dataParser=yE.dataParser,_E._layout=yE.layout,_E._grammarTransforms=yE.grammarTransforms,_E._stageEventPlugins=yE.stageEventPlugins,_E.registerStageEventPlugin=(t,e)=>{_E._stageEventPlugins[t]=e},_E.getStageEventPlugin=t=>_E._stageEventPlugins[t],_E._interactionTriggers=yE.interactionTriggers,_E.registerInteractionTrigger=(t,e)=>{_E._interactionTriggers[t]=e},_E._composedEventMap=yE.composedEventMap,_E.registerComposedEvent=(t,e)=>{_E._composedEventMap[t]=e},_E._tooltipProcessors=yE.tooltipProcessors,_E.registerTooltipProcessor=(t,e)=>{_E._tooltipProcessors[t]=e},_E.createTooltipProcessor=(t,e)=>{const i=_E._tooltipProcessors[t];return i?new i(e):null},_E._runtimePluginInstallers=yE.runtimePluginInstallers,_E.registerRuntimePluginInstaller=(t,e)=>{_E._runtimePluginInstallers[t]=e},_E.getRuntimePluginInstaller=t=>_E._runtimePluginInstallers[t];const SE=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},AE=SE(),kE={[lE.name]:lE},CE=lE.name,wE=new Map(Object.keys(kE).map((t=>[t,kE[t]]))),ME=new Map,TE=new Map(Object.keys(kE).map((t=>[t,t===CE]))),BE=(t,e)=>{if(!t)return;const i=RE(e);wE.set(t,i),TE.set(t,!0)},EE=(t=CE)=>(TE.has(t)&&!TE.get(t)&&BE(t,wE.get(t)),wE.get(t)),PE=t=>wE.delete(t)&&ME.delete(t)&&TE.delete(t),OE=t=>!!v(t)&&wE.has(t),RE=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:CE;return bE({},EE(i),t)};class IE{static registerInstance(t){IE.instances.set(t.id,t)}static unregisterInstance(t){IE.instances.delete(t.id)}static getInstance(t){return IE.instances.get(t)}static instanceExist(t){return IE.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return IE.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}IE.instances=new Map;class DE{static registerTheme(t,e){BE(t,e)}static getTheme(t,e=!1){return EE(t)}static removeTheme(t){return PE(t)}static themeExist(t){return OE(t)}static getDefaultTheme(){return DE.themes.get(CE)}static setCurrentTheme(t){DE.themeExist(t)&&(DE._currentThemeName=t,IE.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return DE.getTheme(DE._currentThemeName,t)}static getCurrentThemeName(){return DE._currentThemeName}}function LE(t){return v(t)?DE.themeExist(t)?DE.getTheme(t):{}:p(t)?t:{}}DE.themes=wE,DE._currentThemeName=CE;const FE=["animationThreshold","colorScheme","name","padding"];function zE(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];FE.includes(n)?s[n]=r:f(r)?HB(r)?s[n]=zB(r,e):aE(r)?s[n]=rE(i,r):s[n]=zE(r,e,i):s[n]=r})),s}function HE(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]=HE(t[s],e)}return i}return y(t)?t.map((t=>HE(t,e))):t}function jE(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=jE(t[s],e)}return i}return y(t)?t.map((t=>jE(t,e))):t}function NE(t,...e){return c(t)?t(...e):t}const VE=(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:oE.fontFamily,fontSize:oE.fontSize}))(e,i,s).measure(t),WE="__VCHART",UE=500,GE=500,YE=`${WE}_MEASURE_CANVAS_ID`,XE=`${WE}_DEFAULT_DATA_INDEX`,KE=`${WE}_DEFAULT_DATA_KEY`,$E=`${WE}_DEFAULT_DATA_SERIES_FIELD`,qE=`${WE}_DEFAULT_SERIES_STYLE_NAME`,ZE=`${WE}_STACK_KEY`,JE=`${WE}_STACK_START`,QE=`${WE}_STACK_END`,tP=`${WE}_STACK_START_PERCENT`,eP=`${WE}_STACK_END_PERCENT`,iP=`${WE}_STACK_START_OffsetSilhouette`,sP=`${WE}_STACK_END_OffsetSilhouette`,nP=`${WE}_STACK_TOTAL`,rP=`${WE}_STACK_TOTAL_PERCENT`,aP=`${WE}_STACK_TOTAL_TOP`,oP=`${WE}_STACK_TOTAL_BOTTOM`,lP=`${WE}_MOSAIC_VALUE_START_PERCENT`,hP=`${WE}_MOSAIC_VALUE_END_PERCENT`,cP=`${WE}_MOSAIC_CAT_START_PERCENT`,dP=`${WE}_MOSAIC_CAT_END_PERCENT`,uP=`${WE}_SEGMENT_START`,pP=`${WE}_SEGMENT_END`,gP=`${WE}_KEY`,fP=`${WE}_MAP_LOOK_UP_KEY`;function mP(t,e){for(let i=0;it.key===e))}function yP(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 _P(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},kP(t,a,n[o],l,e,r))})),s?bP(n):n}function bP(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))):bP(t[e].nodes);return t}function xP(t,e){if("values"in t&&t.values.length){const i=_T(t.values,e),s=yT(t.values,eP);t.values.forEach((t=>{t[nP]=i,t[rP]=s}))}else for(const i in t.nodes)xP(t.nodes[i],e)}function SP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][QE]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)AP(t.nodes[r],e,i,s,n)}function kP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[QE]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),kP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const CP=(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]=MP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function TP(t){return!c(t)&&!E(t)&&Object.keys(t).some((e=>c(t[e])))}function BP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(c(t))return RP(t(r,i,s,n));if(TP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{c(e[t])&&(e[t]=e[t](r,i,s,n))})),RP(e)}return RP(t)}function EP(t={}){const e=Object.assign({},t);if(c(t.style)||TP(t.style)?e.style=(e,i,s,n)=>BP(t.style,e,i,s,n):E(t.style)||(e.style=RP(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])||TP(t.state[e])?i[e]=(i,s,n,r)=>BP(t.state[e],i,s,n,r):E(t.state[e])||(i[e]=RP(t.state[e]))})),e.state=i}return e}function PP(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RP(t[i](e,s,n,r)):E(t[i])||(e[i]=RP(t[i]))})),e}function OP(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),RP(i)}function RP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const IP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},DP=t=>"line"===t||"area"===t,LP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return DP(i)?e:null==e?void 0:e[0]},FP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let zP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=_E.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(_E.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var HP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(HP||(HP={}));const jP=["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 NP,VP,WP;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(NP||(NP={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(VP||(VP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(WP||(WP={}));const UP=[WP.mark,WP.model,WP.chart,WP.vchart];class GP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(WP.vchart,[]),this._levelNodes.set(WP.chart,[]),this._levelNodes.set(WP.model,[]),this._levelNodes.set(WP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const YP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class XP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>LP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||VP.chart);o.get(t)||o.set(t,new GP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||VP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||VP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||VP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?UP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[VP.chart,VP.window,VP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return YP[a]&&(a=YP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?WP.model:WP.vchart:WP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=VP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==WP.model&&s!==WP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=WP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case VP.chart:return this._viewBubbles;case VP.window:return this._windowBubbles;case VP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case VP.chart:return this._viewListeners;case VP.window:return this._windowListeners;case VP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return jP.includes(t)||Object.values(HP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&_E.hasInteractionTrigger(e)}}function KP(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function $P(t,e,i){t.getParser(e)||t.registerParser(e,i)}const qP=new Map;let ZP;function JP(){ZP||(ZP=new La,$P(ZP,"geojson",Ea),$P(ZP,"topojson",Oa),KP(ZP,"simplify",Xr))}function QP(t,e,i={type:"geojson",centroid:!0}){qP.has(t)&&pM(`map type of '${t}' already exists, will be overwritten.`),JP();const s=new Fa(ZP),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):p(r)&&s.transform({type:"simplify",options:r}),qP.set(t,s)}function tO(t){qP.has(t)?qP.delete(t):pM(`map type of '${t}' does not exists.`)}function eO(t,e=!1){let i=e;return t.latestData instanceof Fa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const iO=(t,e)=>0===t.length?[]:1===t.length?eO(t[0],null==e?void 0:e.deep):t.map((t=>eO(t,null==e?void 0:e.deep)));function sO(t,e,i){KP(e=e instanceof La?e:t.dataSet,"copyDataView",iO);const s=new Fa(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:aO.copyDataView}),s}function nO(t,e,i=[]){var s;if(t instanceof Fa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Fa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return pM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return pM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),pM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function rO(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var aO,oO,lO,hO;!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"}(aO||(aO={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(oO||(oO={})),function(t){t.data="data",t.mark="mark"}(lO||(lO={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(hO||(hO={}));const cO=["line","area","trail"];function dO(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(gP,i?t.slice().sort(i):t.slice()),{keys:[gP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const uO=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function pO(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{pO(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function fO(t,e,i,s){const n=dO(t,(t=>i(t))),r=dO(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const mO=`${WE}_BuiltIn_CallBack_Disappear`;var vO;!function(t){t.render="render",t.disappear="disappear"}(vO||(vO={}));const yO=[0,0,0];class _O{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ol),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Il),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xu.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&&(xu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(xu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Nt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(fu(yO,[e,i,s],this.modelMatrix),e=yO[0],i=yO[1],s=yO[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=nu(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:su(this,a,this.dpr),r.strokeStyle=nu(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>xu.free(t))),this.stack.length=0}}_O.env="browser";class bO extends Mu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=ah.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new _O(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 xO(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,Ad,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,kd,e.env));r||i.bind(Ad).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(kd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}bO.env="browser";const SO=xO(bO,_O);class AO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}AO.env="feishu";class kO extends Mu{constructor(t){super(t)}init(){this._context=new AO(this,this._dpr)}release(...t){}}kO.env="feishu";const CO=xO(kO,AO);class wO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:su(this,l,this.dpr),r.strokeStyle=nu(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=ah.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,ah.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}wO.env="harmony";class MO extends Mu{constructor(t){super(t)}init(){this._context=new wO(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}MO.env="harmony";const TO=xO(MO,wO);class BO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:su(this,l,this.dpr),r.strokeStyle=nu(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=ah.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,ah.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}BO.env="lynx";class EO extends Mu{constructor(t){super(t)}init(){this._context=new BO(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}EO.env="lynx";const PO=xO(EO,BO);class OO extends _O{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}OO.env="node";class RO extends Mu{constructor(t){super(t)}init(){this._context=new OO(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}}RO.env="node";const IO=xO(RO,OO);class DO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(nu(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:su(this,l,this.dpr)),r.setStrokeStyle(nu(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}DO.env="taro";class LO extends Mu{constructor(t){super(t)}init(){this._context=new DO(this,this._dpr)}release(...t){}}LO.env="taro";const FO=xO(LO,DO);class zO extends AO{}zO.env="tt";class HO extends Mu{constructor(t){super(t)}init(){this._context=new zO(this,this._dpr)}release(...t){}}HO.env="tt";const jO=xO(HO,zO);class NO extends _O{draw(){}createPattern(t,e){return null}}NO.env="wx";class VO extends Mu{constructor(t){super(t)}init(){this._context=new NO(this,this._dpr)}release(...t){}}VO.env="wx";const WO=xO(VO,NO);class UO extends mA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=yf.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;nnew XO(bS(t,Ay)))).inSingletonScope(),t.bind(tA).toService(zS))}class qO extends kw{constructor(t){super(),this.canvasRenderer=t}}let ZO=!1;class JO extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=pd}}let QO=!1;function tR(t){var e;QO||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Hy))&&(QO=!0,t.bind(QS).toDynamicValue((()=>new JO(bS(t,Hy)))).inSingletonScope(),t.bind(tA).toService(QS))}const eR=Yc();Yc();class iR{constructor(){this.type="gif-image",this.numberType=eR}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let sR=!1;function nR(t){sR||(sR=!0,t.bind(jS).toDynamicValue((()=>new iR)).inSingletonScope(),t.bind(tA).toService(jS))}function rR(t){t.isBound(UO)||t.bind(UO).toDynamicValue((()=>new UO(xS(tA,t),bS(t,zy),xS(Jm,t),xS(Qm,t)))).inSingletonScope(),t.isBound($m)?t.rebind($m).toService(UO):t.bind($m).toService(UO)}function aR(t){(function(t){YO||(YO=!0,t.bind(JS).toDynamicValue((()=>new GO)).inSingletonScope(),t.bind(tA).toService(JS),zm(t.bind.bind(t),tA))})(t),lC(t),vC(t),SC(t),$O(t),PC(t),NC(t),qC(t),function(t){ZO||(ZO=!0,t.bind(VS).toDynamicValue((()=>new qO(bS(t,By)))).inSingletonScope(),t.bind(tA).toService(VS))}(t),nw(t),uw(t),bw(t),Mw(t),Dw(t),jw(t),tR(t),qw(t),nM(t),nR(t),rR(t)}class oR extends hA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${oR.idprefix}_${oR.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=ah.global,this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:oR.GenerateCanvasId(),canvasControled:!0};this.canvas=new bO(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new bO({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function lR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,oR))||t.bind(oR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,oR.env))||t.bind(bf).toService(oR).whenTargetNamed(oR.env)}oR.env="browser",oR.idprefix="visactor_window",oR.prefix_count=0;var hR=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 cR{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 dR(t,e=!1){const i=document.createElement("img");if(ah.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class uR extends lA{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new cR(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return dR(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return dR(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return hR(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function pR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uR))||(t.bind(uR).toSelf().inSingletonScope(),t.bind(mg).toService(uR))}function gR(t=f_(),e=!0){gR.__loaded||(gR.__loaded=!0,pR(t),SO(t),lR(t),e&&aR(t))}gR.__loaded=!1;class fR extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new kO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 kO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fR))||t.bind(fR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,fR.env))||t.bind(bf).toService(fR).whenTargetNamed(fR.env)}fR.env="feishu";class vR extends mA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Cu(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}}let yR=!1;class _R extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=id}}let bR=!1;function xR(t){bR||(bR=!0,t.bind(CS).toDynamicValue((()=>new _R(bS(t,Ay)))).inSingletonScope(),t.bind(SS).toService(CS))}function SR(t){(function(t){yR||(yR=!0,zm(t.bind.bind(t),SS))})(t),function(t){t.isBound(vR)||t.bind(vR).toDynamicValue((()=>new vR(xS(SS,t),xS(Jm,t),xS(Qm,t)))).inSingletonScope(),t.isBound($m)?t.rebind($m).toService(vR):t.bind($m).toService(vR)}(t),dC(t),CC(t),xR(t),IC(t),UC(t),QC(t),fw(t),ow(t),Ew(t),Ww(t),Qw(t),oM(t)}class AR{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class kR{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function CR(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function wR(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new AR(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function MR(t,e,i,s){const n=CR(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new kR(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function TR(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function BR(t,e=TR(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class ER extends lA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=TR(i),n=null!==(e=t.dpr)&&void 0!==e?e:BR(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return BR(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function PR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,ER))||(t.bind(ER).toSelf().inSingletonScope(),t.bind(mg).toService(ER))}function OR(t=f_(),e=!0){OR.__loaded||(OR.__loaded=!0,PR(t),CO(t),mR(t),e&&SR(t))}OR.__loaded=!1;function RR(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function IR(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new MO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 MO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return RR(t,"target",s),RR(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=IR(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=IR(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&DR(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),DR(t,"x",_),DR(t,"y",b),DR(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),DR(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),DR(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),DR(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),DR(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),DR(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function FR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,LR))||t.bind(LR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,LR.env))||t.bind(bf).toService(LR).whenTargetNamed(LR.env)}LR.env="harmony";const zR="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function HR(t){return"number"==typeof t&&Number.isFinite(t)}function jR(...t){for(let e=0;e({width:i,height:s})),new kR(t,l,n,i,s,e)}function GR(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=WR(e*s,i*s);if(t)return t}throw new Error(zR)}class YR extends lA{constructor(){super(),this.type="harmony",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,this.rafSTO=new xh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=NR(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=NR(s),r=null!==(i=t.dpr)&&void 0!==i?i:VR(s),a=function(t,e){if(!HR(t)||!HR(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=UR(GR(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=UR(GR(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return VR(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=jR(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=jR(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function XR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,YR))||(t.bind(YR).toSelf().inSingletonScope(),t.bind(mg).toService(YR))}function KR(t=f_(),e=!0){KR.__loaded||(KR.__loaded=!0,XR(t),TO(t),FR(t),e&&SR(t))}KR.__loaded=!1;function $R(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function qR(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new EO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 EO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return $R(t,"target",s),$R(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=qR(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=qR(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&ZR(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),ZR(t,"x",_),ZR(t,"y",b),ZR(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),ZR(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),ZR(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),ZR(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),ZR(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),ZR(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function QR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,JR))||t.bind(JR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,JR.env))||t.bind(bf).toService(JR).whenTargetNamed(JR.env)}JR.env="lynx";function tI(t){return"number"==typeof t&&Number.isFinite(t)}function eI(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=sI(r),o=null!==(i=t.dpr)&&void 0!==i?i:nI(r,a),l=aI(t.width,t.height),h=oI(lI(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=sI(a),l=null!==(n=t.dpr)&&void 0!==n?n:nI(a,o),h=aI(t.width,t.height),c=Math.random().toString(),d=oI(lI(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return nI(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=eI(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=eI(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function cI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,hI))||(t.bind(hI).toSelf().inSingletonScope(),t.bind(mg).toService(hI))}function dI(t=f_(),e=!0){dI.__loaded||(dI.__loaded=!0,cI(t),PO(t),QR(t),e&&SR(t))}dI.__loaded=!1;class uI extends hA{get container(){return null}constructor(t=ah.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new RO(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new RO({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function pI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,uI))||t.bind(uI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,uI.env))||t.bind(bf).toService(uI).whenTargetNamed(uI.env)}uI.env="node";class gI extends lA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function fI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,gI))||(t.bind(gI).toSelf().inSingletonScope(),t.bind(mg).toService(gI))}function mI(t=f_(),e=!0){mI.__loaded||(mI.__loaded=!0,fI(t),IO(t),pI(t))}mI.__loaded=!1;class vI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new LO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 LO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function yI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,vI))||t.bind(vI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,vI.env))||t.bind(bf).toService(vI).whenTargetNamed(vI.env)}vI.env="taro";class _I extends lA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=MR(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=wR(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function bI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,_I))||(t.bind(_I).toSelf().inSingletonScope(),t.bind(mg).toService(_I))}function xI(t=f_(),e=!0){xI.__loaded||(xI.__loaded=!0,bI(t),FO(t),yI(t),e&&SR(t))}xI.__loaded=!1;class SI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new HO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 HO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function AI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,SI))||t.bind(SI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,SI.env))||t.bind(bf).toService(SI).whenTargetNamed(SI.env)}SI.env="tt";function kI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function CI(t,e=kI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class wI extends lA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=kI(i),n=null!==(e=t.dpr)&&void 0!==e?e:CI(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return CI(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function MI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,wI))||(t.bind(wI).toSelf().inSingletonScope(),t.bind(mg).toService(wI))}function TI(t=f_(),e=!0){TI.__loaded||(TI.__loaded=!0,MI(t),jO(t),AI(t),e&&SR(t))}TI.__loaded=!1;class BI{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={}}}function EI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class PI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="wx",this.eventManager=new BI}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new VO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 VO({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return EI(t,"target",o),EI(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function OI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,PI))||t.bind(PI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,PI.env))||t.bind(bf).toService(PI).whenTargetNamed(PI.env)}PI.env="wx";function RI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function II(t,e=RI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class DI extends lA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=RI(i),n=null!==(e=t.dpr)&&void 0!==e?e:II(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return II(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function LI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,DI))||(t.bind(DI).toSelf().inSingletonScope(),t.bind(mg).toService(DI))}function FI(t=f_(),e=!0){FI.__loaded||(FI.__loaded=!0,LI(t),WO(t),OI(t),e&&SR(t))}FI.__loaded=!1;var zI={},HI={},jI={};Object.defineProperty(jI,"__esModule",{value:!0}),jI.loop=jI.conditional=jI.parse=void 0;jI.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};jI.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};jI.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var NI={};Object.defineProperty(NI,"__esModule",{value:!0}),NI.readBits=NI.readArray=NI.readUnsigned=NI.readString=NI.peekBytes=NI.readBytes=NI.peekByte=NI.readByte=NI.buildStream=void 0;NI.buildStream=function(t){return{data:t,pos:0}};var VI=function(){return function(t){return t.data[t.pos++]}};NI.readByte=VI;NI.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var WI=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};NI.readBytes=WI;NI.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};NI.readString=function(t){return function(e){return Array.from(WI(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};NI.readUnsigned=function(t){return function(e){var i=WI(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};NI.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=WI(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=QI(t),i=XI(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=QI(this.attribute.gifImage),e=XI(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=ah.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=ah.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function iD(t){return new eD(t)}class sD extends _x{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=eR,this._renderContribitions=void 0,this.builtinContributions=[nD],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=Fp(t).image;this._draw(t,n,!1,i)}}const nD=new class extends Zv{constructor(){super(...arguments),this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let rD=!1;function aD(t){rD||(rD=!0,t.bind(sD).toDynamicValue((()=>new sD(xS(Jy,t)))).inSingletonScope(),t.bind(ky).toService(sD))}function oD(){of.RegisterGraphicCreator("gif",iD)}function lD(){if(lD.__loaded)return;lD.__loaded=!0;const t=f_();oD(),aD(t),nR(t)}lD.__loaded=!1;const hD=lD,cD=[{register:fb,bindModule:jb},{register:mb,bindModule:Ub},{register:vb,bindModule:sx},{register:yb,bindModule:ox},{register:_b,bindModule:dx},{register:bb},{register:xb,bindModule:Sx},{register:Sb,bindModule:Mx},{register:Ab,bindModule:Rx},{register:kb,bindModule:Vx},{register:Cb,bindModule:Xx},{register:wb,bindModule:Zx},{register:Mb,bindModule:eS},{register:Tb,bindModule:aS},{register:Bb},{register:Eb,bindModule:cS},{register:Pb,bindModule:gS},{register:Ob,bindModule:yS},{register:Rb},{register:oD}];let dD=!1;const uD=[lC,vC,SC,$O,PC,NC,qC,nw,uw,bw,Mw,Dw,jw,tR,qw,nM,nR];function pD(t){return{getContributions:t}}function gD(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function fD(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=jA();i(a),s(a),n(a),NA(),gD(e,{envParams:r,force:!0})}function mD(t,e){fD(t,"browser",{bindEnv:pR,bindCanvasModules:SO,bindWindowContribution:lR},e)}function vD(t,e){fD(t,"node",{bindEnv:fI,bindCanvasModules:IO,bindWindowContribution:pI},e)}function yD(t){WA(t),function(){if(dD)return;const t=jA();dD=!0,cD.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),aD(t),NA()}(),GA(t),UA(t)}function _D(t){WA(t);const e=jA();uD.forEach((t=>t(e))),rR(e),YA(t,tA),function(t){const e=jA(),i=pD((()=>t.registry.picker.getAll())),s=pD((()=>e.isBound(Jm)?e.getAll(Jm):[])),n=pD((()=>e.isBound(Qm)?e.getAll(Qm):[])),r=VA();ah.pickerServiceFactory=()=>new UO(i,{},s,n),ah.global=r}(t)}function bD(t){WA(t);SR(jA()),YA(t,SS),function(t){const e=jA(),i=pD((()=>t.registry.picker.getAll())),s=pD((()=>e.isBound(Jm)?e.getAll(Jm):[])),n=pD((()=>e.isBound(Qm)?e.getAll(Qm):[]));ah.pickerServiceFactory=()=>new vR(i,s,n)}(t)}function xD(){if(xD.__loaded)return;xD.__loaded=!0;const t=f_();yb(),ox({bind:t.bind}),_S?$O(t):xR(t)}xD.__loaded=!1;const SD=xD;function AD(){if(AD.__loaded)return;AD.__loaded=!0;const t=f_();Eb(),cS({bind:t.bind}),tR(t)}AD.__loaded=!1;const kD=AD;function CD(){CD.__loaded||(CD.__loaded=!0,Rb())}CD.__loaded=!1;const wD=CD;class MD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,K_(this.target,i,yo.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class ED extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class PD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class OD extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const RD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class ID extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){Y_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){Y_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class DD extends ID{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=RD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r),this.determineUpdateFunction()}}class LD extends ID{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class FD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class zD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const HD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class jD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=HD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ND extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const VD=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class WD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(Y_(this.target,{points:r.map(((t,i)=>yh(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class UD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:VD(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class GD extends WD{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:VD(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const YD=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class XD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:YD(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class KD extends WD{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:YD(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const $D=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class qD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:$D(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class ZD extends WD{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:$D(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const JD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class QD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class tL extends QD{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=JD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}}class eL extends QD{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const iL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class sL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=iL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aL extends rL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&A(m.x)?m.x:g,b=u.includes("y")?y:m&&A(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}}class oL extends rL{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,y=v&&A(v.x)?v.x:f,_=v&&A(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class lL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,K_(this.target,{text:n})}}class hL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class cL extends hL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}}class dL extends hL{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class uL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),w=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,T=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,B=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,E=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(T){case"x":A={scaleX:null!==(g=null!=B?B:w.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=E?E:w.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=B?B:w.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=E?E:w.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&$_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),Y_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class pL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class gL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const fL={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function mL(t,e){for(let i=0;ifL[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&w_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(Y_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class yL{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new M_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function _L(t){return new yL(t)}class bL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;K_(this.target,{text:o})}}class xL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if($_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),$_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),$_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),$_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;$_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:bL});const i=s._titleBottom.attribute.text;$_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:bL})}else $_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),$_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;$_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());$_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class SL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class AL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if($_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:bL}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:bL}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class kL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class CL extends nb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=__.createCanvas({width:t.width,height:t.height,dpr:__.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=__.createCanvas({width:t.width,height:t.height,dpr:__.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CL.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class wL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==ML.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==ML.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TL{static createTempCanvas(t,e,i){return __.createCanvas({width:t,height:e,dpr:i||__.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=TL.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TL.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TL.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(TL.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(TL.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(TL.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(TL.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(TL.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class PL extends ML{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class DL extends ML{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=TL.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class LL extends CL{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=__.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=__.createCanvas({width:i,height:s,dpr:__.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class FL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}K_(this.target,{textConfig:o})}}class zL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),K_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),K_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class HL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),K_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),K_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function WL(t,e){Y_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class UL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,$_(this.target,m)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class GL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,$_(this.target,d)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class YL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,$_(this.target,p)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class XL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,$_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),K_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class KL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,$_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),K_(this.target,n)}}class $L extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new M_(this.target);a.execute({type:"custom",custom:UL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:GL,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class qL extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new M_(this.target);a.execute({type:"custom",custom:UL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:YL,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class ZL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class JL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class QL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class tF extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new M_(this.target);n.execute({type:"custom",custom:JL,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class eF extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new M_(this.target);n.execute({type:"custom",custom:QL,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class iF extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),Y_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Pu(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Pu(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class sF extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=ah.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Sl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=ah.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Lo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Lo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function cF(t){var e,i;const s=null!==(e=f_().getAll(ky))&&void 0!==e?e:[],n=lF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;hF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=oF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function dF(t,e){var i,s;const n=null!==(i=f_().getAll(e))&&void 0!==i?i:[],r=lF(t.registry.picker,"vrender:legacy-picker"),a=new Set;hF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=oF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const uF=mD,pF=vD,gF={taro:{installEnv:function(t,e){fD(t,"taro",{bindEnv:bI,bindCanvasModules:FO,bindWindowContribution:yI},e)},loadEnv:xI},feishu:{installEnv:function(t,e){fD(t,"feishu",{bindEnv:PR,bindCanvasModules:CO,bindWindowContribution:mR},e)},loadEnv:OR},tt:{installEnv:function(t,e){fD(t,"tt",{bindEnv:MI,bindCanvasModules:jO,bindWindowContribution:AI},e)},loadEnv:TI},wx:{installEnv:function(t,e){fD(t,"wx",{bindEnv:LI,bindCanvasModules:WO,bindWindowContribution:OI},e)},loadEnv:FI},lynx:{installEnv:function(t,e){fD(t,"lynx",{bindEnv:cI,bindCanvasModules:PO,bindWindowContribution:QR},e)},loadEnv:dI},harmony:{installEnv:function(t,e){fD(t,"harmony",{bindEnv:XR,bindCanvasModules:TO,bindWindowContribution:FR},e)},loadEnv:KR}},fF=[sC,tC,x_,A_,dA,pA],mF=[()=>{M_.registerBuiltInAnimate("increaseCount",lL),M_.registerBuiltInAnimate("fromTo",rb),M_.registerBuiltInAnimate("scaleIn",uL),M_.registerBuiltInAnimate("scaleOut",pL),M_.registerBuiltInAnimate("growHeightIn",jD),M_.registerBuiltInAnimate("growHeightOut",ND),M_.registerBuiltInAnimate("growWidthIn",sL),M_.registerBuiltInAnimate("growWidthOut",nL),M_.registerBuiltInAnimate("growCenterIn",FD),M_.registerBuiltInAnimate("growCenterOut",zD),M_.registerBuiltInAnimate("clipIn",BD),M_.registerBuiltInAnimate("clipOut",ED),M_.registerBuiltInAnimate("fadeIn",PD),M_.registerBuiltInAnimate("fadeOut",OD),M_.registerBuiltInAnimate("growPointsIn",UD),M_.registerBuiltInAnimate("growPointsOut",GD),M_.registerBuiltInAnimate("growPointsXIn",XD),M_.registerBuiltInAnimate("growPointsXOut",KD),M_.registerBuiltInAnimate("growPointsYIn",qD),M_.registerBuiltInAnimate("growPointsYOut",ZD),M_.registerBuiltInAnimate("growAngleIn",DD),M_.registerBuiltInAnimate("growAngleOut",LD),M_.registerBuiltInAnimate("growRadiusIn",tL),M_.registerBuiltInAnimate("growRadiusOut",eL),M_.registerBuiltInAnimate("moveIn",aL),M_.registerBuiltInAnimate("moveOut",oL),M_.registerBuiltInAnimate("rotateIn",cL),M_.registerBuiltInAnimate("rotateOut",dL),M_.registerBuiltInAnimate("update",vL),M_.registerBuiltInAnimate("state",gL),M_.registerBuiltInAnimate("labelItemAppear",xL),M_.registerBuiltInAnimate("labelItemDisappear",SL),M_.registerBuiltInAnimate("poptipAppear",AL),M_.registerBuiltInAnimate("poptipDisappear",kL),M_.registerBuiltInAnimate("inputText",bL),M_.registerBuiltInAnimate("inputRichText",FL),M_.registerBuiltInAnimate("outputRichText",zL),M_.registerBuiltInAnimate("slideRichText",jL),M_.registerBuiltInAnimate("slideOutRichText",HL),M_.registerBuiltInAnimate("slideIn",UL),M_.registerBuiltInAnimate("growIn",GL),M_.registerBuiltInAnimate("spinIn",YL),M_.registerBuiltInAnimate("moveScaleIn",$L),M_.registerBuiltInAnimate("moveRotateIn",qL),M_.registerBuiltInAnimate("strokeIn",XL),M_.registerBuiltInAnimate("slideOut",ZL),M_.registerBuiltInAnimate("growOut",JL),M_.registerBuiltInAnimate("spinOut",QL),M_.registerBuiltInAnimate("moveScaleOut",tF),M_.registerBuiltInAnimate("moveRotateOut",eF),M_.registerBuiltInAnimate("strokeOut",KL),M_.registerBuiltInAnimate("pulse",iF),M_.registerBuiltInAnimate("MotionPath",NL),M_.registerBuiltInAnimate("streamLight",sF),M_.registerBuiltInAnimate("dissolve",EL),M_.registerBuiltInAnimate("grayscale",IL),M_.registerBuiltInAnimate("distortion",PL),M_.registerBuiltInAnimate("particle",DL),M_.registerBuiltInAnimate("glitch",RL),M_.registerBuiltInAnimate("gaussianBlur",OL),M_.registerBuiltInAnimate("pixelation",LL)},gb],vF=[pC,_C,MC,SD,LC,hD,zC,YC,ew,hw,vw,Sw,Ow,Fw,Gw,Xw,eM,hM,wD,kD];function yF(){fF.forEach((t=>t())),mF.forEach((t=>t()))}function _F(t,e){if(!aF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==__?void 0:__.env)?__.envParams:void 0}(e);return void 0===i?vD(t):pF(t,i),yD(t),bD(t),mI(),vF.forEach((t=>t())),cF(t),dF(t,SS),yF(),t}function bF(t,e,i){if(!aF(t,e))return t;const s=gF[e];return s.installEnv(t,i),yD(t),function(t){bD(t)}(t),s.loadEnv(),vF.forEach((t=>t())),cF(t),dF(t,SS),yF(),t}const xF=Symbol.for("visactor.vrender.sharedAppRegistry");function SF(){var t;const e=globalThis,i=null!==(t=e[xF])&&void 0!==t?t:new Map;return e[xF]=i,i}function AF(t,e){const i=SF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function kF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=SF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function CF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=AF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(kF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>kF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=AF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&kF(t,i,s))}}}(t,s,r,o)}const wF=KA,MF=[];function TF(t){MF.forEach((({module:e,options:i})=>{wF(e,Object.assign(Object.assign({},i),{app:t}))}))}var BF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),cF(t),dF(t,tA),yF(),t):t}(_A(BF(t,["envParams"])),e);return TF(i),i}var PF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(t){case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony";case s.lynx:return"lynx";default:return"browser"}},zF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},HF=(t,e)=>{const i=FF(t),s=zF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},jF=(t,e)=>{const i=CF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,LF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},NF="poptipForText";class VF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(NP.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(NP.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(NP.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(NF))&&this._dedupeStagePlugin(NF)}initView(){var t,e,i,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:g,autoPreventDefault:f,background:m}=this._option,v=HF(l,h);__.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const s=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=FF(i.mode),n=HF(i.mode,i.modeParams);return jF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=s.releaseAppRef,null===(t=this._option.runtimePluginInstallers)||void 0===t||t.forEach((t=>t(s.app)));try{this._stage=(_=s.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:g,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:u(a)?a:!u(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=Qp({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(u(c)?c:_M(l))&&!1!==d&&_E.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,p(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=hO.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!y(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!yM(this._option.mode))return!1;return!1===(u(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:__.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(__.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=__.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>pO(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>pO(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{pO(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===hO.before;(e||i)&&(uM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=hO.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=hO.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),uM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=gO(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=fO(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=fO(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=dO(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=dO(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:mO,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{pO(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===oO.appear))?oO.appear:e.every((t=>t===oO.disappear))?oO.disappear:oO.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===VP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=IP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=IP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:LP(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===VP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===VP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===VP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===VP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===VP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{pO(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=gO(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return yM(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{__.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{pO(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=__.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){__.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function WF(t,i){var s;return e(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==i?void 0:i.onError)&&void 0!==s?s:gM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const UF={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}},GF={poptip:z({},UF)};function YF(t){t.crosshair=G(t.crosshair||{}).map((e=>gE({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function XF(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=oi(l,i.width,i.height);a=t,o=e}else if(h&&yM(e.mode)){let t;t=v(h)?__.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(bM(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}}const KF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function $F(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function qF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function ZF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;KF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function JF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}const QF=9,tz=0,ez=-1;var iz,sz,nz,rz,az,oz;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(iz||(iz={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(sz||(sz={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(nz||(nz={}));class lz{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},lz.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}lz.defaultMarkInfo={};class hz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class cz{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=>gE({},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 dz extends hz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=cz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new lz,this._lastLayoutRect=null,this.id=SM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new zP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${WE}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=_E.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return P(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class uz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=sz.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=QB(eE(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:JB(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:JB(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:JB(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:JB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:JB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:JB(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=JB(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=JB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=JB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(tE(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class pz extends dz{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new uz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class gz extends cz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class fz extends pz{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=gz,this.modelType="region",this.specKey="region",this.type=fz.type,this._series=[],this.layoutType="region",this.layoutZIndex=iz.Region,this.seriesDataFilterOver=()=>{this.event.emit(NP.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",iz.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",nz.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:iz.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:iz.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",nz.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",nz.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",nz.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",nz.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",nz.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function mz(t){const e=[],i=[],s=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function vz(t,e,i){e?t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function yz(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 _z(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=Az(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),yz(d,!0,p,l),s&&vz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function bz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=Az(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=Az(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),yz(d,!1,p,o),s&&vz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function Sz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=Az(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=Az(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&_z(n,e,i,!1,"left",s),r.length&&_z(r,e,i,!0,"left",s),a.length&&bz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&xz(n,e,i,!1,"top",s),r.length&&xz(r,e,i,!0,"top",s),a.length&&Sz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&_z(n,e,i,!1,"right",s),r.length&&_z(r,e,i,!0,"right",s),a.length&&bz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&xz(n,e,i,!1,"bottom",s),r.length&&xz(r,e,i,!0,"bottom",s),a.length&&Sz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=Az(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=Az(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:gM)("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}}}kz.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(rz||(rz={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(az||(az={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(oz||(oz={}));const Cz=["linear","radial","conical"],wz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Mz={};Object.values(az).forEach((t=>{Mz[t]=!0})),az.STATE_HOVER,az.STATE_HOVER_REVERSE,az.STATE_SELECTED,az.STATE_SELECTED_REVERSE,az.STATE_DIMENSION_HOVER,az.STATE_DIMENSION_HOVER_REVERSE;class Tz extends hz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class Bz extends Tz{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];u(s.domain)&&(n.domain=s.domain),u(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,cO.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Mz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(WE)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(WE))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(OT(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class Ez extends hz{constructor(){super(...arguments),this.id=SM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=_E.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Pz extends Ez{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Oz=1e3,Rz="quadInOut",Iz=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Dz=(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=Pu(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Lz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?rk(t):[],n=rk(e);i&&s&&(i.fromTransform&&ak(s,i.fromTransform.clone().getInverse()),ak(s,i.toTransfrom));const[r,a]=nk(s,n);return t?sk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},zz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Hz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!zz.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Tu.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class jz extends ib{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Lz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Dz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):K_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Nz=(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=Fz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Hz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new jz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Oz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Rz);return c.play(d),c};class Vz extends ib{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Lz(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&&Dz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Wz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Iz.includes(t))(i)||(e[i]=t[i])})),e},Uz=(t,e,i)=>{const s=Wz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=ah.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Gz=(t,e,i)=>{const s=[],n=i?null:Wz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Wz(t.attribute);if("rect"===t.type)hk(t,e).forEach((t=>{s.push(ah.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)ck(t,e).forEach((t=>{s.push(ah.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)dk(t,e).forEach((t=>{s.push(ah.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=gk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(ah.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?_k(t,e).forEach((t=>{s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?pk(t,e).forEach((t=>{s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&bk(t,e).forEach((t=>{"path"in t?s.push(ah.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Uz(t,s,e),s},Xz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Kz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Xz(l.delay,n,a,o),d=Xz(l.duration,n,a,o),u=Xz(l.oneByOne,n,a,o),p=Xz(l.splitPath,n,a,o),g=A(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Gz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Yz)(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);Nz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Gz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Yz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Fz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Hz(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:yo.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 jz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Oz,null!==(l=i.easing)&&void 0!==l?l:Rz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:yo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Vz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Oz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Rz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Nz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},$z=(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))))},qz=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},Zz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},Jz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];Zz(t,a,s)},Qz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));Zz(t,r,i)},tH=Symbol("statesClearedBeforeReInit");class eH extends Ez{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Pz(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Qp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:iz.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Sl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===rz.enter||t.context.diffState===rz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&Zz(t,r,e)},this.name=t,this.model=e.model,this.key=e.key,this.state=new Bz(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(t){return[nz.User_Mark,nz.User_Series,nz.User_Chart,nz.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&gE(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(RT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=GB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):Cz.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):RT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",nz.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,nz.User_Mark)}else this.setStyle(i,t,nz.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=LB(DB(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},wz[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ii.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)Cz.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=LB(DB(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return dO(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return _E.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[KE],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=dO(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===oO.appear))?oO.appear:t.every((t=>t===oO.disappear))?oO.disappear:t[0];return null!=e?e:oO.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{qz(t),s.push(...t.getGraphics())})),e.forEach((t=>{qz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Kz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=$z(e,n),r=$z(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===oO.exit?oO.exit:i===oO.update?oO.update:oO.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===rz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===rz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=rz.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=rz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=rz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=oO.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=oO.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return uO(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=uO(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||c(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!c(r)&&(!Cz.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!RT(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);d(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,FP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===az.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=_E.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=_E.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===hO.before||(this._product||this._initProduct(),uM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[tH],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?Jz(i,t,!0,a):Qz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[tH]=e:delete s[tH]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===rz.exit&&!e.isExiting)if(e.context.animationState===rz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===rz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:rz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Qp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[tH]=t.currentStates.slice())}))}}var iH;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(iH||(iH={}));class sH extends eH{constructor(){super(...arguments),this.type=sH.type,this._marks=[],this._diffState=rz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(pM("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?(pM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return pO(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===rz.update){const t=this.hasAnimation(),e=FP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=rz.update}render(){this._isCommited&&(uM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}sH.type="group";const nH={measureText:VE};class rH{static instance(){return rH.instance_||(rH.instance_=new rH),rH.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 aH{constructor(){this.id=SM(),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))?pM("不要重复添加相同的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 oH extends aH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const lH=(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"},hH=(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 cH extends o{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=qa.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=qa.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||lH(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=hH(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=qa.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=hH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=lH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=qa.now()-i>this.config.press.time&&hH(s[0],t){ah.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:yo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class uH extends dH{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 C=ah.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,M;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},M={startAngle:x}):(w={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?w:M,"in"===b?M:w,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class pH extends dH{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=ah.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 gH extends ib{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&w_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(Y_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=yh(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));K_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const fH={type:"fadeIn"};function mH(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 fH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class vH extends nb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const yH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},_H={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},bH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},xH=()=>{_E.registerAnimation("scaleInOut",(()=>_H))},SH=()=>{_E.registerAnimation("fadeInOut",(()=>bH))},AH=(t,e)=>({appear:mH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:gH,duration:yH.update.duration,easing:yH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),kH=()=>{_E.registerAnimation("line",AH)},CH=()=>{M_.registerBuiltInAnimate("growPointsIn",UD),M_.registerBuiltInAnimate("growPointsOut",GD),M_.registerBuiltInAnimate("growPointsXIn",XD),M_.registerBuiltInAnimate("growPointsXOut",KD),M_.registerBuiltInAnimate("growPointsYIn",qD),M_.registerBuiltInAnimate("growPointsYOut",ZD),M_.registerBuiltInAnimate("clipIn",BD),M_.registerBuiltInAnimate("clipOut",ED)},wH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};az.STATE_HIGHLIGHT,az.STATE_BLUR;class MH{constructor(t){this._markSet=new lz,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const TH={highlightState:az.STATE_HIGHLIGHT,blurState:az.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class BH extends MH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},TH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Qz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}BH.type="element-highlight",BH.defaultOptions=TH;const EH=()=>{_E.registerInteractionTrigger(BH.type,BH)},PH={state:az.STATE_SELECTED,trigger:"click"};class OH extends MH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},PH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),Jz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Qz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}OH.type="element-select",OH.defaultOptions=PH;const RH=()=>{_E.registerInteractionTrigger(OH.type,OH)};class IH extends aH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const DH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},LH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...LH(t))})),s},FH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(DH(t,r),!1)};class zH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>_E.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>_E.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>_E.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return _E.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>_E.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){_E.registerTransform(t,e)}static registerFunction(t,e){t&&e&&rH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&rH.instance().unregisterFunction(t)}static getFunction(t){return t?rH.instance().getFunction(t):null}static getFunctionList(){return rH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=_E.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=_E.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,qP.get(e);var e}static registerSVG(t,e,i){const s=_E.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=_E.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){IE.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=SM(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=vO.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=ZF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?_E.getSeriesBuiltInTheme(e):_E.getComponentBuiltInTheme(e);i=i?gE({},s,i[e]):s}s===t.length-1&&u(i)&&(i=zE({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},BT(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:y,stage:_,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=yM(y);if(S?gR(eA):"node"===y&&mI(eA),S&&f&&(this._container=v(f)?__.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==y&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=DE.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=_E.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===e.type&&A.push("scrollbar");const C=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new VF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new XP(this,this._compiler),this._event=new zP(this._eventDispatcher,y),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),IE.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=gE({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=HE(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;zH.getFunctionList()&&zH.getFunctionList().length&&(t=jE(t,zH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=_E.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=_E.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=_E.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(NP.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(NP.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return XF(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:UE,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:GE})}_initDataSet(t){this._dataSet=t instanceof La?t:new La,$P(this._dataSet,"dataview",Ra),$P(this._dataSet,"array",i),KP(this._dataSet,"copyDataView",iO);for(const t in _E.transforms)KP(this._dataSet,t,_E.transforms[t]);for(const t in _E.dataParser)$P(this._dataSet,t,_E.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),$F(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(NP.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?oO.none:oO.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,IE.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{DH(t)})),this._exitingVRenderComponents.clear())}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Fa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=nO(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?gE({},t[n][e.index],i):i):t[n]=s?gE({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?gE({},t[n][r],i):i)}else t.id===e&&(t[n]=s?gE({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=gE({},t.getSpec(),e));const r=t.updateSpec(e),a=$F(r),o=qF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(NP.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=bE({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=LE(this._currentThemeName),this._currentTheme=o(a,l);else{const t=bE({},LE(p(r)&&r.type?r.type:p(n)&&n.type?n.type:this._currentThemeName),LE(n),LE(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(GF.poptip,UF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!yM(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return LE(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!DE.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=u(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield WF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!yM(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(u(this._container))return this._container;let e;return e=v(this._canvas)?__.getElementById(this._canvas):this._canvas,u(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?iE(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return pM("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?iE(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(pM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return rH.instance().getFunction(t)}registerFunction(t,e){t&&e&&rH.instance().registerFunction(t,e)}unregisterFunction(t){t&&rH.instance().unregisterFunction(t)}getFunctionList(){return rH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=_E.getChartPlugins();t.length>0&&(this._chartPlugin=new oH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=_E.getVChartPlugins();e.length>0&&(this._vChartPlugin=new IH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=vO.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=vO.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}zH.InstanceManager=IE,zH.ThemeManager=DE,zH.globalConfig={uniqueTooltip:!0},zH.Utils=nH,zH.vglobal=__;_E.registerRegion("region",fz),_E.registerLayout("base",kz),Xw(),zC(),_E.registerMark(sH.type,sH),_E.registerStageEventPlugin("gesture",cH),EH(),RH(),BE(hE.name,hE);const HH="monotone",jH="linear",NH="bevel";var VH;!function(t){t.vertical="vertical",t.horizontal="horizontal"}(VH||(VH={}));class WH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}class UH extends ub{constructor(t){super(t),this.lastFrameTime=0,this.status=Ml.RUNNING}setupTickHandler(){const t=new WH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ml.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ml.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ml.RUNNING,!0}}function GH(t,e){return e("component",t)}function YH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=_E.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const XH=(t,e,i,s)=>{if(d(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},KH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,c(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],p=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(c(e.set))g=function(t){const i=p.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=p.get(`${e[a]}`);if(d(i))for(let i=0;i(g(t),t)))},$H="2.1.3",qH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},ZH=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=YH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},JH=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const QH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function tj(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=ij(ZH(h,r,a,c),p,g),o.value=ij(ZH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=ZH(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function ej(t,e,i,s,n,r,a){if(c(e)){tj(t,e(n,a),i,s,r,a)}else e&&tj(t,e,i,s,r,a)}const ij=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=vi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class sj{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(u(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{ej(a,t,e,i,s,n,r)})):c(t)?ej(a,t,e,i,s,n,r):t&&tj(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:ZH(r.visible,t,n),value:ij(ZH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:ZH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=ZH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&QH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const nj={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},rj=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=mP([],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 aj(a,n,o)},aj=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{AM(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{AM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nj[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},oj=(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=>{AM(t[e])||(t[e]=0)}))})),t},lj=`${WE}_HIERARCHY_DEPTH`,hj=`${WE}_HIERARCHY_ROOT`,cj=`${WE}_HIERARCHY_ROOT_INDEX`;function dj(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function uj(t,e,i){t&&(i.needDefaultSeriesField&&(t[$E]=i.defaultSeriesField),t[XE]=e,t[KE]=i.getKey(t,e,i))}function pj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function gj(t,e,i,s=0,n,r){void 0===r&&(r=e),uj(t,e,i),t[lj]=s,t[hj]=n||t[i.categoryField],t[cj]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>gj(e,s,i,t[lj]+1,t[hj],r)))}const fj={label:{name:"label",type:"text"}},mj=`${WE}_rect_x`,vj=`${WE}_rect_x1`,yj=`${WE}_rect_y`,_j=`${WE}_rect_y1`,bj={data:!0},xj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},Sj=[...Object.keys(yH),"normal"];function Aj(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 Tj(n)&&delete n.type,n.oneByOne&&(n=Cj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:wj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=gE({},o[e],a);return Tj(n)&&delete n.type,n.oneByOne&&(n=Cj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:wj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function kj(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),Bj(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function Cj(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=c(n)?n(t,i,a):A(n)?n:0,h=c(r)?r(t,i,a):A(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):A(n)?n:0,d=c(a)?a(t,r,o):A(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function wj(t,e){var i;return null!==(i=null==t?void 0:t[XE])&&void 0!==i?i:e.context.graphicIndex}function Mj(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 Tj(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function Bj(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),Bj(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),Bj(t[s],e,i))}function Ej(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Pj extends cz{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=OB(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=_E.getSeriesMarkMap(o)?function(t,e,i){const s=_E.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=gE({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return gE({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=gE({},i,s,t),n=i.label;return n&&p(n)&&y(e.label)&&(e.label=e.label.map((t=>gE({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Oj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(xj[e]||(t[e]=!0),t)),{}),Rj={compileOnlyKeys:xj,dataRelatedKeys:Oj,seriesOnlyKeys:{tooltip:!0}},Ij={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Dj=t=>(t=>p(t)&&!y(t)&&!c(t))(t)?t:d(t)?{}:null,Lj=(t,e,i)=>{const s=Dj(t),n=Dj(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function Fj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class zj extends dz{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${WE}_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=Pj,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=iz.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(NP.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Ej(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(NP.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),u(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(KP(this._rawData.dataSet,"invalidTravel",oj),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=nO(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=sO(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=sO(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Pz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=aj(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){KP(this._dataSet,"dimensionStatistics",rj);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Fa(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&&mP(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){KP(this._dataSet,"dimensionStatistics",rj);const s=new Fa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=mP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&mP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Fa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:v(t)?e=>e[t]:y(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(KP(this._rawData.dataSet,"addVChartProperty",qH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:dj.bind(this),call:uj}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(NP.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(NP.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(NP.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(NP.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=Aj({},kj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:_M(i)||bM(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=gE(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=gE(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=wH(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=wH(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:az.STATE_HOVER_REVERSE,highlightState:az.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:az.STATE_SELECTED_REVERSE,state:az.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=wH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:$E;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:qE,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,qE,nz.User_SeriesStyle)}))}afterInitMark(){this.event.emit(NP.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",nz.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(_E.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new sj(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,Fj(i))}_getSpecUpdatePolicy(){return Rj}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},bj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(G(t.label),G(e.label),l),!l.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Lj(t[i],e[i],Ij)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Lj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?Fj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&Fj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Fa||rO(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Ej(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:$E,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DB(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:$E}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,u=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${u}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,gE({},p,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:KE}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${d(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==QE&&t!==eP&&t!==JE&&t!==tP||(t=this.getStackValueField()),null!==(e=yP(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>AM(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:$E]}}function Hj(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();OT(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 jj(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}}}zj.mark=fj,zj.transformerConstructor=Pj;class Nj extends zj{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);OT(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:`${WE}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(QE),this.setFieldX2(JE)):(this.setFieldY(QE),this.setFieldY2(JE))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(eP),this.setFieldX2(tP)):(this.setFieldY(eP),this.setFieldY2(tP))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(sP),this.setFieldX2(iP)):(this.setFieldY(sP),this.setFieldY2(iP))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),u(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(NP.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)&&(Hj("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Vj(t){return"bottom"===t||"top"===t}function Wj(t){return"left"===t||"right"===t}function Uj(t){return"z"===t}function Gj(t,e){return $B(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Yj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Xj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Vj(t)?"linear":"band":Vj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const Kj=(t,e,i)=>{var s;const n=null!==(s="band"===e?GH("axisBand",i):["linear","log","symlog"].includes(e)?GH("axisLinear",i):{})&&void 0!==s?s:{},r=Vj(t)?GH("axisX",i):Wj(t)?GH("axisY",i):GH("axisZ",i);return gE({},GH("axis",i),n,r)};class $j{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:gM)("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:gM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>IT(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Vj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class qj extends $j{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Zj=(t,e)=>{var i,s;return t===e||!d(t)&&!d(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},Jj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return A(s)?[-s,s]:s},Qj=(t,e,i,s)=>{var n;const r=e.getScale(),a=IT(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:tN(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,eN=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class iN extends $j{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Zj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:VP.canvas}),callback:this.onMouseOut}),_M(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),_M(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var sN;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(sN||(sN={}));const nN={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},rN={sampling:!0,samplingFactor:!0};class aN{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(nN.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:NH,curveType:jH,closePath:!0},"normal",nz.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===HH?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",nz.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",nz.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(nN.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:Mj(this._spec,nN.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Fa(this._option.dataSet,{name:`${WE}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(sN.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:nz.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:az.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",nz.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",nz.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[nN.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(sN.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,gE({},this._spec[nN.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:az.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",nz.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",nz.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const oN=Object.assign(Object.assign({},fj),nN),lN=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>lN(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},hN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class cN extends eH{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return hN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(RT(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?lN(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:rz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[KE]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const dN=new Uint32Array(33),uN=new Uint32Array(33);uN[0]=0,dN[0]=~uN[0];for(let t=1;t<=32;++t)uN[t]=uN[t-1]<<1|1,dN[t]=~uN[t];function pN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&dN[31&o]&uN[1+(31&l)])return!0}else{if(i[h]&dN[31&o])return!0;if(i[c]&uN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,dN[31&o]&uN[1+(31&l)]);else for(s(h,dN[31&o]),s(c,uN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,uN[31&a]|dN[1+(31&o)]);else for(n(l,uN[31&a]),n(h,dN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function gN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function fN(t,e,i=!1){return i?gN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function mN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=fN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=gN(t,r)),e.getRange(r)))}function vN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return vN(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return vN(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return vN(t,e,n,s,h,d)}return!1}const _N=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],bN=["top","inside-top","inside"];function xN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const SN={mode:"same-time",duration:300,easing:"linear"};function AN(t){return 3===t||4===t}function kN(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 CN=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 wN(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)}}class MN extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class TN extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const BN=(t,e)=>Math.ceil(t)>Math.floor(e),EN=([t,e],[i,s])=>s>t&&e>i;function PN(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const ON=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class RN extends Jp{constructor(t,e){super(t),this._skipRenderAttributes=ON,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{LN(t,e,i)})),e}function FN(t,e){e&&(null==t||t.onComplete.push(e))}function zN(t){t.forEach((t=>{t()}))}function HN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var jN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(UM.hover,!0),CM(this,(t=>{t===e||E(t.states)||t.addState(UM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(CM(this,(t=>{E(t.states)||(t.removeState(UM.hoverReverse),t.removeState(UM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void CM(this,(t=>{E(t.states)||(t.removeState(UM.selectedReverse),t.removeState(UM.selected))}));E(e.states)||(e.addState(UM.selected,!0),CM(this,(t=>{t===e||E(t.states)||t.addState(UM.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)===yo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===yo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Se(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[wN(g,f,c,d,a,o),wN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=jM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Sl)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),zN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,FN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(SN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=LN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=LN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},HN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(c(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=c(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!h(t)&&c(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}c(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return JM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=c(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&BN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&BN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(PN([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!EN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(fN(i,e,!0))}))),h.length>0&&h.forEach((t=>{v(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(fN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(fN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;DN(i,null==n?void 0:n.attribute),DN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{VN[t]=e};var UN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};GN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const YN=()=>{WN("line",GN),WN("area",GN)};var XN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}KN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const $N=()=>{WN("symbol",KN),WN("line-data",KN)};class qN extends cN{constructor(){super(...arguments),this.type=qN.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)===EB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}qN.type="line";const ZN=()=>{_E.registerMark(qN.type,qN),Xw(),ew(),YN(),$N(),CH(),_E.registerGraphicComponent("line",rg)};class JN extends eH{constructor(){super(...arguments),this.type=JN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}JN.type="symbol";const QN=()=>{_E.registerMark(JN.type,JN),Xw(),eM(),$N(),_E.registerGraphicComponent("symbol",Ug)};class tV extends Pj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function eV(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function iV(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function sV(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 nV(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 rV(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 aV(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 oV=t=>t.map(((t,e)=>({index:e,value:t}))),lV=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},hV=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=KM(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return oV(v)};class uV{constructor(t){this.id=SM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class pV extends uV{constructor(){super(pV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!OT(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(NP.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&eV(c)&&eV(d)))return;const u=iV(t,c),p=iV(e,d);if(!0===u.break&&!0===p.break)return;const{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(!nV(u,p))return}else if(0===_&&0===b){if(!nV(p,u))return}else if(y||A)if(y&&!A){if(!sV(u,p))return}else if(A&&!y){if(!sV(p,u))return}else{if(f===b)return;if(f>b){if(!rV(u,p))return}else if(!rV(p,u))return}else{if(0===f&&0===_){if(!aV(u,p))return}else if(0===b&&0===g&&!aV(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){KP(e.getOption().dataSet,"tickAlign",dV);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}pV.pluginType="component",pV.type="AxisSyncPlugin";const gV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function fV(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 mV(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 vV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const yV=t=>"band"===t||"ordinal"===t||"point"===t;function _V(t,e){return{id:t,label:t,value:e,rawValue:t}}function bV(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class xV extends aH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const SV=`${WE}_ARC_TRANSFORM_VALUE`,AV=`${WE}_ARC_RATIO`,kV=`${WE}_ARC_START_ANGLE`,CV=`${WE}_ARC_END_ANGLE`,wV=`${WE}_ARC_K`,MV=`${WE}_ARC_MIDDLE_ANGLE`,TV=`${WE}_ARC_QUADRANT`,BV=`${WE}_ARC_RADIAN`,EV=-Math.PI/2,PV=3*Math.PI/2,OV=.6,RV=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},IV=(t,e,i)=>{var s;const n=null!==(s="band"===e?GH("axisBand",i):"linear"===e?GH("axisLinear",i):{})&&void 0!==s?s:{},r=GH("angle"===t?"axisAngle":"axisRadius",i);return gE({},GH("axis",i),n,r)};function DV(t,e,i,s){switch(t){case n.cartesianBandAxis:return Kj(Gj(i,["z"]),"band",e);case n.cartesianLinearAxis:return Kj(Gj(i,["z"]),"linear",e);case n.cartesianLogAxis:return Kj(Gj(i,["z"]),"log",e);case n.cartesianSymlogAxis:return Kj(Gj(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return Kj(Gj(i),void 0,e);case n.polarBandAxis:return IV(i.orient,"band",e);case n.polarLinearAxis:return IV(i.orient,"linear",e);case n.polarAxis:return IV(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=GH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>Vj(t.orient)));let g;g=u(p)?gE({},yV(p.type)?a:o,l):l;const f=r.find((t=>Wj(t.orient)));let m;return m=u(f)?gE({},IT(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=GH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?gE({},yV(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?gE({},IT(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return LV(i,GH(t,e));default:return GH(t,e)}}const LV=(t,e)=>{var i;const s=gE({},e,e[Yj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class FV extends cz{getTheme(t,e){return DV(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({},eE(e)),{[s]:0}))}}class zV extends pz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=FV,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof $a||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:VP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new xV(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;DH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=LH(t),s=FH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}DH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var HV,jV;zV.transformerConstructor=FV,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(HV||(HV={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(jV||(jV={}));class NV extends eH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=FH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?DH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(DH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=_E.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(HP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}NV.type="component";const VV=()=>{_E.registerMark(NV.type,NV)};var WV,UV;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(WV||(WV={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(UV||(UV={}));const GV={[UV.selectedReverse]:{},[UV.selected]:{},[UV.hover]:{},[UV.hoverReverse]:{}},YV=t=>t,XV={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class KV extends zV{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?HV.circleAxis:HV.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?jV.circleAxisGrid:jV.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:iz.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(this._syncComponentVisibility(),(null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=Aj(null===(l=_E.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=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||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Pz(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&CT(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=y(a)?OT(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!OT(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return CT(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;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(NP.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=wT(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),CT(this._regions,(t=>{t.event.on(NP.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(NP.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):CT(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(CT(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;tV(null==e?void 0:e[i],null==t?void 0:t[i])||XV[i]))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=EP(s=e.domainLine)).startSymbol=EP(s.startSymbol),s.endSymbol=EP(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=H(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return RP(gE({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:RP(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RP(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=RP(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return RP(gE({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:RP(e.tick.style)),e.tick.state&&(i.tick.state=PP(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return RP(gE({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:RP(e.subTick.style)),e.subTick.state&&(i.subTick.state=PP(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=gV[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:gE({},u,RP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:RP(h.style)}),h.state&&(i.title.state.shape=PP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:RP(o.style)}),o.state&&(i.title.state.background=PP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=PP(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=RP(e.background.style)),e.background.state&&(i.panel.state=PP(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:NE(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return RP(gE({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:RP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:NE(t.subGrid.alternateColor),style:RP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=YH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){$P(this._option.dataSet,"scale",YV);const i=this.registerTicksTransform();return new Fa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===WV.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}KV.specKey="axes";const $V=()=>{VV(),_E.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},qV=[pV];class ZV extends KV{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=iz.Axis,this.layoutLevel=sz.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),CT(this._regions,(t=>{const e=this.getOrient();Vj(e)?bV(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Wj(e)?bV(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Uj(e)&&bV(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=gE({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(gE({x:e.x,y:e.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Vj(this.getOrient()),n=t=>{var e;return(s?!Vj(t.getOrient()):Vj(t.getOrient()))&&OT(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Gj(e,["z"]),Uj(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!vV(e))return null;const{axisType:t,componentName:s}=Xj(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=>Wj(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(!vV(t))return;const{axisType:s,componentName:n}=Xj(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=_E.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Vj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Uj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(qV.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Vj(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!Vj(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Uj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Wj(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=JB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=JB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Vj(this.getOrient())?t.fieldX:Uj(this.getOrient())?t.fieldZ:t.fieldY,OT(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:OT(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(HP.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(Vj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Vj(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return CT(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]:Vj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Uj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();CT(this._regions,(e=>{Vj(t)?bV(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Wj(t)?bV(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Uj(t)&&bV(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Vj(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=Vj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=gE(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ne).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Vj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return _V(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:OT(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(NP.layoutEnd,this._updateAxisLayout),this.event.on(NP.layoutEnd,this._fixAxisOnZero),this.event.on(NP.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}ZV.type=n.cartesianAxis,ZV.specKey="axes";class JV{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Pz(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(NP.scaleDomainUpdate,{model:this}),this.event.emit(NP.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(n.push(r),o){const e=_V(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=>_V(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(NP.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const QV=(t,e,i,s)=>{const n=cV(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},tW=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,eW=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?oV([s[s.length-1]]):oV([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=X(g);if(s.length<=f/n){const i=QV(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=sW(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=QV(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!tW(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?eW(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function rW(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=pT(t,!!n),o=pT(r,!!n);const h=re.distancePP(s,l),c=re.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=nW(e,t,!1,!!n),o=nW(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=pT(t,!!n),o=pT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class aW extends RN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&hT(this._innerView),this.removeAllChild(!0),this._innerView=jM.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 cT(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?`${WV.grid}-sub`:`${WV.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=pT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=nW(t,o,!1,!!a)}const u=jM.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:aW.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=pT(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=jM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:aW.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}aW.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class oW{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=FM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return LM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class lW extends sb{onBind(){var t;const e=_L(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;DN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class hW extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;DN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function cW(){zC(),ew(),Gw(),hM(),M_.registerBuiltInAnimate("axisEnter",lW),M_.registerBuiltInAnimate("axisUpdate",hW)}zC(),hw();class dW extends aW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},aW.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NM,endAngle:r=VM}=this.attribute;i=uT(t,s,re.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function uW(){zC(),ew(),vw(),eM()}function pW(){zC(),ew(),pC(),eM()}U(dW,oW),uW();class gW extends RN{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gW.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=jM.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),E(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=jM.line;G(i)[0].cornerRadius&&(t=jM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=jM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:Z(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}gW.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}}},pW();class fW extends gW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gW.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=jM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function mW(){zC(),Ow(),eM(),Gw(),hM()}var vW=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nc&&(w=c,R.setAttribute("maxLineWidth",c-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=w,A&&A.setAttribute("x",(A.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):j>0&&S.setAttribute("x",b[3]):(k-=w/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const N="right"===_||"end"===_,V="left"===_||"start"===_,W=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:G(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=w-b[1]-b[3],e=I+B,i=1===j?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(V&&1!==j){const t=w-b[1]-b[3],e=0===j?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=w-b[1]-b[3],e=0===j?t/2+B/2:t;if(W(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-D/2),S.setAttribute("y",-b[2])):"top"===H&&(S.setAttribute("y",b[0]),A&&A.setAttribute("y",D/2)),E(null==m?void 0:m.text)||(R.states=m.text);const{visible:U}=a,Y=vW(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:M,x:k,y:C}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Sl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},yW.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}yW.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const _W=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(UM.hover,!0),CM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(UM.hoverReverse,!0)})),s):i},bW=(t,e,i)=>i?(CM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(UM.hoverReverse),t.removeState(UM.hover))})),null):i,xW=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(UM.selected)?(CM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(UM.selectedReverse),t.removeState(UM.selected))})),null):s.name&&!E(s.states)?(s.addState(UM.selected,!0),CM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(UM.selectedReverse,!0)})),s):i},SW={type:"default",duration:300,easing:"linear"};class AW extends IN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=_W(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=bW(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=xW(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=jM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),zN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,FN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(CM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=LN(this),{delay:a=0,duration:o=SW.duration,easing:l=SW.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};DN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=LN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},HN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&hT(this._innerView),this.removeAllChild(!0),this._innerView=jM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(SW)}_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=jM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=WV.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=jM.group({x:0,y:0,pickable:!1});t.name=WV.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=jM.group({x:0,y:0,pickable:!1});i.name=WV.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=jM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=WV.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=GM;else{const t=this.data[s],e=z({},GM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=jM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=WV.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=GM;else{const i=z({},GM,s.state);Object.keys(i).forEach((s=>{c(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=jM.group({x:0,y:0,pickable:!1});return r.name=`${WV.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=JM(this._getLabelAttribute(t,e,n,i));if(a.name=WV.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=GM;else{const s=z({},GM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new yW(Object.assign({},e));i.name=WV.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return cT(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&c(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=c(y)?z({},sT.label.style,y(t,e,i,s)):y;y=z(this.getLabelAlign(m,o,y.angle),y),c(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return c(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},CM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=I(r.attribute),a=I(e.attribute),o=qA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},DN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const kW={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&&gT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function CW(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function wW(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:kW[n]||kW.parity;if(s.length>=3&&fT(s,r)){do{s=a(s,r)}while(s.length>=3&&fT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);gT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),wW(l,s,n,(t=>gT(t,l,r))),wW(h,s,o,(t=>gT(t,h,r)||!(!n||t===l)&&gT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function TW(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},PW(t,e.attribute.angle)),{angle:EW(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({},OW(t,e.attribute.angle)),{angle:EW(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Ce({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function EW(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function PW(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=EW(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 OW(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=EW(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 RW(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=lT(h),m=oT(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function IW(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var DW=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=jM.group({zIndex:999});e.name=WV.axisBreak,e.id=this._getNodeId(`${WV.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},nT,s),a=null!==(e=r.size)&&void 0!==e?e:nT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=jM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=WV.axisBreakSymbol;const h=jM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=WV.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=jM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=WV.background,n.id=this._getNodeId("background"),n.states=z({},GV,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new yW(Object.assign({},t));e.name=WV.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=DW(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},GV,l),symbol:z({},GV,l)});const d=new gW(c);d.name=WV.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=DW(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),k=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let w,M,{angle:T}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(T)&&o){T=zM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else w=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(T&&0!==T){const t=Math.abs(Math.sin(T));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},k),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:M},a),state:{text:z({},GV,c.text),shape:z({},GV,c.shape),panel:z({},GV,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=DW(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=zM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return PW(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return OW(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=Y(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=ae(e)})),BW(i,t),!TW(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=lT(a),l=oT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=IW(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Yt(c,i))}}else{if(l){const i=IW(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Yt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);RW(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&MW(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=jM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=WV.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=$M(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}LW.defaultAttributes=sT,U(LW,oW);const FW={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},zW={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}}},HW={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}}},jW={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}}};class NW extends ZV{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new eB}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,iW),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=YT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),p=e=>{const i=t===n?a:0;if(d(r)||t{_E.registerGraphicComponent(HV.lineAxis,((t,e)=>new LW(t,e))),_E.registerGraphicComponent(jV.lineAxisGrid,((t,e)=>new dW(t,e))),$V(),_E.registerComponent(NW.type,NW,!1)},WW=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function UW(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,YW=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function XW(t,e,i="count"){const s=YW(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const KW=Math.sqrt(50),$W=Math.sqrt(10),qW=Math.sqrt(2);class ZW{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=mV(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=Vj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!c(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(Y(e)-e[0]);i<=1||A(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(GW),e.sort(GW),{domain:UW(t,e),scope:XW(t,e,i)}}(r,cM(t),this._spec.breaks[0].scopeType);e=cM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=mV(this._spec);if(u(e)||u(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=KW?10:n>=$W?5:n>=qW?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(NP.scaleDomainUpdate,{model:this}),this.event.emit(NP.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(NP.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function JW(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function QW(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!OT(t.type))return oV(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return oV([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(u(h))m=JW(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=JW(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=JW(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=cV(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=cV(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?eU.greedy:eU.parity;for(;l.length>=3&&fT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;gT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),QW(t,l,a,(e=>gT(e,t,i))),QW(n,l,o,(e=>gT(e,n,i)||!(!a||e===t)&&gT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return oV(m)},eU={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&gT(i,t,e)||(i=t,0))))}},iU={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class sU extends ZV{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new SB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Uj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Vj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=qB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=cM(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,tU),t}}sU.type=n.cartesianLinearAxis,sU.specKey="axes",sU.builtInTheme={axis:zW,axisLinear:iU,axisX:HW,axisY:jW},U(sU,ZW);const nU=()=>{_E.registerGraphicComponent(HV.lineAxis,((t,e)=>new LW(t,e))),_E.registerGraphicComponent(jV.lineAxisGrid,((t,e)=>new dW(t,e))),$V(),_E.registerComponent(sU.type,sU)},rU=`${WE}_hide_`;function aU(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const oU=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[rU]&&(aU(t,!0),t[rU]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[rU]=!0,aU(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},lU=()=>{_E.registerGrammarTransform("symbolOverlap",{transform:oU,runType:"afterEncode"})},hU={min:K,max:X,average:bT,sum:_T};function cU(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function dU(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 uU(t,e,i,s){return dU(t,e,i,"min",s)}function pU(t,e,i,s){return dU(t,e,i,"max",s)}function gU(t,e,i,s){return dU(t,e,i,"average",s)}function fU(t,e,i,s){return dU(t,e,i,"sum",s)}const mU=(t,e)=>{let i=c(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=cU;if("min"===n?l=uU:"max"===n?l=pU:"average"===n?l=gU:"sum"===n&&(l=fU),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[]},vU=()=>{_E.registerGrammarTransform("dataSampling",{transform:mU})};class yU extends Nj{constructor(){super(...arguments),this.type=EB.line,this.transformerConstructor=tV,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),rN)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(Aj(null===(i=_E.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),kj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=jj(this);this._symbolMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),kj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}yU.type=EB.line,yU.mark=oN,yU.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},yU.transformerConstructor=tV,U(yU,aN);class _U{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{rO(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Fa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];pM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];pM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class bU{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)=>{kM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{mP(e,[{key:t,operations:OT(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&&mP(e,[{key:i.field,operations:OT(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?GB("colorOrdinal"):GB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(kM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),kM(s.domain)?e.reRender=!0:V(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(!kM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=OT(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=OT(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;OT(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(OT(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=OT(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)));OT(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class xU{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Jz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Qz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Qz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Jz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&Jz(t,i,!0,l):a&&Jz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&Jz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Qz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Qz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const SU={[n.markPoint]:!0,[n.markLine]:!0,[n.markArea]:!0},AU={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class kU extends hz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=SM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:UE,height:GE},this._viewRect={width:UE,height:GE},this._viewBox={x1:0,y1:0,x2:UE,y2:GE},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>u(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(AU).some((t=>!d(e[t])))},this._paddingSpec=eE(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new zP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new _U(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new xU;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=_E.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(Aj({},kj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=_E.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:iz.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=_E.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(NP.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(NP.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(NP.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof dz)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 eH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof eH)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&rO(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=XF(this._spec,this._option,{width:UE,height:GE})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DB(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new bU(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){ZF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DB(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=eE(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{ZF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},r={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===n.label||l.type===n.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));r[l.type]&&(r[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(y(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);qF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),ZF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);qF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),ZF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(r).forEach((e=>{if(r[e]){const i=this._spec[e];(y(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(SU[t]&&y(e)&&y(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return SU[t]&&y(e)&&e.length>0&&y(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!SU[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;SU[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];ZF(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=QB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(NP.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(az.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(az.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(az.STATE_SELECTED)}clearHovered(){this.clearState(az.STATE_HOVER)}_initEvent(){[NP.dataZoomChange,NP.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(HP.AFTER_MARK_RENDER_END,e)};this._event.on(HP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:LP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(DP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===sN.dimensionHover||s===sN.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>IT(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>IT(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const CU=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)},wU={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class MU{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},wU),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):dE(t,a,c.spec),dE(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=CU(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=CU(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(_E.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(_E.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=_E.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=_E.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=_E.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):XH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=XH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class TU extends MU{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&gE(i,JF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class BU extends TU{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),YF(t)}}const EU=(t,e)=>{const i={nodes:{}},{fields:s}=c(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=_P(t,!0);for(const e in o)for(const i in o[e].nodes)AP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)SP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&xP(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(NP.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class OU{_beforeInit(){this._dataSet&&KP(this._dataSet,"stackSplit",EU)}_initStack(){this._stack=new PU(this),this._stack.init()}}const RU={state:az.STATE_DIMENSION_HOVER,reverseState:az.STATE_DIMENSION_HOVER_REVERSE,trigger:sN.dimensionHover};class IU extends MH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},RU,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=LP(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}IU.type="dimension-hover",IU.defaultOptions=RU;const DU=()=>{_E.registerInteractionTrigger(IU.type,IU)},LU=()=>{_E.registerComposedEvent(sN.dimensionHover,iN),_E.registerComposedEvent(sN.dimensionClick,qj)},FU=t=>t.fieldX[0],zU=t=>t.fieldY[0],HU=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},jU=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},NU=(t,e)=>t?e?FU:HU:e?zU:jU,VU=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=eN(t,(t=>Vj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=eN(t,(t=>Wj(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{IT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=WU(t,i,NU(e,IT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=WU(t,i,NU(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},WU=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:UU(t,s,i)},UU=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=Qj(e,t,"cartesian",null!=i?i:Vj(t.getOrient())?FU:zU);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},GU=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(IT(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(OT(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=fV(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};XU(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&YU(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),YU=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=YH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},XU=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},KU=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=$U(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},$U=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},qU=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return GU(c,r,e),c.xField.cacheInfo?KU(c.xField):c.yField.cacheInfo?KU(c.yField):void 0},ZU=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],JU=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&ZU.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(QU(s).every((t=>{var e;return!QH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},QU=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},tG={dom:`${WE}_TOOLTIP_HANDLER_DOM`,canvas:`${WE}_TOOLTIP_HANDLER_CANVAS`},eG={key:"其他",value:"..."};var iG;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(iG||(iG={}));class sG{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(NP.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=JU(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},eG),t):eG;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&QH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class nG extends sG{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!IT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const rG=()=>{_E.registerTooltipProcessor("dimension",nG)};class aG extends sG{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,vo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(LP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const oG=()=>{_E.registerTooltipProcessor("mark",aG)};class lG extends sG{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const hG=()=>{_E.registerTooltipProcessor("group",lG)};class cG extends kU{constructor(){super(...arguments),this.transformerConstructor=BU,this.type="line",this.seriesType=EB.line}_setModelOption(){this._modelOption.getDimensionInfo=VU,this._modelOption.getDimensionInfoByValue=UU,this._modelOption.getRectByDimensionData=qU}}cG.type="line",cG.seriesType=EB.line,cG.transformerConstructor=BU,U(cG,OU);const dG=[...hN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class uG extends cN{constructor(){super(...arguments),this.type=uG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return dG}_getIgnoreAttributes(){return[]}}uG.type="area";const pG=()=>{_E.registerMark(uG.type,uG),Xw(),MC(),YN(),$N(),CH(),_E.registerGraphicComponent("area",Gp)};class gG extends sj{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),u(e))return e}return i}}}const fG=Object.assign(Object.assign(Object.assign({},fj),nN),{area:{name:"area",type:"area"}}),mG=()=>{_E.registerAnimation("area",AH),kH(),xH()};class vG extends tV{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||p&&!d)&&(g=h,f=l),l.style=gE({},f.style,g.style),l.state=gE({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function yG(){zC(),Ow()}function _G(){return"browser"===__.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const bG={debounce:xt,throttle:St};yG();let xG=class t extends RN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=_G(),a="browser"===__.env?__:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=vt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:bG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(XM,{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",bG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(yt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ai(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ai(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=vt(t[0],0,1),c=vt(t[1],0,1),d=vt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=_G(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};xG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class SG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ne).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=SG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(XM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new xG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),D.setAttribute("x",D.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),D.setAttribute("y",D.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}PG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class OG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,PG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new PG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,z(e,GF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class RG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class IG extends RG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class DG extends RG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function LG(t){t.isBound(OG)||(t.bind(OG).toSelf().inSingletonScope(),t.bind(a_).toService(OG)),t.isBound(IG)||(t.bind(IG).toSelf(),t.bind(xv).toService(IG)),t.isBound(DG)||(t.bind(DG).toSelf(),t.bind(xv).toService(DG))}class FG extends RN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zC(),ew();class zG extends FG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},zG.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})}}zG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zC(),Ow();class HG extends FG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HG.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})}}HG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zC(),pC();class jG extends FG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}jG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zC(),pC();class NG extends FG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NM,endAngle:s=VM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}NG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zC(),hw();class VG extends FG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},VG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=he(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}VG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class WG{isInValidValue(t){const{startAngle:e=NM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return dT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function UG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=UG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var XG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=uT(n,l,c,e,i);h=jM.path(Object.assign(Object.assign({},a.style),{path:pT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=jM.circle(t)}h.name=WV.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},GV,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=XG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;d(_)&&(_=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:y,textAlign:"center"},l),state:{text:z({},GV,u.text),shape:z({},GV,u.shape),panel:z({},GV,u.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=UG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&GG(e,c,i)}else e.AABBBounds.width()>r&&GG(e,r,i)}else o>a.x&&h.x2>n.x2?(GG(e,n.x2-o,i),r&&YG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}KG.defaultAttributes=sT,U(KG,WG);const $G=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=cT(r,dT(s,r,e,n));return o=a,l=dT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(pt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return oV(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=$G(t,i,e),r=K(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=ZG(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return oV(d)},ZG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&lV(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var JG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=ge(h.endAngle-d/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new eY(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):AN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=AN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=AN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(ft(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=AN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?AN(t.quadrant)?"left":"right":AN(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(AN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(pt(l/2,u))g=0,f=1,m=-p;else if(pt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),zN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,FN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}nY.defaultAttributes={pickable:!1};var rY,aY,oY,lY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(hY,WG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(rY||(rY={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(aY||(aY={})),function(t){t.dataZoomChange="dataZoomChange"}(oY||(oY={}));const cY="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",dY={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:cY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:cY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},uY={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}},pY=0,gY=1,fY=2,mY=3,vY=4,yY=5,_Y=5,bY=999,xY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var SY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:fY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:fY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:pY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,w;const{orient:M,middleHandlerStyle:T={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:O,end:R}=this._getState(),{position:I,width:D,height:L}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(T.visible){const t=(null===(i=T.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+O*D,y:I.y-t,width:(R-O)*D,height:t,zIndex:yY},null===(s=T.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=T.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(O+R)/2*D,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=T.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:yY},T.icon),{pickable:!P&&(null===(h=T.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*D,y:I.y+L/2,size:L,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},uY.horizontal),{zIndex:yY}),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*D,y:I.y+L/2,size:L,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},uY.horizontal),{zIndex:yY}),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+O*D-t/2,y:I.y+L/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:bY},uY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+R*D-g/2,y:I.y+L/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:bY},uY.horizontal),{pickable:!P}),"rect")}else{if(T.visible){const t=(null===(g=T.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+D,y:I.y+O*L,width:t,height:(R-O)*L,zIndex:yY},null===(f=T.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=T.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+D+t/2,y:I.y+(O+R)/2*L,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=T.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:yY},T.icon),{pickable:!P&&(null===(S=null===(x=T.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+O*L,size:D,symbolType:null!==(A=B.symbolType)&&void 0!==A?A:"square"},uY.vertical),{zIndex:yY}),B),{pickable:!P&&(null===(k=B.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+R*L,size:D,symbolType:null!==(C=E.symbolType)&&void 0!==C?C:"square",zIndex:yY},uY.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+D/2+t/2,y:I.y+O*L-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:bY},uY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+D/2+i/2,y:I.y+R*L-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:bY},uY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:mY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:mY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:gY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:vY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return $A(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ne).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=SY(c,["formatMethod"]),{formatMethod:g}=d,f=SY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,w,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},w={textAlign:xY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:xY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:xY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:xY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:_Y}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:_Y}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new yW(e),s.name=i,t.add(s)),s}}const kY={debounce:xt,throttle:St};class CY extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=rY.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=rY.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=rY.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=rY.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=rY.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===__.env?__:this.stage,s=_G();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===rY.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===rY.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===rY.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===rY.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(aY.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(aY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(aY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===rY.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(aY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(aY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:kY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===__.env?__:this.stage,e=_G();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:vt(e+t,0,1),end:vt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=rY.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}mW(),Ow(),eM(),MC(),ew();let wY=class t extends RN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new AY(this._getRendererAttrs()),this._interaction=new CY(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(aY.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(aY.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(oY.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(aY.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(oY.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var MY,TY,BY,EY;function PY(){zC(),mW(),gb()}wY.defaultAttributes=dY,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"}(MY||(MY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(TY||(TY={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(BY||(BY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(EY||(EY={}));class OY extends RN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=_W(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=bW(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=xW(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=jM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=jM.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=jM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),zN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,FN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=LN(this);this.markerAnimate("exit");const n=LN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},HN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function RY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function IY(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;DN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function DY(t,e,i,s){t&&(IY(t.startSymbol,e,i,s),RY(t).forEach((t=>IY(t,e,i,s))),IY(t.endSymbol,e,i,s))}function LY(t,e,i,s){t&&(IY(t.getTextShape(),e,i,s),IY(t.getBgRect(),e,i,s))}function FY(t,e,i,s){var n,r,a,o;t&&(DN(t,{fillOpacity:0,strokeOpacity:0},{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 zY(t,e,i,s){t&&(FY(t.startSymbol,e,i,s),RY(t).forEach((t=>FY(t,e,i,s))),FY(t.endSymbol,e,i,s))}function HY(t,e,i,s){t&&(FY(t.getTextShape(),e,i,s),FY(t.getBgRect(),e,i,s))}function jY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;IY(t.startSymbol,s,r,n);const h=RY(t);h.forEach((t=>DN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),IY(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;IY(t.getTextShape(),e,l,n),IY(t.getBgRect(),e,l,n)}))}function NY(t,e,i,s,n){DY(t,s,i,n),G(e).forEach((t=>{LY(t,s,i,n)}))}function VY(t,e,i,s,n){IY(t,s,i,n),G(e).forEach((t=>{LY(t,s,i,n)}))}function WY(t,e,i,s,n){IY(t,s,i,n),G(e).forEach((t=>{LY(t,s,i,n)}))}function UY(t,e,i,s,n,r){var a;DY(t,n,s,r),IY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?LY(i,n,s,r):IY(i,n,s,r)}function GY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;IY(t.startSymbol,n,o,r);const u=RY(t);u.forEach((t=>DN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),IY(e,n+o+l,h,r),IY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(IY(i.getTextShape(),n+o+l+h+c,d,r),IY(i.getBgRect(),n+o+l+c,d,r)):IY(i,n+o+l+c,d,r)}function YY(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?jY(t,e,s,r,a):"fadeIn"===i&&NY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?jY(t,e,s,n,a):"fadeIn"===i&&NY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){zY(t,s,i,n),G(e).forEach((t=>{HY(t,s,i,n)}))}(t,e,i,s,n)}}function XY(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&&VY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&VY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){FY(t,s,i,n),G(e).forEach((t=>{HY(t,s,i,n)}))}(t,e,i,s,n)}}function KY(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&&WY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&WY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){FY(t,s,i,n),G(e).forEach((t=>{HY(t,s,i,n)}))}(t,e,i,s,n)}}function $Y(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?UY(n,r,e,i,s,o):"callIn"===t&&GY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?UY(n,r,e,i,s,a):"callIn"===t&&GY(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;zY(t,n,s,r),FY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?HY(i,n,s,r):FY(i,n,s,r)}(n,r,e,t,i,s)}}const qY={type:"clipIn",duration:500,easing:"linear",delay:0},ZY={type:"fadeIn",duration:500,easing:"linear",delay:0},JY={type:"callIn",duration:500,easing:"linear",delay:0},QY={type:"fadeOut",duration:500,easing:"linear",delay:0};class tX{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new yW(Object.assign(Object.assign({},h),{state:{panel:z({},GM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},GM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},GM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},GM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class eX extends OY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=qY,this.defaultExitAnimation=QY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;iT(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(eX,tX);const iX=.001,sX={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:MY.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]}},nX={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"}}},rX={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:BY.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]}},aX={interactive:!0,label:{position:TY.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}},oX={interactive:!0,label:{autoRotate:!0,position:BY.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}},lX={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"}},hX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},cX={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 dX(){uX._animate=YY}PY(),uW(),gb();class uX extends eX{markerAnimate(t){uX._animate&&this._animationConfig&&uX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(MM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return TM(Math.abs(e),Math.PI/2,iX)||TM(Math.abs(e),3*Math.PI/2,iX)?BM(i,e,t):MM(e)?nX.postiveXAxis[t]:nX.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new gW({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},GM,null==a?void 0:a.line),startSymbol:z({},GM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},GM,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({},GM,null==a?void 0:a.line),startSymbol:z({},GM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},GM,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=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",uX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(uX.defaultAttributes.label)}}function pX(){gX._animate=XY}uX.defaultAttributes=sX,PY(),vw(),gb();class gX extends OY{markerAnimate(t){gX._animate&&this._animationConfig&&gX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=ZY,this.defaultExitAnimation=QY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},hX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;iT(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=jM.polygon(Object.assign({points:e},i));n.states=z({},GM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",gX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},GM,null==i?void 0:i.area)),this._updateMarkLabels(gX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}gX.defaultAttributes=aX,U(gX,tX),PY(),pW(),gb();class fX extends eX{markerAnimate(t){fX._animate&&this._animationConfig&&fX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case BY.arcInnerStart:l=n;case BY.arcOuterStart:l=n;break;case BY.arcInnerEnd:l=r;case BY.arcOuterEnd:l=r;break;case BY.center:case BY.arcInnerMiddle:case BY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return lX[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new fW({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},GM,null==o?void 0:o.line),startSymbol:z({},GM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},GM,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({},GM,null==o?void 0:o.line),startSymbol:z({},GM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},GM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",fX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(fX.defaultAttributes.label)}}fX.defaultAttributes=rX,PY(),pC(),gb();class mX extends OY{markerAnimate(t){mX._animate&&this._animationConfig&&mX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=ZY,this.defaultExitAnimation=QY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case BY.center:h=(s+n)/2,c=(r+a)/2;break;case BY.arcInnerStart:h=s,c=r;break;case BY.arcOuterStart:h=n,c=r;break;case BY.arcInnerEnd:h=s,c=a;break;case BY.arcOuterEnd:h=n,c=a;break;case BY.arcInnerMiddle:h=s,c=(r+a)/2;break;case BY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},lX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;iT(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=jM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},GM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",mX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},GM,null==o?void 0:o.area)),this._updateMarkLabels(mX.defaultAttributes.label)}isValidPoints(){return!0}}function vX(){yX._animate=$Y}mX.defaultAttributes=oX,U(mX,tX),PY(),uW(),pW(),eM(),YC(),ew(),gb();class yX extends OY{markerAnimate(t){yX._animate&&this._animationConfig&&yX._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yX.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=JY,this.defaultExitAnimation=QY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return TM(Math.abs(s),Math.PI/2,iX)||TM(Math.abs(s),3*Math.PI/2,iX)?BM(t,s,n):MM(s)?cX.postiveXAxis[n]:cX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=EY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},GM,null==p?void 0:p.textBackground),text:z({},GM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},GM,null==p?void 0:p.itemContent));const v=MM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=jM.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"text"===n?o=new yW(Object.assign(Object.assign({},i),{state:{panel:z({},GM,null==s?void 0:s.textBackground),text:z({},GM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=jM.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"image"===n?(o=jM.image(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},GM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=TM(c,0,iX)||TM(d,0,iX),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=tT(e-u,t-d),o=tT(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(MX.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(MX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===MX.focus||"focus"===o){const s=a.hasState(CX.focus);a.toggleState(CX.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[CX.unSelected,CX.unSelectedHover,CX.focus],t),this._setLegendItemState(e,CX.selected,t)})):(this._setLegendItemState(a,CX.selected,t),this._removeLegendItemState(a,[CX.unSelected,CX.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[CX.selected,CX.selectedHover,CX.focus],t),this._setLegendItemState(e,CX.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(CX.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(CX.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(wX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[CX.selected,CX.selectedHover],t),this._setLegendItemState(a,CX.unSelected,t)):(this._setLegendItemState(a,CX.selected,t),this._removeLegendItemState(a,[CX.unSelected,CX.unSelectedHover],t))}else this._setLegendItemState(a,CX.selected,t),this._removeLegendItemState(a,[CX.unSelected,CX.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[CX.selected,CX.selectedHover],t),this._setLegendItemState(e,CX.unSelected,t))}))}this._dispatchLegendEvent(wX.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,CX.selected),this._removeLegendItemState(e,[CX.unSelected,CX.unSelectedHover])):(this._removeLegendItemState(e,[CX.selected,CX.selectedHover]),this._setLegendItemState(e,CX.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=SX,spaceRow:l=AX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,w=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=w+l,w=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,w=Math.max(w,m),M.push(i)):(u(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=jM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=K(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:p,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:_,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),C=this._handleStyle(x,t,e,i,s),w=ai(c);let M;!1===x.visible?(M=jM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,MX.item,t,M)):(M=jM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,MX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?CX.selected:CX.unSelected);const T=jM.group({x:0,y:0,pickable:!1});M.add(T);let B,E=0,O=0,R=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);O=y(i)?i[0]||0:i,R=P(v,"space",8);const s=jM.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,MX.itemShape,t,M,S.state),s.addState(e?CX.selected:CX.unSelected),T.add(s)}let I=0;if(p){const e=P(g,"size",10);B=jM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,MX.focus,t,M),I=e}const D=_.formatMethod?_.formatMethod(o,t,i):o,L=JM(Object.assign(Object.assign({x:O/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:D,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(L,MX.itemLabel,t,M,A.state),L.addState(e?CX.selected:CX.unSelected),T.add(L);const F=P(_,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=JM(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,MX.itemValue,t,M,k.state),r.addState(e?CX.selected:CX.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-O-R-F-I-s;this._autoEllipsis(m,t,L,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2))}else r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),T.add(r)}else this._itemWidthByUser?(L.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-O-R-I),E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2)):E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2);B&&(B.setAttribute("x",E),T.add(B));const z=T.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;T.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=z.height(),N=u(this.attribute.item.width)?this.attribute.item.width:H+w[1]+w[3],V=this._itemHeightByUser||j+w[0]+w[2];return M.setAttributes({width:N,height:V}),B&&B.setAttribute("visible",!1),T.translateTo(-z.x1+w[3],-z.y1+w[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new xX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new xX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new xG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new xG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=SX,spaceRow:o=AX}=n,l=this._itemsContainer,{space:h=kX,defaultCurrent:c=1}=r,d=PX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=jM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=SX,spaceRow:a=AX}=s,o=this._itemsContainer,{space:l=kX,defaultCurrent:h=1}=n,c=PX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=jM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=jM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(CX.selected)?this._setLegendItemState(t,CX.selectedHover,e):this._setLegendItemState(t,CX.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===MX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(wX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(CX.unSelectedHover)||t.hasState(CX.selectedHover))&&(i=!0),t.removeState(CX.unSelectedHover),t.removeState(CX.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(CX.unSelectedHover)&&!t.hasState(CX.selectedHover)||(i=!0),t.removeState(CX.unSelectedHover),t.removeState(CX.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===MX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(wX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(wX.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!==MX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(wX.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!==MX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(wX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(CX.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},OX,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(CX.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var IX;function DX(t){return y(t)?t:[t,t]}function LX(t){return t?"ew-resize":"ns-resize"}RX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:SX,spaceRow:AX,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:kX,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"}(IX||(IX={})),BX();class FX extends RN{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({},FX.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=_G(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=_G(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(u(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=G(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:DX(p)[0],endValue:DX(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=jM.group({x:0,y:0});f.name=IX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=jM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=IX.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=jM.group({x:g?v:0,y:g?0:v});f.add(y);const _=jM.group({x:0,y:0});let b;if(_.name=IX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=jM.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=IX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=jM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=IX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=DX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":LX(p)},r));if(v.name=IX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=IX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":LX(p)},r));if(i.name=IX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=IX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=yt(h,i,s);c=t[0],u=t[1]}else c=i,u=vt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=jM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=IX.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":LX(g);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(u,e?"end":"start"),b=jM.rect(Object.assign({x:g?Math.min(y,_):0,y:g?0:Math.min(y,_),width:g?Math.abs(_-y):r,height:g?n:Math.abs(_-y),cursor:v},a));b.name=IX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return jM.symbol(t)}_renderHandlerText(t,e){return jM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return c(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":LX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=jM.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=jM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=_G(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===IX.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===IX.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===IX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===IX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}FX.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}}},EX(),BX();class zX extends TX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},zX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 HX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}zX.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"}}},EX(),BX(),hw();class jX extends TX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jX.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=jM.group({x:0,y:0});this._innerView.add(x);const S=new FX({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:HX(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 C=jM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}jX.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)"}},zC(),hM(),Gw();let NX=class t extends RN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:w,subtextStyle:M={},width:T,height:B,minWidth:E,maxWidth:P,minHeight:O,maxHeight:R,align:I,verticalAlign:D,padding:L=0}=this.attribute,F=ai(L),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||u(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:T)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},YM),C),x:h,y:c,width:null!==(s=null!=t?t:T)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:T,heightLimit:null!==(a=C.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,R-j);if("rich"===k||u(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:T)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:w},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:w},YM),M),x:n,y:r,width:null!==(c=null!=t?t:T)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(w)?w:[w],whiteSpace:"normal"},M),{maxLineWidth:null!==(p=M.maxLineWidth)&&void 0!==p?p:T,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const V=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(N,W),G=j+(null!==(f=M.height)&&void 0!==f?f:V);if(u(T)&&(U=T),u(B)&&(G=B),u(E)&&UP&&(U=P),u(O)&&GR&&(G=R),z.setAttributes({width:U,height:G,boundsPadding:F}),this._mainTitle){if(u(I)||u(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:U;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:D,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(_=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==_?_:U;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:D,e=this._mainTitle?u(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};NX.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 VX={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"}}};zC(),hM(),Gw();let WX=class extends RN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(VX,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=JM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const p=$M(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",u(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;A(_)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",u(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class UX extends Wg{constructor(t){super(t)}}var GX,YX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(GX||(GX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(YX||(YX={}));class XX extends RN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XX.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"},XX.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"},XX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},XX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},XX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{d(this._playController)&&(this._playController=new UX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new UX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new UX(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(GX.OnPlay)},this.pause=()=>{this._dispatchEvent(GX.OnPause)},this.forward=()=>{this._dispatchEvent(GX.OnForward)},this.backward=()=>{this._dispatchEvent(GX.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()}}XX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},XX.defaultAttributes={[YX.Start]:{},[YX.Pause]:{},[YX.Backward]:{},[YX.Forward]:{}};const KX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},$X=[200,10];var qX,ZX;!function(t){t.Default="default",t.Reverse="reverse"}(qX||(qX={})),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"}(ZX||(ZX={}));const JX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===qX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===qX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),QX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===qX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===qX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),tK=t=>"top"===t||"bottom"===t;class eK extends RN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eK.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(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(tK(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:$X[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:$X[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 FX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=tK(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new XX(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=tK(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:$X[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(tK(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:tK(this._orient)?t+s:(this._size.width-r)/2,y:tK(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:tK(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:tK(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:tK(this._orient)?t+s:(this._size.width-r)/2,y:tK(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function iK(){BX(),zC(),eM()}eK.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({},KX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},KX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},KX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},KX),{key:"backward",position:"start"})}},iK();class sK extends eK{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:qX.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(GX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(GX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(GX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(GX.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(ZX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(JX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||QX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===qX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(ZX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=__.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(ZX.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(ZX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=__.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(),__.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(ZX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(ZX.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(ZX.change),this.dispatchCustomEvent(ZX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var nK,rK=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())}))};iK();class aK extends eK{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(GX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(GX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(GX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(GX.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(ZX.change))},this.play=()=>rK(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(ZX.play),this._rafId=__.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=__.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(ZX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(ZX.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(ZX.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(ZX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(nK||(nK={}));const oK={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},lK=5;const hK={debounce:xt,throttle:St};zC(),vw();let cK=class t extends RN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=oK.updateTrigger,endTrigger:i=oK.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(G(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:hK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(nK.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=oK.trigger,resetTrigger:i=oK.resetTrigger}=this.attribute;G(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),G(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(nK.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(nK.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=lK}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(nK.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(nK.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(nK.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=lK}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(nK.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(nK.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),G(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=oK.updateTrigger,endTrigger:s=oK.endTrigger}=this.attribute;G(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),G(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=jM.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};cK.defaultAttributes=oK;const dK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},uK=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},pK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},gK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zC(),Ow(),eM(),hM(),Gw();let fK=class t extends RN{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=ai(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:wM(p)&&wM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:wM(p)&&wM(p.value)},uK(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:wM(p)&&wM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:wM(p)&&wM(p.value)},uK(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},YM),p.value),visible:wM(p)&&wM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=wM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const y=wM(p)?p.height+p.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!wM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let p="right"===c?(o?d:0)+(wM(n.key)?r+n.key.spacing:0)+(wM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(QM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:wM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),QM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(wM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=kh(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(wM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},uK(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},uK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(wM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},uK(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},uK(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=>gK.includes(t)))?(this._mergeAttributes(e,s),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&wM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=wM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=KM(d),y=KM(u);let _=0;if(wM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(wM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return dK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return dK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};fK.defaultAttributes=pK;class mK extends sU{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),CT(this._regions,(t=>{Vj(this.getOrient())?bV(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):bV(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=gE({},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 Fa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Pz(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=vi.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=>_V(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=>_V(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,tU),t}transformScaleDomain(){}}mK.type=n.cartesianTimeAxis,mK.specKey="axes",mK.builtInTheme={axis:zW,axisX:HW,axisY:jW};class vK extends sU{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new wB}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,tU),t}transformScaleDomain(){}}vK.type=n.cartesianLogAxis,vK.specKey="axes",vK.builtInTheme={axis:zW,axisLinear:iU,axisX:HW,axisY:jW},U(vK,ZW);class yK extends sU{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new MB}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,tU),t}transformScaleDomain(){}}yK.type=n.cartesianSymlogAxis,yK.specKey="axes",yK.builtInTheme={axis:zW,axisLinear:iU,axisX:HW,axisY:jW},U(yK,ZW);class _K extends Nj{constructor(){super(...arguments),this.type=EB.area,this.transformerConstructor=vG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),rN)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(_K.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===HH?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return YB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",nz.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return YB(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",nz.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[QE]},"normal",nz.Series),this.setMarkStyle(o,{curveType:a},"normal",nz.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Aj(null===(e=_E.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),kj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Aj(null===(i=_E.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),kj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=jj(this);this._symbolMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),kj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new gG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}_K.type=EB.area,_K.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},_K.mark=fG,_K.transformerConstructor=vG,U(_K,aN);class bK extends TU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),YF(t)}}class xK extends kU{constructor(){super(...arguments),this.transformerConstructor=bK,this.type="area",this.seriesType=EB.area}_setModelOption(){this._modelOption.getDimensionInfo=VU,this._modelOption.getDimensionInfoByValue=UU,this._modelOption.getRectByDimensionData=qU}}xK.type="area",xK.seriesType=EB.area,xK.transformerConstructor=bK,U(xK,OU);function SK(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 AK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:SK(t,e)}),kK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:SK(t,e)}),CK={type:"fadeIn"},wK={type:"growCenterIn"};function MK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return CK;case"scaleIn":return wK;default:return AK(t)}}class TK extends eH{constructor(){super(...arguments),this.type=TK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}TK.type="rect";const BK=()=>{Xw(),Ow(),WN("rect",QG),_E.registerMark(TK.type,TK),M_.registerBuiltInAnimate("growHeightIn",jD),M_.registerBuiltInAnimate("growHeightOut",ND),M_.registerBuiltInAnimate("growWidthIn",sL),M_.registerBuiltInAnimate("growWidthOut",nL),M_.registerBuiltInAnimate("growCenterIn",FD),M_.registerBuiltInAnimate("growCenterOut",zD),_E.registerGraphicComponent("rect",fg)},EK=Object.assign(Object.assign({},fj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function PK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=sE(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[mj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):YB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vj]):YB(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=YB(this._dataToPosX(t),e,i),n=YB(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[yj]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):YB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[_j]):YB(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=YB(this._dataToPosY(t),e,i),n=YB(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),IK)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},DK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:Mj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(DK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",nz.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===n.cartesianBandAxis));let r;if(KP(this._option.dataSet,"addVChartProperty",qH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};KP(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Fa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:dj.bind(this),call:uj}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new Pz(this._option,r)}init(t){super.init(t),this.initRectMarkStyle()}_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=_j,s=yj,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=vj,s=mj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=_P(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)PK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=YB(this[r](t),l,i),u=YB(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!XB(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",nz.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",nz.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&d(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,d=!1,p=1/0,g=-1/0;i.values.forEach((e=>{const i=e[JE],n=e[QE],r=e[tP],c=e[eP];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?yj:mj],i=e[a?_j:vj];l=Math.min(l,t,i),h=Math.max(h,t,i)}u(r)&&u(c)&&(d=!0,p=Math.min(p,r,c),g=Math.max(g,r,c))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[JE]:s,[QE]:o}),d?{[tP]:p,[eP]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(fg(Object.assign(Object.assign({},m),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>YB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",nz.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",nz.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>YB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",nz.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",nz.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",nz.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",nz.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=jj(this);this._barMark.setAnimationConfig(Aj(null===(e=_E.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),kj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=sE(this._spec.barWidth,a)),l&&(c=Math.max(c,sE(this._spec.barMinWidth,a))),h&&(c=Math.min(c,sE(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=sE(null!==(l=i[r-1])&&void 0!==l?l:Y(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 _=OT(g.type||"band");return p(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}DK.type=EB.bar,DK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},DK.mark=EK,DK.transformerConstructor=RK;const LK=()=>{vU(),BK(),_E.registerAnimation("bar",((t,e)=>({appear:MK(t,e),enter:AK(t,!1),exit:kK(t,!1),disappear:{duration:yH.disappear.duration}}))),VW(),nU(),_E.registerSeries(DK.type,DK)};class FK extends TU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),YF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=p(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class zK extends kU{constructor(){super(...arguments),this.transformerConstructor=FK,this.type="bar",this.seriesType=EB.bar}_setModelOption(){this._modelOption.getDimensionInfo=VU,this._modelOption.getDimensionInfoByValue=UU,this._modelOption.getRectByDimensionData=qU}}zK.type="bar",zK.seriesType=EB.bar,zK.transformerConstructor=FK,U(zK,OU);const HK=[10,20],jK=ET.Linear,NK="circle",VK=ET.Ordinal,WK=["circle","square","triangle","diamond","star"],UK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},GK=Object.assign(Object.assign({},fj),{point:{name:"point",type:"symbol"}});class YK extends Pj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const XK={sizeField:!0};class KK extends Nj{constructor(){super(...arguments),this.type=EB.scatter,this.transformerConstructor=YK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),XK)})}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(c(e))return e;if(y(e)){if(d(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${WE}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${WE}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:jK,defaultRange:HK},"size")}getShapeAttribute(t,e){return d(e)?NK:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:VK,defaultRange:WK},"shape")}initMark(){this._symbolMark=this._createMark(KK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Mj(this._spec,KK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=jj(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(Aj(null===(i=_E.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),kj("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:NK},az.STATE_NORMAL,nz.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},az.STATE_NORMAL,nz.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},az.STATE_NORMAL,nz.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",nz.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",nz.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},az.STATE_NORMAL,nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},az.STATE_NORMAL,nz.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ue});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}KK.type=EB.scatter,KK.mark=GK,KK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},KK.transformerConstructor=YK;const $K=()=>{QN(),_E.registerAnimation("scatter",((t,e)=>Object.assign({appear:UK(0,e)},_H))),VW(),nU(),_E.registerSeries(KK.type,KK)};class qK extends TU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class ZK extends kU{constructor(){super(...arguments),this.transformerConstructor=qK,this.type="scatter",this.seriesType=EB.scatter}_setModelOption(){this._modelOption.getDimensionInfo=VU,this._modelOption.getDimensionInfoByValue=UU,this._modelOption.getRectByDimensionData=qU}}ZK.type="scatter",ZK.seriesType=EB.scatter,ZK.transformerConstructor=qK,U(ZK,OU);class JK extends zj{constructor(){super(...arguments),this.type=EB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return d(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${WE}_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 QK=(t,e)=>{const i=c(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[XE]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[fP]=a||r})),s};class t$ extends sj{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 e$ extends eH{constructor(){super(...arguments),this.type=e$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}e$.type="path";const i$=()=>{_E.registerMark(e$.type,e$),Xw(),hw(),_E.registerGraphicComponent("path",lg)},s$=Object.assign(Object.assign({},fj),{area:{name:"area",type:"path"}});class n${constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Na(i,e):Ha[i]?(za[i]||(za[i]=Na(i,Ha[i])),za[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class r${parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class a${constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function o$(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:r$}:_M(t)||bM(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:a$}:null}const l$={debounce:xt,throttle:St};class h${constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=_M(this._renderMode)||bM(this._renderMode),o$(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return o$(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:WP.chart,consume:!1}];l.on(...c,l$[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,l$[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||o$(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||o$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return d(r)&&d(a)?s:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:WP.chart,consume:!1}];l.on(...c,l$[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,l$[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){o$(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||o$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:WP.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:WP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||o$(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||o$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=l$[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=l$[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:WP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp)}))}}class c$ extends zV{constructor(){var t,e;super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=iz.Mark,this._projectionSpec={name:(t=this.type,e=this.id,`${WE}_${e}_${t}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:n.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=gE(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(NP.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new n$(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===EB.map||e.type===EB.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),CT(this._regions,(t=>{var e;if(t.type===EB.map||t.type===EB.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==EB.map&&e.type!==EB.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[fP],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}c$.type=n.geoCoordinate,U(c$,h$);const d$=()=>{_E.registerComponent(c$.type,c$)};class u$ extends Pj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class p$ extends JK{constructor(){super(...arguments),this.type=EB.map,this.transformerConstructor=u$,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 !`),qP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),KP(this._dataSet,"copyDataView",iO),KP(this._dataSet,"map",QK),KP(this._dataSet,"lookup",KH);const i=qP.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Fa(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:aO.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:fP,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 Pz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(p$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:Mj(this._spec,p$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:$E])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:$E]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",nz.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",nz.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(Aj(null===(t=_E.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),kj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new t$(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[XE]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[XE],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(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 XE}getActiveMarks(){return[this._pathMark]}}p$.type=EB.map,p$.mark=s$,p$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},p$.transformerConstructor=u$;const g$=`${WE}_waterfall_default_seriesField`,f$=(t,e)=>{if(!t||0===t.length)return t;const i=c(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let d=Array.from(l[s]);"decrease"===a&&(d=d.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return d.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[aP]=!0:delete t[aP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===d.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=m$([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}=v$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>se(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=ie(y,e)):(t[c]=+_,_=ie(_,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,d,e,i,a),void o.push(s)}u=m$(r,t,s,o,u,d,e,i),o.push(s)})),o};function m$(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=v$(t,i,s,n,u);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(d(p)||p===g$)&&(t[g$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function v$(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?pM("total.collectCountField error"):n=e[a].start;o<0?pM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ie(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const y$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=c(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},_$={type:"fadeIn"},b$={type:"growCenterIn"};function x$(t,e){switch(e){case"fadeIn":return _$;case"scaleIn":return b$;default:return AK(t,!1)}}class S$ extends eH{constructor(){super(...arguments),this.type=S$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return rg(t)}}S$.type="rule";const A$=()=>{_E.registerMark(S$.type,S$),Xw(),ew(),_E.registerGraphicComponent("line",rg)},k$=Object.assign(Object.assign({},EK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),C$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:w$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function w$(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)=>w$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class M${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 Fa(e instanceof La?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),KP(e,"dimensionTree",C$),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 T$ extends RK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const B$={rect:D$,symbol:R$,arc:F$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=R$(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:z$,line:H$,area:H$,rect3d:D$,arc3d:F$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function E$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=B$[t])&&void 0!==i?i:B$.point;return e.series.type===EB.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=O$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:j$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function P$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==EB.sankey){const{formatFunc:t,args:n}=YH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function O$(t){return c(t)?e=>t(e.data):t}function R$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=O$(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:I$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function I$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function D$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=O$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:L$(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function L$(t){const e=[{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"]}}];return e}function F$(t){var e;const{labelSpec:i}=t,s=null!==(e=O$(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function z$(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=P$(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),Zg(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 H$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[$E]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function j$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const N$={calculationMode:!0};class V$ extends DK{constructor(){super(...arguments),this.type=EB.waterfall,this.transformerConstructor=T$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&xP(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),N$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new M$(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],d(this._seriesField)&&(this._seriesField=g$)}getSeriesKeys(){return this._seriesField===g$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),KP(this._dataSet,"waterfallFillTotal",y$),KP(this._dataSet,"waterfall",f$),(d(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=sO(this.getViewData(),this._dataSet,{name:`${WE}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Pz(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:JE,endAs:QE,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=jj(this);this._barMark.setAnimationConfig(Aj(null===(i=_E.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),kj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),kj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(V$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return z$(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?YB(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):YB(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,y1:e=>this.totalPositionY(e,"index",this._getLeaderLineCategoryPos(!1,t))},"normal",nz.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,x1:e=>this.totalPositionX(e,"index",this._getLeaderLineCategoryPos(!1,t)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",nz.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&XB([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}V$.type=EB.waterfall,V$.mark=k$,V$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},V$.transformerConstructor=T$;const W$=()=>{A$(),BK(),_E.registerAnimation("waterfall",((t,e)=>({appear:x$(t,e),enter:AK(t,!1),exit:kK(t,!1),disappear:{duration:yH.disappear.duration}}))),SH(),VW(),nU(),_E.registerSeries(V$.type,V$)},U$=`${WE}_BOX_PLOT_OUTLIER_VALUE`;var G$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(G$||(G$={}));const Y$=(t,e)=>{const i=[],s=c(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=y(e)?e:[e];i.push(...s.map((e=>{const i={[U$]:e};return r.forEach((e=>{i[e]=t[e]})),u(a)&&(i[a]=t[a]),i})))})),i};class X$ extends sj{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===G$.OUTLIER)return this.series.getOutliersField();if(t===G$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case G$.MIN:return this.series.getMinField();case G$.MAX:return this.series.getMaxField();case G$.MEDIAN:return this.series.getMedianField();case G$.Q1:return this.series.getQ1Field();case G$.Q3:return this.series.getQ3Field();case G$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===G$.OUTLIER)return e[U$];if(t===G$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case G$.MIN:return e[this.series.getMinField()];case G$.MAX:return e[this.series.getMaxField()];case G$.MEDIAN:return e[this.series.getMedianField()];case G$.Q1:return e[this.series.getQ1Field()];case G$.Q3:return e[this.series.getQ3Field()];case G$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[U$])}getDefaultContentList(t){return[{key:this.getContentKey(G$.OUTLIER),value:this.getContentValue(G$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(G$.MAX),value:this.getContentValue(G$.MAX)},{key:this.getContentKey(G$.Q3),value:this.getContentValue(G$.Q3)},{key:this.getContentKey(G$.MEDIAN),value:this.getContentValue(G$.MEDIAN)},{key:this.getContentKey(G$.Q1),value:this.getContentValue(G$.Q1)},{key:this.getContentKey(G$.MIN),value:this.getContentValue(G$.MIN)},{key:this.getContentKey(G$.SERIES_FIELD),value:this.getContentValue(G$.SERIES_FIELD)}]}}const K$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class $$ extends eH{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==rz.enter&&t.context.diffState!==rz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{K$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?z(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=qp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=_E.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const q$=()=>{_E.registerGraphicComponent("glyph",qp),Xw(),LC()},Z$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],J$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class Q$ extends $${constructor(){super(...arguments),this.type=Q$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=Z$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=J$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}Q$.type="boxPlot";const tq=Object.assign(Object.assign({},fj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),eq=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.from.min=o,f.to.min=c),A(d)&&(f.from.max=o,f.to.max=d),A(u)&&(f.from.q1=o,f.to.q1=u),A(p)&&(f.from.q3=o,f.to.q3=p),A(g)&&(f.from.median=o,f.to.median=g),f},iq=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.to.min=o,f.from.min=c),A(d)&&(f.to.max=o,f.from.max=d),A(u)&&(f.to.q1=o,f.from.q1=u),A(p)&&(f.to.q3=o,f.from.q3=p),A(g)&&(f.to.median=o,f.from.median=g),f},sq=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),nq=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,k,C;if(i&&A(i.center))return i.center;let w,M,T,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=sq(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=sq(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,T=null===(p=null===(u=null===(d=null===(c=sq(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=sq(t,"box").attribute.width,i=sq(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=sq(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=sq(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,T=null===(C=null===(k=null===(S=null===(x=sq(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===k?void 0:k[0])||void 0===C?void 0:C.y;const e=sq(t,"box").attribute.height,i=sq(t,"box").attribute.y;B=i,E=i+e}return A(w)?w:A(B)&&A(E)?(B+E)/2:A(M)&&A(T)?(M+T)/2:A(T)?T:A(M)?M:NaN},rq=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(A(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=sq(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=sq(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=sq(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=sq(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=sq(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=sq(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=sq(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=sq(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=sq(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=sq(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return A(v)?v:A(b)&&A(x)?(b+x)/2:A(y)&&A(_)?(y+_)/2:A(_)?_:A(y)?y:NaN};class aq extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return eq(nq)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class oq extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return iq(nq)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class lq extends aq{computeAttribute(){return eq(rq)(this.target,this.params,this.params.options)}}class hq extends oq{computeAttribute(){return iq(rq)(this.target,this.params,this.params.options)}}class cq extends Pj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const dq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class uq extends Nj{constructor(){super(...arguments),this.type=EB.boxPlot,this.transformerConstructor=cq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),dq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(uq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(uq.mark.outlier,{key:XE,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,az.STATE_NORMAL,nz.Series),this.setMarkStyle(a,s,az.STATE_NORMAL,nz.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},az.STATE_NORMAL,nz.Series),this.initBoxPlotMarkStyle()}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>YB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>YB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>YB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>YB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>YB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},az.STATE_NORMAL,nz.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>YB(t(this.getDatumPositionValues(e,U$),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>YB(t(this.getDatumPositionValues(e,U$),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,az.STATE_NORMAL,nz.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;KP(this._dataSet,"foldOutlierData",Y$),KP(this._dataSet,"addVChartProperty",qH);const t=new Fa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${WE}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:dj.bind(this),call:uj}},!1),this._outlierData=new Pz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return u(this._spec.boxWidth)&&(r=sE(this._spec.boxWidth,n)),u(this._spec.boxMinWidth)&&(r=Math.max(r,sE(this._spec.boxMinWidth,n))),u(this._spec.boxMaxWidth)&&(r=Math.min(r,sE(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),p=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,p-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(p>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=sE(null!==(a=i[o-1])&&void 0!==a?a:Y(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=OT(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=jj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=_E.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(kj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Aj(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(Aj(null===(a=_E.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new X$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}uq.type=EB.boxPlot,uq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},uq.mark=tq,uq.transformerConstructor=cq;const pq=()=>{q$(),ew(),Ow(),_E.registerGraphicComponent("line",(t=>rg(t))),_E.registerGraphicComponent("rect",(t=>fg(t))),_E.registerMark(Q$.type,Q$),QN(),xH(),VW(),nU(),M_.registerBuiltInAnimate("boxplotScaleIn",aq),M_.registerBuiltInAnimate("boxplotScaleOut",oq),M_.registerBuiltInAnimate("barBoxplotScaleIn",lq),M_.registerBuiltInAnimate("barBoxplotScaleOut",hq),_E.registerSeries(uq.type,uq)};class gq extends eH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=gq.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Hg(t):Zg(t)}}gq.type="text";const fq=()=>{_E.registerMark(gq.type,gq),Xw(),hM(),Gw(),_E.registerGraphicComponent("text",Zg),_E.registerGraphicComponent("richtext",Hg)};class mq extends sj{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const vq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),yq={type:"fadeIn"},_q=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function bq(t,e){return"fadeIn"===e?yq:vq(t)}const xq=Object.assign(Object.assign({},EK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class Sq extends RK{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 Aq extends DK{constructor(){super(...arguments),this.type=EB.rangeColumn,this._barMarkType="rect",this._barName=EB.bar,this.transformerConstructor=Sq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(Aq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Mj(this._spec,Aq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(Aq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(Aq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",nz.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=jj(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(Aj(null===(i=_E.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),kj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),kj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Aj(null===(n=_E.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),kj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new mq(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)}}Aq.type=EB.rangeColumn,Aq.mark=xq,Aq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},Aq.transformerConstructor=Sq;const kq=()=>{BK(),fq(),_E.registerAnimation("rangeColumn",((t,e)=>({appear:bq(t,e),enter:vq(t),exit:_q(t),disappear:{duration:yH.disappear.duration}}))),SH(),VW(),nU(),_E.registerSeries(Aq.type,Aq)};var Cq,wq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(Cq||(Cq={})),function(t){t.middle="middle",t.start="start",t.end="end"}(wq||(wq={}));class Mq extends sj{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const Tq=Object.assign({},fG);class Bq extends _K{constructor(){super(...arguments),this.type=EB.rangeArea}initMark(){this._areaMark=this._createMark(Bq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",nz.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",nz.Series),this.setMarkStyle(t,{stroke:!1},"normal",nz.Series))}initTooltip(){this._tooltipHelper=new Mq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}Bq.type=EB.rangeArea,Bq.mark=Tq;class Eq extends zj{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=OV,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};OT(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:[]};OT(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(NP.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)&&Hj(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Pq(t){return AM(t)?Number.parseFloat(t):0}const Oq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&Rq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[SV],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[SV]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},Rq=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===Pq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Pq(i[e])),0)));function Iq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const Dq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Iq(t,!0,oO.appear)}),Lq={type:"fadeIn"},Fq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Iq(t,!0,oO.enter)}),zq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Iq(t,!0,oO.exit)});function Hq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Lq;case"growRadius":return Dq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Dq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class jq extends eH{constructor(t,e){super(t,e),this.type=Nq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[MV])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Nq extends jq{constructor(){super(...arguments),this.type=Nq.type}}Nq.type="arc";const Vq=()=>{Xw(),pC(),WN("arc",iY),M_.registerBuiltInAnimate("growRadiusIn",tL),M_.registerBuiltInAnimate("growRadiusOut",eL),M_.registerBuiltInAnimate("growAngleIn",DD),M_.registerBuiltInAnimate("growAngleOut",LD),_E.registerGraphicComponent("arc",Vp),_E.registerMark(Nq.type,Nq)},Wq=Object.assign(Object.assign({},fj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Uq extends Pj{_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=gE({},this._theme,i,t);const n=(t,e)=>gE({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Gq=`${WE}_LABEL_VISIBLE`,Yq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},Xq={outerRadius:!0};class Kq extends Eq{constructor(){super(...arguments),this.transformerConstructor=Uq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:JB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:JB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=EV,this._endAngle=PV,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[MV];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(u(this._spec.startAngle)?ae(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?ae(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;KP(this._dataSet,"pie",Oq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:kV,asEndAngle:CV,asRatio:AV,asMiddleAngle:MV,asRadian:BV,asQuadrant:TV,asK:wV,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Fa(this._dataSet,{name:`${WE}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Pz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Kq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:KE,groupKey:this._seriesField,isSeriesMark:!0},{morph:Mj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return TT(kV)(t)}endAngleScale(t){return TT(CV)(t)}_computeLayoutRadius(){return RV((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:KB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:KB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",nz.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",nz.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,nz.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",nz.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:TT(Gq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(NP.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Xq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Yq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[MV];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===oO.appear)return this._startAngle;if(i===oO.disappear)return this._endAngle;const r=[oO.disappear,oO.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[XE];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[MV]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[MV]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[MV]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[MV]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=Aj(null===(i=_E.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Kq.transformerConstructor=Uq,Kq.mark=Wq,Kq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class $q extends Kq{constructor(){super(...arguments),this.type=EB.pie}}$q.type=EB.pie;const qq=()=>{Vq(),_E.registerAnimation("pie",((t,e)=>({appear:Hq(t,e),enter:Fq(t),exit:zq(t),disappear:{duration:yH.disappear.duration}}))),_E.registerAnimation("emptyCircle",((t,e)=>({appear:Hq(t,e)}))),_E.registerSeries($q.type,$q)};function Zq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const Jq=t=>({type:Zq(t.growField),options:{overall:!0}}),Qq={type:"fadeIn"},tZ=t=>({type:Zq(t.growField)}),eZ=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function iZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Qq;case"growAngle":return Jq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return Jq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const sZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class nZ extends Eq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),sZ)})}getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(QE),this.setInnerRadiusField(JE)}setValueFieldToPercent(){this.setRadiusField(eP),this.setInnerRadiusField(tP)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const rZ=Object.assign(Object.assign({},fj),{rose:{name:"rose",type:"arc"}});class aZ extends Pj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class oZ extends KV{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=_E.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=iz.Axis,this._tick=void 0,this._center=null,this._startAngle=EV,this._endAngle=PV,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),CT(this._regions,(t=>{"radius"===this.getOrient()?bV(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):bV(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:JB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:JB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:fV(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){CT(this._regions,(t=>{"radius"===this.getOrient()?bV(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):bV(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return OT(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:OT(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>_V(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=re.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return RV((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=OV,e=0;const i=this.getChart().getSpec();return CT(this.getRegions(),(s=>{const n=s;if(r=n.type,[EB.rose,EB.radar,EB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(gE({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(gE({},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)}}oZ.type=n.polarAxis,oZ.specKey="axes";const lZ={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},hZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class cZ extends oZ{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new SB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,tU),t}}cZ.type=n.polarLinearAxis,cZ.specKey="axes",cZ.builtInTheme={axis:zW,axisLinear:iU,axisAngle:hZ,axisRadius:lZ},U(cZ,ZW);const dZ=()=>{_E.registerGraphicComponent(HV.lineAxis,((t,e)=>new LW(t,e))),_E.registerGraphicComponent(jV.lineAxisGrid,((t,e)=>new dW(t,e))),_E.registerGraphicComponent(HV.circleAxis,((t,e)=>new KG(t,e))),_E.registerGraphicComponent(jV.circleAxisGrid,((t,e)=>new hY(t,e))),$V(),_E.registerComponent(cZ.type,cZ)};class uZ extends oZ{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new eB}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,qG),t}transformScaleDomain(){}}uZ.type=n.polarBandAxis,uZ.specKey="axes",uZ.builtInTheme={axis:zW,axisBand:FW,axisAngle:hZ,axisRadius:lZ},U(uZ,JV);const pZ=()=>{_E.registerGraphicComponent(HV.lineAxis,((t,e)=>new LW(t,e))),_E.registerGraphicComponent(jV.lineAxisGrid,((t,e)=>new dW(t,e))),_E.registerGraphicComponent(HV.circleAxis,((t,e)=>new KG(t,e))),_E.registerGraphicComponent(jV.circleAxisGrid,((t,e)=>new hY(t,e))),$V(),_E.registerComponent(uZ.type,uZ)};class gZ extends nZ{constructor(){super(...arguments),this.type=EB.rose,this.transformerConstructor=aZ,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(gZ.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Mj(this._spec,gZ.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>YB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=YB(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(Aj(null===(i=_E.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),kj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}gZ.type=EB.rose,gZ.mark=rZ,gZ.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},gZ.transformerConstructor=aZ;const fZ=()=>{_E.registerSeries(gZ.type,gZ),Vq(),_E.registerAnimation("rose",((t,e)=>({appear:iZ(t,e),enter:tZ(t),exit:eZ(t),disappear:{duration:yH.disappear.duration}}))),pZ(),dZ()};class mZ extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,mT(this._fromAngle,this._toAngle)&&mT(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class vZ extends gH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!kT(t)&&!kT(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new ne(s,n,r,a);return o.defined=e.defined,o}}const yZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function _Z(t,e,i){return"fadeIn"===e?yZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function bZ(t,e,i){return"fadeIn"===e?yZ(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 xZ=(t,e)=>({custom:uH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),SZ=Object.assign(Object.assign(Object.assign({},fj),nN),{area:{name:"area",type:"area"}});class AZ extends nZ{constructor(){super(...arguments),this.type=EB.radar,this.transformerConstructor=tV,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(AZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:jH,closePath:!0},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:u(this._spec.startAngle)?ae(this._spec.startAngle):EV},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(Aj(null===(s=_E.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),kj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=_E.getAnimationInKey(e);t.setAnimationConfig(Aj(null==i?void 0:i(n,r),kj(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}}}AZ.type=EB.radar,AZ.mark=SZ,AZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},AZ.transformerConstructor=tV,U(AZ,aN);const kZ=()=>{_E.registerSeries(AZ.type,AZ),pG(),ZN(),QN(),_E.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:_Z(t,e,"in"),enter:_Z(t,e,"in"),exit:_Z(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:yH.disappear.duration},update:[{channel:["points","center"],custom:vZ,customParameters:t,duration:yH.update.duration,easing:yH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),_E.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:bZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:yH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:mZ,customParameters:t,duration:yH.update.duration,easing:yH.update.easing}]}))),_E.registerAnimation("radarGroup",((t,e)=>({appear:xZ(t,"in"),disappear:{duration:yH.disappear.duration}}))),pC(),pZ(),dZ()};class CZ extends sj{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>vi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const wZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(WE)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[XE]:r,[KE]:`${s}_${e}`})),r++}))})),n},MZ={fill:"#bbb",fillOpacity:.2},TZ=Object.assign(Object.assign({},fj),{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"}}),BZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},EZ={grid:{background:!0}};class PZ extends Nj{constructor(){super(...arguments),this.type=EB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),BZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),EZ)})}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),KP(this._option.dataSet,"objFlat",wZ),KP(this._option.dataSet,"copyDataView",iO),$P(this._option.dataSet,"dataview",Ra),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:aO.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(gE(MZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(PZ.mark.group),this._containerMark=this._createMark(PZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(PZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(PZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(PZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(PZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(PZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(PZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",nz.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",nz.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",nz.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",nz.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",nz.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",nz.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",nz.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",nz.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",nz.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:$E}}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 WB).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:$E}}initTooltip(){this._tooltipHelper=new CZ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}PZ.type=EB.dot,PZ.mark=TZ,PZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class OZ extends sj{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>vi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const RZ=Object.assign(Object.assign({},fj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),IZ=(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 DZ extends Nj{constructor(){super(...arguments),this.type=EB.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),KP(this._option.dataSet,"linkDotInfo",IZ),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:aO.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(DZ.mark.group),this._containerMark=this._createMark(DZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(DZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(DZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",nz.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",nz.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",nz.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",nz.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:$E}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new OZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}DZ.type=EB.link,DZ.mark=RZ,DZ.builtInTheme={link:{arrow:{style:{size:10}}}};const LZ=Object.assign(Object.assign({},fj),{group:{name:"group",type:"group"}}),FZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class zZ extends Eq{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()?JE:uP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle);let o;if(u(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return d(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?QE:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),FZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=u(n)?ae(n):EV;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?ae(r):PV,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||u(null==s?void 0:s.startAngle)||u(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=YB(this.angleAxisHelper.dataToPosition([t[JE]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=YB(this.angleAxisHelper.dataToPosition([t[QE]]),this.angleAxisHelper.getScale(0));if(A(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?YB(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(zZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",nz.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[fg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const VZ=()=>{_E.registerAnimation("circularProgress",((t,e)=>({appear:NZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:yH.disappear.duration}})))};class WZ extends Pj{constructor(){super(...arguments),this._supportStack=!0}}const UZ={cornerRadius:!0,roundCap:!0};class GZ extends zZ{constructor(){super(...arguments),this.type=EB.circularProgress,this.transformerConstructor=WZ,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(A(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(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),UZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(GZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:Mj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",nz.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(GZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?JE:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?QE: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",nz.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(Aj(null===(i=_E.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),kj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),kj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}GZ.type=EB.circularProgress,GZ.mark=HZ,GZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},GZ.transformerConstructor=WZ;const YZ=()=>{_E.registerSeries(GZ.type,GZ),Vq(),VZ(),SH(),pZ(),dZ()};function XZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const KZ={type:"fadeIn"};function $Z(t,e="grow"){return!1===e?{}:"fadeIn"===e?KZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:XZ(t)}))(t)}class qZ extends sj{enableByType(t){return"dimension"!==t}}const ZZ=Object.assign(Object.assign({},fj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),JZ={bandWidth:!0,cornerRadius:!0,clamp:!0},QZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class tJ extends Nj{constructor(){super(...arguments),this.type=EB.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),JZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),QZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(tJ.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return YB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?YB(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",nz.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return YB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?YB(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",nz.Series)}}_initTrackMark(){return this._trackMark=this._createMark(tJ.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",nz.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return YB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",nz.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Aj(null===(i=_E.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),kj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),kj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new qZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}tJ.type=EB.linearProgress,tJ.mark=ZZ,tJ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const eJ=()=>{BK(),_E.registerAnimation("linearProgress",((t,e)=>({appear:$Z(t,e),enter:$Z(t),disappear:{duration:yH.disappear.duration}}))),SH(),_E.registerSeries(tJ.type,tJ)},iJ=[0],sJ=[20,40],nJ=[200,500],rJ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},aJ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class oJ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const lJ=`${WE}_WORD_CLOUD_TEXT`,hJ=Object.assign(Object.assign({},fj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),cJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class dJ extends zj{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=sJ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:nJ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:iJ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?lJ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:rJ},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||yM(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:iJ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!aJ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new oJ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(dJ.mark.word,{key:KE,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(dJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:iz.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",nz.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",nz.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",nz.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(Aj(_E.getAnimationInKey("wordCloud")(n,s),kj("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 WB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:$E])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new SB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new SB).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[XE])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,NP.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:KE,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:__.createCanvas.bind(__),getTextBounds:pv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:ig,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}dJ.mark=hJ,dJ.builtInTheme={wordCloud:cJ};function uJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||yH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=pJ(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,Ct(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Ct(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},gJ=(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=gJ(t.children,e,t,n))})),s},fJ=(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=fJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},mJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):mJ(t.children,e,i)))})),e};function vJ(t,e){let i,s;if(bJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function bJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*w*T))/(2*w):T/M);return{x:s+S+A*B,y:n+k+C*B,radius:B}}function kJ(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 CJ(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 wJ(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 MJ(t){return{_:t,next:null,prev:null}}function TJ(t,e){const i=(t=G(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];kJ(n,s,r);let a,o,l,h,c,d,u,p=MJ(s),g=MJ(n),f=MJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=pJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:OJ.defaultOpionts.nodeSort;gJ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)gJ([o],BJ(h)),fJ([o],EJ(this._getPadding,.5,a)),gJ([o],PJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);gJ([o],BJ(OJ.defaultOpionts.setRadius)),fJ([o],EJ(Ot,1,a)),d&&fJ([o],EJ(this._getPadding,o.radius/t,a)),gJ([o],PJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}OJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const RJ=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=RJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function IJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){RJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:Ct(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Ct(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function DJ(t){return t.depth}function LJ(t,e){return e-1-t.endDepth}const FJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),zJ=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},HJ={left:DJ,right:LJ,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:DJ,end:LJ},jJ=_t(0,1);class NJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>FJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>FJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},NJ.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):HJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return IJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!d(r.source),l=!d(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&d(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[zJ(s[t.source]),zJ(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(v(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*jJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}d(this.options.nodeSortBy)&&n.sort(FJ),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(FJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];VJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),WJ);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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},UJ.defaultOpionts,t):Object.assign({},UJ.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,u=h?a.map((t=>Pt(t,n))):Pt(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Pt(r,n),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(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=pJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=he({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function GJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:VJ,slice:GJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?GJ:VJ)(t,e,i,s,n)}};class KJ{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({},KJ.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Et(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?YJ(this.options.aspectRatio):null!==(e=XJ[this.options.splitType])&&void 0!==e?e:XJ.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=pJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function $J(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+di?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=$J(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ii(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=qJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function sQ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*nQ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},aQ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||JJ,s=e.lossFunction||ZJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ui(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:rQ(f),arcs:f})}))},oQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:lQ,triangle:lQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function lQ(){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 hQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const cQ=t=>oQ[t]?oQ[t]():oQ.circle(),dQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function uQ(t){return c(t)?t:function(){return t}}class pQ{constructor(t){var e,i;switch(this.options=z({},pQ.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=cQ(this.options.shape),this.getText=null!==(e=uQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=uQ(this.options.fontWeight),this.getTextFontSize=uQ(this.options.fontSize),this.getTextFontStyle=uQ(this.options.fontStyle),this.getTextFontFamily=uQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>dQ(10,50);break;case"random-light":this.getTextColor=()=>dQ(50,90);break;default:this.getTextColor=uQ(this.options.color)}if(d(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=c(this.options.rotate)?t=>{var e;return ae(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():wt(e);return ae(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!d(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class fQ extends pQ{constructor(t){var e;super(z({},fQ.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<=fQ.defaultOptions.minFontSize&&(this.options.minFontSize=fQ.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=gQ[this.options.spiral])&&void 0!==e?e:gQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=uQ(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}=hQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(_Q(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(yQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}_Q(p,this._size)&&(p=bQ(p,this._size))}else if(_Q(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||vQ(p,i))&&(!i||!mQ(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 mQ(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 vQ(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,_Q=(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 bQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},SQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},AQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},kQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=hQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=cQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)AQ(n,SQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)AQ(n,SQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)AQ(n,SQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)AQ(n,SQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)AQ(n,SQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=SQ({x:l,y:h},o,-Math.PI/2,5),e=SQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);AQ(n,i)}else n.fillRect(0,0,i,s)}; +function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var y=t=>Array.isArray?Array.isArray(t):l(t,"Array");var _=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>x(t)&&Number.isFinite(t);var k=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var C=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 M=Object.prototype;var T=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||M)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(_(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(T(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&y(t[a])?F(t,a,n[a]):L(t,e,a,i,s)}}}}function L(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(_(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function j(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function V(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(j(t)!==j(e))return!1;if(c(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(!V(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function et(t){return Number(t)}function it(t,e,i=et){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&x(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(t=rt.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),it(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var vt=function(t,e,i){return ti?i:t};var yt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Ct(t){if(A(t))return t;const e=+t;return A(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const Mt=4294967296;const Tt=t=>e=>P(e,t),Bt=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Et=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Pt=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Ot=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Zt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class re{static distancePP(t,e){return Kt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Kt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function he(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function ce(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ue(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ge(t){return(t=ue(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const be=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function xe(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ce({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?ae(t.angle):t.angle,s=we(t);return[Ce({x:t.x1,y:t.y1},i,s),Ce({x:t.x2,y:t.y1},i,s),Ce({x:t.x2,y:t.y2},i,s),Ce({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=Me(t,i),n=Me(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+Ht;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Ee(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Le{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const Fe=(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}},ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),He=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ne{}class We extends Ne{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ce({x:this.x1,y:this.y1},this.angle,t),Ce({x:this.x2,y:this.y1},this.angle,t),Ce({x:this.x1,y:this.y2},this.angle,t),Ce({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ue,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new Ue;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=oe(r.rotateDeg),r}}class Ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function Ye(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Xe(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 Ke=/^#([0-9a-f]{3,8})$/,$e={transparent:4294967040},qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return x(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Ke.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u($e[t]))return function(t){return x(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}($e[t]);if(u(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const s=this.color.opacity,n=Xe(this.color.r,this.color.g,this.color.b),r=Ye(d(t)?n.h:vt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new si(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=Xe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new si(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:Xe});function ai(t){if(A(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(p(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const li=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function hi(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 ci(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const di=1e-10;function ui(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+di)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=mi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=pi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-di,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function pi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function gi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return pi(t,t-(i*i-e*e+t*t)/(2*i))+pi(e,s)}function fi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function mi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let _i;function bi(t,e){const i=yi(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 xi{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Si=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ai(t){let e;if(e=Si.exec(t))return new xi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const ki=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ci{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 Ci.instance||(Ci.instance=new Ci),Ci.instance}newFormat(t){const e=Ai(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"):wi[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=wi[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?ki[8+_i/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 C=S.length+k.length+A.length,w=C>1)+S+k+A+w.slice(C);break;default:k=w+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Ai(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=yi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=ki[8+n/3];return function(t){return s(r*t)+a}}}const wi={"%":(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)=>bi(100*t,e),r:bi,s:function(t,e){const i=yi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+yi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Pi(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Pi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ii(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Li(){return new Fi}function Fi(){this.reset()}Fi.prototype={constructor:Fi,reset:function(){this.s=this.t=0},add:function(t){Hi(zi,t,this.t),Hi(this,zi.s,this.s),this.s?this.t+=zi.t:this.s=zi.t},valueOf:function(){return this.s}};var zi=new Fi;function Hi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var ji=1e-6,Ni=Math.PI,Vi=Ni/2,Wi=Ni/4,Ui=2*Ni,Gi=180/Ni,Yi=Ni/180,Xi=Math.abs,Ki=Math.atan,$i=Math.atan2,qi=Math.cos,Zi=Math.exp,Ji=Math.log,Qi=Math.pow,ts=Math.sin,es=Math.sign||function(t){return t>0?1:t<0?-1:0},is=Math.sqrt,ss=Math.tan;function ns(t){return t>1?0:t<-1?Ni:Math.acos(t)}function rs(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function as(){}function os(t,e){t&&hs.hasOwnProperty(t.type)&&hs[t.type](t,e)}var ls={Feature:function(t,e){os(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sNi?t+Math.round(-t/Ui)*Ui:t,e]}function Ss(t,e,i){return(t%=Ui)?e||i?bs(ks(t),Cs(e,i)):ks(t):e||i?Cs(e,i):xs}function As(t){return function(e,i){return[(e+=t)>Ni?e-Ui:e<-Ni?e+Ui:e,i]}}function ks(t){var e=As(t);return e.invert=As(-t),e}function Cs(t,e){var i=qi(t),s=ts(t),n=qi(e),r=ts(e);function a(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),rs(c*n+l*r)]}return a.invert=function(t,e){var a=qi(e),o=qi(t)*a,l=ts(t)*a,h=ts(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),rs(c*i-o*s)]},a}function ws(t,e){(e=gs(e))[0]-=t,_s(e);var i=ns(-e[1]);return((-e[2]<0?-i:i)+Ui-ji)%Ui}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:as,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Xi(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 Ps(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Fs(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 zs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Fs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=ts(s),r=[ts(i),-qi(i),0],a=0,o=0;Is.reset(),1===n?s=Vi+ji:-1===n&&(s=-Vi-ji);for(var l=0,h=t.length;l=0?1:-1,C=k*A,w=C>Ni,M=f*x;if(Is.add($i(M*k*ts(C),m*S+M*qi(C))),a+=w?A+k*Ui:A,w^p>=i^_>=i){var T=ms(gs(u),gs(y));_s(T);var B=ms(r,T);_s(B);var E=(w^A>=0?-1:1)*rs(B[2]);(s>E||s===E&&(T[0]||T[1]))&&(o+=w^A>=0?1:-1)}}return(a<-ji||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(Hs))}return u}}function Hs(t){return t.length>1}function js(t,e){return((t=t.x)[0]<0?t[1]-Vi-ji:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-ji:Vi-e[1])}1===(Os=Ls).length&&(Rs=Os,Os=function(t,e){return Ls(Rs(t),e)});var Ns=zs((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?Ni:-Ni,l=Xi(r-i);Xi(l-Ni)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ni&&(Xi(i-n)ji?Ki((ts(e)*(r=qi(s))*ts(i)-ts(s)*(n=qi(e))*ts(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*Vi,s.point(-Ni,n),s.point(0,n),s.point(Ni,n),s.point(Ni,0),s.point(Ni,-n),s.point(0,-n),s.point(-Ni,-n),s.point(-Ni,0),s.point(-Ni,n);else if(Xi(t[0]-e[0])>ji){var r=t[0]0,n=Xi(e)>ji;function r(t,i){return qi(t)*qi(i)>e}function a(t,i,s){var n=[1,0,0],r=ms(gs(t),gs(i)),a=fs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ms(n,r),u=ys(n,h);vs(u,ys(r,c));var p=d,g=fs(u,p),f=fs(p,p),m=g*g-f*(fs(u,u)-1);if(!(m<0)){var v=is(m),y=ys(p,(-g-v)/f);if(vs(y,u),y=ps(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Xi(y[0]-b)Ni^(b<=y[0]&&y[0]<=x)){var w=ys(p,(-g+v)/f);return vs(w,u),[y,ps(w)]}}}function o(e,i){var n=s?t:Ni-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return zs(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?Ni:-Ni),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^f){var v;m&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=qi(e),o=ts(e),l=s*i;null==n?(n=e+s*Ui,r=e-l/2):(n=ws(a,n),r=ws(a,r),(s>0?nr)&&(n+=s*Ui));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 Xi(s[0]-t)0?0:3:Xi(s[0]-i)0?2:1:Xi(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,f,m,v,y,_=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&_.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=Fs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Es(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(Us,Math.min(Ws,g)),f=Math.max(Us,Math.min(Ws,f))],b=[r=Math.max(Us,Math.min(Ws,r)),a=Math.max(Us,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&&(_.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 Ys(t){return t}var Xs,Ks,$s,qs,Zs=Li(),Js=Li(),Qs={point:as,lineStart:as,lineEnd:as,polygonStart:function(){Qs.lineStart=tn,Qs.lineEnd=nn},polygonEnd:function(){Qs.lineStart=Qs.lineEnd=Qs.point=as,Zs.add(Xi(Js)),Js.reset()},result:function(){var t=Zs/2;return Zs.reset(),t}};function tn(){Qs.point=en}function en(t,e){Qs.point=sn,Xs=$s=t,Ks=qs=e}function sn(t,e){Js.add(qs*t-$s*e),$s=t,qs=e}function nn(){sn(Xs,Ks)}var rn=Qs,an=1/0,on=an,ln=-an,hn=ln;var cn,dn,un,pn,gn={point:function(t,e){tln&&(ln=t);ehn&&(hn=e)},lineStart:as,lineEnd:as,polygonStart:as,polygonEnd:as,result:function(){var t=[[an,on],[ln,hn]];return ln=hn=-(on=an=1/0),t}},fn=0,mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn={point:Cn,lineStart:wn,lineEnd:Bn,polygonStart:function(){kn.lineStart=En,kn.lineEnd=Pn},polygonEnd:function(){kn.point=Cn,kn.lineStart=wn,kn.lineEnd=Bn},result:function(){var t=An?[xn/An,Sn/An]:bn?[yn/bn,_n/bn]:vn?[fn/vn,mn/vn]:[NaN,NaN];return fn=mn=vn=yn=_n=bn=xn=Sn=An=0,t}};function Cn(t,e){fn+=t,mn+=e,++vn}function wn(){kn.point=Mn}function Mn(t,e){kn.point=Tn,Cn(un=t,pn=e)}function Tn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,Cn(un=t,pn=e)}function Bn(){kn.point=Cn}function En(){kn.point=On}function Pn(){Rn(cn,dn)}function On(t,e){kn.point=Rn,Cn(cn=un=t,dn=pn=e)}function Rn(t,e){var i=t-un,s=e-pn,n=is(i*i+s*s);yn+=n*(un+t)/2,_n+=n*(pn+e)/2,bn+=n,xn+=(n=pn*t-un*e)*(un+t),Sn+=n*(pn+e),An+=3*n,Cn(un=t,pn=e)}var In=kn;function Dn(t){this._context=t}Dn.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,Ui)}},result:as};var Ln,Fn,zn,Hn,jn,Nn=Li(),Vn={point:as,lineStart:function(){Vn.point=Wn},lineEnd:function(){Ln&&Un(Fn,zn),Vn.point=as},polygonStart:function(){Ln=!0},polygonEnd:function(){Ln=null},result:function(){var t=+Nn;return Nn.reset(),t}};function Wn(t,e){Vn.point=Un,Fn=Hn=t,zn=jn=e}function Un(t,e){Hn-=t,jn-=e,Nn.add(is(Hn*Hn+jn*jn)),Hn=t,jn=e}var Gn=Vn;function Yn(){this._string=[]}function Xn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Kn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),us(t,i(s))),s.result()}return r.area=function(t){return us(t,i(rn)),rn.result()},r.measure=function(t){return us(t,i(Gn)),Gn.result()},r.bounds=function(t){return us(t,i(gn)),gn.result()},r.centroid=function(t){return us(t,i(In)),In.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ys):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Yn):new Dn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function $n(t){return function(e){var i=new qn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function qn(){}function Zn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),us(i,t.stream(gn)),e(gn.result()),null!=s&&t.clipExtent(s),t}function Jn(t,e,i){return Zn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Qn(t,e,i){return Jn(t,[[0,0],e],i)}function tr(t,e,i){return Zn(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 er(t,e,i){return Zn(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)}Yn.prototype={_radius:4.5,_circle:Xn(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=Xn(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}},qn.prototype={constructor:qn,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 ir=16,sr=qi(30*Yi);function nr(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=is(b*b+x*x+S*S),k=rs(S/=A),C=Xi(Xi(S)-1)e||Xi((v*B+y*E)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Yi:0,B()):[m*Gi,v*Gi,y*Gi]},M.angle=function(t){return arguments.length?(_=t%360*Yi,B()):_*Gi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},M.precision=function(t){return arguments.length?(a=nr(o,w=t*t),E()):is(w)},M.fitExtent=function(t,e){return Jn(M,t,e)},M.fitSize=function(t,e){return Qn(M,t,e)},M.fitWidth=function(t,e){return tr(M,t,e)},M.fitHeight=function(t,e){return er(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&T,B()}}function cr(t){var e=0,i=Ni/3,s=hr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Yi,i=t[1]*Yi):[e*Gi,i*Gi]},n}function dr(t,e){var i=ts(t),s=(i+ts(e))/2;if(Xi(s)2?t[2]*Yi:0),e.invert=function(e){return(e=t.invert(e[0]*Yi,e[1]*Yi))[0]*=Gi,e[1]*=Gi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===yr?[[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 br(t){return ss((Vi+t)/2)}function xr(t,e){var i=qi(t),s=t===e?ts(t):Ji(i/qi(e))/Ji(br(e)/br(t)),n=i*Qi(br(t),s)/s;if(!s)return yr;function r(t,e){n>0?e<-Vi+ji&&(e=-Vi+ji):e>Vi-ji&&(e=Vi-ji);var i=n/Qi(br(e),s);return[i*ts(s*t),n-i*qi(s*t)]}return r.invert=function(t,e){var i=n-e,r=es(s)*is(t*t+i*i),a=$i(t,Xi(i))*es(i);return i*s<0&&(a-=Ni*es(t)*es(i)),[a/s,2*Ki(Qi(n/r,1/s))-Vi]},r}function Sr(t,e){return[t,e]}function Ar(t,e){var i=qi(t),s=t===e?ts(t):(i-qi(e))/(e-t),n=i/s+t;if(Xi(s)ji&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Or.invert=fr(rs),Rr.invert=fr((function(t){return 2*Ki(t)})),Ir.invert=function(t,e){return[-e,2*Ki(Zi(t))-Vi]};var Fr={exports:{}},zr=function(t,e){this.p1=t,this.p2=e};zr.prototype.rise=function(){return this.p2[1]-this.p1[1]},zr.prototype.run=function(){return this.p2[0]-this.p1[0]},zr.prototype.slope=function(){return this.rise()/this.run()},zr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},zr.prototype.isVertical=function(){return!isFinite(this.slope())},zr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},zr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},zr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},zr.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)},zr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Hr=zr,jr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Hr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=jr(t.slice(0,s),e),o=jr(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},Nr=jr;!function(t){var e=Nr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Yr,e),{tolerance:s}=i;return Vr(t,s)};var Kr;!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"}(Kr||(Kr={}));const $r=(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},qr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(A(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let C=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/C:0,w.push(_[t])}return w},Jr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],T=M.length?M:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:T});if(!w.length)return Zr(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...M,...w];return Zr(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",T=null!==(l=k.q1)&&void 0!==l?l:"q1",B=null!==(h=k.median)&&void 0!==h?h:"median",E=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(u=k.iqr)&&void 0!==u?u:"iqr",O=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",D=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",L=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),y(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}y(S)&&(S=[vt(Math.min.apply(null,S),0,1),vt(Math.max.apply(null,S),0,1)]);const V=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[M]=o,f[T]=l,f[B]=h,f[E]=c,f[P]=d,f[O]=n,f[R]=r,f[I]=u,f[D]=p,f[L]=g,A&&(f[F]=H.get(t)||[]),V.push(f)}return V};var ta={},ea={};function ia(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function sa(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function na(t,e){var i=t+"",s=i.length;return s9999?"+"+na(e,6):na(e,4))+"-"+na(t.getUTCMonth()+1,2)+"-"+na(t.getUTCDate(),2)+(r?"T"+na(i,2)+":"+na(s,2)+":"+na(n,2)+"."+na(r,3)+"Z":n?"T"+na(i,2)+":"+na(s,2)+":"+na(n,2)+"Z":s||i?"T"+na(i,2)+":"+na(s,2)+"Z":"")}function aa(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 ea;if(h)return h=!1,ta;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=Kr.DSV;const s=Wr(ha,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return aa(n).parse(t)},da=(t,e={},i)=>(i.type=Kr.DSV,oa(t)),ua=(t,e={},i)=>(i.type=Kr.DSV,la(t));function pa(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return ga(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 ga(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ma(t);default:throw new Error("unknown GeoJSON type")}}function ga(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=fa(t.properties),e.geometry=ma(t.geometry),e}function fa(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]=fa(s):e[i]=s})),e):e}function ma(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return ma(t)})),e):(e.coordinates=va(t.coordinates),e)}function va(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return va(t)}))}function ya(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 _a(t){for(var e,i,s=ya(t),n=0,r=1;r0}function ba(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=pa(t));var r=[];switch(t.type){case"GeometryCollection":return xa(t,(function(t){Aa(t,s)})),t;case"FeatureCollection":return ba(t,(function(t){ba(Aa(t,s),(function(t){r.push(t)}))})),ci(r)}return Aa(t,s)}function Aa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return xa(t,(function(t){Aa(t,e)})),t;case"LineString":return ka(ya(t),e),t;case"Polygon":return Ca(ya(t),e),t;case"MultiLineString":return ya(t).forEach((function(t){ka(t,e)})),t;case"MultiPolygon":return ya(t).forEach((function(t){Ca(t,e)})),t;case"Point":case"MultiPoint":return t}}function ka(t,e){_a(t)===e&&t.reverse()}function Ca(t,e){_a(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=wa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Ea=(t,e={},i)=>{i.type=Kr.GEO;const s=Wr(Ta,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Sa(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=Ma.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=Ma.bounds(t);t.bbox=e}})),t.features=l,t},Pa={},Oa=(t,e,i)=>{i.type=Kr.GEO;const s=Wr(Ta,Pa,e),{object:n}=s;if(!v(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return Lr(a,t)}))}:Lr(a,o));var a,o;return Ea(r,s,i)},Ra=(t,e,i)=>{const s=!h(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 Ia=0;function Da(t="dataset"){return Ia>1e8&&(Ia=0),t+"_"+Ia++}class La{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class Fa{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Fa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",qr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Kn();const za={},Ha={albers:pr,albersusa:function(){var t,e,i,s,n,r,a=pr(),o=ur().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=ur().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)}},ja=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Na(t,e){return function i(){const s=e();return s.type=t,s.path=Kn().projection(s),s.copy=s.copy||function(){const t=i();return ja.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ua extends o{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Za(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 Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=qa.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Za(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(Za(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,Za(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Xa))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Za(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 Ka))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=qa.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Ja(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Xa,this.rootWheelEvent=new Ka,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&v(t)&&!R(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const io=jt-1e-8;class so{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>io)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ro=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ao={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},oo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let lo,ho,co,uo,po,go;function fo(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tgo){let t,e=co;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),w=.5*(b+S)+k*(x-_),M=Math.atan2(b-w,_-C);let T=Math.atan2(S-w,x-C)-M;T<0&&1===r?T+=jt:T>0&&0===r&&(T-=jt);const B=Math.ceil(Math.abs(T/(Ht+.001))),E=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 Mo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Lo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function zo(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new Ho(i,n),new Ho(n,s)]}class Ho extends To{constructor(t,e){super(),this.type=bo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===_o.ROW?Vt(this.p0.x-this.p1.x):t===_o.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class jo{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Fo(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Ho(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===_o.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===_o.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class No extends jo{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 Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?_o.ROW:_o.COLUMN;return"monotoneY"===t?new No(t,s):new jo(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 Go(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Yo(new Uo(n,s),t),n}function Yo(t,e){return Vo(t,e,1)}function Xo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Ko{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Xo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Xo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function $o(t,e){return Vo(t,e,2)}function qo(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("basis",i,t);return $o(new Ko(n,s),t),n}function Zo(t){return t<0?-1:1}function Jo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Zo(r)+Zo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Qo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function tl(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class el{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:tl(this,this._t0,Qo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,tl(this,Qo(this,e=Jo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:tl(this,this._t0,e=Jo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class il extends el{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function sl(t,e){return Vo(t,e,2)}function nl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("monotoneX",i,t);return sl(new el(n,s),t),n}function rl(t,e){return Vo(t,e,2)}function al(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Go(t,e);const n=Wo("monotoneY",i,t);return rl(new il(n,s),t),n}let ol=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class ll extends ol{lineEnd(){this.context.closePath()}}function hl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new jo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?_o.ROW:_o.COLUMN);return cl(new ol(r,e,n),t),r}function cl(t,e){return Vo(t,e,1)}function dl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new jo("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?_o.ROW:_o.COLUMN);return cl(new ll(r,e,n),t),r}class ul extends Uo{lineEnd(){this.context.closePath()}}function pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return gl(new ul(n,s),t),n}function gl(t,e){return Vo(t,e,1)}function fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ft){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function ml(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Go(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const vl=ml("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const yl=ml("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class _l extends To{constructor(t,e,i){super(),this.type=bo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Io(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===_o.ROW?Vt(this.p0.x-this.p2.x):t===_o.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Io(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new _l(i,a,r),new _l(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class bl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Ho(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new _l(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Fo(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function xl(t,e,i){var s,n;switch(e){case"linear":default:return Go(t,i);case"basis":return qo(t,i);case"monotoneX":return nl(t,i);case"monotoneY":return al(t,i);case"step":return hl(t,.5,i);case"stepClosed":return dl(t,.5,i);case"stepBefore":return hl(t,0,i);case"stepAfter":return hl(t,1,i);case"catmullRom":return vl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return yl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return pl(t,i)}}class Sl extends no{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new so(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([oo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([oo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([oo.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([oo.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([oo.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([oo.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([oo.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([oo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([oo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new bl(this);Mo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[oo.M]=t=>`M${t[1]} ${t[2]}`,t[oo.L]=t=>`L${t[1]} ${t[2]}`,t[oo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[oo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[oo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];Co(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[oo.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=fo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=xl(e,i);"x"===s?this.direction=_o.ROW:"y"===s?this.direction=_o.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[oo.M]=this.moveToTransform,t[oo.L]=this.lineToTransform,t[oo.Q]=this.quadraticCurveToTransform,t[oo.C]=this.bezierCurveToTransform,t[oo.AT]=this.arcToTransform,t[oo.E]=this.ellipseTransform,t[oo.R]=this.rectTransform,t[oo.A]=this.arcTransform,t[oo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Mo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===_o.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===_o.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),Kl=Object.assign(Object.assign({},jl),{points:[],cornerRadius:0,closePath:!0}),$l=Object.assign(Object.assign({},jl),{width:100,height:100,spikes:5,thickness:.5}),ql=Object.assign(Object.assign({},jl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Zl=Object.assign(Object.assign({},jl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},jl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Ql=Object.assign(Object.assign(Object.assign({},jl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),th=Object.assign(Object.assign(Object.assign({},jl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),eh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},jl),{fill:!0,cornerRadius:0,cornerType:"round"}),ih=Object.assign(Object.assign({},eh),{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});class sh{}const nh=Symbol.for("@visactor/vrender-core/application-state");function rh(){const t=globalThis;return t[nh]||(t[nh]={application:new sh}),t[nh]}const ah=rh().application;class oh{static GetImage(t,e){var i;const s=oh.cache.get(t);s?"fail"===s.loadState?ah.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):oh.loadImage(t,e)}static GetSvg(t,e){var i;let s=oh.cache.get(t);s?"fail"===s.loadState?ah.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"},oh.cache.set(t,s),s.dataPromise=ah.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=oh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},oh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=ah.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=ah.global.loadBlob(t):"json"===e&&(i.dataPromise=ah.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!oh.isLoading&&oh.toLoadAueue.length){oh.isLoading=!0;const t=oh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(oh.cache.set(i,n),n.dataPromise=ah.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()})).catch((t=>{console.error(t),oh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),oh.loading()}))}}),0)}static loadImage(t,e){const i=lh(t,oh.toLoadAueue);if(-1!==i)return oh.toLoadAueue[i].marks.push(e),void oh.loading();oh.toLoadAueue.push({url:t,marks:[e]}),oh.loading()}static improveImageLoading(t){const e=lh(t,oh.toLoadAueue);if(-1!==e){const t=oh.toLoadAueue.splice(e,1);oh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function lh(t,e){for(let i=0;i{var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)ch[s]=t,i&&(i=!(null!==(e=ch[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ch[e]=!!t[e],i&&(i=!!ch[e]);else ch[0]=!1,ch[1]=!1,ch[2]=!1,ch[3]=!1;return{isFullStroke:i,stroke:ch}},uh=[0,0,0,0],ph=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(uh[0]=t[0],uh[2]=t[0],uh[1]=t[1],uh[3]=t[1],uh):t:t:0,gh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],fh=[1,2,3,0,1,2,3,0];function mh(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;gh[0].x=i,gh[1].y=i,gh[2].x=-i,gh[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Ut(t)*i,Xt(t)*i),s.add(Ut(e)*i,Xt(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}xh.TimeOut=1e3/60;const Sh=new xh,Ah=(t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,kh=(t,e)=>{const i=Ah(t,e);return isNaN(i)?i:Math.max(e,i)};class Ch{bounds(t,e){if(x(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function wh(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var Mh=new class extends Ch{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 wh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Th=new class extends Ch{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Eh=new class extends Ch{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Ph(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Ch{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Ph(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ph(t,this.parseSize(e)/2+n,i,s)}};function Rh(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Ih extends Ch{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 Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Ih;var Lh=new class extends Ih{constructor(){super(...arguments),this.type="triangle"}};const Fh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),zh=Math.sin(jt/10)*Fh,Hh=-Math.cos(jt/10)*Fh;function jh(t,e,i,s){const n=zh*e,r=Hh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Nh=new class extends Ch{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 jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return jh(t,this.parseSize(e)/2+n,i,s)}};const Vh=Kt(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Uh=new class extends Ch{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Gh(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 Yh=new class extends Ch{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Gh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Gh(t,this.parseSize(e)/2+n,i,s)}};function Xh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Kh=new class extends Ch{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Xh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Xh(t,this.parseSize(e)/2+n,i,s)}};const $h=-.5,qh=Kt(3)/2,Zh=1/Kt(12);function Jh(t,e,i,s){const n=e/2,r=e*Zh,a=n,o=e*Zh+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($h*n-qh*r+i,qh*n+$h*r+s),t.lineTo($h*a-qh*o+i,qh*a+$h*o+s),t.lineTo($h*l-qh*h+i,qh*l+$h*h+s),t.lineTo($h*n+qh*r+i,$h*r-qh*n+s),t.lineTo($h*a+qh*o+i,$h*o-qh*a+s),t.lineTo($h*l+qh*h+i,$h*h-qh*l+s),t.closePath(),!1}var Qh=new class extends Ch{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 Jh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Jh(t,this.parseSize(e)/2+n,i,s)}};function tc(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ec=new class extends Ch{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 tc(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return tc(t,this.parseSize(e)/2,i,s,n)}};function ic(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var sc=new class extends Ch{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 ic(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ic(t,this.parseSize(e)/2,i,s,n)}};function nc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var rc=new class extends Ch{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 nc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return nc(t,this.parseSize(e)/2,i,s,n)}};const ac=Kt(3);function oc(t,e,i,s){const n=e*ac;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var lc=new class extends Ch{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return oc(t,this.parseSize(e)/2/ac,i,s)}drawOffset(t,e,i,s,n){return oc(t,this.parseSize(e)/2/ac+n,i,s)}};function hc(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 cc=new class extends Ch{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 hc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hc(t,this.parseSize(e)/4+n,i,s)}};function dc(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 uc=new class extends Ch{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 dc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return dc(t,this.parseSize(e)/4+n,i,s)}};function pc(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 gc=new class extends Ch{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 pc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pc(t,this.parseSize(e)/4+n,i,s)}};function fc(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 mc=new class extends Ch{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 fc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return fc(t,this.parseSize(e)/4+n,i,s)}};function vc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var yc=new class extends Ch{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return vc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function _c(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var bc=new class extends Ch{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return _c(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return _c(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function xc(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 Sc=new class extends Ch{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 xc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return xc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function Ac(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function kc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Cc=new class extends Ch{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return x(e)?kc(t,e,i,s):Ac(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?kc(t,e+2*n,i,s):Ac(t,[e[0]+2*n,e[1]+2*n],i,s)}};const wc=new Ve;class Mc{constructor(t,e,i=!1){this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Mo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Mo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{wc.x1=i.bounds.x1*t,wc.y1=i.bounds.y1*t,wc.x2=i.bounds.x2*t,wc.y2=i.bounds.y2*t,e.union(wc)}))}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 Tc=[Mh,Th,Eh,Oh,lc,Lh,Nh,Uh,Yh,Kh,Qh,ec,sc,Dh,rc,cc,uc,gc,mc,Cc,yc,bc,Sc],Bc={};Tc.forEach((t=>{Bc[t.type]=t}));const Ec={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Pc{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 Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Rc(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Rc(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Rc(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 Pc(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 Pc(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 Lc(t,e){return Fc(t)}function Fc(t,e){const i={};for(let e=0;e$c.set(t,!0)));const qc=new Map;function Zc(t){if($c.has(t))return!0;if(qc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Jc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>qc.set(t,!0)));const Qc=Yc(),td=Yc(),ed=Yc(),id=Yc(),sd=Yc(),nd=Yc(),rd=Yc(),ad=Yc(),od=Yc(),ld=Yc(),hd=Yc(),cd=Yc(),dd=Yc(),ud=Yc(),pd=Yc(),gd=Yc(),fd=Yc(),md=Symbol.for("GraphicService"),vd=Symbol.for("GraphicCreator"),yd={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},_d=Object.keys(yd),bd={"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"},xd=Object.keys(bd),Sd={duration:200,easing:"cubicOut"},Ad=Symbol.for("CanvasFactory"),kd=Symbol.for("Context2dFactory");function Cd(t){return function(){var t,e;const i=null===(t=ah.global)||void 0===t?void 0:t.env,s=i?null===(e=ah.canvasFactory)||void 0===e?void 0:e.call(ah,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const wd=1e-4,Md=Math.sqrt(3),Td=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Pd(t){return"number"==typeof t&&Number.isFinite(t)}const Od=[0,0],Rd=[0,0],Id=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Ld(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Fd(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 zd(t){return(t%=Nt)<0&&(t+=Nt),t}function Hd(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function Vd(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(Bd(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 Gd=[-1,-1,-1],Yd=[-1,-1];function Xd(){const t=Yd[0];Yd[0]=Yd[1],Yd[1]=t}function Kd(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(Bd(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,Td):Math.pow(i,Td),s=s<0?-Math.pow(-s,Td):Math.pow(s,Td);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+Md*Math.sin(e)))/(3*a),h=(-o+i*(s-Md*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,Gd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Xd(),p=Fd(e,s,r,o,Yd[0]),u>1&&(g=Fd(e,s,r,o,Yd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Gd);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=Ld(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Gd[0]=-l,Gd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=Gd[0]+t&&a<=Gd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=Gd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function Zd(t){return Math.round(t/zt*1e8)/1e8%2*zt}function Jd(t,e){let i=Zd(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-Zd(i-n)):e&&i1&&(i||(h+=Oe(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;Qd[0]=S,Qd[1]=A,Jd(Qd,Boolean(a[6])),S=Qd[0],A=Qd[1];const k=S,C=A-S,w=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case oo.M:u=m,p=v,c=u,d=p;break;case oo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case oo.C:if(i){if(jd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=Kd(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case oo.Q:if(i){if(Hd(c,d,m,v,y,_,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case oo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Nd(m,v,y,k,k+C,w,e,M,n))return!0}else h+=qd(m,v,y,k,k+C,w,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case oo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case oo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class iu{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(iu.IsGradientStr(t))try{const e=eu(t)[0];if(e){if("linear"===e.type)return iu.ParseLinear(e);if("radial"===e.type)return iu.ParseRadial(e);if("conic"===e.type)return iu.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:iu.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:iu.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function ru(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function au(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];return 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}function ou(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];return 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}function lu(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];return 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,t}function hu(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 cu(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 du(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function uu(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 pu(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];return Math.abs(g-b)0&&(xu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(xu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},ku),function(t,e,i){return tu(t,0,!1,e,i)}(this.path.commandList,ku.x,ku.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ku);const i=su(this,this.lineWidth,this.dpr);return function(t,e,i,s){return tu(t,e,!0,i,s)}(this.path.commandList,i,ku.x,ku.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(Au,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>xu.free(t))),this.stack.length=0}}const wu={WIDTH:500,HEIGHT:500,DPR:1};class Mu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=wu.WIDTH,height:n=wu.HEIGHT,dpr:r=wu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Tu;Mu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Tu||(Tu={}));class Bu{static Get(t,e=Tu.Color1,i=[0,0,0,1]){if(e===Tu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Tu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Eu(t,e=!1){return Array.isArray(t)&&x(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Pu(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ou(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ou(t,e,i,s,n)}function Ou(t,e,i,s,n){if(!t||!e)return t&&Eu(t)||e&&Eu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Tu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Tu.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:Eu(a)})))});return o?Pu(r,l,i,s,n):Pu(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 Ru(s,n,i);if("radial"===s.gradient)return Iu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Eu(Lu(r,a,i),s)}function Ru(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Iu(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:ju(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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]}function Fu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const zu=[0,0,0,0],Hu=[0,0,0,0];function ju(t,e,i){return Bu.Get(t,Tu.Color255,zu),Bu.Get(e,Tu.Color255,Hu),`rgba(${Math.round(zu[0]+(Hu[0]-zu[0])*i)},${Math.round(zu[1]+(Hu[1]-zu[1])*i)},${Math.round(zu[2]+(Hu[2]-zu[2])*i)},${zu[3]+(Hu[3]-zu[3])*i})`}class Nu{static GetCanvas(){try{return Nu.canvas||(Nu.canvas=ah.global.createCanvas({})),Nu.canvas}catch(t){return null}}static GetCtx(){if(!Nu.ctx){const t=Nu.GetCanvas();Nu.ctx=t.getContext("2d")}return Nu.ctx}}class Vu extends Ge{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Nu.GetCanvas(),s=Nu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Uu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Nt;for(;i>Nt;)i-=Nt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Pu(o.color,l.color,h,!1)}function Gu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Nu.GetCanvas(),d=Nu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Yu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Xu(t){return null==t?void 0:t}class Ku{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Xu(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Yu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Xu(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function $u(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function qu(t){if(!$u(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=qu(t[i])})),e}function Zu(t,e){var i;const s=null!==(i=qu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];$u(n)&&$u(i)?s[t]=Zu(n,i):s[t]=qu(i)})),s}class Ju{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=qu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];$u(r)&&$u(n)?t[i]=Zu(r,n):!$u(r)&&$u(a)&&$u(n)?t[i]=Zu(a,n):t[i]=qu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?Qu.PAINT|Qu.BOUNDS|Qu.PICK:Qu.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?Qu.PAINT|Qu.BOUNDS:Qu.PAINT}};class ip{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Sd;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:yo.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:yo.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:yo.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const sp=new Ku;function np(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,rp(t),!0)}function rp(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=sp.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function ap(t){if(t)return t.parentScope&&ap(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&rp(t),t}function op(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function lp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function hp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,lp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),op(null!=e?e:t.ownerStage))}const cp=new Ve,dp=new Ue,up=["lineWidth","scaleX","scaleY","angle","anchor","visible"],pp=["x","y"],gp=["scaleX","scaleY"],fp=["angle"],mp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),vp=new ne,yp=[],_p=Qu.PAINT|Qu.SHAPE|Qu.BOUNDS|Qu.TRANSFORM|Qu.LAYOUT;function bp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function xp(t){if(!bp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=bp(s)?xp(s):s})),i}function Sp(t,e){return t===e||!!(bp(t)||bp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function Ap(t,e){var i;const s=null!==(i=xp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];bp(n)&&bp(i)?s[t]=Ap(n,i):s[t]=xp(i)})),s}const kp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Cp extends Ua{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,lp(this.stage,this),op(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&ap(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:yo.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(ap(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new Ku).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=xp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&bp(n)&&bp(s)?e[t]=Ap(n,s):e[t]=xp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:xp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Sp(a,o)||(s.set(n,{prev:a,next:o}),t[n]=xp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ep[t];return n?n(e,i):null!==(s=tp[t])&&void 0!==s?s:Qu.PAINT}(e,i,s):null!==(n=tp[e])&&void 0!==n?n:Qu.PAINT;return r&Qu.PICK&&(r|=Qu.BOUNDS),r===Qu.PAINT&&this.needUpdateTag(e)&&(r=Qu.SHAPE|Qu.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&_p)!==_p?(t&Qu.SHAPE?this.addUpdateShapeAndBoundsTag():t&Qu.BOUNDS&&this.addUpdateBoundTag(),t&Qu.PAINT&&this.addUpdatePaintTag(),t&Qu.TRANSFORM&&this.addUpdatePositionTag(),t&Qu.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=Qu.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!bp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=bp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&mo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Tp.userSymbolMap[t],e)return e;if(!0===jc(t=Ec[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=y(i.path)?i.path:[i.path];cp.clear();const n=[];s.forEach((t=>{const e=(new Sl).fromString(t.d),i={};xd.forEach((e=>{t[e]&&(i[bd[e]]=t[e])})),n.push({path:e,attribute:i}),cp.union(e.bounds)}));const r=cp.width(),a=cp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new Mc(t,n,!0);return Tp.userSymbolMap[t]=l,l}const i=(new Sl).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Gt(s,n);i.transform(0,0,r,r);const a=new Mc(t,i);return Tp.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=ph(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new so(t);return Mo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&mo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&mo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&mo.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&mo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=mo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vo.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===yo.STATE||null!=i&&i>=yo.ANIMATE_BIND&&i<=yo.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===yo.STATE||null!=o&&o>=yo.ANIMATE_BIND&&o<=yo.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Sp(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:yp,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:yo.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Sd}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:yp,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?xp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:yo.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:yp,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:yp,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:yo.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:yo.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:yo.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Pl.x,y:e=Pl.y,scaleX:i=Pl.scaleX,scaleY:s=Pl.scaleY,angle:n=Pl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ut(a),f=Xt(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,!0),ah.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Pl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:ah.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:yo.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:yo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=ah.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new Sl).fromString(t):this.pathProxy=new Sl,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:ah.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new $a(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ua.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:yo.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:yo.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||ah.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Cu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Cp.userSymbolMap={};const wp=Symbol.for("@visactor/vrender-core/graphic-class");function Mp(){var t;const e=globalThis;return null!==(t=e[wp])&&void 0!==t||(e[wp]={Graphic:Cp}),e[wp]}const Tp=Mp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!mp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Ip=Op();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Pp.forEach((t=>{this._defaultTheme[t]=Object.create(Ip[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Pp.forEach((s=>{const n=Object.create(Ip[s]);t&&t[s]&&Rp(n,t[s]),i[s]&&Rp(n,i[s]),e[s]&&Rp(n,e[s]),this.combinedTheme[s]=n})),e.common&&Pp.forEach((t=>{Rp(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 Lp=new Dp;function Fp(t,e){return t.glyphHost?Fp(t.glyphHost):e?(t.isContainer,e):zp(t)||t.attachedThemeGraphic&&Fp(t.attachedThemeGraphic)||Lp.getTheme()}function zp(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)):Lp.getTheme()}return null}const Hp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},jp=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...up];class Np extends Tp{constructor(t){super(t),this.type="arc",this.numberType=Qc}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=le(e),i=e+a,s&&Vt(a)>Ft&&Vt(a)Ft&&o>Ft)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Kt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*Xt(g)),n=qt(Number(l)/a*Xt(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Fp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);Hp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Nt-Ft?i.set(-s,-s,s,s):(mh(l,o,s,i),mh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,jp)}needUpdateTag(t){return super.needUpdateTag(t,jp)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Nt-Ft)n.moveTo(0+h*Ut(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Ut(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Ut(a),e=h*Xt(a),i=l*Ut(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Np(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Np.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Np(t)}Np.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);const Wp=["segments","points","curveType","curveTension",...up];class Up extends Tp{constructor(t){super(t),this.type="area",this.numberType=ed}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Fp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),ah.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Sl;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Gp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Yp=["radius","startAngle","endAngle",...up];class Xp extends Tp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Fp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-Ft?i.set(-r,-r,r,r):mh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Yp)}needUpdateTag(t){return super.needUpdateTag(t,Yp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Sl,s.arc(0,0,r,a,o),s}clone(){return new Xp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xp.NOWORK_ANIMATE_ATTR}}function Kp(t){return new Xp(t)}Xp.NOWORK_ANIMATE_ATTR=kp;class $p extends Tp{constructor(t){super(t),this.type="glyph",this.numberType=sd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Fp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new $p(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return $p.NOWORK_ANIMATE_ATTR}}function qp(t){return new $p(t)}var Zp;$p.NOWORK_ANIMATE_ATTR=kp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Zp||(Zp={}));let Jp=class t extends Tp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=nd,this._childUpdateTag=mo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(np(this.sharedStateScope,t),hp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vo.GLOBAL){const i=new ne(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&mo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Pl.x,y:e=Pl.y,dx:i=Pl.dx,dy:s=Pl.dy,scaleX:n=Pl.scaleX,scaleY:r=Pl.scaleY,angle:a=Pl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Fp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=mo.CLEAR_BOUNDS,this._childUpdateTag&=mo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&mo.UPDATE_BOUNDS||(this._childUpdateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:ah.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&mo.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=ah.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&np(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return rp({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function Qp(t){return new Jp(t)}Jp.NOWORK_ANIMATE_ATTR=kp;const tg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...up];class eg extends Tp{constructor(t){super(t),this.type="image",this.numberType=rd,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Fp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return eh[t]}needUpdateTags(t){return super.needUpdateTags(t,tg)}needUpdateTag(t){return super.needUpdateTag(t,tg)}clone(){return new eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return eg.NOWORK_ANIMATE_ATTR}}function ig(t){return new eg(t)}eg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},kp);const sg=["segments","points","curveType","curveTension",...up];let ng=class t extends Tp{constructor(t={}){super(t),this.type="line",this.numberType=ad}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=_h(i,s,e))}getGraphicTheme(){return Fp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),ah.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,sg)}needUpdateTag(t){return super.needUpdateTag(t,sg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Sl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function rg(t){return new ng(t)}ng.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const ag=["path","customPath",...up];class og extends Tp{constructor(t){super(t),this.type="path",this.numberType=od}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Sl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Sl?this.cache:t.path)}getGraphicTheme(){return Fp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Sl).fromString(t.path):t.customPath&&(this.cache=new Sl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,ag)}needUpdateTag(t){return super.needUpdateTag(t,ag)}toCustomPath(){return(new Sl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return og.NOWORK_ANIMATE_ATTR}}function lg(t){return new og(t)}og.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},kp);const hg=["points","cornerRadius",...up];class cg extends Tp{constructor(t){super(t),this.type="polygon",this.numberType=ld}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Fp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),ah.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=_h(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,hg)}needUpdateTag(t){return super.needUpdateTag(t,hg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Sl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new cg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return cg.NOWORK_ANIMATE_ATTR}}function dg(t){return new cg(t)}cg.NOWORK_ANIMATE_ATTR=kp;const ug=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}},pg=["width","x1","y1","height","cornerRadius",...up];class gg extends Tp{constructor(t){super(t),this.type="rect",this.numberType=cd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Fp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return Hp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,pg)}needUpdateTag(t){return super.needUpdateTag(t,pg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=ug(e);return t=new Sl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new gg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return gg.NOWORK_ANIMATE_ATTR}}function fg(t){return new gg(t)}gg.NOWORK_ANIMATE_ATTR=kp;const mg=Symbol.for("EnvContribution"),vg=Symbol.for("VGlobal"),yg="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",_g={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"}},bg=!0,xg=!1,Sg=/\w|\(|\)|-/,Ag=/[.?!,;:/,。?!、;:]/,kg=/\S/,Cg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=ah.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=Mg(t,a)),a}function Mg(t,e,i=!1){let s=e;for(;Sg.test(t[s-1])&&Sg.test(t[s])||Ag.test(t[s]);)if(s--,s<=0)return i?Tg(t,e):e;return s}function Tg(t,e){let i=e;for(;Sg.test(t[i+1])&&Sg.test(t[i])||Ag.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=ah.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Eg{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=_g[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Pg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Og{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=kh(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Pg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Pg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=wg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Rg extends eg{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=ph(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=ph(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=eh.width,height:e=eh.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Ig{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Rg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=_g[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=kg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Rg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Rg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Rg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||xg;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,Cg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||bg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?nu(t,s,{AABBBounds:i}):s,Cg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Rg)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Rg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=_g[this.direction]}store(t){if(t instanceof Rg){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Ig(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Rg?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character,t.ascentDescentMode),new Og(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Lg=!1;try{Lg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Lg=!1}const Fg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...up];class zg extends Tp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ud,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:th.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:th.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:th.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:th.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:th.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:th.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:th.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:th.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Fp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&zg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&zg.splitText(t.text).length>1)))}static splitText(t){if(Lg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=zg.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),ah.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||ah.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!zg.AllSingleCharacter(y)&&(y=zg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),w=new Eg(0,0,(k?n:S?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&S,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(w);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&w.lines[w.lines.length-1].paragraphs.push(s)):M.deal(s,!0),w.lines.length!==t&&(t=w.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,w.lines[w.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===w.layoutDirection?k:C)){const t=w.getActualSizeWidthEllipsis();let e="horizontal"===w.layoutDirection?t.width:t.height;("horizontal"===w.layoutDirection?S:A)&&(e=Math.min(e,"horizontal"===w.layoutDirection?i:s)),w.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&w.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new zg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function Hg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},kp);class jg extends Jp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ng(t){return new jg(t)}const Vg=["symbolType","size",...up];let Wg=class t extends Tp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=gd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Fp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=ah.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Uc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return ah.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Sl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Sl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Ug(t){return new Wg(t)}function Gg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Yg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Xg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[li(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=li(s);d(t[s])||(e[n]=i(t[s]))})),u(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&v(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},kp);class Kg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Cl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=fd}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Fp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new qg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ce(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=ah.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Uc(n,o/Math.abs(r+a),!0,l),i.union(n)}return ah.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||ah.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Kg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new Kg(a,w,C),T=y(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=T.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=Gg(y,a),e=this.cache.verticalList.length*v,i=Yg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>Kc(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Xc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const S=Gg(y,a),A=x.verticalList.length*v,k=Yg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=kh(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=$g){return super.needUpdateTags(t,e)}needUpdateTag(t,e=$g){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return qg.baselineMapAlign}getAlignMapBaseline(){return qg.alignMapBaseline}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},kp),qg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},qg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Jg=["heightLimit","lineClamp"];class Qg extends qg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=kh(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=ah.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new Kg(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),w=[],M=[0,0];let T=1/0;if(y>0&&(T=Math.max(Math.floor(y/x),1)),b&&(T=Math.min(T,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 df extends cf{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let uf=0;class pf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=ah.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++uf,t),this.tryRunAnimationFrameNextFrame(),uf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class gf{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var ff=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 mf extends gf{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new df(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new pf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new pf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return ff(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class vf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Cd(Object.assign({nativeCanvas:ah.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Cd(Object.assign({nativeCanvas:ah.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const yf=new vf,_f=Symbol.for("VWindow"),bf=Symbol.for("WindowHandlerContribution");function xf(t){const e=ah.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Sf extends gf{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(t=ah.global,e=xf){super(),this.handlerFactory=e,this.hooks={onChange:new df(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class Af{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=ah.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=yf.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=ah.windowFactory)||void 0===s?void 0:s.call(ah))&&void 0!==n?n:new Sf(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var kf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(kf||(kf={}));const Cf=new Ue;class wf{constructor(){this.matrix=new Ue}init(t){return this.mode=kf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=kf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Cf.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(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Cf.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(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}scale(t,e,i){return this.mode===kf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===kf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Cf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Cf.a,Cf.b,Cf.c,Cf.d,Cf.e,Cf.f),this}translate(t,e){return this.mode===kf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===kf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const Mf=Symbol.for("@visactor/vrender-core/factory-state");function Tf(){const t=globalThis;return t[Mf]||(t[Mf]={pluginClasses:{}}),t[Mf]}class Bf{constructor(){this.global=ah.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ue(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new ne(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Ef=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 Pf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Of(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Pf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Pf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Lf{constructor(){this.time=xo.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(Hf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Fp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Xf(t,e,i,s)}}const Ff=new Lf,zf=new Set(["top","center","bottom"]);function Hf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function jf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Nf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Nf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:jf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Uf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:zf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Gf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Yf(t){if(!t)return null;const e=Gf(t.naturalWidth,t.videoWidth,t.width),i=Gf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Xf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Yf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Uf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=yf.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),yf.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class Kf{constructor(t){this.subRenderContribitions=t,this.time=xo.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)}))}}class $f{constructor(){this.time=xo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const qf=new $f;class Zf{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Jf=new Zf,Qf={getContributions:()=>[]};class tm{constructor(t=[],e=Qf,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Of(e,jl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ne,this.backupDirtyBounds=new Ne,this.global=null!==(s=i.global)&&void 0!==s?s:ah.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:ah.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:Qf,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,xu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=If(e,i,jl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=xu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),xu.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||function(){const t=ah.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class im{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class sm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class nm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const am={getContributions:()=>[]};class om{constructor(t=am,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new nm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class lm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class hm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=ah.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=ah.global.getRequestAnimationFrame();this.rafId=t((()=>{ah.global.devicePixelRatio!==this.dpr&&(this.dpr=ah.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=ah.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class cm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,ah.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const dm=new Ve;class um{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&mo.UPDATE_PAINT)||s._updateTag&mo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(dm.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(dm,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let pm;function gm(){if(null==pm)try{const t=document.createElement("canvas"),e=t.getContext("2d");pm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),pm&&(pm=!!document.createElement)}catch(t){pm=!1}}function fm(){gm();const t=ah.global&&ah.global.env;return t?"browser"===t:pm}function mm(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle: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(ru(t),hu(t,t,[n+o,r+l,a+h]),hu(t,t,[y[0],y[1],y[2]]),au(t,t,g),ou(t,t,p),hu(t,t,[-y[0],-y[1],y[2]]),du(t,t,[c,d,u]),f){const i=Su.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]}hu(i,i,[s[0],s[1],0]),lu(i,i,f),hu(i,i,[-s[0],-s[1],0]),uu(t,t,i)}}function vm(t){const{alpha:e,beta:i}=t.attribute;return e||i}class ym{constructor(t=of){this.creator=t,this.hooks={onAttributeUpdate:new df(["graphic"]),onSetStage:new df(["graphic","stage"]),onRemove:new df(["graphic"]),onRelease:new df(["graphic"]),onAddIncremental:new df(["graphic","group","stage"]),onClearIncremental:new df(["graphic","group","stage"]),beforeUpdateAABBBounds:new df(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new df(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new df(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Yg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Gg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Uc(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;Uc(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const _m="white";class bm extends Jp{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:_m}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,y,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new df(["stage"]),afterRender:new df(["stage"]),afterClearScreen:new df(["stage"]),afterClearRect:new df(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:ah.global,!this.global.env&&fm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:ah.windowFactory)&&void 0!==n?n:()=>new Sf(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=ah.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=ah.renderServiceFactory)||void 0===h?void 0:h.call(ah))&&void 0!==c?c:ah.renderService)&&void 0!==d?d:new em,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=ah.pluginServiceFactory)||void 0===p?void 0:p.call(ah))&&void 0!==g?g:ah.pluginService)&&void 0!==f?f:new om,this.layerService=null!==(y=null!==(m=e.layerService)&&void 0!==m?m:ah.layerService)&&void 0!==y?y:new wm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:ah.graphicService)&&void 0!==b?b:new ym,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:_m,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,rp(s)),hp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new eo(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=km.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=km.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=km.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new lm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new hm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new cm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ne;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new um,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=km.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=km.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=km.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return rp({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class xm{constructor(t=bm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Sm extends Jp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{ah.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=>{ah.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)))}}class Am{constructor(t=Sm){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let km=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Cm(t){const e=ah.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}km._pluginClasses=Tf().pluginClasses;class wm{static GenerateLayerId(){return`${wm.idprefix}_${wm.prefix_count++}`}constructor(t=ah.global,e=new Am,i=Cm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:wm.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)}}wm.idprefix="visactor_layer",wm.prefix_count=0;const Mm=Symbol.for("TransformUtil"),Tm=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Em=Symbol.for("StaticLayerHandlerContribution"),Pm=Symbol.for("DynamicLayerHandlerContribution"),Om=Symbol.for("VirtualLayerHandlerContribution"),Rm=Symbol.for("@visactor/vrender-core/contribution-store-state");function Im(){const t=globalThis;return t[Rm]||(t[Rm]={store:new Map}),t[Rm]}const Dm=Symbol("ContributionProvider");class Lm{constructor(t,e){this.serviceIdentifier=t,this.container=e,jm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function Fm(t,e){return new Lm(t,e)}function zm(t,e){t(Dm).toDynamicValue((({container:t})=>Fm(e,t))).inSingletonScope().whenTargetNamed(e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>Fm(e,t))).whenTargetNamed(e)}class jm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}jm.store=Im().store;class Nm{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=Ql.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Mg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Mg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Nm{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Um({bind:t}){t(vg).toDynamicValue((({container:t})=>new mf(Fm(mg,t)))).inSingletonScope(),t(_f).to(Sf),t(Tm).toDynamicValue((({container:t})=>new Af(Fm(Vm,t)))).inSingletonScope(),t(Mm).to(wf).inSingletonScope(),t(Bm).to(wm).inSingletonScope()}const Gm=Symbol.for("RenderService"),Ym=Symbol.for("BeforeRenderConstribution");function Xm({bind:t}){t(Gm).to(em)}const Km=Symbol.for("GraphicPicker"),$m=Symbol.for("PickerService"),qm=Symbol.for("BoundsPicker"),Zm=Symbol.for("GlobalPickerService"),Jm=Symbol.for("PickItemInterceptor"),Qm=Symbol.for("PickServiceInterceptor"),tv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===td,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},ev=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class iv extends gg{constructor(t){super(t),this.type="rect3d",this.numberType=dd}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Yt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return Fp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=ah.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,nv)}needUpdateTag(t){return super.needUpdateTag(t,nv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Sl,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new rv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rv.NOWORK_ANIMATE_ATTR}}function av(t){return new rv(t)}rv.NOWORK_ANIMATE_ATTR=kp;class ov extends Np{constructor(t){super(t),this.type="arc3d",this.numberType=td}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return ov.NOWORK_ANIMATE_ATTR}}function lv(t){return new ov(t)}ov.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);class hv extends cg{constructor(t){super(t),this.type="pyramid3d",this.numberType=hd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),ah.graphicService.updateTempAABBBounds(i),ah.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return hv.NOWORK_ANIMATE_ATTR}}function cv(t){return new hv(t)}let dv,uv;function pv(t){return dv||(dv=hf("text",{})),dv.initAttributes(t),dv.AABBBounds}function gv(t){return uv||(uv=hf("richtext",{})),uv.setAttributes(t),uv.AABBBounds}hv.NOWORK_ANIMATE_ATTR=kp;class fv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Fp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=xu.allocateByObj(a),u=new ne(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class vv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=tv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function _v({bind:t,isBound:e}){e($m)||(t(Zm).toSelf(),t($m).toService(Zm)),t(yv).toSelf().inSingletonScope(),t(Jm).toService(yv),t(mv).toSelf().inSingletonScope(),t(Jm).toService(mv),t(vv).toSelf().inSingletonScope(),t(Jm).toService(vv),zm(t,Jm),t(fv).toSelf().inSingletonScope(),t(Qm).toService(fv),zm(t,Qm)}function bv({bind:t}){t(md).to(ym),t(vd).toConstantValue(of)}const xv=Symbol.for("AutoEnablePlugins"),Sv=Symbol.for("PluginService");class Av{constructor(){this.type="static",this.offscreen=!1,this.global=ah.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Cd({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()}}function kv(t){(function({bind:t}){zm(t,mg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),zm(t,Vm)}({bind:t.bind}),function({bind:t}){t(Av).toSelf(),t(Em).toService(Av)}({bind:t.bind})}const Cv=zt/2;function wv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!$(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Cv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!$(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Cv,!1)}if(o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),!$(S,A)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Cv,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Cv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Mv(t,e){return!(!t&&!e)}function Tv(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Ev(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Pv(t,e){return t*e>0}function Ov(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Rv(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*uE*E+P*P&&(k=w,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Ut(c),k=n*Xt(c),C=s*Ut(u),w=s*Xt(u);let M,T,B,E;if((b>Ft||_>Ft)&&(M=n*Ut(d),T=n*Xt(d),B=s*Ut(p),E=s*Xt(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:B,yirs:E,xore:M,yore:T,xire:C,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Lv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Nt-Ft)e.moveTo(i+n*Ut(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Ut(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:w,innerDeltaAngle:M,innerEndAngle:T,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:O}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(y,m),o=Iv(g,f,u,p,n,t,Number(c)),l=Iv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Ut(Wt(l.y01,l.x01)),s+o.cy+m*Xt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ut(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Ut(C),s+n*Xt(C));if(!(r>Ft)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(w>Ft){const t=Yt(E,w),n=Yt(P,w),o=Iv(S,A,b,x,r,-n,Number(c)),l=Iv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ut(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,T,B,c):e.moveTo(i+r*Ut(B),s+r*Xt(B))}return a?a[3]&&e.lineTo(i+n*Ut(o),s+n*Xt(o)):e.closePath(),d}const Fv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class zv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=yf.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])),yf.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Nt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=yf.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Ug({}));const C=h.columns?v/h.columns:b,w=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,w-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:Fv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=yf.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),yf.free(l),c}yf.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const Hv=new zv;class jv{constructor(){this.time=xo.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,w-=m;const T=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:su(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:w-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Lv(t,e,i,s,M+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&T(u,"outerBorder"),f&&T(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:w,startAngle:y,endAngle:_})}}const Nv=new jv,Vv=Hv,Wv=Ff;class Uv{constructor(){this.time=xo.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:su(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Gv=new Uv,Yv=Hv,Xv=Ff;class Kv extends Lf{constructor(){super(...arguments),this.time=xo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(Hf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const $v=new Kv;function qv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Zv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:M,height:T}=t.attribute;M=(null!=M?M:k-i)||0,T=(null!=T?T:C-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:su(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,T-o*g)):(e.beginPath(),wv(e,u,p,M-o*g,T-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}class Jv{constructor(){this.time=xo.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;qv(p)&&(u.doStroke=!1)}}class Qv{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,qv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return wv(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ty=new Zv,ey=Hv,iy=Ff;class sy extends Zv{constructor(){super(...arguments),this.time=xo.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)}}const ny=new sy,ry=Ff;class ay{constructor(){this.time=xo.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:su(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class oy{constructor(){this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const ly=new ay,hy=new oy,cy=Hv,dy=Ff,uy=Hv,py=Ff;class gy extends zv{constructor(){super(...arguments),this.time=xo.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:bh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:bh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:bh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:bh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class fy{constructor(t){this.groupRenderContribitions=t,this.numberType=nd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push($v)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Fp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:w=l.y}=t.attribute,M=Ev(p,m,g,f,c),T=Ov(p,v,g,f),B=Mv(c,u),E=Tv(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(M||T||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),wv(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push($v));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===xo.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o,P)})),h&&e.clip();const O=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,w-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,C-i,w-s,l),e.stroke()))};A?(R(),O()):(O(),R()),this._groupRenderContribitions.forEach((r=>{r.time===xo.afterFillStroke&&r.drawShape(t,e,i,s,B,E,M,T,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=ah.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Fp(t,null==s?void 0:s.theme).group,i=Su.allocate(),n=Su.allocate();mm(n,t,e),uu(i,p||i,n),a.modelMatrix=i,Su.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Su.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var my,vy=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"}(my||(my={}));class yy extends tm{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=my.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new df([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return vy(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return vy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return vy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>vy(this,void 0,void 0,(function*(){if(2!==t.count)yield Rf(t,jl.zIndex,((i,s)=>{if(this.status===my.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return vy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return vy(this,void 0,void 0,(function*(){this.rendering&&(this.status=my.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=my.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 vy(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:()=>vy(this,void 0,void 0,(function*(){yield Rf(t,jl.zIndex,(t=>vy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const _y=Symbol.for("IncrementalDrawContribution"),by=Symbol.for("ArcRender"),xy=Symbol.for("Arc3dRender"),Sy=Symbol.for("AreaRender"),Ay=Symbol.for("CircleRender"),ky=Symbol.for("GraphicRender"),Cy=Symbol.for("GroupRender"),wy=Symbol.for("LineRender"),My=Symbol.for("PathRender"),Ty=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Ey=Symbol.for("Rect3DRender"),Py=Symbol.for("SymbolRender"),Oy=Symbol.for("TextRender"),Ry=Symbol.for("RichTextRender"),Iy=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Ly=Symbol.for("ImageRender"),Fy=Symbol.for("RenderSelector"),zy=Symbol.for("DrawContribution"),Hy=Symbol.for("StarRender"),jy=Symbol.for("DrawItemInterceptor"),Ny=new Ve,Vy=new Ve;class Wy{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){Ny.copy(s.dirtyBounds),Vy.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,xu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Ny),s.backupDirtyBounds.copy(Vy)),!0}}class Uy{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}}class Gy{constructor(){this.order=1,this.interceptors=[new Wy,new Xy,new Yy,new Uy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Su.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const Ky=Symbol.for("ArcRenderContribution"),$y=Symbol.for("AreaRenderContribution"),qy=Symbol.for("CircleRenderContribution"),Zy=Symbol.for("GroupRenderContribution"),Jy=Symbol.for("ImageRenderContribution"),Qy=Symbol.for("PathRenderContribution"),t_=Symbol.for("PolygonRenderContribution"),e_=Symbol.for("RectRenderContribution"),i_=Symbol.for("SymbolRenderContribution"),s_=Symbol.for("TextRenderContribution"),n_=Symbol.for("StarRenderContribution"),r_=Symbol.for("CommonRenderContribution"),a_=Symbol.for("InteractiveSubRenderContribution");function o_(t){!function({bind:t}){t(Lf).toSelf().inSingletonScope(),t(zv).toSelf().inSingletonScope(),t(zy).to(tm),t(_y).to(yy),t(Cy).toDynamicValue((({container:t})=>new fy(Fm(Zy,t)))).inSingletonScope(),t(ky).toService(Cy),zm(t,Zy),zm(t,a_),t(Kf).toDynamicValue((({container:t})=>new Kf(Fm(a_,t)))).inSingletonScope(),zm(t,ky),t(Gy).toSelf().inSingletonScope(),t(jy).toService(Gy),zm(t,jy)}({bind:t.bind})}class l_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class h_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new l_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function c_(){return new h_}const d_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const u_=function(){const t=globalThis;return t[d_]||(t[d_]={legacyBindingContext:c_(),preloaded:!1}),t[d_]}(),p_=u_.legacyBindingContext;function g_(){u_.preloaded||(u_.preloaded=!0,Um({bind:p_.bind}),bv({bind:p_.bind}),Xm({bind:p_.bind}),_v({bind:p_.bind,isBound:p_.isBound}),function({bind:t}){t(Sv).to(om),Hm(t,xv)}({bind:p_.bind}),kv(p_),o_(p_))}function f_(){return p_}function m_(t){g_();const[e]=p_.getAll(t);return e}function v_(t,e){return g_(),p_.getNamed(t,e)}function y_(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const __=y_((()=>m_(vg)));ah.global=__;class b_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?ah.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:ah.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Xg("text"===t.type&&t.attribute?t.attribute:Fp(t).text)}getTransformOfText(t){const e=Fp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const u=t.globalAABBBounds;let g=n.anchorType;if(d(g)&&(g="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===g&&(g="top-left"),"position"===g||u.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=Fe(u,g);l=t.x,h=t.y}const f=ah.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),y=e.viewBox,_=l+m.left-f.left+y.x1,b=h+m.top-f.top+y.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===g&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),c(n.style)){const e=n.style({top:b,left:_,width:u.width(),height:u.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else p(n.style)?o=Object.assign(Object.assign({},o),n.style):v(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));ah.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===ah.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:jl.zIndex)})).forEach((t=>{this.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&&ah.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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=d(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"===ah.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 x_=()=>{km.registerPlugin("HtmlAttributePlugin",b_)};class S_ extends b_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?ah.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&ah.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const A_=()=>{km.registerPlugin("ReactAttributePlugin",S_)};class k_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return k_.instance||(k_.instance=new k_),k_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function C_(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function w_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:M_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=C_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:M_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=C_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:w,customType:M,controlOptions:T}=t,B=e.animate();B.priority=k;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],O=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&O&&(i=null!==(h=P[O])&&void 0!==h?h:i),B.startAt(b);const R=i*x+E;R>0&&B.wait(R);let I=null,D=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.props),L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,M,L,D,_,m,f,T,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(B,e,p,D);let z=0;x&&(z=x*(s-i-1));const H=c(y)?y(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&B.wait(z),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,y,_,b;if(e&&i){i=C_(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(y=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:M_.builtInAnimateMap[r],m=t.custom?t.customType:C_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{w_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}M_.builtInAnimateMap={};const T_="appear",B_="disappear",E_="update",P_="highlight",O_="unhighlight";class R_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class I_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new M_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new M_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([T_],[{name:T_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyHighlightState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([O_],[{name:O_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new I_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new R_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class L_{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-L_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*L_.bounceIn(2*t):.5*L_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){L_[t]=e}}function F_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}L_.quadIn=L_.getPowIn(2),L_.quadOut=L_.getPowOut(2),L_.quadInOut=L_.getPowInOut(2),L_.cubicIn=L_.getPowIn(3),L_.cubicOut=L_.getPowOut(3),L_.cubicInOut=L_.getPowInOut(3),L_.quartIn=L_.getPowIn(4),L_.quartOut=L_.getPowOut(4),L_.quartInOut=L_.getPowInOut(4),L_.quintIn=L_.getPowIn(5),L_.quintOut=L_.getPowOut(5),L_.quintInOut=L_.getPowInOut(5),L_.backIn=L_.getBackIn(1.7),L_.backOut=L_.getBackOut(1.7),L_.backInOut=L_.getBackInOut(1.7),L_.elasticIn=L_.getElasticIn(1,.3),L_.elasticOut=L_.getElasticOut(1,.3),L_.elasticInOut=L_.getElasticInOut(1,.3*1.5),L_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),L_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},L_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)L_[`flicker${t}`]=e=>F_(e,t);for(let t=2;t<10;t++)L_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function z_(t,e,i){return t+(e-t)*i}const H_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=z_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=z_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=z_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=z_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=z_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=z_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=z_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=z_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=z_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Pu(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Fu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Pu(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Fu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=z_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=z_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=z_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=z_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=z_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=z_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=z_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=z_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=z_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=z_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=_h(e,i,s),r.addUpdateBoundTag()}}};function j_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:yo.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=L_[s])&&void 0!==n?n:L_.linear:L_.linear,"wait"===t&&(this.onUpdate=q_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=q_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=Bu.Get(i,Tu.Color255),r=Bu.Get(s,Tu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(H_["fill"===e?"fillPure":"strokePure"])}else H_[e]?t.push(H_[e]):t.push(j_)}else H_[e]?t.push(H_[e]):t.push(j_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class Q_ extends J_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();K_(this.target,t,yo.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class tb extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const eb=new tb;eb.isGlobal=!0;class ib extends J_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class sb extends ib{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class nb extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class rb extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){K_(this.target,this.from,yo.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ab(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class hb{constructor(t=Va.GenAutoIncrementId(),e=eb,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(lb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new J_(Tl.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new Q_(Tl.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new rb(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(lb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&K_(this.target,this._startProps,yo.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const cb=new pf;class db{constructor(){this.released=!1}tick(t,e){cb.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class ub extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ml.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ml.INITIAL,ah.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),ah.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new db;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ml.INITIAL&&(this.status=Ml.PAUSE,!0)}resume(){return this.status!==Ml.INITIAL&&(this.status=Ml.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ml.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ml.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ml.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ml.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ml.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ml.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,ah.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function gb(){U(Tp,D_),U(Tp,pb)}function fb(){lf("arc",Vp)}function mb(){lf("arc3d",lv)}function vb(){lf("area",Gp)}function yb(){lf("circle",Kp)}function _b(){lf("glyph",qp)}function bb(){lf("group",Qp)}function xb(){lf("image",ig)}function Sb(){lf("line",rg)}function Ab(){lf("path",lg)}function kb(){lf("polygon",dg)}function Cb(){lf("pyramid3d",cv)}function wb(){lf("rect",fg)}function Mb(){lf("rect3d",sv)}function Tb(){lf("richtext",Hg)}function Bb(){lf("shadowRoot",Ng)}function Eb(){lf("star",av)}function Pb(){lf("symbol",Ug)}function Ob(){lf("text",Zg)}function Rb(){lf("wrapText",tf)}function Ib(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Lb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(qf),e(Jf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===xo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===xo.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Fp(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=Bv(d,u,h),_=Pv(d,g),b=Mv(h),x=Tv(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Mo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Pv(o,c),g=Mv(n,r),f=Tv(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||vm(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Su.allocate(),n=Su.allocate();mm(n,t,e),uu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Su.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Su.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class Fb extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Qc,this.builtinContributions=[Nv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nFt){const t=Yt(b,_),r=Yt(x,_),a=Iv(v,y,f,m,n,t,Number(u)),o=Iv(A,k,C,w,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||T<.001)e.lineTo(i+C,s+w),p=!0;else if(M>Ft){const t=Yt(E,M),n=Yt(P,M),a=Iv(C,w,A,k,r,-n,Number(u)),o=Iv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Ut(B),s+r*Xt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Fp(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let w=0;const M=(h(S)&&S||S[0])&&"conical"===c.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Nt-Ft){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),T||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Uu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const zb=new WeakSet;function Hb({bind:t}){Ib(zb,t)||(t(Fb).toDynamicValue((({container:t})=>new Fb(Fm(Ky,t)))).inSingletonScope(),t(by).toService(Fb),t(ky).toService(by),t(Ky).toService(Kf),zm(t,Ky))}const jb=Hb;class Nb extends Lb{constructor(){super(...arguments),this.numberType=td}drawShape(t,e,i,s,n,r,a,o){var l;const h=Fp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Tu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},w={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Nt-Ft)e.moveTo(i+r*Ut(o),s+r*Xt(o),n),e.arc(i,s,r,o,l,!c,n),a>Ft&&(e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Ut(p),y=r*Xt(p),_=a*Ut(f),b=a*Xt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>Ft)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Nt,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=Ft)e.moveTo(i,s,n);else if(c>=Nt-Ft)e.moveTo(i+a*Ut(l),s+a*Xt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Ut(h),s+a*Xt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Ut(c),f=a*Xt(c),m=a*Ut(p),v=a*Xt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(w[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Ib(Vb,t)||(t(Nb).toDynamicValue((()=>new Nb)).inSingletonScope(),t(xy).toService(Nb),t(ky).toService(xy))}const Ub=Wb;function Gb(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]=Lo(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 Yb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?_o.ROW:_o.COLUMN,Number.isFinite(c)||(o=_o.COLUMN),Number.isFinite(d)||(o=_o.ROW);const u=i*(o===_o.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Gb(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),Gb(t,l,1,s),o=!1):o=!0}t.closePath()}function Kb(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function $b(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Kb(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Gb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=_o.ROW:"y"===s?u=_o.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Zb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Jb=new gy,Qb=Ff;class tx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ed,this.builtinContributions=[Jb,Qb],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Fp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:w,points:M,segments:T}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===C&&!T&&!M.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,_,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=xl(E(t.points,x),B,{startPoint:e,curveTension:b});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=xl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=xl(e,B,{curveTension:b}),n=xl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Yt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=_o.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Vt(_.x-b.x),A=Vt(_.y-b.y);x=null==_.x1?_o.ROW:null==_.y1?_o.COLUMN:Number.isFinite(S+A)?S>A?_o.ROW:_o.COLUMN:_o.ROW,Yb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),$b(t,i[0]?e.top:e.bottom,l,x===_o.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ex=new WeakSet;function ix({bind:t}){Ib(ex,t)||(t(tx).toDynamicValue((({container:t})=>new tx(Fm($y,t)))).inSingletonScope(),t(Sy).toService(tx),t(ky).toService(Sy),t($y).toService(Kf),zm(t,$y))}const sx=ix;class nx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Gv,Xv,Yv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const rx=new WeakSet;function ax({bind:t}){Ib(rx,t)||(t(nx).toDynamicValue((({container:t})=>new nx(Fm(qy,t)))).inSingletonScope(),t(Ay).toService(nx),t(ky).toService(Ay),t(qy).toService(Kf),zm(t,qy))}const ox=ax;class lx{constructor(){this.numberType=sd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Fp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const hx=new WeakSet;function cx({bind:t}){Ib(hx,t)||(t(lx).toDynamicValue((()=>new lx)).inSingletonScope(),t(Dy).toService(lx),t(ky).toService(Dy))}const dx=cx,ux=["","repeat-x","repeat-y","repeat"];function px(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?ux[i]:"no-repeat"}function gx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=px(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const fx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function mx(t){return{backgroundMode:fx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function vx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=gx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function yx(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=gx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?mx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Xf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class _x extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=rd,this.builtinContributions=[ny,ry],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:_=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:w,doStroke:M}=A;if(!S||!t.resources)return;const T=t.resources.get(S);if("success"!==T.state)return;const B=t.width,E=t.height;e.beginPath();let P=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,B,E):(wv(e,i,s,B,E,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const O=()=>{w&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),yx(e,T.data,i,s,B,E,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x})))},R=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=vx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:_,imageOffsetY:b,imagePosition:x}),D=P||I;g?(R(),D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore()):(D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,w,!1,k,!1,l,n,a),O(),D&&e.restore(),R()),this.afterRenderStep(t,e,i,s,w,!1,k,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&v(s))return void oh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Fp(t).image;this._draw(t,a,!1,i)}}const bx=new WeakSet;function xx({bind:t}){Ib(bx,t)||(t(Ly).toDynamicValue((({container:t})=>new _x(Fm(Jy,t)))).inSingletonScope(),t(ky).toService(Ly),t(Jy).toService(Kf),zm(t,Jy))}const Sx=xx;class Ax extends Lb{constructor(){super(...arguments),this.numberType=ad}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();$b(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=xl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const kx=new WeakSet;function Cx({bind:t}){Ib(kx,t)||(t(Ax).toDynamicValue((()=>new Ax)).inSingletonScope(),t(wy).toService(Ax),t(ky).toService(wy))}const Mx=Cx,Tx=Hv,Bx=Ff;class Ex extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=od,this.builtinContributions=[Bx,Tx],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:Fp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Mo(t.pathShape.commandList,e,i,s,1,1,f);else{Mo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Px=new WeakSet;function Ox({bind:t}){Ib(Px,t)||(t(Ex).toDynamicValue((({container:t})=>new Ex(Fm(Qy,t)))).inSingletonScope(),t(My).toService(Ex),t(ky).toService(My),t(Qy).toService(Kf),zm(t,Qy))}const Rx=Ox;function Ix(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Ix(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Ix(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Lx(h,y,_,d,u),A=Lx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,w=Dx(k,C),M=Lx(h,Dx(y,v),w,k,C);let T=Math.atan2(S.y-M.y,S.x-M.x);const B=Math.atan2(A.y-M.y,A.x-M.x);let E=B-T;E<0&&(T=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const jx=new WeakSet;function Nx({bind:t}){Ib(jx,t)||(t(Ty).toDynamicValue((({container:t})=>new Hx(Fm(t_,t)))).inSingletonScope(),t(ky).toService(Ty),t(t_).toService(Kf),zm(t,t_))}const Vx=Nx;class Wx extends Lb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Tu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Ux extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=hd}drawShape(t,e,i,s,n,r,a,o){var l;const h=Fp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=Fp(t).polygon;this._draw(t,s,!1,i)}}const Gx=new WeakSet;function Yx({bind:t}){Ib(Gx,t)||(t(Ux).toDynamicValue((()=>new Ux)).inSingletonScope(),t(Iy).toService(Ux),t(ky).toService(Iy))}const Xx=Yx;class Kx extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=cd,this.builtinContributions=[ty,iy,ey],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Fp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:M}=t.attribute;w=(null!=w?w:b-S)||0,M=(null!=M?M:x-A)||0;const T=Ev(g,f,w,M,h),B=Ov(g,v,w,M,C),E=Mv(h,c),P=Tv(d,m);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||B||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,M)):(e.beginPath(),wv(e,i,s,w,M,u,"bevel"!==p));const O={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,T,B,l,n,a,o,O),k?(this._runStroke(t,e,i,s,l,O,B,S,A,o),this._runFill(t,e,i,s,l,O,T,S,A,a)):(this._runFill(t,e,i,s,l,O,T,S,A,a),this._runStroke(t,e,i,s,l,O,B,S,A,o)),this.afterRenderStep(t,e,i,s,E,P,T,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const $x=new WeakSet;function qx({bind:t}){Ib($x,t)||(t(Kx).toDynamicValue((({container:t})=>new Kx(Fm(e_,t)))).inSingletonScope(),t(By).toService(Kx),t(ky).toService(By),t(Qv).toSelf(),t(Jv).toSelf(),t(e_).toService(Qv),t(e_).toService(Jv),t(e_).toService(Kf),zm(t,e_))}const Zx=qx;class Jx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=dd}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=Fp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,w=Ev(v,y,A,k,d),M=Ov(v,b,A,k,S),T=Mv(d),B=Tv(u,_);if(!t.valid||!x)return;if(!T&&!B)return;if(!(w||M||a||o))return;const{light:E}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,E,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=Fp(t).rect;this._draw(t,s,!1,i)}}const Qx=new WeakSet;function tS({bind:t}){Ib(Qx,t)||(t(Jx).toDynamicValue((()=>new Jx)).inSingletonScope(),t(Ey).toService(Jx),t(ky).toService(Ey))}const eS=tS;const iS=new class extends Lf{constructor(){super(...arguments),this.time=xo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:T=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:O=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let I,{background:D}=t.attribute;if(!D)return;const L=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=p(D)&&D.background?D:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(g=z.dx)&&void 0!==g?g:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),D=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=pv(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 i=t.resources.get(D);if(!i||"success"!==i.state||!i.data)return void L();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,O&&(e.beginPath(),R?wv(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:w,backgroundKeepAspectRatio:M,backgroundScale:T,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=D,R?(wv(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),L()}};class sS extends Lb{constructor(){super(),this.numberType=ud,this.builtinContributions=[iS],this.init()}drawShape(t,e,i,s,n){const r=Fp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Fp(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(),wv(e,i-t,s-n,v,y,f,!0)),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=Fp(t).richtext;this._draw(t,s,!1,i)}}const nS=new WeakSet;function rS({bind:t}){Ib(nS,t)||(t(sS).toDynamicValue((()=>new sS)).inSingletonScope(),t(Ry).toService(sS),t(ky).toService(Ry))}const aS=rS;class oS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=pd,this.builtinContributions=[py,uy],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const lS=new WeakSet;function hS({bind:t}){Ib(lS,t)||(t(oS).toDynamicValue((({container:t})=>new oS(Fm(n_,t)))).inSingletonScope(),t(Hy).toService(oS),t(ky).toService(Hy),zm(t,n_))}const cS=hS;class dS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[ly,dy,cy,hy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Fp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,M=s,T=C;const B=e.camera;if(k&&B&&e.project){const t=e.project(i,s,C);e.camera=null,y(c)&&(c[0],c[1]),w=t.x,M=t.y,T=void 0}!1===A.draw(e,c,w,M,T,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const uS=new WeakSet;function pS({bind:t}){Ib(uS,t)||(t(dS).toDynamicValue((({container:t})=>new dS(Fm(i_,t)))).inSingletonScope(),t(Py).toService(dS),t(ky).toService(Py),t(i_).toService(Kf),zm(t,i_))}const gS=pS;class fS extends Lb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[iS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Fp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=kh(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:w}=S,M=!f,T=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,w,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,T,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=xu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),xu.free(t)}w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,T))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,T))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,T),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,T)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,T),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,T,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,T,e),this.afterRenderStep(t,e,i,s,C,w,A,k,d,n,a,o)}draw(t,e,i,s){const n=Fp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:Gg(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const mS=new WeakSet;function vS({bind:t}){Ib(mS,t)||(t(Oy).toDynamicValue((({container:t})=>new fS(Fm(s_,t)))).inSingletonScope(),t(ky).toService(Oy),t(s_).toService(Kf),zm(t,s_))}const yS=vS,_S=fm();function bS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function xS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const SS=Symbol.for("MathPickerContribution"),AS=Symbol.for("MathArcPicker"),kS=Symbol.for("MathAreaPicker"),CS=Symbol.for("MathCirclePicker"),wS=Symbol.for("MathImagePicker"),MS=Symbol.for("MathLinePicker"),TS=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),ES=Symbol.for("MathSymbolPicker"),PS=Symbol.for("MathTextPicker"),OS=Symbol.for("MathPolygonPicker"),RS=Symbol.for("MathGlyphPicker"),IS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),LS=Symbol.for("CanvasArc3dPicker"),FS=Symbol.for("CanvasAreaPicker"),zS=Symbol.for("CanvasCirclePicker"),HS=Symbol.for("CanvasImagePicker"),jS=Symbol.for("CanvasGifImagePicker"),NS=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),US=Symbol.for("CanvasRectPicker"),GS=Symbol.for("CanvasRect3dPicker"),YS=Symbol.for("CanvasSymbolPicker"),XS=Symbol.for("CanvasTextPicker"),KS=Symbol.for("CanvasPolygonPicker"),$S=Symbol.for("CanvasPyramid3dPicker"),qS=Symbol.for("CanvasRichTextPicker"),ZS=Symbol.for("CanvasGlyphPicker"),JS=Symbol.for("CanvasGroupPicker"),QS=Symbol.for("CanvasStarPicker"),tA=Symbol.for("CanvasPickerContribution"),eA=f_(),iA=y_((()=>m_(Tm))),sA=y_((()=>m_(Mm))),nA=y_((()=>m_(md))),rA=y_((()=>m_(Bm)));function aA(){ah.global=__,ah.graphicUtil=iA,ah.transformUtil=sA,ah.graphicService=nA,ah.layerService=rA,ah.canvasFactory=t=>v_(Ad,t),ah.context2dFactory=t=>v_(kd,t),ah.windowFactory=()=>new Sf(ah.global),ah.windowHandlerFactory=t=>function(t){const e=v_(bf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),ah.renderServiceFactory=()=>m_(Gm),ah.renderService=y_((()=>m_(Gm))),ah.pluginServiceFactory=()=>m_(Sv),ah.pluginService=y_((()=>m_(Sv))),ah.pickerServiceFactory=()=>m_($m),ah.layerHandlerFactory=t=>m_("static"===t?Em:"dynamic"===t?Pm:Om),ah.incrementalDrawContributionFactory=()=>m_(_y)}aA();var oA=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 lA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return oA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class hA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class cA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Tu.Color1),this.ambient=i;const s=Kt(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=Yt(Gt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=v(e)?Bu.Get(e,Tu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const dA=()=>{km.registerPlugin("DirectionalLight",cA)};class uA{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=Su.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Su.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return pu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Su.allocate()),this._vp=uu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Su.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Su.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return gu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Su.allocate()),this._vp=uu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return fu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;fu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const pA=()=>{km.registerPlugin("OrthoCamera",uA)},gA={getContributions:()=>[]},fA={getContributions:()=>[]};class mA{constructor(t=gA,e=fA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:ah.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:gA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:fA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ue(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Fp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new ne(e.x,e.y);l.transformPoint(a,a);const o=Fp(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&&Su.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),xu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class vA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new im,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new sm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new rm,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new nm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new xm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new Am,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new ef}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new em(new tm([],(t=this.registry.contribution,e=jy,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class yA{constructor(t={}){this.context=new vA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function _A(t={}){return new yA(t)}class bA extends yA{}class xA extends yA{}class SA extends tx{constructor(){super(...arguments),this.numberType=ed}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=Fp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=Mv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=Fp(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=Bv(u,p,c),y=Pv(u,g),_=Mv(c),b=Tv(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{};function DA(){wA.preloaded||(wA.preloaded=!0,Um({bind:MA.bind}),bv({bind:MA.bind}),Xm({bind:MA.bind}),_v({bind:MA.bind,isBound:MA.isBound}),kv(MA),o_(MA))}function LA(t,e){const i=jA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function FA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function zA(t,e){let i=EA.get(t);i||(i=new Map,EA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function HA(t,e,i){const s=zA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function jA(){return DA(),MA}function NA(){jm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=wA.runtimeGlobal)&&void 0!==t||(wA.runtimeGlobal=new mf(Fm(mg,MA))),wA.runtimeGlobal}function WA(t){const e=jA(),i=VA();ah.global=i,ah.canvasFactory=t=>e.getNamed(Ad,t),ah.context2dFactory=t=>e.getNamed(kd,t),ah.windowHandlerFactory=t=>LA(bf,t),ah.windowFactory=()=>new Sf(i,(t=>LA(bf,t))),ah.pluginServiceFactory=()=>new om(Fm(xv,e),{pluginRegistry:t.context.registry.plugin}),ah.incrementalDrawContributionFactory=()=>new yy([],new AA,new SA(Fm($y,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,jy))}function UA(t){var e;const i=jA();NA();const s=i.getAll(ky),n=zA(t.registry.renderer,TA);HA(t.registry.renderer,TA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),FA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,TA)}function GA(t){var e;const i=jA();NA();const s=i.getAll(jy),n=null!==(e=PA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,jy,e)})),n.clear(),PA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(jy));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(jy,e),r.add(e)),n.add(e)}))}function YA(t,e){var i;const s=jA();NA();const n=s.getAll(e),r=zA(t.registry.picker,BA);HA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),FA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function XA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=OA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,IA,t.isBound,t.rebind),function(t,e){let i=OA.get(t);i||(i=new WeakSet,OA.set(t,i)),i.add(e)}(t,e))}function KA(t,{app:e,legacy:i=!0,targets:s}={}){XA(jA(),t),i&&(g_(),XA(f_(),t)),NA(),e&&function(t,e){const i=null!=e?e:RA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&GA(t),s&&UA(t),r.forEach((e=>{YA(t,e)}))}(e,s)}function $A(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function qA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function ZA(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 JA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ak(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=ug(t.attribute),n=lk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=lk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=lk(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{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;n{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return yk(l,e,h),h},gk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return uk(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 uk(t,e)}return[]};const fk=t=>t.map((t=>({x:t.x,y:t.y}))),mk=(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]},vk=t=>{const e=new Ne;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return mk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return mk(t,{x:e.x1,y:n},{x:e.x2,y:n})},yk=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=vk(t);yk(n[0],s,i),yk(n[1],e-s,i)}},_k=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:fk(i)}];const s=[];return yk(i,e,s),s},bk=(t,e)=>{const i=rk(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;rObject.assign({},t))):[]}function Sk(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:xk(t.touches),configurable:!0},changedTouches:{value:xk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Ak(t,e){try{return t[e]}catch(t){return}}function kk(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Sk(t),l=Ak(t,"target"),h=Ak(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Ck=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Tk(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:Mk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},wk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},wk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Ck(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=Mk(i,this.selectionStartCursorIdx),a=Mk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=wk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Tk(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),ah.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),ah.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Ek{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=Mk(i,Math.ceil(t)),n=Mk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=Mk(i.attribute.textConfig,a),h=Mk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Pk,[this.formatTextCommandCb]),this.commandCbs.set(Ok,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):p(t)&&e.forEach((e=>z(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),ah.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(ah.global.isMacOS()&&t.metaKey&&"c"===t.key||!ah.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return ah.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(ah.global.isMacOS()&&t.metaKey&&"a"===t.key||!ah.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},wk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=Hg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:gv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||fg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},wk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),ah.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=Qp({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Rk.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=rg({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=Qp({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=gv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=gv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(fg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(fg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(fg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=gv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=gv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:gv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Jk=new Zk;class Qk{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const tC=()=>{km.registerPlugin("ViewTransform3dPlugin",Qk)},eC=new Ve;class iC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=Fp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&eC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(eC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const sC=()=>{km.registerPlugin("FlexLayoutPlugin",iC)};var nC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:nh,ARC3D_NUMBER_TYPE:td,ARC_NUMBER_TYPE:Qc,AREA_NUMBER_TYPE:ed,AbstractGraphicRender:class{},get AnimateMode(){return wl},get AnimateStatus(){return Bl},get AnimateStepType(){return Tl},AppContext:vA,Application:sh,Arc:Np,Arc3d:ov,Arc3dRender:xy,ArcRender:by,ArcRenderContribution:Ky,Area:Up,AreaRender:Sy,AreaRenderContribution:$y,get AttributeUpdateType(){return yo},AutoEnablePlugins:xv,Base3dRender:Wx,BaseCanvas:Mu,BaseEnvContribution:lA,BaseRender:Lb,get BaseRenderContributionTime(){return xo},BaseWindowHandlerContribution:hA,Basis:Ko,BeforeRenderConstribution:Ym,BoundsContext:so,BoundsPicker:qm,BrowserEntry:yA,CIRCLE_NUMBER_TYPE:id,CONTRIBUTION_STORE_STATE_SYMBOL:Rm,Canvas3DDrawItemInterceptor:Xy,Canvas3DPickItemInterceptor:yv,CanvasFactory:Ad,CanvasTextLayout:Kg,Circle:Xp,CircleRender:Ay,CircleRenderContribution:qy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Tu},CommonDrawItemInterceptorContribution:Gy,CommonRenderContribution:r_,Context2dFactory:kd,ContributionProvider:Dm,ContributionRegistry:rm,ContributionStore:jm,CubicBezierCurve:Fo,CurveContext:bl,get CurveTypeEnum(){return bo},CustomEvent:$a,CustomPath2D:Sl,CustomSymbolClass:Mc,DEFAULT_TEXT_FONT_FAMILY:yg,DebugDrawItemInterceptorContribution:Uy,DefaultArcAllocate:Fk,DefaultArcAttribute:Nl,DefaultArcRenderContribution:jv,DefaultAreaAllocate:Hk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:gy,DefaultAttribute:jl,DefaultBaseBackgroundRenderContribution:Lf,DefaultBaseClipRenderAfterContribution:Zf,DefaultBaseClipRenderBeforeContribution:$f,DefaultBaseInteractiveRenderContribution:Kf,DefaultBaseTextureRenderContribution:zv,DefaultCanvasAllocate:vf,DefaultCanvasArc3DRender:Nb,DefaultCanvasArcRender:Fb,DefaultCanvasAreaRender:tx,DefaultCanvasCircleRender:nx,DefaultCanvasGroupRender:fy,DefaultCanvasImageRender:_x,DefaultCanvasLineRender:Ax,DefaultCanvasPathRender:Ex,DefaultCanvasPolygonRender:Hx,DefaultCanvasPyramid3dRender:Ux,DefaultCanvasRect3dRender:Jx,DefaultCanvasRectRender:Kx,DefaultCanvasSymbolRender:dS,DefaultCanvasTextRender:fS,DefaultCircleAllocate:Nk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Uv,DefaultConnectAttribute:zl,DefaultDebugAttribute:Hl,DefaultFillStyle:Ol,DefaultGlobal:mf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Gl,DefaultGraphicAllocate:Ik,DefaultGraphicMemoryManager:Zk,DefaultGraphicService:ym,DefaultGraphicUtil:Af,DefaultGroupAttribute:Ul,DefaultGroupBackgroundRenderContribution:Kv,DefaultImageAttribute:eh,DefaultImageRenderContribution:sy,DefaultLayerService:wm,DefaultLayout:El,DefaultLineAllocate:Wk,DefaultLineAttribute:Yl,DefaultMat4Allocate:bu,DefaultMatrixAllocate:_u,DefaultPathAllocate:Gk,DefaultPathAttribute:Xl,DefaultPickService:mA,DefaultPickStyle:Ll,DefaultPolygonAttribute:Kl,DefaultRect3dAttribute:Zl,DefaultRectAllocate:Dk,DefaultRectAttribute:ql,DefaultRectRenderContribution:Zv,DefaultRenderService:em,DefaultRichTextAttribute:th,DefaultRichTextIconAttribute:ih,DefaultStarAttribute:$l,DefaultStrokeStyle:Il,DefaultStyle:Fl,DefaultSymbolAllocate:Xk,DefaultSymbolAttribute:Jl,DefaultSymbolClipRangeStrokeRenderContribution:oy,DefaultSymbolRenderContribution:ay,DefaultTextAllocate:$k,DefaultTextAttribute:Ql,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Pl,DefaultTransformUtil:wf,DefaultWindow:Sf,get Direction(){return _o},DirectionalLight:cA,DrawContribution:zy,DrawItemInterceptor:jy,DynamicLayerHandlerContribution:Pm,get Edge(){return hh},EditModule:Bk,EmptyContext2d:Cu,EnvContribution:mg,EventManager:Ja,EventSystem:eo,EventTarget:Qa,FACTORY_STATE_SYMBOL:Mf,FORMAT_ALL_TEXT_COMMAND:Ok,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Pk,Factory:km,FederatedEvent:Ga,FederatedMouseEvent:Ya,FederatedPointerEvent:Xa,FederatedWheelEvent:Ka,FlexLayoutPlugin:iC,GLYPH_NUMBER_TYPE:sd,GRAPHIC_CLASS_SYMBOL:wp,GRAPHIC_REGISTRY_SYMBOL:nf,GRAPHIC_UPDATE_TAG_KEY:up,GROUP_NUMBER_TYPE:nd,Generator:Va,GlobalPickerService:Zm,Glyph:$p,GlyphRender:Dy,GradientParser:iu,Graphic:Tp,GraphicCreator:vd,GraphicFactory:ef,GraphicPicker:Km,GraphicRender:ky,GraphicService:md,GraphicUtil:Tm,Group:Jp,GroupRender:Cy,GroupRenderContribution:Zy,get GroupUpdateAABBBoundsMode(){return Zp},HtmlAttributePlugin:b_,get IContainPointMode(){return vo},IMAGE_NUMBER_TYPE:rd,Image:eg,ImageRender:Ly,ImageRenderContribution:Jy,IncrementalDrawContribution:_y,InteractiveDrawItemInterceptorContribution:Yy,InteractivePickItemInterceptorContribution:vv,InteractiveSubRenderContribution:a_,LINE_NUMBER_TYPE:ad,Layer:Sm,LayerFactory:Am,LayerService:Bm,Line:ng,LineRender:wy,Linear:Uo,LinearClosed:ul,Mat4Allocate:vu,MatrixAllocate:mu,get MeasureModeEnum(){return Cl},MiniappEntry:xA,MonotoneX:el,MonotoneY:il,NOWORK_ANIMATE_ATTR:kp,Node:Ua,NodeEntry:bA,OrthoCamera:uA,PATH_NUMBER_TYPE:od,POLYGON_NUMBER_TYPE:ld,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:hd,Path:og,PathRender:My,PathRenderContribution:Qy,PerformanceRAF:pf,PickItemInterceptor:Jm,PickServiceInterceptor:Qm,PickerRegistry:sm,PickerService:$m,PluginRegistry:nm,PluginService:Sv,Polygon:cg,PolygonRender:Ty,PolygonRenderContribution:t_,Pyramid3d:hv,Pyramid3dRender:Iy,RECT3D_NUMBER_TYPE:dd,RECT_NUMBER_TYPE:cd,RICHTEXT_NUMBER_TYPE:ud,RUNTIME_INSTALLER_STATE_SYMBOL:kA,RafBasedSTO:xh,ReactAttributePlugin:S_,Rect:gg,Rect3DRender:Ey,Rect3d:iv,RectRender:By,RectRenderContribution:e_,ReflectSegContext:No,RenderSelector:Fy,RenderService:Gm,RendererRegistry:im,ResourceLoader:oh,RichText:zg,RichTextEditPlugin:Rk,RichTextRender:Ry,STAR_NUMBER_TYPE:pd,get STATUS(){return Ml},SVG_ATTRIBUTE_MAP:yd,SVG_ATTRIBUTE_MAP_KEYS:_d,SVG_PARSE_ATTRIBUTE_MAP:bd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:xd,SYMBOL_NUMBER_TYPE:gd,SegContext:jo,ShadowPickServiceInterceptorContribution:fv,ShadowRoot:jg,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:mv,SplitRectAfterRenderContribution:Qv,SplitRectBeforeRenderContribution:Jv,Stage:bm,StageFactory:xm,Star:rv,StarRender:Hy,StarRenderContribution:n_,StateDefinitionCompiler:Ku,StateEngine:Ju,StaticLayerHandlerContribution:Em,Step:ol,StepClosed:ll,Symbol:Wg,SymbolRender:Py,SymbolRenderContribution:i_,TEXT_NUMBER_TYPE:fd,Text:qg,get TextDirection(){return Xc},TextMeasureContribution:Vm,TextRender:Oy,TextRenderContribution:s_,Theme:Dp,TransformUtil:Mm,get UpdateTag(){return mo},VGlobal:vg,VWindow:_f,ViewTransform3dPlugin:Qk,VirtualLayerHandlerContribution:Om,WILDCARD:"*",WindowHandlerContribution:bf,WrapText:Qg,XMLParser:Vc,_calculateLineHeight:Ah,_interpolateColor:Ou,addArcToBezierPath:Co,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:nk,alignSubpath:JA,application:ah,applyTransformOnBezierCurves:ak,arc3dModule:Ub,arcModule:jb,areaModule:sx,bezier:Ao,bezierCurversToPath:ok,binarySplitPolygon:vk,bindArc3dRenderModule:Wb,bindArcRenderModule:Hb,bindAreaRenderModule:ix,bindCircleRenderModule:ax,bindContributionProvider:zm,bindContributionProviderNoSingletonScope:Hm,bindGlyphRenderModule:cx,bindImageRenderModule:xx,bindLineRenderModule:Cx,bindPathRenderModule:Ox,bindPolygonRenderModule:Nx,bindPyramid3dRenderModule:Yx,bindRect3dRenderModule:tS,bindRectRenderModule:qx,bindRichtextRenderModule:rS,bindStarRenderModule:hS,bindSymbolRenderModule:pS,bindTextRenderModule:vS,boundStroke:Uc,builtInSymbolStrMap:Ec,builtinSymbols:Tc,builtinSymbolsMap:Bc,calcLineCache:xl,calculateArcCornerRadius:Dv,calculateLineHeight:kh,canvasAllocate:yf,centroidOfSubpath:ek,circleBounds:mh,circleModule:ox,clock:qa,colorEqual:function(t,e){const i=ii.parseColorString(t),s=ii.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:ju,configureRuntimeApplicationForApp:WA,container:eA,cornerTangents:Iv,createApp:_A,createArc:Vp,createArc3d:lv,createArea:Gp,createBrowserApp:_A,createCanvasEventTransformer:function(t,e,i,s){return kk(t.parentElement,e,i,s)},createCircle:Kp,createColor:nu,createConicalGradient:Gu,createContributionProvider:Fm,createEventTransformer:kk,createGlyph:qp,createGraphic:hf,createGroup:Qp,createImage:ig,createLine:rg,createMat4:yu,createMiniappApp:function(t={}){return new xA(t)},createNodeApp:function(t={}){return new bA(t)},createPath:lg,createPolygon:dg,createPyramid3d:cv,createRect:fg,createRect3d:sv,createRectPath:wv,createRichText:Hg,createShadowRoot:Ng,createStage:function(t){return aA(),(new xm).create(t)},createStar:av,createSymbol:Ug,createText:Zg,createWrapText:tf,cubicCalc:Po,cubicLength:Eo,cubicPointAt:Oo,cubicSubdivide:ZA,defaultArcAllocate:zk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Nv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:jk,defaultBaseBackgroundRenderContribution:Ff,defaultBaseClipRenderAfterContribution:Jf,defaultBaseClipRenderBeforeContribution:qf,defaultBaseTextureRenderContribution:Hv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Xv,defaultCircleRenderContribution:Gv,defaultCircleTextureRenderContribution:Yv,defaultGraphicMemoryManager:Jk,defaultGroupBackgroundRenderContribution:$v,defaultImageBackgroundRenderContribution:ry,defaultImageRenderContribution:ny,defaultLineAllocate:Uk,defaultPathAllocate:Yk,defaultRectAllocate:Lk,defaultRectBackgroundRenderContribution:iy,defaultRectRenderContribution:ty,defaultRectTextureRenderContribution:ey,defaultStarBackgroundRenderContribution:py,defaultStarTextureRenderContribution:uy,defaultSymbolAllocate:Kk,defaultSymbolBackgroundRenderContribution:dy,defaultSymbolClipRangeStrokeRenderContribution:hy,defaultSymbolRenderContribution:ly,defaultSymbolTextureRenderContribution:cy,defaultTextAllocate:qk,diff:qA,divideCubic:Lo,drawArc:ko,drawArcPath:Lv,drawAreaSegments:Yb,drawBackgroundImage:Xf,drawImageWithLayout:yx,drawIncrementalAreaSegments:Zb,drawIncrementalSegments:qb,drawSegments:$b,enumCommandMap:oo,fillVisible:Bv,findBestMorphingRotation:sk,findConfigIndexByCursorIdx:Mk,findCursorIdxByConfigIndex:Tk,findNextGraphic:If,flatten_simplify:$A,foreach:Of,foreachAsync:Rf,genBasisSegments:qo,genBasisTypeSegments:$o,genLinearClosedSegments:pl,genLinearClosedTypeSegments:gl,genLinearSegments:Go,genLinearTypeSegments:Yo,genMonotoneXSegments:nl,genMonotoneXTypeSegments:sl,genMonotoneYSegments:al,genMonotoneYTypeSegments:rl,genNumberType:Yc,genStepClosedSegments:dl,genStepSegments:hl,genStepTypeSegments:cl,getApplicationState:rh,getAttributeFromDefaultAttrList:bh,getBackgroundImage:Hf,getConicGradientAt:Uu,getContributionStoreState:Im,getCurrentEnv:function(){return fm()?"browser":"node"},getDefaultCharacterConfig:wk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Gg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Su.allocate();return hu(o,o,[a[0],a[1],0]),n&&au(o,o,n),s&&ou(o,o,s),hu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Tf,getGraphicClassState:Mp,getGraphicRegistryState:rf,getLegacyBindingContext:f_,getModelMatrix:mm,getRichTextBounds:gv,getRuntimeInstallerBindingContext:jA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:CA,getScaledStroke:su,getTextBounds:pv,getTheme:Fp,getThemeFromGroup:zp,globalTheme:Lp,glyphModule:dx,graphicCreator:of,graphicService:nA,graphicUtil:iA,identityMat4:ru,imageModule:Sx,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:KA,installRuntimeDrawContributionsToApp:GA,installRuntimeGraphicRenderersToApp:UA,installRuntimePickersToApp:YA,interpolateColor:Pu,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Ru,interpolateGradientRadialColor:Iu,interpolatePureColorArray:Lu,interpolatePureColorArrayToStr:Fu,intersect:Rv,isBrowserEnv:fm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){gm();const t=ah.global&&ah.global.env;return t?"node"===t:!pm},isSvg:jc,isXML:Nc,layerService:rA,lineModule:Mx,lookAt:pu,mapToCanvasPointForCanvas:function(t){var e;if(Pd(t._canvasX)&&Pd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:cu,mat4Allocate:Su,matrixAllocate:xu,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:uu,newThemeObj:Op,ortho:gu,parsePadding:ph,parseStroke:dh,parseSvgPath:fo,pathModule:Rx,pathToBezierCurves:rk,point:Xo,pointEqual:vh,pointInterpolation:yh,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Zt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Zt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>vh(t,e[i]))):!Number.isNaN(t.x+t.y)&&vh(t,e))},pointsInterpolation:_h,polygonModule:Vx,preLoadAllModule:g_,pyramid3dModule:Xx,quadCalc:Ro,quadLength:Do,quadPointAt:Io,rafBasedSto:Sh,rect3dModule:eS,rectFillVisible:Ev,rectModule:Zx,rectStrokeVisible:Ov,recursiveCallBinarySplit:yk,refreshRuntimeInstallerContributions:NA,registerArc3dGraphic:mb,registerArcGraphic:fb,registerAreaGraphic:vb,registerCircleGraphic:yb,registerDirectionalLight:dA,registerFlexLayoutPlugin:sC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=kk(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:_b,registerGraphic:lf,registerGroupGraphic:bb,registerHtmlAttributePlugin:x_,registerImageGraphic:xb,registerLineGraphic:Sb,registerOrthoCamera:pA,registerPathGraphic:Ab,registerPolygonGraphic:kb,registerPyramid3dGraphic:Cb,registerReactAttributePlugin:A_,registerRect3dGraphic:Mb,registerRectGraphic:wb,registerRichtextGraphic:Tb,registerShadowRootGraphic:Bb,registerStarGraphic:Eb,registerSymbolGraphic:Pb,registerTextGraphic:Ob,registerViewTransform3dPlugin:tC,registerWindowEventTransformer:function(t,e,i,s,n){const r=kk(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Rb,renderCommandList:Mo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:mx,resolveBackgroundPosition:Uf,resolveBackgroundSizing:jf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:gx,resolveImageRepeatMode:px,resolveRenderableImageSize:Yf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:aS,rotateX:au,rotateY:ou,rotateZ:lu,runFill:Mv,runStroke:Tv,scaleMat4:du,segments:So,shouldClipImageByLayout:vx,shouldUseMat4:vm,snapLength:Bo,splitArc:ck,splitArea:pk,splitCircle:dk,splitLine:gk,splitPath:bk,splitPolygon:_k,splitRect:hk,splitToGrids:lk,starModule:cS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Pv,symbolModule:gS,textAttributesToStyle:Xg,textDrawOffsetX:Gg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Yg,textModule:yS,transformMat4:fu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:sA,translate:hu,verticalLayout:Kc,vglobal:__,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{ah.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)}))},wrapCanvas:Cd,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=ah.global)||void 0===t?void 0:t.env,s=i?null===(e=ah.context2dFactory)||void 0===e?void 0:e.call(ah,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=y(t)?t[0]:t,i=[];if(!e)return i;if(!0===Nc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Jc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Jc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class rC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:su(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class aC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Qc}}let oC=!1;function lC(t){oC||(oC=!0,t.bind(DS).toDynamicValue((()=>new aC(bS(t,by)))).inSingletonScope(),t.bind(tA).toService(DS))}class hC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Qc}}let cC=!1;function dC(t){cC||(cC=!0,t.bind(AS).toDynamicValue((()=>new hC(bS(t,by)))).inSingletonScope(),t.bind(SS).toService(AS))}function uC(){if(uC.__loaded)return;uC.__loaded=!0;const t=f_();fb(),jb({bind:t.bind}),_S?lC(t):dC(t)}uC.__loaded=!1;const pC=uC;class gC extends Lb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Su.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class fC extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=td,this.themeType="arc"}}let mC=!1;function vC(t){var e;mC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,xy))&&(mC=!0,t.bind(LS).toDynamicValue((()=>new fC(bS(t,xy)))).inSingletonScope(),t.bind(tA).toService(LS))}function yC(){if(yC.__loaded)return;yC.__loaded=!0;const t=f_();mb(),dA(),pA(),Ub({bind:t.bind}),vC(t)}yC.__loaded=!1;const _C=yC;class bC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ed}}let xC=!1;function SC(t){xC||(xC=!0,t.bind(FS).toDynamicValue((()=>new bC(bS(t,Sy)))).inSingletonScope(),t.bind(tA).toService(FS))}class AC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ed}}let kC=!1;function CC(t){kC||(kC=!0,t.bind(kS).toDynamicValue((()=>new AC(bS(t,Sy)))).inSingletonScope(),t.bind(SS).toService(kS))}function wC(){if(wC.__loaded)return;wC.__loaded=!0;const t=f_();vb(),sx({bind:t.bind}),_S?SC(t):CC(t)}wC.__loaded=!1;const MC=wC;class TC{constructor(){this.type="glyph",this.numberType=sd}contains(t,e,i){if(!t.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}}class BC extends TC{constructor(t){super(),this.canvasRenderer=t}}let EC=!1;function PC(t){EC||(EC=!0,t.bind(ZS).toDynamicValue((()=>new BC(bS(t,Dy)))).inSingletonScope(),t.bind(tA).toService(ZS))}class OC extends TC{constructor(t){super(),this.canvasRenderer=t}}let RC=!1;function IC(t){RC||(RC=!0,t.bind(RS).toDynamicValue((()=>new OC(bS(t,Dy)))).inSingletonScope(),t.bind(SS).toService(RS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=f_();_b(),dx({bind:t.bind}),_S?PC(t):IC(t)}DC.__loaded=!1;const LC=DC;function FC(){FC.__loaded||(FC.__loaded=!0,bb())}FC.__loaded=!1;const zC=FC;class HC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=rd}}let jC=!1;function NC(t){jC||(jC=!0,t.bind(HS).toDynamicValue((()=>new HC(bS(t,Ly)))).inSingletonScope(),t.bind(tA).toService(HS))}class VC{constructor(){this.type="image",this.numberType=rd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function UC(t){WC||(WC=!0,t.bind(wS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(SS).toService(wS))}function GC(){if(GC.__loaded)return;GC.__loaded=!0;const t=f_();xb(),Sx({bind:t.bind}),_S?NC(t):UC(t)}GC.__loaded=!1;const YC=GC;class XC extends Lb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:su(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Su.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class KC extends XC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ad}}let $C=!1;function qC(t){$C||($C=!0,t.bind(NS).toDynamicValue((()=>new KC(bS(t,wy)))).inSingletonScope(),t.bind(tA).toService(NS))}class ZC extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ad}}let JC=!1;function QC(t){JC||(JC=!0,t.bind(MS).toDynamicValue((()=>new ZC(bS(t,wy)))).inSingletonScope(),t.bind(SS).toService(MS))}function tw(){if(tw.__loaded)return;tw.__loaded=!0;const t=f_();Sb(),Mx({bind:t.bind}),_S?qC(t):QC(t)}tw.__loaded=!1;const ew=tw;class iw extends XC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=od}}let sw=!1;function nw(t){sw||(sw=!0,t.bind(WS).toDynamicValue((()=>new iw(bS(t,My)))).inSingletonScope(),t.bind(tA).toService(WS))}class rw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=od}}let aw=!1;function ow(t){aw||(aw=!0,t.bind(TS).toDynamicValue((()=>new rw(bS(t,My)))).inSingletonScope(),t.bind(SS).toService(TS))}function lw(){if(lw.__loaded)return;lw.__loaded=!0;const t=f_();Ab(),Rx({bind:t.bind}),_S?nw(t):ow(t)}lw.__loaded=!1;const hw=lw;class cw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ld}}let dw=!1;function uw(t){dw||(dw=!0,t.bind(KS).toDynamicValue((()=>new cw(bS(t,Ty)))).inSingletonScope(),t.bind(tA).toService(KS))}class pw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ld}}let gw=!1;function fw(t){gw||(gw=!0,t.bind(OS).toDynamicValue((()=>new pw(bS(t,Ty)))).inSingletonScope(),t.bind(SS).toService(OS))}function mw(){if(mw.__loaded)return;mw.__loaded=!0;const t=f_();kb(),Vx({bind:t.bind}),_S?uw(t):fw(t)}mw.__loaded=!1;const vw=mw;class yw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=hd,this.themeType="polygon"}}let _w=!1;function bw(t){var e;_w||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Iy))&&(_w=!0,t.bind($S).toDynamicValue((()=>new yw(bS(t,Iy)))).inSingletonScope(),t.bind(tA).toService($S))}function xw(){if(xw.__loaded)return;xw.__loaded=!0;const t=f_();Cb(),dA(),pA(),Xx({bind:t.bind}),bw(t)}xw.__loaded=!1;const Sw=xw,Aw=new Ve;class kw{constructor(){this.type="rect",this.numberType=cd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||x(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:su(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;Aw.setValue(i.x1,i.y1,i.x2,i.y2),Aw.expand(-r/2),h=!Aw.containsPoint(e)}}return s.highPerformanceRestore(),h}}class Cw extends kw{constructor(t){super(),this.canvasRenderer=t}}let ww=!1;function Mw(t){ww||(ww=!0,t.bind(US).toDynamicValue((()=>new Cw(bS(t,By)))).inSingletonScope(),t.bind(tA).toService(US))}class Tw extends kw{constructor(t){super(),this.canvasRenderer=t}}let Bw=!1;function Ew(t){Bw||(Bw=!0,t.bind(BS).toDynamicValue((()=>new Tw(bS(t,By)))).inSingletonScope(),t.bind(SS).toService(BS))}function Pw(){if(Pw.__loaded)return;Pw.__loaded=!0;const t=f_();wb(),Zx({bind:t.bind}),_S?Mw(t):Ew(t)}Pw.__loaded=!1;const Ow=Pw;class Rw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=dd,this.themeType="rect"}}let Iw=!1;function Dw(t){var e;Iw||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ey))&&(Iw=!0,t.bind(GS).toDynamicValue((()=>new Rw(bS(t,Ey)))).inSingletonScope(),t.bind(tA).toService(GS))}function Lw(){if(Lw.__loaded)return;Lw.__loaded=!0;const t=f_();Mb(),eS({bind:t.bind}),Dw(t)}Lw.__loaded=!1;const Fw=Lw;class zw{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ud}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let Hw=!1;function jw(t){Hw||(Hw=!0,t.bind(qS).toDynamicValue((()=>new zw(bS(t,Ry)))).inSingletonScope(),t.bind(tA).toService(qS))}class Nw{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ud}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let Vw=!1;function Ww(t){Vw||(Vw=!0,t.bind(IS).toDynamicValue((()=>new Nw(bS(t,Ry)))).inSingletonScope(),t.bind(SS).toService(IS))}function Uw(){if(Uw.__loaded)return;Uw.__loaded=!0;const t=f_();Tb(),aS({bind:t.bind}),_S?jw(t):Ww(t)}Uw.__loaded=!1;const Gw=Uw;function Yw(){Yw.__loaded||(Yw.__loaded=!0,Bb())}Yw.__loaded=!1;const Xw=Yw;class Kw extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=gd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:su(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Su.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let $w=!1;function qw(t){$w||($w=!0,t.bind(YS).toDynamicValue((()=>new Kw(bS(t,Py)))).inSingletonScope(),t.bind(tA).toService(YS))}class Zw extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=gd}}let Jw=!1;function Qw(t){Jw||(Jw=!0,t.bind(ES).toDynamicValue((()=>new Zw(bS(t,Py)))).inSingletonScope(),t.bind(SS).toService(ES))}function tM(){if(tM.__loaded)return;tM.__loaded=!0;const t=f_();Pb(),gS({bind:t.bind}),_S?qw(t):Qw(t)}tM.__loaded=!1;const eM=tM;class iM extends gC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Yg(a,u,n),v=Gg(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&&Su.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let sM=!1;function nM(t){sM||(sM=!0,t.bind(XS).toDynamicValue((()=>new iM(bS(t,Oy)))).inSingletonScope(),t.bind(tA).toService(XS))}class rM{constructor(){this.type="text",this.numberType=fd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let aM=!1;function oM(t){aM||(aM=!0,t.bind(PS).toDynamicValue((()=>new rM)).inSingletonScope(),t.bind(SS).toService(PS))}function lM(){if(lM.__loaded)return;lM.__loaded=!0;const t=f_();Ob(),yS({bind:t.bind}),_S?nM(t):oM(t)}lM.__loaded=!1;const hM=lM;function cM(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),pM=(t,e)=>(c(fM.warnHandler)&&fM.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),gM=(t,e,i)=>{if(!c(fM.errorHandler))throw new Error(t);fM.errorHandler.call(null,t,e)},fM={silent:!1,warnHandler:!1,errorHandler:!1},mM=fm(),vM=mM&&globalThis?globalThis.document:void 0;function yM(t){return("desktop-browser"===t||"mobile-browser"===t)&&mM}function _M(t){return bM(t)||"mobile-browser"===t}function bM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let xM=0;function SM(){return xM>=9999999&&(xM=0),xM++}function AM(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function kM(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&y(t[0].fields))}function CM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&CM(t,e)}))}const wM=t=>!d(t)&&!1!==t.visible;function MM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function TM(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 EM=["#ffffff","#000000"];function PM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return OM(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(...EM);for(const n of a)if(t!==n&&OM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function OM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?RM(t,e)>s:"largeText"===i?RM(t,e)>3:RM(t,e)>4.5}function RM(t,e){const i=IM(t),s=IM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function IM(t){const e=ni(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function DM(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 LM(t,e){return[t[0]*e,t[1]*e]}function FM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function zM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const HM=hf,jM={arc:t=>HM("arc",t),circle:t=>HM("circle",t),group:t=>HM("group",t),image:t=>HM("image",t),line:t=>HM("line",t),path:t=>HM("path",t),polygon:t=>HM("polygon",t),rect:t=>HM("rect",t),richtext:t=>HM("richtext",t),symbol:t=>HM("symbol",t),text:t=>HM("text",t)},NM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 UM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(UM||(UM={}));const GM={[UM.selectedReverse]:{},[UM.selected]:{},[UM.hover]:{},[UM.hoverReverse]:{}},YM={container:"",width:30,height:30,style:{}},XM="scrollDrag",KM=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:pv,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function $M(t,e,i={}){if(!t)return{width:0,height:0};const s=pv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 qM(t,e="type"){var i,s;return p(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function ZM(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function JM(t,e="type"){const i=qM(t,e);return"rich"===i?jM.richtext(ZM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),jM.text(t))}function QM(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 tT=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function eT(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 iT(t,e){const{dx:i,dy:s}=eT(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const sT={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},nT={size:8,stroke:"#000",lineWidth:1,zIndex:1};function rT(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Se(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Te(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const aT=Math.sin(Math.PI/10);function oT(t,e=aT){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function lT(t,e=aT){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function hT(t){const e={};return CM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function cT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function dT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return LM(r,(s?-1:1)*(n?-1:1)*t/FM(r))}function uT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function gT(t,e,i){var s;if(lT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>He(n,r)}function fT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function yT(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function _T(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function bT(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function xT(t,e){const i=bT(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 ST(t,e){const i=AT(t),s=AT(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 AT(t,e={x:0,y:0}){return re.distancePP(t,e)}function kT(t){return A(t.x)&&A(t.y)}function CT(t,e,i){let s=!1;if(e&&c(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function wT(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const MT=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function BT(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&BT(t[i],e)}}var ET;!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"}(ET||(ET={}));const PT={};function OT(t){switch(t){case ET.Linear:case ET.Log:case ET.Pow:case ET.Sqrt:case ET.Symlog:case ET.Time:return!0;default:return!1}}function RT(t){return!!PT[t]}function IT(t){switch(t){case ET.Ordinal:case ET.Point:case ET.Band:return!0;default:return!1}}function DT(t){return t}Object.values(ET).forEach((t=>{PT[t]=!0}));const LT=t=>-Math.log(-t),FT=t=>-Math.exp(-t),zT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,HT=t=>10===t?zT:t===Math.E?Math.exp:e=>Math.pow(t,e),jT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),NT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),VT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function WT(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 UT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function GT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function YT(t,e,i,s){return 1===i&&(i=0),GT(t,i,s)*(e/(1-i))}function XT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function KT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class qT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=XT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const ZT=Symbol("implicit");class JT extends qT{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=ET.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=ZT}clone(){const t=(new JT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==ZT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return QT(t,e,r,n)}class eB extends JT{constructor(t){super(),this.type=ET.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=YT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:tB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return tB(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&x(this._userBandwidth)}clone(){var t,e,i;return new eB(!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:iB}=ri;function sB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=iB(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof si?iB(t,e):e instanceof ii?iB(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):At(Number(t),Number(e))}class nB extends qT{constructor(t=DT,e=DT){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=DT,this._piecewise=UT,this._interpolate=sB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),At)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?KT:UT,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:DT),this.rescale(i)):this._clamp!==DT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const rB=Math.sqrt(50),aB=Math.sqrt(10),oB=Math.sqrt(2),lB=[1,2,5,10],hB=(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=pB(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),J(0,e).map((t=>n+t*s))):t>0?dB(0,-(e-1)/s,s):dB((e-1)/s,0,s)},cB=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 hB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return hB(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=dB(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=dB(t,e,l);return n&&r.reverse(),r})),pB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=lB[0];return i>=rB?s=lB[3]:i>=aB?s=lB[2]:i>=oB&&(s=lB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function gB(t,e,i){const s=(e-t)/Math.max(0,i);return pB(s)}function fB(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=gB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function vB(t,e){const i=x(e.forceMin),s=x(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const yB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),_B=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})),bB=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=uB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?yB(t,e,n):yB(t,e,$T(n)),h=yB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),xB=mt(((t,e,i,s,n)=>fB(s(t),s(e),i).map((t=>$T(n(t))))));class SB extends nB{constructor(){super(...arguments),this.type=ET.Linear}clone(){var t;const e=new SB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return cB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=uB(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return fB(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function kB(t){return e=>-t(-e)}function CB(t=Number.EPSILON){return e=>Math.max(e,t)}class wB extends nB{constructor(){super(jT(10),HT(10)),this.type=ET.Log,this._limit=CB(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new wB).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=jT(this._base),s=HT(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=kB(i),this._pows=kB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=LT,this.untransformer=FT):(this._logs=i,this._pows=s,this._limit=CB(),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 DT}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return _B(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return bB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return xB(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(wB,AB);class MB extends SB{constructor(){super(NT(1),VT(1)),this.type=ET.Symlog,this._const=1}clone(){return(new MB).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=NT(t),this.untransformer=VT(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return _B(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return bB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return xB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(MB,AB);class TB{constructor(){this.type=ET.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new TB).domain(this._domain).range(this._range).unknown(this._unknown)}}var BB,EB,PB;function OB(t){var e,i;const{type:s}=t;return s===EB.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BB||(BB={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(EB||(EB={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(PB||(PB={}));const RB={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},IB={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DB(t,e){var i;if(!t)return[];const s=VB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?jB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>HB(i)?FB(t,i,e):i)).filter(u)}))):i.map((i=>HB(i)?FB(t,i,e):i)).filter(u):[]}return[]}function LB(t,e){var i,s;return jB(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function FB(t,e,i){var s;const n=VB(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=RB[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=IB[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ii(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Xe(t,i,s),a=Ye(n,r,e.l),l=new ii(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const zB=(t,e)=>{if(e&&HB(t)){const i=FB(e,t);if(i)return i}return t};function HB(t){return t&&"palette"===t.type&&!!t.key}function jB(t){return!(!y(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function NB(t){return y(t)?{dataScheme:t}:t}function VB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=OB(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 WB extends JT{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!jB(this._range))return void super.range(this._range);const t=LB(this._range,this._domain);super.range(t)}}const UB={linear:SB,band:eB,point:class extends eB{constructor(t){super(!1),this.type=ET.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:JT,threshold:TB,colorOrdinal:WB};function GB(t){const e=UB[t];return e?new e:null}function YB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function XB(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function KB(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function $B(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function qB(t){return!!v(t)&&(!!t.endsWith("%")&&AM(t.substring(0,t.length-1)))}function ZB(t){return!!p(t)&&("percent"in t||"offset"in t)}function JB(t,e,i,s=0){var n,r;return x(t)?t:qB(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function QB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=JB(t[s],e.size,i)}))})),o}function tE(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function eE(t){let e={};return y(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||qB(t)||c(t)||ZB(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function iE(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const sE=(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},nE=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function rE(t,e){return t&&e.key in t?t[e.key]:e.default}function aE(t){return t&&"token"===t.type&&!!t.key}const oE={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%"},lE={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:nE,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:oE,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},hE={name:"dark",colorScheme:{default:{dataScheme:nE,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},cE=(t,e)=>t===e||!c(t)&&!c(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>cE(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>cE(t[i],e[i])))),dE=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),dE(t[s],e.slice(1),i))},uE=t=>t instanceof Fa||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function pE(t,e=["data"]){return I(t,uE,e)}function gE(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=NB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}_E._charts=yE.charts,_E._series=yE.series,_E._components=yE.components,_E._graphicComponents=yE.graphicComponents,_E._marks=yE.marks,_E._regions=yE.regions,_E._animations=yE.animations,_E._implements=yE.implements,_E._chartPlugin=yE.chartPlugin,_E._vChartPlugin=yE.vChartPlugin,_E._componentPlugin=yE.componentPlugin,_E.transforms=yE.transforms,_E.dataParser=yE.dataParser,_E._layout=yE.layout,_E._grammarTransforms=yE.grammarTransforms,_E._stageEventPlugins=yE.stageEventPlugins,_E.registerStageEventPlugin=(t,e)=>{_E._stageEventPlugins[t]=e},_E.getStageEventPlugin=t=>_E._stageEventPlugins[t],_E._interactionTriggers=yE.interactionTriggers,_E.registerInteractionTrigger=(t,e)=>{_E._interactionTriggers[t]=e},_E._composedEventMap=yE.composedEventMap,_E.registerComposedEvent=(t,e)=>{_E._composedEventMap[t]=e},_E._tooltipProcessors=yE.tooltipProcessors,_E.registerTooltipProcessor=(t,e)=>{_E._tooltipProcessors[t]=e},_E.createTooltipProcessor=(t,e)=>{const i=_E._tooltipProcessors[t];return i?new i(e):null},_E._runtimePluginInstallers=yE.runtimePluginInstallers,_E.registerRuntimePluginInstaller=(t,e)=>{_E._runtimePluginInstallers[t]=e},_E.getRuntimePluginInstaller=t=>_E._runtimePluginInstallers[t];const SE=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}},conversionArrow:{line:{style:{stroke:"black"}},symbol:{style:{fill:"black"}},text:{style:{fontSize:12,fill:"#606773"}}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},AE=SE(),kE={[lE.name]:lE},CE=lE.name,wE=new Map(Object.keys(kE).map((t=>[t,kE[t]]))),ME=new Map,TE=new Map(Object.keys(kE).map((t=>[t,t===CE]))),BE=(t,e)=>{if(!t)return;const i=RE(e);wE.set(t,i),TE.set(t,!0)},EE=(t=CE)=>(TE.has(t)&&!TE.get(t)&&BE(t,wE.get(t)),wE.get(t)),PE=t=>wE.delete(t)&&ME.delete(t)&&TE.delete(t),OE=t=>!!v(t)&&wE.has(t),RE=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:CE;return bE({},EE(i),t)};class IE{static registerInstance(t){IE.instances.set(t.id,t)}static unregisterInstance(t){IE.instances.delete(t.id)}static getInstance(t){return IE.instances.get(t)}static instanceExist(t){return IE.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return IE.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}IE.instances=new Map;class DE{static registerTheme(t,e){BE(t,e)}static getTheme(t,e=!1){return EE(t)}static removeTheme(t){return PE(t)}static themeExist(t){return OE(t)}static getDefaultTheme(){return DE.themes.get(CE)}static setCurrentTheme(t){DE.themeExist(t)&&(DE._currentThemeName=t,IE.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return DE.getTheme(DE._currentThemeName,t)}static getCurrentThemeName(){return DE._currentThemeName}}function LE(t){return v(t)?DE.themeExist(t)?DE.getTheme(t):{}:p(t)?t:{}}DE.themes=wE,DE._currentThemeName=CE;const FE=["animationThreshold","colorScheme","name","padding"];function zE(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];FE.includes(n)?s[n]=r:f(r)?HB(r)?s[n]=zB(r,e):aE(r)?s[n]=rE(i,r):s[n]=zE(r,e,i):s[n]=r})),s}function HE(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]=HE(t[s],e)}return i}return y(t)?t.map((t=>HE(t,e))):t}function jE(t,e){var i;if(!t)return t;if(v(t))return null!==(i=e.getFunction(t))&&void 0!==i?i:t;if(f(t)){const i={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=jE(t[s],e));return i}return y(t)?t.map((t=>jE(t,e))):t}function NE(t,...e){return c(t)?t(...e):t}const VE=(t,e,i,s)=>((t,e,i)=>KM(t,e,i,{fontFamily:oE.fontFamily,fontSize:oE.fontSize}))(e,i,s).measure(t),WE="__VCHART",UE=500,GE=500,YE=`${WE}_MEASURE_CANVAS_ID`,XE=`${WE}_DEFAULT_DATA_INDEX`,KE=`${WE}_DEFAULT_DATA_KEY`,$E=`${WE}_DEFAULT_DATA_SERIES_FIELD`,qE=`${WE}_DEFAULT_SERIES_STYLE_NAME`,ZE=`${WE}_STACK_KEY`,JE=`${WE}_STACK_START`,QE=`${WE}_STACK_END`,tP=`${WE}_STACK_START_PERCENT`,eP=`${WE}_STACK_END_PERCENT`,iP=`${WE}_STACK_START_OffsetSilhouette`,sP=`${WE}_STACK_END_OffsetSilhouette`,nP=`${WE}_STACK_TOTAL`,rP=`${WE}_STACK_TOTAL_PERCENT`,aP=`${WE}_STACK_TOTAL_TOP`,oP=`${WE}_STACK_TOTAL_BOTTOM`,lP=`${WE}_MOSAIC_VALUE_START_PERCENT`,hP=`${WE}_MOSAIC_VALUE_END_PERCENT`,cP=`${WE}_MOSAIC_CAT_START_PERCENT`,dP=`${WE}_MOSAIC_CAT_END_PERCENT`,uP=`${WE}_SEGMENT_START`,pP=`${WE}_SEGMENT_END`,gP=`${WE}_KEY`,fP=`${WE}_MAP_LOOK_UP_KEY`;function mP(t,e){for(let i=0;it.key===e))}function yP(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 _P(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},kP(t,a,n[o],l,e,r))})),s?bP(n):n}function bP(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))):bP(t[e].nodes);return t}function xP(t,e){if("values"in t&&t.values.length){const i=_T(t.values,e),s=yT(t.values,eP);t.values.forEach((t=>{t[nP]=i,t[rP]=s}))}else for(const i in t.nodes)xP(t.nodes[i],e)}function SP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][QE]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)AP(t.nodes[r],e,i,s,n)}function kP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[QE]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),kP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const CP=(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]=MP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function TP(t){return!c(t)&&!E(t)&&Object.keys(t).some((e=>c(t[e])))}function BP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(c(t))return RP(t(r,i,s,n));if(TP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{c(e[t])&&(e[t]=e[t](r,i,s,n))})),RP(e)}return RP(t)}function EP(t={}){const e=Object.assign({},t);if(c(t.style)||TP(t.style)?e.style=(e,i,s,n)=>BP(t.style,e,i,s,n):E(t.style)||(e.style=RP(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])||TP(t.state[e])?i[e]=(i,s,n,r)=>BP(t.state[e],i,s,n,r):E(t.state[e])||(i[e]=RP(t.state[e]))})),e.state=i}return e}function PP(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RP(t[i](e,s,n,r)):E(t[i])||(e[i]=RP(t[i]))})),e}function OP(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),RP(i)}function RP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const IP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},DP=t=>"line"===t||"area"===t,LP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return DP(i)?e:null==e?void 0:e[0]},FP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let zP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=_E.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(_E.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var HP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(HP||(HP={}));const jP=["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 NP,VP,WP;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(NP||(NP={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(VP||(VP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(WP||(WP={}));const UP=[WP.mark,WP.model,WP.chart,WP.vchart];class GP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(WP.vchart,[]),this._levelNodes.set(WP.chart,[]),this._levelNodes.set(WP.model,[]),this._levelNodes.set(WP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const YP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class XP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>LP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||VP.chart);o.get(t)||o.set(t,new GP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||VP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||VP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||VP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?UP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[VP.chart,VP.window,VP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return YP[a]&&(a=YP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?WP.model:WP.vchart:WP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=VP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==WP.model&&s!==WP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=WP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case VP.chart:return this._viewBubbles;case VP.window:return this._windowBubbles;case VP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case VP.chart:return this._viewListeners;case VP.window:return this._windowListeners;case VP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return jP.includes(t)||Object.values(HP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&_E.hasInteractionTrigger(e)}}function KP(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function $P(t,e,i){t.getParser(e)||t.registerParser(e,i)}const qP=new Map;let ZP;function JP(){ZP||(ZP=new La,$P(ZP,"geojson",Ea),$P(ZP,"topojson",Oa),KP(ZP,"simplify",Xr))}function QP(t,e,i={type:"geojson",centroid:!0}){qP.has(t)&&pM(`map type of '${t}' already exists, will be overwritten.`),JP();const s=new Fa(ZP),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):p(r)&&s.transform({type:"simplify",options:r}),qP.set(t,s)}function tO(t){qP.has(t)?qP.delete(t):pM(`map type of '${t}' does not exists.`)}function eO(t,e=!1){let i=e;return t.latestData instanceof Fa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const iO=(t,e)=>0===t.length?[]:1===t.length?eO(t[0],null==e?void 0:e.deep):t.map((t=>eO(t,null==e?void 0:e.deep)));function sO(t,e,i){KP(e=e instanceof La?e:t.dataSet,"copyDataView",iO);const s=new Fa(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:aO.copyDataView}),s}function nO(t,e,i=[]){var s;if(t instanceof Fa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Fa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return pM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return pM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),pM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function rO(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var aO,oO,lO,hO;!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"}(aO||(aO={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(oO||(oO={})),function(t){t.data="data",t.mark="mark"}(lO||(lO={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(hO||(hO={}));const cO=["line","area","trail"];function dO(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(gP,i?t.slice().sort(i):t.slice()),{keys:[gP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const uO=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function pO(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{pO(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function fO(t,e,i,s){const n=dO(t,(t=>i(t))),r=dO(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const mO=`${WE}_BuiltIn_CallBack_Disappear`;var vO;!function(t){t.render="render",t.disappear="disappear"}(vO||(vO={}));const yO=[0,0,0];class _O{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ol),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Il),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xu.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&&(xu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(xu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Nt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(fu(yO,[e,i,s],this.modelMatrix),e=yO[0],i=yO[1],s=yO[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=nu(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:su(this,a,this.dpr),r.strokeStyle=nu(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>xu.free(t))),this.stack.length=0}}_O.env="browser";class bO extends Mu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=ah.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new _O(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 xO(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,Ad,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,kd,e.env));r||i.bind(Ad).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(kd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}bO.env="browser";const SO=xO(bO,_O);class AO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}AO.env="feishu";class kO extends Mu{constructor(t){super(t)}init(){this._context=new AO(this,this._dpr)}release(...t){}}kO.env="feishu";const CO=xO(kO,AO);class wO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:su(this,l,this.dpr),r.strokeStyle=nu(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=ah.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,ah.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}wO.env="harmony";class MO extends Mu{constructor(t){super(t)}init(){this._context=new wO(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}MO.env="harmony";const TO=xO(MO,wO);class BO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:su(this,l,this.dpr),r.strokeStyle=nu(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=ah.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,ah.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}BO.env="lynx";class EO extends Mu{constructor(t){super(t)}init(){this._context=new BO(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}EO.env="lynx";const PO=xO(EO,BO);class OO extends _O{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}OO.env="node";class RO extends Mu{constructor(t){super(t)}init(){this._context=new OO(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}}RO.env="node";const IO=xO(RO,OO);class DO extends _O{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(nu(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:su(this,l,this.dpr)),r.setStrokeStyle(nu(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}DO.env="taro";class LO extends Mu{constructor(t){super(t)}init(){this._context=new DO(this,this._dpr)}release(...t){}}LO.env="taro";const FO=xO(LO,DO);class zO extends AO{}zO.env="tt";class HO extends Mu{constructor(t){super(t)}init(){this._context=new zO(this,this._dpr)}release(...t){}}HO.env="tt";const jO=xO(HO,zO);class NO extends _O{draw(){}createPattern(t,e){return null}}NO.env="wx";class VO extends Mu{constructor(t){super(t)}init(){this._context=new NO(this,this._dpr)}release(...t){}}VO.env="wx";const WO=xO(VO,NO);class UO extends mA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=yf.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;nnew XO(bS(t,Ay)))).inSingletonScope(),t.bind(tA).toService(zS))}class qO extends kw{constructor(t){super(),this.canvasRenderer=t}}let ZO=!1;class JO extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=pd}}let QO=!1;function tR(t){var e;QO||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Hy))&&(QO=!0,t.bind(QS).toDynamicValue((()=>new JO(bS(t,Hy)))).inSingletonScope(),t.bind(tA).toService(QS))}const eR=Yc();Yc();class iR{constructor(){this.type="gif-image",this.numberType=eR}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let sR=!1;function nR(t){sR||(sR=!0,t.bind(jS).toDynamicValue((()=>new iR)).inSingletonScope(),t.bind(tA).toService(jS))}function rR(t){t.isBound(UO)||t.bind(UO).toDynamicValue((()=>new UO(xS(tA,t),bS(t,zy),xS(Jm,t),xS(Qm,t)))).inSingletonScope(),t.isBound($m)?t.rebind($m).toService(UO):t.bind($m).toService(UO)}function aR(t){(function(t){YO||(YO=!0,t.bind(JS).toDynamicValue((()=>new GO)).inSingletonScope(),t.bind(tA).toService(JS),zm(t.bind.bind(t),tA))})(t),lC(t),vC(t),SC(t),$O(t),PC(t),NC(t),qC(t),function(t){ZO||(ZO=!0,t.bind(VS).toDynamicValue((()=>new qO(bS(t,By)))).inSingletonScope(),t.bind(tA).toService(VS))}(t),nw(t),uw(t),bw(t),Mw(t),Dw(t),jw(t),tR(t),qw(t),nM(t),nR(t),rR(t)}class oR extends hA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${oR.idprefix}_${oR.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=ah.global,this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:oR.GenerateCanvasId(),canvasControled:!0};this.canvas=new bO(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new bO({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function lR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,oR))||t.bind(oR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,oR.env))||t.bind(bf).toService(oR).whenTargetNamed(oR.env)}oR.env="browser",oR.idprefix="visactor_window",oR.prefix_count=0;var hR=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 cR{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 dR(t,e=!1){const i=document.createElement("img");if(ah.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class uR extends lA{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new cR(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return dR(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return dR(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return hR(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function pR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uR))||(t.bind(uR).toSelf().inSingletonScope(),t.bind(mg).toService(uR))}function gR(t=f_(),e=!0){gR.__loaded||(gR.__loaded=!0,pR(t),SO(t),lR(t),e&&aR(t))}gR.__loaded=!1;class fR extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new kO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 kO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fR))||t.bind(fR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,fR.env))||t.bind(bf).toService(fR).whenTargetNamed(fR.env)}fR.env="feishu";class vR extends mA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Cu(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}}let yR=!1;class _R extends rC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=id}}let bR=!1;function xR(t){bR||(bR=!0,t.bind(CS).toDynamicValue((()=>new _R(bS(t,Ay)))).inSingletonScope(),t.bind(SS).toService(CS))}function SR(t){(function(t){yR||(yR=!0,zm(t.bind.bind(t),SS))})(t),function(t){t.isBound(vR)||t.bind(vR).toDynamicValue((()=>new vR(xS(SS,t),xS(Jm,t),xS(Qm,t)))).inSingletonScope(),t.isBound($m)?t.rebind($m).toService(vR):t.bind($m).toService(vR)}(t),dC(t),CC(t),xR(t),IC(t),UC(t),QC(t),fw(t),ow(t),Ew(t),Ww(t),Qw(t),oM(t)}class AR{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class kR{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function CR(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function wR(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new AR(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function MR(t,e,i,s){const n=CR(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new kR(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function TR(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function BR(t,e=TR(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class ER extends lA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=TR(i),n=null!==(e=t.dpr)&&void 0!==e?e:BR(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return BR(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function PR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,ER))||(t.bind(ER).toSelf().inSingletonScope(),t.bind(mg).toService(ER))}function OR(t=f_(),e=!0){OR.__loaded||(OR.__loaded=!0,PR(t),CO(t),mR(t),e&&SR(t))}OR.__loaded=!1;function RR(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function IR(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new MO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 MO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return RR(t,"target",s),RR(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=IR(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=IR(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&DR(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),DR(t,"x",_),DR(t,"y",b),DR(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),DR(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),DR(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),DR(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),DR(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),DR(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function FR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,LR))||t.bind(LR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,LR.env))||t.bind(bf).toService(LR).whenTargetNamed(LR.env)}LR.env="harmony";const zR="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function HR(t){return"number"==typeof t&&Number.isFinite(t)}function jR(...t){for(let e=0;e({width:i,height:s})),new kR(t,l,n,i,s,e)}function GR(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=WR(e*s,i*s);if(t)return t}throw new Error(zR)}class YR extends lA{constructor(){super(),this.type="harmony",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,this.rafSTO=new xh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=NR(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=NR(s),r=null!==(i=t.dpr)&&void 0!==i?i:VR(s),a=function(t,e){if(!HR(t)||!HR(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=UR(GR(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=UR(GR(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return VR(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=jR(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=jR(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function XR(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,YR))||(t.bind(YR).toSelf().inSingletonScope(),t.bind(mg).toService(YR))}function KR(t=f_(),e=!0){KR.__loaded||(KR.__loaded=!0,XR(t),TO(t),FR(t),e&&SR(t))}KR.__loaded=!1;function $R(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function qR(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new EO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 EO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return $R(t,"target",s),$R(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=qR(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=qR(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&ZR(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),ZR(t,"x",_),ZR(t,"y",b),ZR(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),ZR(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),ZR(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),ZR(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),ZR(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),ZR(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function QR(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,JR))||t.bind(JR).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,JR.env))||t.bind(bf).toService(JR).whenTargetNamed(JR.env)}JR.env="lynx";function tI(t){return"number"==typeof t&&Number.isFinite(t)}function eI(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=sI(r),o=null!==(i=t.dpr)&&void 0!==i?i:nI(r,a),l=aI(t.width,t.height),h=oI(lI(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=sI(a),l=null!==(n=t.dpr)&&void 0!==n?n:nI(a,o),h=aI(t.width,t.height),c=Math.random().toString(),d=oI(lI(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return nI(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=eI(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=eI(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function cI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,hI))||(t.bind(hI).toSelf().inSingletonScope(),t.bind(mg).toService(hI))}function dI(t=f_(),e=!0){dI.__loaded||(dI.__loaded=!0,cI(t),PO(t),QR(t),e&&SR(t))}dI.__loaded=!1;class uI extends hA{get container(){return null}constructor(t=ah.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new RO(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new RO({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function pI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,uI))||t.bind(uI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,uI.env))||t.bind(bf).toService(uI).whenTargetNamed(uI.env)}uI.env="node";class gI extends lA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function fI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,gI))||(t.bind(gI).toSelf().inSingletonScope(),t.bind(mg).toService(gI))}function mI(t=f_(),e=!0){mI.__loaded||(mI.__loaded=!0,fI(t),IO(t),pI(t))}mI.__loaded=!1;class vI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new LO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 LO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function yI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,vI))||t.bind(vI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,vI.env))||t.bind(bf).toService(vI).whenTargetNamed(vI.env)}vI.env="taro";class _I extends lA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=MR(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=wR(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function bI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,_I))||(t.bind(_I).toSelf().inSingletonScope(),t.bind(mg).toService(_I))}function xI(t=f_(),e=!0){xI.__loaded||(xI.__loaded=!0,bI(t),FO(t),yI(t),e&&SR(t))}xI.__loaded=!1;class SI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new HO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 HO({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function AI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,SI))||t.bind(SI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,SI.env))||t.bind(bf).toService(SI).whenTargetNamed(SI.env)}SI.env="tt";function kI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function CI(t,e=kI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class wI extends lA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=kI(i),n=null!==(e=t.dpr)&&void 0!==e?e:CI(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return CI(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function MI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,wI))||(t.bind(wI).toSelf().inSingletonScope(),t.bind(mg).toService(wI))}function TI(t=f_(),e=!0){TI.__loaded||(TI.__loaded=!0,MI(t),jO(t),AI(t),e&&SR(t))}TI.__loaded=!1;class BI{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={}}}function EI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class PI extends hA{get container(){return null}constructor(t=ah.global){super(),this.global=t,this.type="wx",this.eventManager=new BI}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new VO(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 VO({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return EI(t,"target",o),EI(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function OI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,PI))||t.bind(PI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,bf,PI.env))||t.bind(bf).toService(PI).whenTargetNamed(PI.env)}PI.env="wx";function RI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function II(t,e=RI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class DI extends lA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=RI(i),n=null!==(e=t.dpr)&&void 0!==e?e:II(i,s),r=MR(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=CR(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=wR(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return II(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Sh.call(t)}}getCancelAnimationFrame(){return t=>{Sh.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function LI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,DI))||(t.bind(DI).toSelf().inSingletonScope(),t.bind(mg).toService(DI))}function FI(t=f_(),e=!0){FI.__loaded||(FI.__loaded=!0,LI(t),WO(t),OI(t),e&&SR(t))}FI.__loaded=!1;var zI={},HI={},jI={};Object.defineProperty(jI,"__esModule",{value:!0}),jI.loop=jI.conditional=jI.parse=void 0;jI.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};jI.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};jI.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var NI={};Object.defineProperty(NI,"__esModule",{value:!0}),NI.readBits=NI.readArray=NI.readUnsigned=NI.readString=NI.peekBytes=NI.readBytes=NI.peekByte=NI.readByte=NI.buildStream=void 0;NI.buildStream=function(t){return{data:t,pos:0}};var VI=function(){return function(t){return t.data[t.pos++]}};NI.readByte=VI;NI.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var WI=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};NI.readBytes=WI;NI.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};NI.readString=function(t){return function(e){return Array.from(WI(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};NI.readUnsigned=function(t){return function(e){var i=WI(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};NI.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=WI(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=QI(t),i=XI(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=QI(this.attribute.gifImage),e=XI(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=ah.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=ah.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function iD(t){return new eD(t)}class sD extends _x{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=eR,this._renderContribitions=void 0,this.builtinContributions=[nD],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Fp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=Fp(t).image;this._draw(t,n,!1,i)}}const nD=new class extends Zv{constructor(){super(...arguments),this.time=xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let rD=!1;function aD(t){rD||(rD=!0,t.bind(sD).toDynamicValue((()=>new sD(xS(Jy,t)))).inSingletonScope(),t.bind(ky).toService(sD))}function oD(){of.RegisterGraphicCreator("gif",iD)}function lD(){if(lD.__loaded)return;lD.__loaded=!0;const t=f_();oD(),aD(t),nR(t)}lD.__loaded=!1;const hD=lD,cD=[{register:fb,bindModule:jb},{register:mb,bindModule:Ub},{register:vb,bindModule:sx},{register:yb,bindModule:ox},{register:_b,bindModule:dx},{register:bb},{register:xb,bindModule:Sx},{register:Sb,bindModule:Mx},{register:Ab,bindModule:Rx},{register:kb,bindModule:Vx},{register:Cb,bindModule:Xx},{register:wb,bindModule:Zx},{register:Mb,bindModule:eS},{register:Tb,bindModule:aS},{register:Bb},{register:Eb,bindModule:cS},{register:Pb,bindModule:gS},{register:Ob,bindModule:yS},{register:Rb},{register:oD}];let dD=!1;const uD=[lC,vC,SC,$O,PC,NC,qC,nw,uw,bw,Mw,Dw,jw,tR,qw,nM,nR];function pD(t){return{getContributions:t}}function gD(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function fD(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=jA();i(a),s(a),n(a),NA(),gD(e,{envParams:r,force:!0})}function mD(t,e){fD(t,"browser",{bindEnv:pR,bindCanvasModules:SO,bindWindowContribution:lR},e)}function vD(t,e){fD(t,"node",{bindEnv:fI,bindCanvasModules:IO,bindWindowContribution:pI},e)}function yD(t){WA(t),function(){if(dD)return;const t=jA();dD=!0,cD.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),aD(t),NA()}(),GA(t),UA(t)}function _D(t){WA(t);const e=jA();uD.forEach((t=>t(e))),rR(e),YA(t,tA),function(t){const e=jA(),i=pD((()=>t.registry.picker.getAll())),s=pD((()=>e.isBound(Jm)?e.getAll(Jm):[])),n=pD((()=>e.isBound(Qm)?e.getAll(Qm):[])),r=VA();ah.pickerServiceFactory=()=>new UO(i,{},s,n),ah.global=r}(t)}function bD(t){WA(t);SR(jA()),YA(t,SS),function(t){const e=jA(),i=pD((()=>t.registry.picker.getAll())),s=pD((()=>e.isBound(Jm)?e.getAll(Jm):[])),n=pD((()=>e.isBound(Qm)?e.getAll(Qm):[]));ah.pickerServiceFactory=()=>new vR(i,s,n)}(t)}function xD(){if(xD.__loaded)return;xD.__loaded=!0;const t=f_();yb(),ox({bind:t.bind}),_S?$O(t):xR(t)}xD.__loaded=!1;const SD=xD;function AD(){if(AD.__loaded)return;AD.__loaded=!0;const t=f_();Eb(),cS({bind:t.bind}),tR(t)}AD.__loaded=!1;const kD=AD;function CD(){CD.__loaded||(CD.__loaded=!0,Rb())}CD.__loaded=!1;const wD=CD;class MD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,K_(this.target,i,yo.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class ED extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class PD extends MD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class OD extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const RD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class ID extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){Y_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){Y_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class DD extends ID{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=RD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r),this.determineUpdateFunction()}}class LD extends ID{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class FD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class zD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const HD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class jD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=HD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ND extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const VD=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class WD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(Y_(this.target,{points:r.map(((t,i)=>yh(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class UD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:VD(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class GD extends WD{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:VD(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const YD=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class XD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:YD(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class KD extends WD{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:YD(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const $D=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class qD extends WD{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:$D(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}else this.valid=!1}}class ZD extends WD{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:$D(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const JD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class QD extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class tL extends QD{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=JD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}}class eL extends QD{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const iL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class sL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=iL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&$_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){X_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aL extends rL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&A(m.x)?m.x:g,b=u.includes("y")?y:m&&A(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}}class oL extends rL{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,y=v&&A(v.x)?v.x:f,_=v&&A(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class lL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,K_(this.target,{text:n})}}class hL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class cL extends hL{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&$_(this.target,e)}}class dL extends hL{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=pt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:A(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class uL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),w=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,T=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,B=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,E=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(T){case"x":A={scaleX:null!==(g=null!=B?B:w.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=E?E:w.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=B?B:w.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=E?E:w.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&$_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),Y_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class pL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),Y_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class gL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const fL={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function mL(t,e){for(let i=0;ifL[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&w_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(Y_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class yL{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new M_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function _L(t){return new yL(t)}class bL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;K_(this.target,{text:o})}}class xL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if($_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),$_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),$_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),$_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;$_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:bL});const i=s._titleBottom.attribute.text;$_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:bL})}else $_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),$_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;$_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());$_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class SL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class AL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if($_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:bL}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:bL}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class kL extends sb{onBind(){super.onBind();const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class CL extends nb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=__.createCanvas({width:t.width,height:t.height,dpr:__.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=__.createCanvas({width:t.width,height:t.height,dpr:__.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CL.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class wL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==ML.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==ML.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TL{static createTempCanvas(t,e,i){return __.createCanvas({width:t,height:e,dpr:i||__.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=TL.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TL.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TL.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(TL.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(TL.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(TL.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(TL.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(TL.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class PL extends ML{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class DL extends ML{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=TL.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class LL extends CL{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=__.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=__.createCanvas({width:i,height:s,dpr:__.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class FL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}K_(this.target,{textConfig:o})}}class zL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),K_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),K_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class HL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?zg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),K_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?zg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=zg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),K_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function WL(t,e){Y_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class UL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,$_(this.target,m)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class GL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,$_(this.target,d)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class YL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,$_(this.target,p)}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class XL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,$_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),K_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class KL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,$_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),K_(this.target,n)}}class $L extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new M_(this.target);a.execute({type:"custom",custom:UL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:GL,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class qL extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new M_(this.target);a.execute({type:"custom",custom:UL,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:YL,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class ZL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class JL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class QL extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){WL(this.target,VL(this.propKeys,this.from,this.to,e))}}class tF extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new M_(this.target);n.execute({type:"custom",custom:JL,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class eF extends ib{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new M_(this.target);n.execute({type:"custom",custom:QL,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:ZL,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class iF extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),Y_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Pu(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Pu(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class sF extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=ah.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Sl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=ah.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Lo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Lo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function cF(t){var e,i;const s=null!==(e=f_().getAll(ky))&&void 0!==e?e:[],n=lF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;hF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=oF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function dF(t,e){var i,s;const n=null!==(i=f_().getAll(e))&&void 0!==i?i:[],r=lF(t.registry.picker,"vrender:legacy-picker"),a=new Set;hF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=oF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const uF=mD,pF=vD,gF={taro:{installEnv:function(t,e){fD(t,"taro",{bindEnv:bI,bindCanvasModules:FO,bindWindowContribution:yI},e)},loadEnv:xI},feishu:{installEnv:function(t,e){fD(t,"feishu",{bindEnv:PR,bindCanvasModules:CO,bindWindowContribution:mR},e)},loadEnv:OR},tt:{installEnv:function(t,e){fD(t,"tt",{bindEnv:MI,bindCanvasModules:jO,bindWindowContribution:AI},e)},loadEnv:TI},wx:{installEnv:function(t,e){fD(t,"wx",{bindEnv:LI,bindCanvasModules:WO,bindWindowContribution:OI},e)},loadEnv:FI},lynx:{installEnv:function(t,e){fD(t,"lynx",{bindEnv:cI,bindCanvasModules:PO,bindWindowContribution:QR},e)},loadEnv:dI},harmony:{installEnv:function(t,e){fD(t,"harmony",{bindEnv:XR,bindCanvasModules:TO,bindWindowContribution:FR},e)},loadEnv:KR}},fF=[sC,tC,x_,A_,dA,pA],mF=[()=>{M_.registerBuiltInAnimate("increaseCount",lL),M_.registerBuiltInAnimate("fromTo",rb),M_.registerBuiltInAnimate("scaleIn",uL),M_.registerBuiltInAnimate("scaleOut",pL),M_.registerBuiltInAnimate("growHeightIn",jD),M_.registerBuiltInAnimate("growHeightOut",ND),M_.registerBuiltInAnimate("growWidthIn",sL),M_.registerBuiltInAnimate("growWidthOut",nL),M_.registerBuiltInAnimate("growCenterIn",FD),M_.registerBuiltInAnimate("growCenterOut",zD),M_.registerBuiltInAnimate("clipIn",BD),M_.registerBuiltInAnimate("clipOut",ED),M_.registerBuiltInAnimate("fadeIn",PD),M_.registerBuiltInAnimate("fadeOut",OD),M_.registerBuiltInAnimate("growPointsIn",UD),M_.registerBuiltInAnimate("growPointsOut",GD),M_.registerBuiltInAnimate("growPointsXIn",XD),M_.registerBuiltInAnimate("growPointsXOut",KD),M_.registerBuiltInAnimate("growPointsYIn",qD),M_.registerBuiltInAnimate("growPointsYOut",ZD),M_.registerBuiltInAnimate("growAngleIn",DD),M_.registerBuiltInAnimate("growAngleOut",LD),M_.registerBuiltInAnimate("growRadiusIn",tL),M_.registerBuiltInAnimate("growRadiusOut",eL),M_.registerBuiltInAnimate("moveIn",aL),M_.registerBuiltInAnimate("moveOut",oL),M_.registerBuiltInAnimate("rotateIn",cL),M_.registerBuiltInAnimate("rotateOut",dL),M_.registerBuiltInAnimate("update",vL),M_.registerBuiltInAnimate("state",gL),M_.registerBuiltInAnimate("labelItemAppear",xL),M_.registerBuiltInAnimate("labelItemDisappear",SL),M_.registerBuiltInAnimate("poptipAppear",AL),M_.registerBuiltInAnimate("poptipDisappear",kL),M_.registerBuiltInAnimate("inputText",bL),M_.registerBuiltInAnimate("inputRichText",FL),M_.registerBuiltInAnimate("outputRichText",zL),M_.registerBuiltInAnimate("slideRichText",jL),M_.registerBuiltInAnimate("slideOutRichText",HL),M_.registerBuiltInAnimate("slideIn",UL),M_.registerBuiltInAnimate("growIn",GL),M_.registerBuiltInAnimate("spinIn",YL),M_.registerBuiltInAnimate("moveScaleIn",$L),M_.registerBuiltInAnimate("moveRotateIn",qL),M_.registerBuiltInAnimate("strokeIn",XL),M_.registerBuiltInAnimate("slideOut",ZL),M_.registerBuiltInAnimate("growOut",JL),M_.registerBuiltInAnimate("spinOut",QL),M_.registerBuiltInAnimate("moveScaleOut",tF),M_.registerBuiltInAnimate("moveRotateOut",eF),M_.registerBuiltInAnimate("strokeOut",KL),M_.registerBuiltInAnimate("pulse",iF),M_.registerBuiltInAnimate("MotionPath",NL),M_.registerBuiltInAnimate("streamLight",sF),M_.registerBuiltInAnimate("dissolve",EL),M_.registerBuiltInAnimate("grayscale",IL),M_.registerBuiltInAnimate("distortion",PL),M_.registerBuiltInAnimate("particle",DL),M_.registerBuiltInAnimate("glitch",RL),M_.registerBuiltInAnimate("gaussianBlur",OL),M_.registerBuiltInAnimate("pixelation",LL)},gb],vF=[pC,_C,MC,SD,LC,hD,zC,YC,ew,hw,vw,Sw,Ow,Fw,Gw,Xw,eM,hM,wD,kD];function yF(){fF.forEach((t=>t())),mF.forEach((t=>t()))}function _F(t,e){if(!aF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==__?void 0:__.env)?__.envParams:void 0}(e);return void 0===i?vD(t):pF(t,i),yD(t),bD(t),mI(),vF.forEach((t=>t())),cF(t),dF(t,SS),yF(),t}function bF(t,e,i){if(!aF(t,e))return t;const s=gF[e];return s.installEnv(t,i),yD(t),function(t){bD(t)}(t),s.loadEnv(),vF.forEach((t=>t())),cF(t),dF(t,SS),yF(),t}const xF=Symbol.for("visactor.vrender.sharedAppRegistry");function SF(){var t;const e=globalThis,i=null!==(t=e[xF])&&void 0!==t?t:new Map;return e[xF]=i,i}function AF(t,e){const i=SF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function kF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=SF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function CF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=AF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(kF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>kF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=AF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&kF(t,i,s))}}}(t,s,r,o)}const wF=KA,MF=[];function TF(t){MF.forEach((({module:e,options:i})=>{wF(e,Object.assign(Object.assign({},i),{app:t}))}))}var BF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),cF(t),dF(t,tA),yF(),t):t}(_A(BF(t,["envParams"])),e);return TF(i),i}var PF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(t){case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony";case s.lynx:return"lynx";default:return"browser"}},zF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},HF=(t,e)=>{const i=FF(t),s=zF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},jF=(t,e)=>{const i=CF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,LF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},NF="poptipForText";class VF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(NP.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(NP.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(NP.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(NF))&&this._dedupeStagePlugin(NF)}initView(){var t,e,i,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:g,autoPreventDefault:f,background:m}=this._option,v=HF(l,h);__.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const s=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=FF(i.mode),n=HF(i.mode,i.modeParams);return jF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=s.releaseAppRef,null===(t=this._option.runtimePluginInstallers)||void 0===t||t.forEach((t=>t(s.app)));try{this._stage=(_=s.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:g,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:u(a)?a:!u(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=Qp({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(u(c)?c:_M(l))&&!1!==d&&_E.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,p(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=hO.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!y(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!yM(this._option.mode))return!1;return!1===(u(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:__.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(__.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=__.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>pO(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>pO(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{pO(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===hO.before;(e||i)&&(uM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=hO.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=hO.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),uM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=gO(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=fO(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=fO(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=dO(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=dO(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:mO,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{pO(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===oO.appear))?oO.appear:e.every((t=>t===oO.disappear))?oO.disappear:oO.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===VP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=IP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=IP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:LP(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===VP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===VP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===VP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===VP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===VP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{pO(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=gO(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return yM(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{__.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{pO(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=__.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){__.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function WF(t,i){var s;return e(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==i?void 0:i.onError)&&void 0!==s?s:gM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const UF={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}},GF={poptip:z({},UF)};function YF(t){t.crosshair=G(t.crosshair||{}).map((e=>gE({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function XF(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=oi(l,i.width,i.height);a=t,o=e}else if(h&&yM(e.mode)){let t;t=v(h)?__.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(bM(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}}const KF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function $F(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function qF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function ZF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;KF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function JF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}const QF=9,tz=0,ez=-1;var iz,sz,nz,rz,az,oz;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(iz||(iz={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(sz||(sz={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(nz||(nz={}));class lz{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},lz.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}lz.defaultMarkInfo={};class hz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class cz{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=>gE({},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 dz extends hz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=cz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new lz,this._lastLayoutRect=null,this.id=SM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new zP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${WE}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=_E.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return P(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class uz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=sz.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=QB(eE(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:JB(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:JB(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:JB(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:JB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:JB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:JB(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=JB(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=JB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=JB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(tE(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class pz extends dz{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new uz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class gz extends cz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class fz extends pz{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=gz,this.modelType="region",this.specKey="region",this.type=fz.type,this._series=[],this.layoutType="region",this.layoutZIndex=iz.Region,this.seriesDataFilterOver=()=>{this.event.emit(NP.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",iz.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",nz.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:iz.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:iz.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",nz.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",nz.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",nz.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",nz.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",nz.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function mz(t){const e=[],i=[],s=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function vz(t,e,i){e?t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function yz(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 _z(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=Az(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),yz(d,!0,p,l),s&&vz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function bz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=Az(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=Az(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),yz(d,!1,p,o),s&&vz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function Sz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=Az(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=Az(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&_z(n,e,i,!1,"left",s),r.length&&_z(r,e,i,!0,"left",s),a.length&&bz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&xz(n,e,i,!1,"top",s),r.length&&xz(r,e,i,!0,"top",s),a.length&&Sz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&_z(n,e,i,!1,"right",s),r.length&&_z(r,e,i,!0,"right",s),a.length&&bz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=mz(t);n.length&&xz(n,e,i,!1,"bottom",s),r.length&&xz(r,e,i,!0,"bottom",s),a.length&&Sz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=Az(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=Az(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:gM)("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}}}kz.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(rz||(rz={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(az||(az={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(oz||(oz={}));const Cz=["linear","radial","conical"],wz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Mz={};Object.values(az).forEach((t=>{Mz[t]=!0})),az.STATE_HOVER,az.STATE_HOVER_REVERSE,az.STATE_SELECTED,az.STATE_SELECTED_REVERSE,az.STATE_DIMENSION_HOVER,az.STATE_DIMENSION_HOVER_REVERSE;class Tz extends hz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class Bz extends Tz{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];u(s.domain)&&(n.domain=s.domain),u(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,cO.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Mz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(WE)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(WE))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(OT(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class Ez extends hz{constructor(){super(...arguments),this.id=SM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=_E.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Pz extends Ez{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Oz=1e3,Rz="quadInOut",Iz=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Dz=(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=Pu(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Lz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?rk(t):[],n=rk(e);i&&s&&(i.fromTransform&&ak(s,i.fromTransform.clone().getInverse()),ak(s,i.toTransfrom));const[r,a]=nk(s,n);return t?sk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},zz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Hz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!zz.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Tu.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class jz extends ib{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Lz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Dz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):K_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Nz=(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=Fz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Hz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new jz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Oz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Rz);return c.play(d),c};class Vz extends ib{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Lz(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&&Dz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Wz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Iz.includes(t))(i)||(e[i]=t[i])})),e},Uz=(t,e,i)=>{const s=Wz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=ah.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Gz=(t,e,i)=>{const s=[],n=i?null:Wz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Wz(t.attribute);if("rect"===t.type)hk(t,e).forEach((t=>{s.push(ah.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)ck(t,e).forEach((t=>{s.push(ah.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)dk(t,e).forEach((t=>{s.push(ah.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=gk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(ah.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?_k(t,e).forEach((t=>{s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?pk(t,e).forEach((t=>{s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&bk(t,e).forEach((t=>{"path"in t?s.push(ah.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(ah.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Uz(t,s,e),s},Xz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Kz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Xz(l.delay,n,a,o),d=Xz(l.duration,n,a,o),u=Xz(l.oneByOne,n,a,o),p=Xz(l.splitPath,n,a,o),g=A(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Gz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Yz)(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);Nz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Gz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Yz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Fz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Hz(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:yo.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 jz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Oz,null!==(l=i.easing)&&void 0!==l?l:Rz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:yo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Vz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Oz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Rz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Nz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},$z=(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))))},qz=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},Zz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},Jz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];Zz(t,a,s)},Qz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));Zz(t,r,i)},tH=Symbol("statesClearedBeforeReInit");class eH extends Ez{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Pz(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Qp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:iz.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Sl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===rz.enter||t.context.diffState===rz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&Zz(t,r,e)},this.name=t,this.model=e.model,this.key=e.key,this.state=new Bz(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(t){return[nz.User_Mark,nz.User_Series,nz.User_Chart,nz.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&gE(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(RT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=GB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):Cz.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):RT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",nz.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,nz.User_Mark)}else this.setStyle(i,t,nz.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=LB(DB(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},wz[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ii.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)Cz.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=LB(DB(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return dO(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return _E.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[KE],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=dO(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===oO.appear))?oO.appear:t.every((t=>t===oO.disappear))?oO.disappear:t[0];return null!=e?e:oO.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{qz(t),s.push(...t.getGraphics())})),e.forEach((t=>{qz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Kz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=$z(e,n),r=$z(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===oO.exit?oO.exit:i===oO.update?oO.update:oO.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===rz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===rz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=rz.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=rz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=rz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=oO.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=oO.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return uO(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=uO(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||c(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!c(r)&&(!Cz.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!RT(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);d(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,FP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===az.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=_E.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=_E.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===hO.before||(this._product||this._initProduct(),uM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[tH],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?Jz(i,t,!0,a):Qz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[tH]=e:delete s[tH]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===rz.exit&&!e.isExiting)if(e.context.animationState===rz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===rz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:rz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Qp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[tH]=t.currentStates.slice())}))}}var iH;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(iH||(iH={}));class sH extends eH{constructor(){super(...arguments),this.type=sH.type,this._marks=[],this._diffState=rz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(pM("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?(pM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return pO(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===rz.update){const t=this.hasAnimation(),e=FP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=rz.update}render(){this._isCommited&&(uM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}sH.type="group";const nH={measureText:VE};class rH{static instance(){return rH.instance_||(rH.instance_=new rH),rH.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 aH{constructor(){this.id=SM(),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))?pM("不要重复添加相同的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 oH extends aH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const lH=(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"},hH=(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 cH extends o{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=qa.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=qa.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||lH(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=hH(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=qa.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=hH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=lH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=qa.now()-i>this.config.press.time&&hH(s[0],t){ah.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:yo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class uH extends dH{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 C=ah.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,M;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},M={startAngle:x}):(w={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?w:M,"in"===b?M:w,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class pH extends dH{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=ah.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 gH extends ib{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&w_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(Y_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=yh(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));K_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const fH={type:"fadeIn"};function mH(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 fH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class vH extends nb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const yH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},_H={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},bH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},xH=()=>{_E.registerAnimation("scaleInOut",(()=>_H))},SH=()=>{_E.registerAnimation("fadeInOut",(()=>bH))},AH=(t,e)=>({appear:mH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:gH,duration:yH.update.duration,easing:yH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),kH=()=>{_E.registerAnimation("line",AH)},CH=()=>{M_.registerBuiltInAnimate("growPointsIn",UD),M_.registerBuiltInAnimate("growPointsOut",GD),M_.registerBuiltInAnimate("growPointsXIn",XD),M_.registerBuiltInAnimate("growPointsXOut",KD),M_.registerBuiltInAnimate("growPointsYIn",qD),M_.registerBuiltInAnimate("growPointsYOut",ZD),M_.registerBuiltInAnimate("clipIn",BD),M_.registerBuiltInAnimate("clipOut",ED)},wH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};az.STATE_HIGHLIGHT,az.STATE_BLUR;class MH{constructor(t){this._markSet=new lz,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const TH={highlightState:az.STATE_HIGHLIGHT,blurState:az.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class BH extends MH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},TH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Qz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}BH.type="element-highlight",BH.defaultOptions=TH;const EH=()=>{_E.registerInteractionTrigger(BH.type,BH)},PH={state:az.STATE_SELECTED,trigger:"click"};class OH extends MH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},PH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),Jz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Qz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}OH.type="element-select",OH.defaultOptions=PH;const RH=()=>{_E.registerInteractionTrigger(OH.type,OH)};class IH extends aH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const DH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},LH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...LH(t))})),s},FH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(DH(t,r),!1)};class zH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>_E.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>_E.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>_E.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return _E.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>_E.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){_E.registerTransform(t,e)}static registerFunction(t,e){t&&e&&rH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&rH.instance().unregisterFunction(t)}static getFunction(t){return t?rH.instance().getFunction(t):null}static getFunctionList(){return rH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=_E.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=_E.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,qP.get(e);var e}static registerSVG(t,e,i){const s=_E.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=_E.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){IE.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=SM(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=vO.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=ZF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{var n;if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?_E.getSeriesBuiltInTheme(e):_E.getComponentBuiltInTheme(e);i=i?gE({},s,i[e]):s}s===t.length-1&&u(i)&&(i=zE({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e],(null===(n=this.getFunctionList())||void 0===n?void 0:n.length)&&(i=jE(i,this)))})),this._cachedProcessedTheme[e]=i,i},BT(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:y,stage:_,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=yM(y);if(S?gR(eA):"node"===y&&mI(eA),S&&f&&(this._container=v(f)?__.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==y&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=DE.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=_E.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===e.type&&A.push("scrollbar");const C=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new VF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new XP(this,this._compiler),this._event=new zP(this._eventDispatcher,y),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),IE.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=gE({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=HE(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;zH.getFunctionList()&&zH.getFunctionList().length&&(t=jE(t,zH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=_E.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=_E.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=_E.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(NP.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(NP.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return XF(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:UE,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:GE})}_initDataSet(t){this._dataSet=t instanceof La?t:new La,$P(this._dataSet,"dataview",Ra),$P(this._dataSet,"array",i),KP(this._dataSet,"copyDataView",iO);for(const t in _E.transforms)KP(this._dataSet,t,_E.transforms[t]);for(const t in _E.dataParser)$P(this._dataSet,t,_E.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),$F(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(NP.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?oO.none:oO.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,IE.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{DH(t)})),this._exitingVRenderComponents.clear())}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Fa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=nO(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?gE({},t[n][e.index],i):i):t[n]=s?gE({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?gE({},t[n][r],i):i)}else t.id===e&&(t[n]=s?gE({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=gE({},t.getSpec(),e));const r=t.updateSpec(e),a=$F(r),o=qF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(NP.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=bE({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=LE(this._currentThemeName),this._currentTheme=o(a,l);else{const t=bE({},LE(p(r)&&r.type?r.type:p(n)&&n.type?n.type:this._currentThemeName),LE(n),LE(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(GF.poptip,UF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!yM(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return LE(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!DE.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=u(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(n.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield WF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!yM(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,e):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(u(this._container))return this._container;let e;return e=v(this._canvas)?__.getElementById(this._canvas):this._canvas,u(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?iE(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return pM("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?iE(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(pM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return rH.instance().getFunction(t)}registerFunction(t,e){t&&e&&rH.instance().registerFunction(t,e)}unregisterFunction(t){t&&rH.instance().unregisterFunction(t)}getFunctionList(){return rH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=_E.getChartPlugins();t.length>0&&(this._chartPlugin=new oH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=_E.getVChartPlugins();e.length>0&&(this._vChartPlugin=new IH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=vO.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=vO.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}zH.InstanceManager=IE,zH.ThemeManager=DE,zH.globalConfig={uniqueTooltip:!0},zH.Utils=nH,zH.vglobal=__;_E.registerRegion("region",fz),_E.registerLayout("base",kz),Xw(),zC(),_E.registerMark(sH.type,sH),_E.registerStageEventPlugin("gesture",cH),EH(),RH(),BE(hE.name,hE);const HH="monotone",jH="linear",NH="bevel";var VH;!function(t){t.vertical="vertical",t.horizontal="horizontal"}(VH||(VH={}));class WH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}class UH extends ub{constructor(t){super(t),this.lastFrameTime=0,this.status=Ml.RUNNING}setupTickHandler(){const t=new WH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ml.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ml.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ml.RUNNING,!0}}function GH(t,e){return e("component",t)}function YH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=_E.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const XH=(t,e,i,s)=>{if(d(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},KH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,c(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],p=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(c(e.set))g=function(t){const i=p.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=p.get(`${e[a]}`);if(d(i))for(let i=0;i(g(t),t)))},$H="2.1.4",qH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},ZH=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=YH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},JH=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const QH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function tj(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=ij(ZH(h,r,a,c),p,g),o.value=ij(ZH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=ZH(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function ej(t,e,i,s,n,r,a){if(c(e)){tj(t,e(n,a),i,s,r,a)}else e&&tj(t,e,i,s,r,a)}const ij=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=vi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class sj{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(u(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{ej(a,t,e,i,s,n,r)})):c(t)?ej(a,t,e,i,s,n,r):t&&tj(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:ZH(r.visible,t,n),value:ij(ZH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:ZH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=ZH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&QH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const nj={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},rj=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=mP([],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 aj(a,n,o)},aj=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{AM(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{AM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nj[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},oj=(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=>{AM(t[e])||(t[e]=0)}))})),t},lj=`${WE}_HIERARCHY_DEPTH`,hj=`${WE}_HIERARCHY_ROOT`,cj=`${WE}_HIERARCHY_ROOT_INDEX`;function dj(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function uj(t,e,i){t&&(i.needDefaultSeriesField&&(t[$E]=i.defaultSeriesField),t[XE]=e,t[KE]=i.getKey(t,e,i))}function pj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function gj(t,e,i,s=0,n,r){void 0===r&&(r=e),uj(t,e,i),t[lj]=s,t[hj]=n||t[i.categoryField],t[cj]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>gj(e,s,i,t[lj]+1,t[hj],r)))}const fj={label:{name:"label",type:"text"}},mj=`${WE}_rect_x`,vj=`${WE}_rect_x1`,yj=`${WE}_rect_y`,_j=`${WE}_rect_y1`,bj={data:!0},xj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},Sj=[...Object.keys(yH),"normal"];function Aj(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 Tj(n)&&delete n.type,n.oneByOne&&(n=Cj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:wj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=gE({},o[e],a);return Tj(n)&&delete n.type,n.oneByOne&&(n=Cj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:wj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function kj(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),Bj(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function Cj(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=c(n)?n(t,i,a):A(n)?n:0,h=c(r)?r(t,i,a):A(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):A(n)?n:0,d=c(a)?a(t,r,o):A(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function wj(t,e){var i;return null!==(i=null==t?void 0:t[XE])&&void 0!==i?i:e.context.graphicIndex}function Mj(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 Tj(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function Bj(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),Bj(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),Bj(t[s],e,i))}function Ej(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Pj extends cz{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=OB(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=_E.getSeriesMarkMap(o)?function(t,e,i){const s=_E.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=gE({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return gE({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=gE({},i,s,t),n=i.label;return n&&p(n)&&y(e.label)&&(e.label=e.label.map((t=>gE({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Oj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(xj[e]||(t[e]=!0),t)),{}),Rj={compileOnlyKeys:xj,dataRelatedKeys:Oj,seriesOnlyKeys:{tooltip:!0}},Ij={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Dj=t=>(t=>p(t)&&!y(t)&&!c(t))(t)?t:d(t)?{}:null,Lj=(t,e,i)=>{const s=Dj(t),n=Dj(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function Fj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class zj extends dz{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){u(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${WE}_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=Pj,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=iz.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(NP.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Ej(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(NP.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),u(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(KP(this._rawData.dataSet,"invalidTravel",oj),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=nO(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=sO(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=sO(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Pz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=aj(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){KP(this._dataSet,"dimensionStatistics",rj);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Fa(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&&mP(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){KP(this._dataSet,"dimensionStatistics",rj);const s=new Fa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=mP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&mP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Fa(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:v(t)?e=>e[t]:y(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(KP(this._rawData.dataSet,"addVChartProperty",qH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:dj.bind(this),call:uj}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(NP.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(NP.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(NP.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(NP.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=Aj({},kj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:_M(i)||bM(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=gE(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=gE(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=wH(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=wH(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:az.STATE_HOVER_REVERSE,highlightState:az.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:az.STATE_SELECTED_REVERSE,state:az.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=wH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:$E;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:qE,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,qE,nz.User_SeriesStyle)}))}afterInitMark(){this.event.emit(NP.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",nz.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(_E.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new sj(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,Fj(i))}_getSpecUpdatePolicy(){return Rj}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},bj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(G(t.label),G(e.label),l),!l.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Lj(t[i],e[i],Ij)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Lj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?Fj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&Fj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Fa||rO(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Ej(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:$E,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DB(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:$E}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,u=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${u}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,gE({},p,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:KE}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${d(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==QE&&t!==eP&&t!==JE&&t!==tP||(t=this.getStackValueField()),null!==(e=yP(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>AM(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:$E]}}function Hj(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();OT(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 jj(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}}}zj.mark=fj,zj.transformerConstructor=Pj;class Nj extends zj{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);OT(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:`${WE}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(QE),this.setFieldX2(JE)):(this.setFieldY(QE),this.setFieldY2(JE))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(eP),this.setFieldX2(tP)):(this.setFieldY(eP),this.setFieldY2(tP))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(sP),this.setFieldX2(iP)):(this.setFieldY(sP),this.setFieldY2(iP))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),u(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(NP.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)&&(Hj("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Vj(t){return"bottom"===t||"top"===t}function Wj(t){return"left"===t||"right"===t}function Uj(t){return"z"===t}function Gj(t,e){return $B(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Yj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Xj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Vj(t)?"linear":"band":Vj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const Kj=(t,e,i)=>{var s;const n=null!==(s="band"===e?GH("axisBand",i):["linear","log","symlog"].includes(e)?GH("axisLinear",i):{})&&void 0!==s?s:{},r=Vj(t)?GH("axisX",i):Wj(t)?GH("axisY",i):GH("axisZ",i);return gE({},GH("axis",i),n,r)};class $j{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:gM)("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:gM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>IT(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Vj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class qj extends $j{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Zj=(t,e)=>{var i,s;return t===e||!d(t)&&!d(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},Jj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return A(s)?[-s,s]:s},Qj=(t,e,i,s)=>{var n;const r=e.getScale(),a=IT(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:tN(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,eN=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class iN extends $j{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Zj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:VP.canvas}),callback:this.onMouseOut}),_M(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),_M(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var sN;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(sN||(sN={}));const nN={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},rN={sampling:!0,samplingFactor:!0};class aN{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(nN.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:NH,curveType:jH,closePath:!0},"normal",nz.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===HH?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",nz.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",nz.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(nN.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:Mj(this._spec,nN.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Fa(this._option.dataSet,{name:`${WE}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(sN.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:nz.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:az.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",nz.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",nz.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[nN.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(sN.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,gE({},this._spec[nN.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:az.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",nz.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",nz.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const oN=Object.assign(Object.assign({},fj),nN),lN=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>lN(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},hN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class cN extends eH{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return hN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(RT(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?lN(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:rz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[KE]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const dN=new Uint32Array(33),uN=new Uint32Array(33);uN[0]=0,dN[0]=~uN[0];for(let t=1;t<=32;++t)uN[t]=uN[t-1]<<1|1,dN[t]=~uN[t];function pN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&dN[31&o]&uN[1+(31&l)])return!0}else{if(i[h]&dN[31&o])return!0;if(i[c]&uN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,dN[31&o]&uN[1+(31&l)]);else for(s(h,dN[31&o]),s(c,uN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,uN[31&a]|dN[1+(31&o)]);else for(n(l,uN[31&a]),n(h,dN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function gN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function fN(t,e,i=!1){return i?gN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function mN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=fN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=gN(t,r)),e.getRange(r)))}function vN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return vN(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return vN(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return vN(t,e,n,s,h,d)}return!1}const _N=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],bN=["top","inside-top","inside"];function xN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const SN={mode:"same-time",duration:300,easing:"linear"};function AN(t){return 3===t||4===t}function kN(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 CN=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 wN(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)}}class MN extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class TN extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const BN=(t,e)=>Math.ceil(t)>Math.floor(e),EN=([t,e],[i,s])=>s>t&&e>i;function PN(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const ON=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class RN extends Jp{constructor(t,e){super(t),this._skipRenderAttributes=ON,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{LN(t,e,i)})),e}function FN(t,e){e&&(null==t||t.onComplete.push(e))}function zN(t){t.forEach((t=>{t()}))}function HN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var jN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(UM.hover,!0),CM(this,(t=>{t===e||E(t.states)||t.addState(UM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(CM(this,(t=>{E(t.states)||(t.removeState(UM.hoverReverse),t.removeState(UM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void CM(this,(t=>{E(t.states)||(t.removeState(UM.selectedReverse),t.removeState(UM.selected))}));E(e.states)||(e.addState(UM.selected,!0),CM(this,(t=>{t===e||E(t.states)||t.addState(UM.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)===yo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===yo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Se(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[wN(g,f,c,d,a,o),wN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=jM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Sl)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),zN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,FN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(SN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=LN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=LN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},HN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(c(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=c(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!h(t)&&c(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}c(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return JM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=c(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&BN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&BN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(PN([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!EN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(fN(i,e,!0))}))),h.length>0&&h.forEach((t=>{v(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(fN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(fN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;DN(i,null==n?void 0:n.attribute),DN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{VN[t]=e};var UN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};GN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const YN=()=>{WN("line",GN),WN("area",GN)};var XN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}KN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const $N=()=>{WN("symbol",KN),WN("line-data",KN)};class qN extends cN{constructor(){super(...arguments),this.type=qN.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)===EB.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}qN.type="line";const ZN=()=>{_E.registerMark(qN.type,qN),Xw(),ew(),YN(),$N(),CH(),_E.registerGraphicComponent("line",rg)};class JN extends eH{constructor(){super(...arguments),this.type=JN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}JN.type="symbol";const QN=()=>{_E.registerMark(JN.type,JN),Xw(),eM(),$N(),_E.registerGraphicComponent("symbol",Ug)};class tV extends Pj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function eV(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function iV(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function sV(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 nV(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 rV(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 aV(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 oV=t=>t.map(((t,e)=>({index:e,value:t}))),lV=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},hV=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=KM(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return oV(v)};class uV{constructor(t){this.id=SM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class pV extends uV{constructor(){super(pV.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!OT(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(NP.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&eV(c)&&eV(d)))return;const u=iV(t,c),p=iV(e,d);if(!0===u.break&&!0===p.break)return;const{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(!nV(u,p))return}else if(0===_&&0===b){if(!nV(p,u))return}else if(y||A)if(y&&!A){if(!sV(u,p))return}else if(A&&!y){if(!sV(p,u))return}else{if(f===b)return;if(f>b){if(!rV(u,p))return}else if(!rV(p,u))return}else{if(0===f&&0===_){if(!aV(u,p))return}else if(0===b&&0===g&&!aV(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){KP(e.getOption().dataSet,"tickAlign",dV);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}pV.pluginType="component",pV.type="AxisSyncPlugin";const gV={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function fV(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 mV(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 vV(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const yV=t=>"band"===t||"ordinal"===t||"point"===t;function _V(t,e){return{id:t,label:t,value:e,rawValue:t}}function bV(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class xV extends aH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const SV=`${WE}_ARC_TRANSFORM_VALUE`,AV=`${WE}_ARC_RATIO`,kV=`${WE}_ARC_START_ANGLE`,CV=`${WE}_ARC_END_ANGLE`,wV=`${WE}_ARC_K`,MV=`${WE}_ARC_MIDDLE_ANGLE`,TV=`${WE}_ARC_QUADRANT`,BV=`${WE}_ARC_RADIAN`,EV=-Math.PI/2,PV=3*Math.PI/2,OV=.6,RV=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},IV=(t,e,i)=>{var s;const n=null!==(s="band"===e?GH("axisBand",i):"linear"===e?GH("axisLinear",i):{})&&void 0!==s?s:{},r=GH("angle"===t?"axisAngle":"axisRadius",i);return gE({},GH("axis",i),n,r)};function DV(t,e,i,s){switch(t){case n.cartesianBandAxis:return Kj(Gj(i,["z"]),"band",e);case n.cartesianLinearAxis:return Kj(Gj(i,["z"]),"linear",e);case n.cartesianLogAxis:return Kj(Gj(i,["z"]),"log",e);case n.cartesianSymlogAxis:return Kj(Gj(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return Kj(Gj(i),void 0,e);case n.polarBandAxis:return IV(i.orient,"band",e);case n.polarLinearAxis:return IV(i.orient,"linear",e);case n.polarAxis:return IV(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=GH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>Vj(t.orient)));let g;g=u(p)?gE({},yV(p.type)?a:o,l):l;const f=r.find((t=>Wj(t.orient)));let m;return m=u(f)?gE({},IT(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=GH(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?gE({},yV(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?gE({},IT(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return LV(i,GH(t,e));default:return GH(t,e)}}const LV=(t,e)=>{var i;const s=gE({},e,e[Yj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class FV extends cz{getTheme(t,e){return DV(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({},eE(e)),{[s]:0}))}}class zV extends pz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=FV,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof $a||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:VP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new xV(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;DH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=LH(t),s=FH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}DH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var HV,jV;zV.transformerConstructor=FV,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(HV||(HV={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(jV||(jV={}));class NV extends eH{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=FH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?DH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(DH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?(this._component.setAttributes(i),this._product&&this._component.parent!==this._product&&this._product.appendChild(this._component)):(this._component=_E.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(HP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}NV.type="component";const VV=()=>{_E.registerMark(NV.type,NV)};var WV,UV;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(WV||(WV={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(UV||(UV={}));const GV={[UV.selectedReverse]:{},[UV.selected]:{},[UV.hover]:{},[UV.hoverReverse]:{}},YV=t=>t,XV={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class KV extends zV{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?HV.circleAxis:HV.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?jV.circleAxisGrid:jV.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:iz.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(this._syncComponentVisibility(),(null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=Aj(null===(l=_E.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=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||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Pz(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&CT(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=y(a)?OT(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!OT(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return CT(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;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(NP.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=wT(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),CT(this._regions,(t=>{t.event.on(NP.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(NP.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):CT(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(CT(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;tV(null==e?void 0:e[i],null==t?void 0:t[i])||XV[i]))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=EP(s=e.domainLine)).startSymbol=EP(s.startSymbol),s.endSymbol=EP(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=H(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return RP(gE({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:RP(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>RP(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=RP(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return RP(gE({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:RP(e.tick.style)),e.tick.state&&(i.tick.state=PP(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return RP(gE({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:RP(e.subTick.style)),e.subTick.state&&(i.subTick.state=PP(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=gV[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:gE({},u,RP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:RP(h.style)}),h.state&&(i.title.state.shape=PP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:RP(o.style)}),o.state&&(i.title.state.background=PP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=PP(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=RP(e.background.style)),e.background.state&&(i.panel.state=PP(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:NE(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(t.grid.style)?(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return RP(gE({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:RP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:NE(t.subGrid.alternateColor),style:RP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=YH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){$P(this._option.dataSet,"scale",YV);const i=this.registerTicksTransform();return new Fa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===WV.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}KV.specKey="axes";const $V=()=>{VV(),_E.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},qV=[pV];class ZV extends KV{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=iz.Axis,this.layoutLevel=sz.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),CT(this._regions,(t=>{const e=this.getOrient();Vj(e)?bV(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Wj(e)?bV(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Uj(e)&&bV(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._clearContinuousBarBandwidthCache=()=>{this._continuousBarBandwidthCache=void 0},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=gE({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(gE({x:e.x,y:e.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Vj(this.getOrient()),n=t=>{var e;return(s?!Vj(t.getOrient()):Vj(t.getOrient()))&&OT(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Gj(e,["z"]),Uj(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!vV(e))return null;const{axisType:t,componentName:s}=Xj(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=>Wj(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(!vV(t))return;const{axisType:s,componentName:n}=Xj(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=_E.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Vj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Uj(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(qV.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Vj(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!Vj(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Uj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Wj(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=JB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=JB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Vj(this.getOrient())?t.fieldX:Uj(this.getOrient())?t.fieldZ:t.fieldY,OT(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:OT(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getBandwidth:(t=0)=>this._getContinuousBarBandwidth(t),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}_getContinuousBarBandwidth(t=0){if(0!==t||!OT(this._scale.type))return;const e=this._scales[0],i=e.domain(),s=e.range(),n=+(null==i?void 0:i[0]),r=+(null==i?void 0:i[i.length-1]),a=+(null==s?void 0:s[0]),o=+(null==s?void 0:s[s.length-1]);if(!(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(a)&&Number.isFinite(o)&&n!==r))return;const l=this._continuousBarBandwidthCache;if(l&&l.scale===e&&l.domainStart===n&&l.domainEnd===r&&l.rangeStart===a&&l.rangeEnd===o)return l.bandWidth;const h=new Set,c=this.getOrient();CT(this._regions,(t=>{var e,i,s,n;if(t.type!==EB.bar)return;const r=t,a=Vj(c)&&"vertical"===r.direction?r.fieldX[0]:Wj(c)&&"horizontal"===r.direction?r.fieldY[0]:void 0,o=a?null===(n=null===(s=null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.latestData)||void 0===s?void 0:s[a])||void 0===n?void 0:n.values:void 0;null==o||o.forEach((t=>{const e=+t;Number.isFinite(e)&&h.add(e)}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const d=Array.from(h).sort(((t,e)=>t-e));if(d.length<2)return;let u=1/0,p=d[0];for(let t=1;t0&&i{if(t===this._axisMark&&!1===this._isLayout&&(Vj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Vj(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return CT(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]:Vj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Uj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();CT(this._regions,(e=>{Vj(t)?bV(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Wj(t)?bV(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Uj(t)&&bV(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Vj(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=Vj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=gE(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ne).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Vj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return _V(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:OT(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),CT(this._regions,(t=>{var e,i;null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i||i.target.addListener("change",this._clearContinuousBarBandwidthCache)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._specVisible&&(this.event.on(NP.layoutEnd,this._updateAxisLayout),this.event.on(NP.layoutEnd,this._fixAxisOnZero),this.event.on(NP.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}ZV.type=n.cartesianAxis,ZV.specKey="axes";class JV{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Pz(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(NP.scaleDomainUpdate,{model:this}),this.event.emit(NP.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(n.push(r),o){const e=_V(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=>_V(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(NP.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const QV=(t,e,i,s)=>{const n=cV(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},tW=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,eW=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?oV([s[s.length-1]]):oV([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=X(g);if(s.length<=f/n){const i=QV(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=sW(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=QV(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!tW(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?eW(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function rW(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=pT(t,!!n),o=pT(r,!!n);const h=re.distancePP(s,l),c=re.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=nW(e,t,!1,!!n),o=nW(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=pT(t,!!n),o=pT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class aW extends RN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&hT(this._innerView),this.removeAllChild(!0),this._innerView=jM.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 cT(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?`${WV.grid}-sub`:`${WV.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=pT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=nW(t,o,!1,!!a)}const u=jM.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:aW.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=pT(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=jM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:aW.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}aW.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class oW{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=FM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return LM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class lW extends sb{onBind(){var t;const e=_L(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;DN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class hW extends sb{onBind(){const t=_L(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;DN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function cW(){zC(),ew(),Gw(),hM(),M_.registerBuiltInAnimate("axisEnter",lW),M_.registerBuiltInAnimate("axisUpdate",hW)}zC(),hw();class dW extends aW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},aW.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NM,endAngle:r=VM}=this.attribute;i=uT(t,s,re.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function uW(){zC(),ew(),vw(),eM()}function pW(){zC(),ew(),pC(),eM()}U(dW,oW),uW();class gW extends RN{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gW.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=jM.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),E(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=jM.line;G(i)[0].cornerRadius&&(t=jM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=jM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:Z(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}gW.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}}},pW();class fW extends gW{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gW.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=jM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function mW(){zC(),Ow(),eM(),Gw(),hM()}var vW=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nc&&(w=c,R.setAttribute("maxLineWidth",c-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=w,A&&A.setAttribute("x",(A.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):j>0&&S.setAttribute("x",b[3]):(k-=w/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const N="right"===_||"end"===_,V="left"===_||"start"===_,W=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:G(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=w-b[1]-b[3],e=I+B,i=1===j?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(V&&1!==j){const t=w-b[1]-b[3],e=0===j?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=w-b[1]-b[3],e=0===j?t/2+B/2:t;if(W(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-D/2),S.setAttribute("y",-b[2])):"top"===H&&(S.setAttribute("y",b[0]),A&&A.setAttribute("y",D/2)),E(null==m?void 0:m.text)||(R.states=m.text);const{visible:U}=a,Y=vW(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:M,x:k,y:C}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Sl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},yW.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}yW.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const _W=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(UM.hover,!0),CM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(UM.hoverReverse,!0)})),s):i},bW=(t,e,i)=>i?(CM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(UM.hoverReverse),t.removeState(UM.hover))})),null):i,xW=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(UM.selected)?(CM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(UM.selectedReverse),t.removeState(UM.selected))})),null):s.name&&!E(s.states)?(s.addState(UM.selected,!0),CM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(UM.selectedReverse,!0)})),s):i},SW={type:"default",duration:300,easing:"linear"};class AW extends IN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=_W(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=bW(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=xW(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=jM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),zN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,FN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(CM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=LN(this),{delay:a=0,duration:o=SW.duration,easing:l=SW.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};DN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=LN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},HN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&hT(this._innerView),this.removeAllChild(!0),this._innerView=jM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(SW)}_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=jM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=WV.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=jM.group({x:0,y:0,pickable:!1});t.name=WV.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=jM.group({x:0,y:0,pickable:!1});i.name=WV.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=jM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=WV.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=GM;else{const t=this.data[s],e=z({},GM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=jM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=WV.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=GM;else{const i=z({},GM,s.state);Object.keys(i).forEach((s=>{c(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=jM.group({x:0,y:0,pickable:!1});return r.name=`${WV.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=JM(this._getLabelAttribute(t,e,n,i));if(a.name=WV.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=GM;else{const s=z({},GM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new yW(Object.assign({},e));i.name=WV.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return cT(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&c(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=c(y)?z({},sT.label.style,y(t,e,i,s)):y;y=z(this.getLabelAlign(m,o,y.angle),y),c(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return c(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},CM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=I(r.attribute),a=I(e.attribute),o=qA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},DN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const kW={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&&gT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function CW(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function wW(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:kW[n]||kW.parity;if(s.length>=3&&fT(s,r)){do{s=a(s,r)}while(s.length>=3&&fT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);gT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),wW(l,s,n,(t=>gT(t,l,r))),wW(h,s,o,(t=>gT(t,h,r)||!(!n||t===l)&&gT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function TW(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},PW(t,e.attribute.angle)),{angle:EW(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({},OW(t,e.attribute.angle)),{angle:EW(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Ce({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function EW(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function PW(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=EW(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 OW(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=EW(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 RW(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=lT(h),m=oT(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function IW(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var DW=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=jM.group({zIndex:999});e.name=WV.axisBreak,e.id=this._getNodeId(`${WV.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},nT,s),a=null!==(e=r.size)&&void 0!==e?e:nT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=jM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=WV.axisBreakSymbol;const h=jM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=WV.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=jM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=WV.background,n.id=this._getNodeId("background"),n.states=z({},GV,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new yW(Object.assign({},t));e.name=WV.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=DW(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},GV,l),symbol:z({},GV,l)});const d=new gW(c);d.name=WV.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=DW(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),k=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let w,M,{angle:T}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(T)&&o){T=zM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else w=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(T&&0!==T){const t=Math.abs(Math.sin(T));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},k),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:M},a),state:{text:z({},GV,c.text),shape:z({},GV,c.shape),panel:z({},GV,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=DW(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=zM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return PW(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return OW(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=Y(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=ae(e)})),BW(i,t),!TW(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=lT(a),l=oT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=IW(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Yt(c,i))}}else{if(l){const i=IW(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Yt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);RW(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&MW(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=jM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=WV.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=$M(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}LW.defaultAttributes=sT,U(LW,oW);const FW={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},zW={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}}},HW={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}}},jW={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}}};class NW extends ZV{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new eB}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,iW),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=YT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),p=e=>{const i=t===n?a:0;if(d(r)||t{_E.registerGraphicComponent(HV.lineAxis,((t,e)=>new LW(t,e))),_E.registerGraphicComponent(jV.lineAxisGrid,((t,e)=>new dW(t,e))),$V(),_E.registerComponent(NW.type,NW,!1)},WW=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function UW(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,YW=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function XW(t,e,i="count"){const s=YW(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const KW=Math.sqrt(50),$W=Math.sqrt(10),qW=Math.sqrt(2);class ZW{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=mV(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=Vj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!c(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(Y(e)-e[0]);i<=1||A(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(GW),e.sort(GW),{domain:UW(t,e),scope:XW(t,e,i)}}(r,cM(t),this._spec.breaks[0].scopeType);e=cM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=mV(this._spec);if(u(e)||u(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=KW?10:n>=$W?5:n>=qW?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(NP.scaleDomainUpdate,{model:this}),this.event.emit(NP.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(NP.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function JW(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function QW(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!OT(t.type))return oV(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return oV([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(u(h))m=JW(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=JW(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=JW(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=cV(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=cV(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?eU.greedy:eU.parity;for(;l.length>=3&&fT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;gT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),QW(t,l,a,(e=>gT(e,t,i))),QW(n,l,o,(e=>gT(e,n,i)||!(!a||e===t)&&gT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return oV(m)},eU={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&gT(i,t,e)||(i=t,0))))}},iU={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class sU extends ZV{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new SB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Uj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Vj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=qB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=cM(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,tU),t}}sU.type=n.cartesianLinearAxis,sU.specKey="axes",sU.builtInTheme={axis:zW,axisLinear:iU,axisX:HW,axisY:jW},U(sU,ZW);const nU=()=>{_E.registerGraphicComponent(HV.lineAxis,((t,e)=>new LW(t,e))),_E.registerGraphicComponent(jV.lineAxisGrid,((t,e)=>new dW(t,e))),$V(),_E.registerComponent(sU.type,sU)},rU=`${WE}_hide_`;function aU(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const oU=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[rU]&&(aU(t,!0),t[rU]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[rU]=!0,aU(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},lU=()=>{_E.registerGrammarTransform("symbolOverlap",{transform:oU,runType:"afterEncode"})},hU={min:K,max:X,average:bT,sum:_T};function cU(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function dU(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 uU(t,e,i,s){return dU(t,e,i,"min",s)}function pU(t,e,i,s){return dU(t,e,i,"max",s)}function gU(t,e,i,s){return dU(t,e,i,"average",s)}function fU(t,e,i,s){return dU(t,e,i,"sum",s)}const mU=(t,e)=>{let i=c(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=cU;if("min"===n?l=uU:"max"===n?l=pU:"average"===n?l=gU:"sum"===n&&(l=fU),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[]},vU=()=>{_E.registerGrammarTransform("dataSampling",{transform:mU})};class yU extends Nj{constructor(){super(...arguments),this.type=EB.line,this.transformerConstructor=tV,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),rN)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(Aj(null===(i=_E.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),kj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=jj(this);this._symbolMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),kj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}yU.type=EB.line,yU.mark=oN,yU.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},yU.transformerConstructor=tV,U(yU,aN);class _U{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{rO(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Fa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];pM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];pM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class bU{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)=>{kM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{mP(e,[{key:t,operations:OT(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&&mP(e,[{key:i.field,operations:OT(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?GB("colorOrdinal"):GB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(kM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),kM(s.domain)?e.reRender=!0:V(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(!kM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=OT(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=OT(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;OT(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(OT(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=OT(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)));OT(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class xU{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Jz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Qz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Qz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Jz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&Jz(t,i,!0,l):a&&Jz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&Jz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Qz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Qz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const SU={[n.markPoint]:!0,[n.markLine]:!0,[n.markArea]:!0},AU={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class kU extends hz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=SM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:UE,height:GE},this._viewRect={width:UE,height:GE},this._viewBox={x1:0,y1:0,x2:UE,y2:GE},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>u(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(AU).some((t=>!d(e[t])))},this._paddingSpec=eE(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new zP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new _U(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new xU;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=_E.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(Aj({},kj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=_E.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:iz.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=_E.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(NP.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(NP.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(NP.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof dz)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 eH))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof eH)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&rO(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=XF(this._spec,this._option,{width:UE,height:GE})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DB(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new bU(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){ZF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DB(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=eE(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{ZF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},r={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===n.label||l.type===n.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));r[l.type]&&(r[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(y(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);qF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),ZF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);qF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),ZF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(r).forEach((e=>{if(r[e]){const i=this._spec[e];(y(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(SU[t]&&y(e)&&y(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return SU[t]&&y(e)&&e.length>0&&y(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!SU[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;SU[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];ZF(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=QB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(NP.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(az.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(az.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(az.STATE_SELECTED)}clearHovered(){this.clearState(az.STATE_HOVER)}_initEvent(){[NP.dataZoomChange,NP.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(HP.AFTER_MARK_RENDER_END,e)};this._event.on(HP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:LP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(DP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===sN.dimensionHover||s===sN.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>IT(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>IT(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const CU=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)},wU={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class MU{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},wU),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):dE(t,a,c.spec),dE(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=CU(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=CU(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(_E.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(_E.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=_E.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=_E.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=_E.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):XH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=XH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class TU extends MU{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&gE(i,JF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class BU extends TU{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),YF(t)}}const EU=(t,e)=>{const i={nodes:{}},{fields:s}=c(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=_P(t,!0);for(const e in o)for(const i in o[e].nodes)AP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)SP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&xP(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(NP.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class OU{_beforeInit(){this._dataSet&&KP(this._dataSet,"stackSplit",EU)}_initStack(){this._stack=new PU(this),this._stack.init()}}const RU={state:az.STATE_DIMENSION_HOVER,reverseState:az.STATE_DIMENSION_HOVER_REVERSE,trigger:sN.dimensionHover};class IU extends MH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},RU,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=LP(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}IU.type="dimension-hover",IU.defaultOptions=RU;const DU=()=>{_E.registerInteractionTrigger(IU.type,IU)},LU=()=>{_E.registerComposedEvent(sN.dimensionHover,iN),_E.registerComposedEvent(sN.dimensionClick,qj)},FU=t=>t.fieldX[0],zU=t=>t.fieldY[0],HU=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},jU=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},NU=(t,e)=>t?e?FU:HU:e?zU:jU,VU=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=eN(t,(t=>Vj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=eN(t,(t=>Wj(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{IT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=WU(t,i,NU(e,IT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=WU(t,i,NU(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},WU=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:UU(t,s,i)},UU=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=Qj(e,t,"cartesian",null!=i?i:Vj(t.getOrient())?FU:zU);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},GU=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(IT(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(OT(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=fV(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};XU(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&YU(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),YU=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=YH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},XU=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},KU=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=$U(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},$U=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},qU=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return GU(c,r,e),c.xField.cacheInfo?KU(c.xField):c.yField.cacheInfo?KU(c.yField):void 0},ZU=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],JU=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&ZU.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(QU(s).every((t=>{var e;return!QH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},QU=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},tG={dom:`${WE}_TOOLTIP_HANDLER_DOM`,canvas:`${WE}_TOOLTIP_HANDLER_CANVAS`},eG={key:"其他",value:"..."};var iG;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(iG||(iG={}));class sG{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(NP.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=JU(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},eG),t):eG;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&QH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class nG extends sG{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!IT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const rG=()=>{_E.registerTooltipProcessor("dimension",nG)};class aG extends sG{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,vo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(LP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const oG=()=>{_E.registerTooltipProcessor("mark",aG)};class lG extends sG{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const hG=()=>{_E.registerTooltipProcessor("group",lG)};class cG extends kU{constructor(){super(...arguments),this.transformerConstructor=BU,this.type="line",this.seriesType=EB.line}_setModelOption(){this._modelOption.getDimensionInfo=VU,this._modelOption.getDimensionInfoByValue=UU,this._modelOption.getRectByDimensionData=qU}}cG.type="line",cG.seriesType=EB.line,cG.transformerConstructor=BU,U(cG,OU);const dG=[...hN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class uG extends cN{constructor(){super(...arguments),this.type=uG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return dG}_getIgnoreAttributes(){return[]}}uG.type="area";const pG=()=>{_E.registerMark(uG.type,uG),Xw(),MC(),YN(),$N(),CH(),_E.registerGraphicComponent("area",Gp)};class gG extends sj{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),u(e))return e}return i}}}const fG=Object.assign(Object.assign(Object.assign({},fj),nN),{area:{name:"area",type:"area"}}),mG=()=>{_E.registerAnimation("area",AH),kH(),xH()};class vG extends tV{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||p&&!d)&&(g=h,f=l),l.style=gE({},f.style,g.style),l.state=gE({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function yG(){zC(),Ow()}function _G(){return"browser"===__.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const bG={debounce:xt,throttle:St};yG();let xG=class t extends RN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=_G(),a="browser"===__.env?__:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=vt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:bG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(XM,{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",bG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(yt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:ai(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=ai(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=vt(t[0],0,1),c=vt(t[1],0,1),d=vt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=_G(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};xG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class SG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ne).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=SG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(XM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new xG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),D.setAttribute("x",D.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),D.setAttribute("y",D.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}PG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class OG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,PG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new PG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,z(e,GF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class RG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class IG extends RG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class DG extends RG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function LG(t){t.isBound(OG)||(t.bind(OG).toSelf().inSingletonScope(),t.bind(a_).toService(OG)),t.isBound(IG)||(t.bind(IG).toSelf(),t.bind(xv).toService(IG)),t.isBound(DG)||(t.bind(DG).toSelf(),t.bind(xv).toService(DG))}class FG extends RN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zC(),ew();class zG extends FG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},zG.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})}}zG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zC(),Ow();class HG extends FG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HG.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})}}HG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zC(),pC();class jG extends FG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}jG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zC(),pC();class NG extends FG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NM,endAngle:s=VM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}NG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zC(),hw();class VG extends FG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},VG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=he(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=re.distancePP(t,e);this.setAttribute("radius",i)}}VG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class WG{isInValidValue(t){const{startAngle:e=NM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return dT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function UG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=UG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var XG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=uT(n,l,c,e,i);h=jM.path(Object.assign(Object.assign({},a.style),{path:pT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=jM.circle(t)}h.name=WV.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},GV,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=XG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;d(_)&&(_=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:y,textAlign:"center"},l),state:{text:z({},GV,u.text),shape:z({},GV,u.shape),panel:z({},GV,u.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=UG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&GG(e,c,i)}else e.AABBBounds.width()>r&&GG(e,r,i)}else o>a.x&&h.x2>n.x2?(GG(e,n.x2-o,i),r&&YG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}KG.defaultAttributes=sT,U(KG,WG);const $G=(t,e,i)=>{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=KM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=cT(r,dT(s,r,e,n));return o=a,l=dT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(pt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return oV(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=$G(t,i,e),r=K(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=ZG(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return oV(d)},ZG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&lV(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var JG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=ge(h.endAngle-d/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new eY(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):AN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=AN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=AN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(ft(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=AN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?AN(t.quadrant)?"left":"right":AN(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(AN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(pt(l/2,u))g=0,f=1,m=-p;else if(pt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),zN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,FN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}nY.defaultAttributes={pickable:!1};var rY,aY,oY,lY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(hY,WG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(rY||(rY={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(aY||(aY={})),function(t){t.dataZoomChange="dataZoomChange"}(oY||(oY={}));const cY="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",dY={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:cY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:cY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},uY={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}},pY=0,gY=1,fY=2,mY=3,vY=4,yY=5,_Y=5,bY=999,xY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var SY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:fY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:fY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:pY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,w;const{orient:M,middleHandlerStyle:T={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:O,end:R}=this._getState(),{position:I,width:D,height:L}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(T.visible){const t=(null===(i=T.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+O*D,y:I.y-t,width:(R-O)*D,height:t,zIndex:yY},null===(s=T.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=T.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(O+R)/2*D,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=T.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:yY},T.icon),{pickable:!P&&(null===(h=T.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*D,y:I.y+L/2,size:L,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},uY.horizontal),{zIndex:yY}),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*D,y:I.y+L/2,size:L,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},uY.horizontal),{zIndex:yY}),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+O*D-t/2,y:I.y+L/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:bY},uY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+R*D-g/2,y:I.y+L/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:bY},uY.horizontal),{pickable:!P}),"rect")}else{if(T.visible){const t=(null===(g=T.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+D,y:I.y+O*L,width:t,height:(R-O)*L,zIndex:yY},null===(f=T.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=T.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+D+t/2,y:I.y+(O+R)/2*L,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=T.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:yY},T.icon),{pickable:!P&&(null===(S=null===(x=T.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+O*L,size:D,symbolType:null!==(A=B.symbolType)&&void 0!==A?A:"square"},uY.vertical),{zIndex:yY}),B),{pickable:!P&&(null===(k=B.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+D/2,y:I.y+R*L,size:D,symbolType:null!==(C=E.symbolType)&&void 0!==C?C:"square",zIndex:yY},uY.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+D/2+t/2,y:I.y+O*L-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:bY},uY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+D/2+i/2,y:I.y+R*L-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:bY},uY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:mY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:mY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:gY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:vY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return $A(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ne).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=SY(c,["formatMethod"]),{formatMethod:g}=d,f=SY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,w,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},w={textAlign:xY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:xY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:xY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:xY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:_Y}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:_Y}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new yW(e),s.name=i,t.add(s)),s}}const kY={debounce:xt,throttle:St};class CY extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=rY.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=rY.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=rY.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=rY.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=rY.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===__.env?__:this.stage,s=_G();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===rY.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===rY.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===rY.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===rY.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(aY.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(aY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(aY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===rY.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(aY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(aY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:kY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===__.env?__:this.stage,e=_G();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:vt(e+t,0,1),end:vt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=rY.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}mW(),Ow(),eM(),MC(),ew();let wY=class t extends RN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new AY(this._getRendererAttrs()),this._interaction=new CY(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(aY.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(aY.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(oY.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(aY.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(oY.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var MY,TY,BY,EY;function PY(){zC(),mW(),gb()}wY.defaultAttributes=dY,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"}(MY||(MY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(TY||(TY={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(BY||(BY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(EY||(EY={}));class OY extends RN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=_W(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=bW(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=xW(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=jM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=jM.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=jM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),zN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,FN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=LN(this);this.markerAnimate("exit");const n=LN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},HN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function RY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function IY(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;DN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function DY(t,e,i,s){t&&(IY(t.startSymbol,e,i,s),RY(t).forEach((t=>IY(t,e,i,s))),IY(t.endSymbol,e,i,s))}function LY(t,e,i,s){t&&(IY(t.getTextShape(),e,i,s),IY(t.getBgRect(),e,i,s))}function FY(t,e,i,s){var n,r,a,o;t&&(DN(t,{fillOpacity:0,strokeOpacity:0},{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 zY(t,e,i,s){t&&(FY(t.startSymbol,e,i,s),RY(t).forEach((t=>FY(t,e,i,s))),FY(t.endSymbol,e,i,s))}function HY(t,e,i,s){t&&(FY(t.getTextShape(),e,i,s),FY(t.getBgRect(),e,i,s))}function jY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;IY(t.startSymbol,s,r,n);const h=RY(t);h.forEach((t=>DN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),IY(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;IY(t.getTextShape(),e,l,n),IY(t.getBgRect(),e,l,n)}))}function NY(t,e,i,s,n){DY(t,s,i,n),G(e).forEach((t=>{LY(t,s,i,n)}))}function VY(t,e,i,s,n){IY(t,s,i,n),G(e).forEach((t=>{LY(t,s,i,n)}))}function WY(t,e,i,s,n){IY(t,s,i,n),G(e).forEach((t=>{LY(t,s,i,n)}))}function UY(t,e,i,s,n,r){var a;DY(t,n,s,r),IY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?LY(i,n,s,r):IY(i,n,s,r)}function GY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;IY(t.startSymbol,n,o,r);const u=RY(t);u.forEach((t=>DN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),IY(e,n+o+l,h,r),IY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(IY(i.getTextShape(),n+o+l+h+c,d,r),IY(i.getBgRect(),n+o+l+c,d,r)):IY(i,n+o+l+c,d,r)}function YY(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?jY(t,e,s,r,a):"fadeIn"===i&&NY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?jY(t,e,s,n,a):"fadeIn"===i&&NY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){zY(t,s,i,n),G(e).forEach((t=>{HY(t,s,i,n)}))}(t,e,i,s,n)}}function XY(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&&VY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&VY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){FY(t,s,i,n),G(e).forEach((t=>{HY(t,s,i,n)}))}(t,e,i,s,n)}}function KY(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&&WY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&WY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){FY(t,s,i,n),G(e).forEach((t=>{HY(t,s,i,n)}))}(t,e,i,s,n)}}function $Y(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?UY(n,r,e,i,s,o):"callIn"===t&&GY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?UY(n,r,e,i,s,a):"callIn"===t&&GY(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;zY(t,n,s,r),FY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?HY(i,n,s,r):FY(i,n,s,r)}(n,r,e,t,i,s)}}const qY={type:"clipIn",duration:500,easing:"linear",delay:0},ZY={type:"fadeIn",duration:500,easing:"linear",delay:0},JY={type:"callIn",duration:500,easing:"linear",delay:0},QY={type:"fadeOut",duration:500,easing:"linear",delay:0};class tX{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new yW(Object.assign(Object.assign({},h),{state:{panel:z({},GM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},GM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},GM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},GM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class eX extends OY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=qY,this.defaultExitAnimation=QY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;iT(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(eX,tX);const iX=.001,sX={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:MY.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]}},nX={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"}}},rX={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:BY.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]}},aX={interactive:!0,label:{position:TY.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}},oX={interactive:!0,label:{autoRotate:!0,position:BY.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}},lX={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"}},hX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},cX={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 dX(){uX._animate=YY}PY(),uW(),gb();class uX extends eX{markerAnimate(t){uX._animate&&this._animationConfig&&uX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(MM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return TM(Math.abs(e),Math.PI/2,iX)||TM(Math.abs(e),3*Math.PI/2,iX)?BM(i,e,t):MM(e)?nX.postiveXAxis[t]:nX.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new gW({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},GM,null==a?void 0:a.line),startSymbol:z({},GM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},GM,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({},GM,null==a?void 0:a.line),startSymbol:z({},GM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},GM,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=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",uX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(uX.defaultAttributes.label)}}function pX(){gX._animate=XY}uX.defaultAttributes=sX,PY(),vw(),gb();class gX extends OY{markerAnimate(t){gX._animate&&this._animationConfig&&gX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=ZY,this.defaultExitAnimation=QY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},hX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;iT(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=jM.polygon(Object.assign({points:e},i));n.states=z({},GM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",gX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},GM,null==i?void 0:i.area)),this._updateMarkLabels(gX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}gX.defaultAttributes=aX,U(gX,tX),PY(),pW(),gb();class fX extends eX{markerAnimate(t){fX._animate&&this._animationConfig&&fX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case BY.arcInnerStart:l=n;case BY.arcOuterStart:l=n;break;case BY.arcInnerEnd:l=r;case BY.arcOuterEnd:l=r;break;case BY.center:case BY.arcInnerMiddle:case BY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return lX[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new fW({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},GM,null==o?void 0:o.line),startSymbol:z({},GM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},GM,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({},GM,null==o?void 0:o.line),startSymbol:z({},GM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},GM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",fX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(fX.defaultAttributes.label)}}fX.defaultAttributes=rX,PY(),pC(),gb();class mX extends OY{markerAnimate(t){mX._animate&&this._animationConfig&&mX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},mX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=ZY,this.defaultExitAnimation=QY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case BY.center:h=(s+n)/2,c=(r+a)/2;break;case BY.arcInnerStart:h=s,c=r;break;case BY.arcOuterStart:h=n,c=r;break;case BY.arcInnerEnd:h=s,c=a;break;case BY.arcOuterEnd:h=n,c=a;break;case BY.arcInnerMiddle:h=s,c=(r+a)/2;break;case BY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},lX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;iT(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=jM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},GM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",mX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},GM,null==o?void 0:o.area)),this._updateMarkLabels(mX.defaultAttributes.label)}isValidPoints(){return!0}}function vX(){yX._animate=$Y}mX.defaultAttributes=oX,U(mX,tX),PY(),uW(),pW(),eM(),YC(),ew(),gb();class yX extends OY{markerAnimate(t){yX._animate&&this._animationConfig&&yX._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},yX.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=JY,this.defaultExitAnimation=QY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return TM(Math.abs(s),Math.PI/2,iX)||TM(Math.abs(s),3*Math.PI/2,iX)?BM(t,s,n):MM(s)?cX.postiveXAxis[n]:cX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=EY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},GM,null==p?void 0:p.textBackground),text:z({},GM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},GM,null==p?void 0:p.itemContent));const v=MM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=jM.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"text"===n?o=new yW(Object.assign(Object.assign({},i),{state:{panel:z({},GM,null==s?void 0:s.textBackground),text:z({},GM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=jM.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"image"===n?(o=jM.image(Object.assign(Object.assign({},i),r)),o.states=z({},GM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},GM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=TM(c,0,iX)||TM(d,0,iX),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=tT(e-u,t-d),o=tT(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(MX.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(MX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===MX.focus||"focus"===o){const s=a.hasState(CX.focus);a.toggleState(CX.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[CX.unSelected,CX.unSelectedHover,CX.focus],t),this._setLegendItemState(e,CX.selected,t)})):(this._setLegendItemState(a,CX.selected,t),this._removeLegendItemState(a,[CX.unSelected,CX.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[CX.selected,CX.selectedHover,CX.focus],t),this._setLegendItemState(e,CX.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(CX.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(CX.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(wX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[CX.selected,CX.selectedHover],t),this._setLegendItemState(a,CX.unSelected,t)):(this._setLegendItemState(a,CX.selected,t),this._removeLegendItemState(a,[CX.unSelected,CX.unSelectedHover],t))}else this._setLegendItemState(a,CX.selected,t),this._removeLegendItemState(a,[CX.unSelected,CX.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[CX.selected,CX.selectedHover],t),this._setLegendItemState(e,CX.unSelected,t))}))}this._dispatchLegendEvent(wX.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,CX.selected),this._removeLegendItemState(e,[CX.unSelected,CX.unSelectedHover])):(this._removeLegendItemState(e,[CX.selected,CX.selectedHover]),this._setLegendItemState(e,CX.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=SX,spaceRow:l=AX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,w=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=w+l,w=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,w=Math.max(w,m),M.push(i)):(u(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=jM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=K(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:p,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:_,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),C=this._handleStyle(x,t,e,i,s),w=ai(c);let M;!1===x.visible?(M=jM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,MX.item,t,M)):(M=jM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,MX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?CX.selected:CX.unSelected);const T=jM.group({x:0,y:0,pickable:!1});M.add(T);let B,E=0,O=0,R=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);O=y(i)?i[0]||0:i,R=P(v,"space",8);const s=jM.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,MX.itemShape,t,M,S.state),s.addState(e?CX.selected:CX.unSelected),T.add(s)}let I=0;if(p){const e=P(g,"size",10);B=jM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,MX.focus,t,M),I=e}const D=_.formatMethod?_.formatMethod(o,t,i):o,L=JM(Object.assign(Object.assign({x:O/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:D,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(L,MX.itemLabel,t,M,A.state),L.addState(e?CX.selected:CX.unSelected),T.add(L);const F=P(_,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=JM(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,MX.itemValue,t,M,k.state),r.addState(e?CX.selected:CX.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-O-R-F-I-s;this._autoEllipsis(m,t,L,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2))}else r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),T.add(r)}else this._itemWidthByUser?(L.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-O-R-I),E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2)):E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2);B&&(B.setAttribute("x",E),T.add(B));const z=T.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;T.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=z.height(),N=u(this.attribute.item.width)?this.attribute.item.width:H+w[1]+w[3],V=this._itemHeightByUser||j+w[0]+w[2];return M.setAttributes({width:N,height:V}),B&&B.setAttribute("visible",!1),T.translateTo(-z.x1+w[3],-z.y1+w[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new xX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new xX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new xG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new xG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=SX,spaceRow:o=AX}=n,l=this._itemsContainer,{space:h=kX,defaultCurrent:c=1}=r,d=PX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=jM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=SX,spaceRow:a=AX}=s,o=this._itemsContainer,{space:l=kX,defaultCurrent:h=1}=n,c=PX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=jM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=jM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(CX.selected)?this._setLegendItemState(t,CX.selectedHover,e):this._setLegendItemState(t,CX.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===MX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(wX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(CX.unSelectedHover)||t.hasState(CX.selectedHover))&&(i=!0),t.removeState(CX.unSelectedHover),t.removeState(CX.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(CX.unSelectedHover)&&!t.hasState(CX.selectedHover)||(i=!0),t.removeState(CX.unSelectedHover),t.removeState(CX.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===MX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(wX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(wX.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!==MX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(wX.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!==MX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(wX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(CX.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},OX,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(CX.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var IX;function DX(t){return y(t)?t:[t,t]}function LX(t){return t?"ew-resize":"ns-resize"}RX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:SX,spaceRow:AX,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:kX,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"}(IX||(IX={})),BX();class FX extends RN{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({},FX.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=_G(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=_G(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(u(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=G(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:DX(p)[0],endValue:DX(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=jM.group({x:0,y:0});f.name=IX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=jM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=IX.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=jM.group({x:g?v:0,y:g?0:v});f.add(y);const _=jM.group({x:0,y:0});let b;if(_.name=IX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=jM.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=IX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=jM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=IX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=DX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":LX(p)},r));if(v.name=IX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=IX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":LX(p)},r));if(i.name=IX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=IX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=yt(h,i,s);c=t[0],u=t[1]}else c=i,u=vt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=jM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=IX.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":LX(g);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(u,e?"end":"start"),b=jM.rect(Object.assign({x:g?Math.min(y,_):0,y:g?0:Math.min(y,_),width:g?Math.abs(_-y):r,height:g?n:Math.abs(_-y),cursor:v},a));b.name=IX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return jM.symbol(t)}_renderHandlerText(t,e){return jM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return c(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":LX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=jM.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=jM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=_G(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===IX.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===IX.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===IX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===IX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===__.env?__:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}FX.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}}},EX(),BX();class zX extends TX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},zX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 HX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}zX.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"}}},EX(),BX(),hw();class jX extends TX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jX.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=jM.group({x:0,y:0});this._innerView.add(x);const S=new FX({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:HX(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 C=jM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}jX.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)"}},zC(),hM(),Gw();let NX=class t extends RN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:w,subtextStyle:M={},width:T,height:B,minWidth:E,maxWidth:P,minHeight:O,maxHeight:R,align:I,verticalAlign:D,padding:L=0}=this.attribute,F=ai(L),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||u(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:T)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},YM),C),x:h,y:c,width:null!==(s=null!=t?t:T)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:T,heightLimit:null!==(a=C.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,R-j);if("rich"===k||u(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:T)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:w},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:w},YM),M),x:n,y:r,width:null!==(c=null!=t?t:T)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(w)?w:[w],whiteSpace:"normal"},M),{maxLineWidth:null!==(p=M.maxLineWidth)&&void 0!==p?p:T,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const V=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(N,W),G=j+(null!==(f=M.height)&&void 0!==f?f:V);if(u(T)&&(U=T),u(B)&&(G=B),u(E)&&UP&&(U=P),u(O)&&GR&&(G=R),z.setAttributes({width:U,height:G,boundsPadding:F}),this._mainTitle){if(u(I)||u(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:U;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:D,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(_=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==_?_:U;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:D,e=this._mainTitle?u(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};NX.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 VX={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"}}};zC(),hM(),Gw();let WX=class extends RN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(VX,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=JM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const p=$M(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",u(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;A(_)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",u(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;G(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class UX extends Wg{constructor(t){super(t)}}var GX,YX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(GX||(GX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(YX||(YX={}));class XX extends RN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XX.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"},XX.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"},XX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},XX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},XX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"M 521.29 734.276 L 230.929 448.019 L 521.29 161.762 c 37.685 -37.153 38.003 -97.625 0.707 -134.384 c -37.297 -36.758 -98.646 -36.435 -136.331 0.718 l -357.43 352.378 c -0.155 0.153 -0.297 0.314 -0.451 0.468 c -0.084 0.082 -0.172 0.157 -0.256 0.239 c -18.357 18.092 -27.581 41.929 -27.743 65.902 c -0.004 0.311 -0.017 0.623 -0.018 0.934 c 0.001 0.316 0.014 0.632 0.018 0.948 c 0.165 23.97 9.389 47.803 27.743 65.892 c 0.083 0.082 0.171 0.157 0.255 0.239 c 0.154 0.154 0.296 0.315 0.452 0.468 l 357.43 352.378 c 37.685 37.153 99.034 37.476 136.331 0.718 c 37.297 -36.758 36.979 -97.231 -0.707 -134.384 z",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"M 30 163 L 320.361 449.257 L 30 735.514 c -37.685 37.153 -38.003 97.625 -0.707 134.384 c 37.297 36.758 98.646 36.435 136.331 -0.718 l 357.43 -352.378 c 0.155 -0.153 0.297 -0.314 0.451 -0.468 c 0.084 -0.082 0.172 -0.157 0.256 -0.239 c 18.357 -18.092 27.581 -41.929 27.743 -65.902 c 0.004 -0.311 0.017 -0.623 0.018 -0.934 c -0.001 -0.316 -0.014 -0.632 -0.018 -0.948 c -0.165 -23.97 -9.389 -47.803 -27.743 -65.892 c -0.083 -0.082 -0.171 -0.157 -0.255 -0.239 c -0.154 -0.154 -0.296 -0.315 -0.452 -0.468 l -357.43 -352.378 c -37.685 -37.153 -99.034 -37.476 -136.331 -0.718 c -37.297 36.758 -36.979 97.231 0.707 134.384 z"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"m 161.724 521.29 l 286.257 -290.361 l 286.257 290.361 c 37.153 37.685 97.625 38.003 134.384 0.707 c 36.758 -37.297 36.435 -98.646 -0.718 -136.331 l -352.378 -357.43 c -0.153 -0.155 -0.314 -0.297 -0.468 -0.451 c -0.082 -0.084 -0.157 -0.172 -0.239 -0.256 c -18.092 -18.357 -41.929 -27.581 -65.902 -27.743 c -0.311 -0.004 -0.623 -0.017 -0.934 -0.018 c -0.316 0.001 -0.632 0.014 -0.948 0.018 c -23.97 0.165 -47.803 9.389 -65.892 27.743 c -0.082 0.083 -0.157 0.171 -0.239 0.255 c -0.154 0.154 -0.315 0.296 -0.468 0.452 l -352.378 357.43 c -37.153 37.685 -37.476 99.034 -0.718 136.331 c 36.758 37.297 97.231 36.979 134.384 -0.707 z",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"M 734.276 28.71 L 448.019 319.071 L 161.762 28.71 c -37.153 -37.685 -97.625 -38.003 -134.384 -0.707 c -36.758 37.297 -36.435 98.646 0.718 136.331 l 352.378 357.43 c 0.153 0.155 0.314 0.297 0.468 0.451 c 0.082 0.084 0.157 0.172 0.239 0.256 c 18.092 18.357 41.929 27.581 65.902 27.743 c 0.311 0.004 0.623 0.017 0.934 0.018 c 0.316 -0.001 0.632 -0.014 0.948 -0.018 c 23.97 -0.165 47.803 -9.389 65.892 -27.743 c 0.082 -0.083 0.157 -0.171 0.239 -0.255 c 0.154 -0.154 0.315 -0.296 0.468 -0.452 l 352.378 -357.43 c 37.153 -37.685 37.476 -99.034 0.718 -136.331 c -36.758 -37.297 -97.231 -36.979 -134.384 0.707 z")},this._initPlay=()=>{d(this._playController)&&(this._playController=new UX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new UX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new UX(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(GX.OnPlay)},this.pause=()=>{this._dispatchEvent(GX.OnPause)},this.forward=()=>{this._dispatchEvent(GX.OnForward)},this.backward=()=>{this._dispatchEvent(GX.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()}}XX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},XX.defaultAttributes={[YX.Start]:{},[YX.Pause]:{},[YX.Backward]:{},[YX.Forward]:{}};const KX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},$X=[200,10];var qX,ZX;!function(t){t.Default="default",t.Reverse="reverse"}(qX||(qX={})),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"}(ZX||(ZX={}));const JX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===qX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===qX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),QX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===qX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===qX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),tK=t=>"top"===t||"bottom"===t;class eK extends RN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eK.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(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(tK(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:$X[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:$X[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 FX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=tK(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new XX(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=tK(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:$X[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(tK(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:tK(this._orient)?t+s:(this._size.width-r)/2,y:tK(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:tK(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:tK(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=x(n)?n:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:tK(this._orient)?t+s:(this._size.width-r)/2,y:tK(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function iK(){BX(),zC(),eM()}eK.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({},KX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},KX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},KX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},KX),{key:"backward",position:"start"})}},iK();class sK extends eK{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:qX.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(GX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(GX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(GX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(GX.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(ZX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(JX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||QX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===qX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(ZX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=__.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(ZX.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(ZX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=__.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(),__.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(ZX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(ZX.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(ZX.change),this.dispatchCustomEvent(ZX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var nK,rK=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())}))};iK();class aK extends eK{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(GX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(GX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(GX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(GX.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(ZX.change))},this.play=()=>rK(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(ZX.play),this._rafId=__.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=__.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(ZX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(ZX.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(ZX.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(ZX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(nK||(nK={}));const oK={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},lK=5;const hK={debounce:xt,throttle:St};zC(),vw();let cK=class t extends RN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=oK.updateTrigger,endTrigger:i=oK.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(G(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:hK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(nK.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=oK.trigger,resetTrigger:i=oK.resetTrigger}=this.attribute;G(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),G(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(nK.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(nK.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=lK}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(nK.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(nK.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(nK.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=lK}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(nK.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(nK.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),G(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=oK.updateTrigger,endTrigger:s=oK.endTrigger}=this.attribute;G(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),G(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=jM.polygon(Object.assign(Object.assign({points:I(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};cK.defaultAttributes=oK;const dK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},uK=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},pK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},gK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zC(),Ow(),eM(),hM(),Gw();let fK=class t extends RN{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=ai(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:wM(p)&&wM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:wM(p)&&wM(p.value)},uK(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:wM(p)&&wM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:wM(p)&&wM(p.value)},uK(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},YM),p.value),visible:wM(p)&&wM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=wM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const y=wM(p)?p.height+p.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!wM(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let p="right"===c?(o?d:0)+(wM(n.key)?r+n.key.spacing:0)+(wM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(QM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:wM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),QM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(wM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=kh(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(wM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},uK(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},uK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(wM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},uK(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},uK(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=>gK.includes(t)))?(this._mergeAttributes(e,s),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&wM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=wM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=KM(d),y=KM(u);let _=0;if(wM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(wM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return dK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return dK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};fK.defaultAttributes=pK;class mK extends sU{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),CT(this._regions,(t=>{Vj(this.getOrient())?bV(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):bV(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=gE({},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 Fa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Pz(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=vi.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=>_V(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=>_V(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,tU),t}transformScaleDomain(){}}mK.type=n.cartesianTimeAxis,mK.specKey="axes",mK.builtInTheme={axis:zW,axisX:HW,axisY:jW};class vK extends sU{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new wB}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,tU),t}transformScaleDomain(){}}vK.type=n.cartesianLogAxis,vK.specKey="axes",vK.builtInTheme={axis:zW,axisLinear:iU,axisX:HW,axisY:jW},U(vK,ZW);class yK extends sU{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new MB}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,tU),t}transformScaleDomain(){}}yK.type=n.cartesianSymlogAxis,yK.specKey="axes",yK.builtInTheme={axis:zW,axisLinear:iU,axisX:HW,axisY:jW},U(yK,ZW);class _K extends Nj{constructor(){super(...arguments),this.type=EB.area,this.transformerConstructor=vG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),rN)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(_K.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===HH?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return YB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",nz.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return YB(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",nz.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[QE]},"normal",nz.Series),this.setMarkStyle(o,{curveType:a},"normal",nz.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Aj(null===(e=_E.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),kj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Aj(null===(i=_E.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),kj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=jj(this);this._symbolMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),kj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new gG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}_K.type=EB.area,_K.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},_K.mark=fG,_K.transformerConstructor=vG,U(_K,aN);class bK extends TU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),YF(t)}}class xK extends kU{constructor(){super(...arguments),this.transformerConstructor=bK,this.type="area",this.seriesType=EB.area}_setModelOption(){this._modelOption.getDimensionInfo=VU,this._modelOption.getDimensionInfoByValue=UU,this._modelOption.getRectByDimensionData=qU}}xK.type="area",xK.seriesType=EB.area,xK.transformerConstructor=bK,U(xK,OU);function SK(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 AK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:SK(t,e)}),kK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:SK(t,e)}),CK={type:"fadeIn"},wK={type:"growCenterIn"};function MK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return CK;case"scaleIn":return wK;default:return AK(t)}}class TK extends eH{constructor(){super(...arguments),this.type=TK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}TK.type="rect";const BK=()=>{Xw(),Ow(),WN("rect",QG),_E.registerMark(TK.type,TK),M_.registerBuiltInAnimate("growHeightIn",jD),M_.registerBuiltInAnimate("growHeightOut",ND),M_.registerBuiltInAnimate("growWidthIn",sL),M_.registerBuiltInAnimate("growWidthOut",nL),M_.registerBuiltInAnimate("growCenterIn",FD),M_.registerBuiltInAnimate("growCenterOut",zD),_E.registerGraphicComponent("rect",fg)},EK=Object.assign(Object.assign({},fj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function PK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=sE(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[mj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):YB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vj]):YB(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=YB(this._dataToPosX(t),e,i),n=YB(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[yj]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):YB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[_j]):YB(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=YB(this._dataToPosY(t),e,i),n=YB(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),IK)})}getStatisticFields(){var t;const e=super.getStatisticFields(),i="horizontal"===this.direction?this.getYAxisHelper():this.getXAxisHelper(),s="horizontal"===this.direction?this._fieldY:this._fieldX,n=null===(t=null==i?void 0:i.getScale)||void 0===t?void 0:t.call(i,0);return n&&OT(n.type)&&s.forEach((t=>{const i=e.find((e=>e.key===t));i?i.operations.includes("values")||i.operations.push("values"):e.push({key:t,operations:["values"]})})),e}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},DK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:Mj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(DK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",nz.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===n.cartesianBandAxis));let r;if(KP(this._option.dataSet,"addVChartProperty",qH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};KP(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Fa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:dj.bind(this),call:uj}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new Pz(this._option,r)}init(t){super.init(t),this.initRectMarkStyle()}_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=_j,s=yj,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=vj,s=mj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=_P(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)PK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=YB(this[r](t),l,i),u=YB(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!XB(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",nz.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",nz.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&d(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,d=!1,p=1/0,g=-1/0;i.values.forEach((e=>{const i=e[JE],n=e[QE],r=e[tP],c=e[eP];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?yj:mj],i=e[a?_j:vj];l=Math.min(l,t,i),h=Math.max(h,t,i)}u(r)&&u(c)&&(d=!0,p=Math.min(p,r,c),g=Math.max(g,r,c))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[JE]:s,[QE]:o}),d?{[tP]:p,[eP]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(fg(Object.assign(Object.assign({},m),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>YB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",nz.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",nz.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>YB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",nz.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",nz.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",nz.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",nz.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=jj(this);this._barMark.setAnimationConfig(Aj(null===(e=_E.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),kj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i;const s=this._groups?this._groups.fields.length:1,n=d(e)?s:Math.min(s,e),r=u(this._spec.barWidth)&&n===s,a=r&&"number"==typeof this._spec.barWidth&&"string"!=typeof this._spec.barMinWidth&&"string"!=typeof this._spec.barMaxWidth||null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,n-1),o=null!=a?a:6,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=!t.isContinuous||d(a)||r?o:.5*o;return r&&(c=sE(this._spec.barWidth,o)),l&&(c=Math.max(c,sE(this._spec.barMinWidth,o))),h&&(c=Math.min(c,sE(this._spec.barMaxWidth,o))),c}_getPosition(t,e,i,s){var n,r,a,o,l,h;let c,p,g;"horizontal"===t?(c=this.getYAxisHelper(),p="height",g="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(c=this.getXAxisHelper(),p="width",g="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const f=c.getScale(0),m=this._groups?this._groups.fields.length:1,v=d(i)?m:Math.min(m,i),y=null!==(r=null===(n=c.getBandwidth)||void 0===n?void 0:n.call(c,v-1))&&void 0!==r?r:6,_=v===m?this._barMark.getAttribute(p,e):y;if(v>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const h=t[r],d=null!==(o=null===(a=c.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=sE(null!==(l=i[r-1])&&void 0!==l?l:Y(i),y),g=d.indexOf(e[h]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return f.scale(e[t[0]])+(null!==(h=c.getBandwidth(0))&&void 0!==h?h:y)/2-s/2+n}const b=OT(f.type||"band");return g(e,v)+.5*(y-_)+(b?-y/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}DK.type=EB.bar,DK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},DK.mark=EK,DK.transformerConstructor=RK;const LK=()=>{vU(),BK(),_E.registerAnimation("bar",((t,e)=>({appear:MK(t,e),enter:AK(t,!1),exit:kK(t,!1),disappear:{duration:yH.disappear.duration}}))),VW(),nU(),_E.registerSeries(DK.type,DK)};class FK extends TU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),YF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=p(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class zK extends kU{constructor(){super(...arguments),this.transformerConstructor=FK,this.type="bar",this.seriesType=EB.bar}_setModelOption(){this._modelOption.getDimensionInfo=VU,this._modelOption.getDimensionInfoByValue=UU,this._modelOption.getRectByDimensionData=qU}}zK.type="bar",zK.seriesType=EB.bar,zK.transformerConstructor=FK,U(zK,OU);const HK=[10,20],jK=ET.Linear,NK="circle",VK=ET.Ordinal,WK=["circle","square","triangle","diamond","star"],UK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},GK=Object.assign(Object.assign({},fj),{point:{name:"point",type:"symbol"}});class YK extends Pj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const XK={sizeField:!0};class KK extends Nj{constructor(){super(...arguments),this.type=EB.scatter,this.transformerConstructor=YK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),XK)})}setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(c(e))return e;if(y(e)){if(d(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${WE}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${WE}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:jK,defaultRange:HK},"size")}getShapeAttribute(t,e){return d(e)?NK:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:VK,defaultRange:WK},"shape")}initMark(){this._symbolMark=this._createMark(KK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Mj(this._spec,KK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=jj(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(Aj(null===(i=_E.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),kj("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:NK},az.STATE_NORMAL,nz.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},az.STATE_NORMAL,nz.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},az.STATE_NORMAL,nz.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",nz.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",nz.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},az.STATE_NORMAL,nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},az.STATE_NORMAL,nz.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ue});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}KK.type=EB.scatter,KK.mark=GK,KK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},KK.transformerConstructor=YK;const $K=()=>{QN(),_E.registerAnimation("scatter",((t,e)=>Object.assign({appear:UK(0,e)},_H))),VW(),nU(),_E.registerSeries(KK.type,KK)};class qK extends TU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class ZK extends kU{constructor(){super(...arguments),this.transformerConstructor=qK,this.type="scatter",this.seriesType=EB.scatter}_setModelOption(){this._modelOption.getDimensionInfo=VU,this._modelOption.getDimensionInfoByValue=UU,this._modelOption.getRectByDimensionData=qU}}ZK.type="scatter",ZK.seriesType=EB.scatter,ZK.transformerConstructor=qK,U(ZK,OU);class JK extends zj{constructor(){super(...arguments),this.type=EB.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return d(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${WE}_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 QK=(t,e)=>{const i=c(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[XE]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[fP]=a||r})),s};class t$ extends sj{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 e$ extends eH{constructor(){super(...arguments),this.type=e$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}e$.type="path";const i$=()=>{_E.registerMark(e$.type,e$),Xw(),hw(),_E.registerGraphicComponent("path",lg)},s$=Object.assign(Object.assign({},fj),{area:{name:"area",type:"path"}});class n${constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Na(i,e):Ha[i]?(za[i]||(za[i]=Na(i,Ha[i])),za[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class r${parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class a${constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function o$(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:r$}:_M(t)||bM(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:a$}:null}const l$={debounce:xt,throttle:St};class h${constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=_M(this._renderMode)||bM(this._renderMode),o$(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return o$(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:WP.chart,consume:!1}];l.on(...c,l$[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,l$[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||o$(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||o$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return d(r)&&d(a)?s:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:WP.chart,consume:!1}];l.on(...c,l$[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,l$[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){o$(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||o$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:WP.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:WP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||o$(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||o$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=l$[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=l$[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:WP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp)}))}}class c$ extends zV{constructor(){var t,e;super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=iz.Mark,this._projectionSpec={name:(t=this.type,e=this.id,`${WE}_${e}_${t}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:n.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=gE(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(NP.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new n$(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===EB.map||e.type===EB.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(d(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),CT(this._regions,(t=>{var e;if(t.type===EB.map||t.type===EB.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==EB.map&&e.type!==EB.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[fP],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}c$.type=n.geoCoordinate,U(c$,h$);const d$=()=>{_E.registerComponent(c$.type,c$)};class u$ extends Pj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class p$ extends JK{constructor(){super(...arguments),this.type=EB.map,this.transformerConstructor=u$,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 !`),qP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),KP(this._dataSet,"copyDataView",iO),KP(this._dataSet,"map",QK),KP(this._dataSet,"lookup",KH);const i=qP.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Fa(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:aO.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:fP,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 Pz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(p$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:Mj(this._spec,p$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:$E])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:$E]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",nz.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",nz.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(Aj(null===(t=_E.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),kj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new t$(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[XE]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[XE],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(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 XE}getActiveMarks(){return[this._pathMark]}}p$.type=EB.map,p$.mark=s$,p$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},p$.transformerConstructor=u$;const g$=`${WE}_waterfall_default_seriesField`,f$=(t,e)=>{if(!t||0===t.length)return t;const i=c(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let d=Array.from(l[s]);"decrease"===a&&(d=d.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return d.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[aP]=!0:delete t[aP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===d.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=m$([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}=v$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>se(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=ie(y,e)):(t[c]=+_,_=ie(_,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,d,e,i,a),void o.push(s)}u=m$(r,t,s,o,u,d,e,i),o.push(s)})),o};function m$(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=v$(t,i,s,n,u);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(d(p)||p===g$)&&(t[g$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function v$(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?pM("total.collectCountField error"):n=e[a].start;o<0?pM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ie(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const y$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=c(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},_$={type:"fadeIn"},b$={type:"growCenterIn"};function x$(t,e){switch(e){case"fadeIn":return _$;case"scaleIn":return b$;default:return AK(t,!1)}}class S$ extends eH{constructor(){super(...arguments),this.type=S$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return rg(t)}}S$.type="rule";const A$=()=>{_E.registerMark(S$.type,S$),Xw(),ew(),_E.registerGraphicComponent("line",rg)},k$=Object.assign(Object.assign({},EK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),C$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:w$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function w$(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)=>w$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class M${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 Fa(e instanceof La?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),KP(e,"dimensionTree",C$),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 T$ extends RK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const B$={rect:D$,symbol:R$,arc:F$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=R$(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:z$,line:H$,area:H$,rect3d:D$,arc3d:F$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function E$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=B$[t])&&void 0!==i?i:B$.point;return e.series.type===EB.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=O$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:j$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function P$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==EB.sankey){const{formatFunc:t,args:n}=YH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function O$(t){return c(t)?e=>t(e.data):t}function R$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=O$(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:I$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function I$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function D$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=O$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:L$(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function L$(t){const e=[{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"]}}];return e}function F$(t){var e;const{labelSpec:i}=t,s=null!==(e=O$(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function z$(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=P$(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),Zg(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 H$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[$E]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function j$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const N$={calculationMode:!0};class V$ extends DK{constructor(){super(...arguments),this.type=EB.waterfall,this.transformerConstructor=T$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&xP(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),N$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new M$(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this.setValueFieldToStack(),this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],d(this._seriesField)&&(this._seriesField=g$)}getSeriesKeys(){return this._seriesField===g$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),KP(this._dataSet,"waterfallFillTotal",y$),KP(this._dataSet,"waterfall",f$),(d(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=sO(this.getViewData(),this._dataSet,{name:`${WE}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Pz(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:JE,endAs:QE,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=jj(this);this._barMark.setAnimationConfig(Aj(null===(i=_E.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),kj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),kj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(V$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return z$(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?YB(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):YB(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,y1:e=>this.totalPositionY(e,"index",this._getLeaderLineCategoryPos(!1,t))},"normal",nz.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",this._getLeaderLineCategoryPos(!0,t)):0,x1:e=>this.totalPositionX(e,"index",this._getLeaderLineCategoryPos(!1,t)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",nz.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&XB([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}V$.type=EB.waterfall,V$.mark=k$,V$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},V$.transformerConstructor=T$;const W$=()=>{A$(),BK(),_E.registerAnimation("waterfall",((t,e)=>({appear:x$(t,e),enter:AK(t,!1),exit:kK(t,!1),disappear:{duration:yH.disappear.duration}}))),SH(),VW(),nU(),_E.registerSeries(V$.type,V$)},U$=`${WE}_BOX_PLOT_OUTLIER_VALUE`;var G$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(G$||(G$={}));const Y$=(t,e)=>{const i=[],s=c(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=y(e)?e:[e];i.push(...s.map((e=>{const i={[U$]:e};return r.forEach((e=>{i[e]=t[e]})),u(a)&&(i[a]=t[a]),i})))})),i};class X$ extends sj{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===G$.OUTLIER)return this.series.getOutliersField();if(t===G$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case G$.MIN:return this.series.getMinField();case G$.MAX:return this.series.getMaxField();case G$.MEDIAN:return this.series.getMedianField();case G$.Q1:return this.series.getQ1Field();case G$.Q3:return this.series.getQ3Field();case G$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===G$.OUTLIER)return e[U$];if(t===G$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case G$.MIN:return e[this.series.getMinField()];case G$.MAX:return e[this.series.getMaxField()];case G$.MEDIAN:return e[this.series.getMedianField()];case G$.Q1:return e[this.series.getQ1Field()];case G$.Q3:return e[this.series.getQ3Field()];case G$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[U$])}getDefaultContentList(t){return[{key:this.getContentKey(G$.OUTLIER),value:this.getContentValue(G$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(G$.MAX),value:this.getContentValue(G$.MAX)},{key:this.getContentKey(G$.Q3),value:this.getContentValue(G$.Q3)},{key:this.getContentKey(G$.MEDIAN),value:this.getContentValue(G$.MEDIAN)},{key:this.getContentKey(G$.Q1),value:this.getContentValue(G$.Q1)},{key:this.getContentKey(G$.MIN),value:this.getContentValue(G$.MIN)},{key:this.getContentKey(G$.SERIES_FIELD),value:this.getContentValue(G$.SERIES_FIELD)}]}}const K$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class $$ extends eH{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==rz.enter&&t.context.diffState!==rz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{K$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?z(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=qp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=_E.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const q$=()=>{_E.registerGraphicComponent("glyph",qp),Xw(),LC()},Z$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],J$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class Q$ extends $${constructor(){super(...arguments),this.type=Q$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=Z$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=J$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),A(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}Q$.type="boxPlot";const tq=Object.assign(Object.assign({},fj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),eq=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.from.min=o,f.to.min=c),A(d)&&(f.from.max=o,f.to.max=d),A(u)&&(f.from.q1=o,f.to.q1=u),A(p)&&(f.from.q3=o,f.to.q3=p),A(g)&&(f.from.median=o,f.to.median=g),f},iq=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!A(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return A(c)&&(f.to.min=o,f.from.min=c),A(d)&&(f.to.max=o,f.from.max=d),A(u)&&(f.to.q1=o,f.from.q1=u),A(p)&&(f.to.q3=o,f.from.q3=p),A(g)&&(f.to.median=o,f.from.median=g),f},sq=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),nq=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,k,C;if(i&&A(i.center))return i.center;let w,M,T,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=sq(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=sq(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,T=null===(p=null===(u=null===(d=null===(c=sq(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=sq(t,"box").attribute.width,i=sq(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=sq(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=sq(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,T=null===(C=null===(k=null===(S=null===(x=sq(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===k?void 0:k[0])||void 0===C?void 0:C.y;const e=sq(t,"box").attribute.height,i=sq(t,"box").attribute.y;B=i,E=i+e}return A(w)?w:A(B)&&A(E)?(B+E)/2:A(M)&&A(T)?(M+T)/2:A(T)?T:A(M)?M:NaN},rq=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(A(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=sq(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=sq(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=sq(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=sq(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=sq(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=sq(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=sq(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=sq(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=sq(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=sq(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return A(v)?v:A(b)&&A(x)?(b+x)/2:A(y)&&A(_)?(y+_)/2:A(_)?_:A(y)?y:NaN};class aq extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return eq(nq)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class oq extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return iq(nq)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class lq extends aq{computeAttribute(){return eq(rq)(this.target,this.params,this.params.options)}}class hq extends oq{computeAttribute(){return iq(rq)(this.target,this.params,this.params.options)}}class cq extends Pj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const dq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class uq extends Nj{constructor(){super(...arguments),this.type=EB.boxPlot,this.transformerConstructor=cq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),dq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(uq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(uq.mark.outlier,{key:XE,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return sE(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return sE(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,az.STATE_NORMAL,nz.Series),this.setMarkStyle(a,s,az.STATE_NORMAL,nz.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},az.STATE_NORMAL,nz.Series),this.initBoxPlotMarkStyle()}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>YB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>YB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>YB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>YB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>YB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},az.STATE_NORMAL,nz.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>YB(t(this.getDatumPositionValues(e,U$),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>YB(t(this.getDatumPositionValues(e,U$),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,az.STATE_NORMAL,nz.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;KP(this._dataSet,"foldOutlierData",Y$),KP(this._dataSet,"addVChartProperty",qH);const t=new Fa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${WE}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:dj.bind(this),call:uj}},!1),this._outlierData=new Pz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return u(this._spec.boxWidth)&&(r=sE(this._spec.boxWidth,n)),u(this._spec.boxMinWidth)&&(r=Math.max(r,sE(this._spec.boxMinWidth,n))),u(this._spec.boxMaxWidth)&&(r=Math.min(r,sE(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),p=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,p-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(p>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=sE(null!==(a=i[o-1])&&void 0!==a?a:Y(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=OT(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=jj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=_E.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(kj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Aj(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(Aj(null===(a=_E.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new X$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}uq.type=EB.boxPlot,uq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},uq.mark=tq,uq.transformerConstructor=cq;const pq=()=>{q$(),ew(),Ow(),_E.registerGraphicComponent("line",(t=>rg(t))),_E.registerGraphicComponent("rect",(t=>fg(t))),_E.registerMark(Q$.type,Q$),QN(),xH(),VW(),nU(),M_.registerBuiltInAnimate("boxplotScaleIn",aq),M_.registerBuiltInAnimate("boxplotScaleOut",oq),M_.registerBuiltInAnimate("barBoxplotScaleIn",lq),M_.registerBuiltInAnimate("barBoxplotScaleOut",hq),_E.registerSeries(uq.type,uq)};class gq extends eH{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=gq.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Hg(t):Zg(t)}}gq.type="text";const fq=()=>{_E.registerMark(gq.type,gq),Xw(),hM(),Gw(),_E.registerGraphicComponent("text",Zg),_E.registerGraphicComponent("richtext",Hg)};class mq extends sj{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const vq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),yq={type:"fadeIn"},_q=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function bq(t,e){return"fadeIn"===e?yq:vq(t)}const xq=Object.assign(Object.assign({},EK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class Sq extends RK{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 Aq extends DK{constructor(){super(...arguments),this.type=EB.rangeColumn,this._barMarkType="rect",this._barName=EB.bar,this.transformerConstructor=Sq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(Aq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Mj(this._spec,Aq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(Aq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(Aq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",nz.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=jj(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(Aj(null===(i=_E.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),kj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),kj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Aj(null===(n=_E.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),kj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new mq(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)}}Aq.type=EB.rangeColumn,Aq.mark=xq,Aq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},Aq.transformerConstructor=Sq;const kq=()=>{BK(),fq(),_E.registerAnimation("rangeColumn",((t,e)=>({appear:bq(t,e),enter:vq(t),exit:_q(t),disappear:{duration:yH.disappear.duration}}))),SH(),VW(),nU(),_E.registerSeries(Aq.type,Aq)};var Cq,wq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(Cq||(Cq={})),function(t){t.middle="middle",t.start="start",t.end="end"}(wq||(wq={}));class Mq extends sj{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const Tq=Object.assign({},fG);class Bq extends _K{constructor(){super(...arguments),this.type=EB.rangeArea}initMark(){this._areaMark=this._createMark(Bq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",nz.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",nz.Series),this.setMarkStyle(t,{stroke:!1},"normal",nz.Series))}initTooltip(){this._tooltipHelper=new Mq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}Bq.type=EB.rangeArea,Bq.mark=Tq;class Eq extends zj{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=OV,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};OT(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:[]};OT(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(NP.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)&&Hj(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Pq(t){return AM(t)?Number.parseFloat(t):0}const Oq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&Rq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[SV],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[SV]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},Rq=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===Pq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Pq(i[e])),0)));function Iq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const Dq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Iq(t,!0,oO.appear)}),Lq={type:"fadeIn"},Fq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Iq(t,!0,oO.enter)}),zq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Iq(t,!0,oO.exit)});function Hq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Lq;case"growRadius":return Dq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Dq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class jq extends eH{constructor(t,e){super(t,e),this.type=Nq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[MV])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Nq extends jq{constructor(){super(...arguments),this.type=Nq.type}}Nq.type="arc";const Vq=()=>{Xw(),pC(),WN("arc",iY),M_.registerBuiltInAnimate("growRadiusIn",tL),M_.registerBuiltInAnimate("growRadiusOut",eL),M_.registerBuiltInAnimate("growAngleIn",DD),M_.registerBuiltInAnimate("growAngleOut",LD),_E.registerGraphicComponent("arc",Vp),_E.registerMark(Nq.type,Nq)},Wq=Object.assign(Object.assign({},fj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Uq extends Pj{_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=gE({},this._theme,i,t);const n=(t,e)=>gE({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Gq=`${WE}_LABEL_VISIBLE`,Yq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},Xq={outerRadius:!0};class Kq extends Eq{constructor(){super(...arguments),this.transformerConstructor=Uq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:JB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:JB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=EV,this._endAngle=PV,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[MV];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(u(this._spec.startAngle)?ae(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?ae(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;KP(this._dataSet,"pie",Oq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:kV,asEndAngle:CV,asRatio:AV,asMiddleAngle:MV,asRadian:BV,asQuadrant:TV,asK:wV,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Fa(this._dataSet,{name:`${WE}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Pz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Kq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:KE,groupKey:this._seriesField,isSeriesMark:!0},{morph:Mj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return TT(kV)(t)}endAngleScale(t){return TT(CV)(t)}_computeLayoutRadius(){return RV((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:KB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:KB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",nz.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",nz.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,nz.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",nz.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:TT(Gq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(NP.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Xq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Yq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[MV];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===oO.appear)return this._startAngle;if(i===oO.disappear)return this._endAngle;const r=[oO.disappear,oO.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[XE];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[XE])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[MV]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[MV]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[MV]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[MV]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=Aj(null===(i=_E.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Kq.transformerConstructor=Uq,Kq.mark=Wq,Kq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class $q extends Kq{constructor(){super(...arguments),this.type=EB.pie}}$q.type=EB.pie;const qq=()=>{Vq(),_E.registerAnimation("pie",((t,e)=>({appear:Hq(t,e),enter:Fq(t),exit:zq(t),disappear:{duration:yH.disappear.duration}}))),_E.registerAnimation("emptyCircle",((t,e)=>({appear:Hq(t,e)}))),_E.registerSeries($q.type,$q)};function Zq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const Jq=t=>({type:Zq(t.growField),options:{overall:!0}}),Qq={type:"fadeIn"},tZ=t=>({type:Zq(t.growField)}),eZ=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function iZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Qq;case"growAngle":return Jq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return Jq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const sZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class nZ extends Eq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),sZ)})}getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(this._spec.radiusField)[0]}getGroupFields(){return this._angleField}setAttrFromSpec(){super.setAttrFromSpec(),this.setAngleField(this._spec.categoryField||this._spec.angleField),this.setRadiusField(this._spec.valueField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice(),this.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(QE),this.setInnerRadiusField(JE)}setValueFieldToPercent(){this.setRadiusField(eP),this.setInnerRadiusField(tP)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const rZ=Object.assign(Object.assign({},fj),{rose:{name:"rose",type:"arc"}});class aZ extends Pj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class oZ extends KV{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=_E.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=iz.Axis,this._tick=void 0,this._center=null,this._startAngle=EV,this._endAngle=PV,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),CT(this._regions,(t=>{"radius"===this.getOrient()?bV(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):bV(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:JB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:JB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:fV(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){CT(this._regions,(t=>{"radius"===this.getOrient()?bV(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):bV(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return OT(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:OT(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>_V(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=re.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return RV((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=OV,e=0;const i=this.getChart().getSpec();return CT(this.getRegions(),(s=>{const n=s;if(r=n.type,[EB.rose,EB.radar,EB.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(gE({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(gE({},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)}}oZ.type=n.polarAxis,oZ.specKey="axes";const lZ={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},hZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class cZ extends oZ{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new SB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,tU),t}}cZ.type=n.polarLinearAxis,cZ.specKey="axes",cZ.builtInTheme={axis:zW,axisLinear:iU,axisAngle:hZ,axisRadius:lZ},U(cZ,ZW);const dZ=()=>{_E.registerGraphicComponent(HV.lineAxis,((t,e)=>new LW(t,e))),_E.registerGraphicComponent(jV.lineAxisGrid,((t,e)=>new dW(t,e))),_E.registerGraphicComponent(HV.circleAxis,((t,e)=>new KG(t,e))),_E.registerGraphicComponent(jV.circleAxisGrid,((t,e)=>new hY(t,e))),$V(),_E.registerComponent(cZ.type,cZ)};class uZ extends oZ{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new eB}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return KP(this._option.dataSet,t,qG),t}transformScaleDomain(){}}uZ.type=n.polarBandAxis,uZ.specKey="axes",uZ.builtInTheme={axis:zW,axisBand:FW,axisAngle:hZ,axisRadius:lZ},U(uZ,JV);const pZ=()=>{_E.registerGraphicComponent(HV.lineAxis,((t,e)=>new LW(t,e))),_E.registerGraphicComponent(jV.lineAxisGrid,((t,e)=>new dW(t,e))),_E.registerGraphicComponent(HV.circleAxis,((t,e)=>new KG(t,e))),_E.registerGraphicComponent(jV.circleAxisGrid,((t,e)=>new hY(t,e))),$V(),_E.registerComponent(uZ.type,uZ)};class gZ extends nZ{constructor(){super(...arguments),this.type=EB.rose,this.transformerConstructor=aZ,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(gZ.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:Mj(this._spec,gZ.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>YB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=YB(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(Aj(null===(i=_E.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),kj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}gZ.type=EB.rose,gZ.mark=rZ,gZ.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},gZ.transformerConstructor=aZ;const fZ=()=>{_E.registerSeries(gZ.type,gZ),Vq(),_E.registerAnimation("rose",((t,e)=>({appear:iZ(t,e),enter:tZ(t),exit:eZ(t),disappear:{duration:yH.disappear.duration}}))),pZ(),dZ()};class mZ extends ib{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,mT(this._fromAngle,this._toAngle)&&mT(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class vZ extends gH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!kT(t)&&!kT(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new ne(s,n,r,a);return o.defined=e.defined,o}}const yZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function _Z(t,e,i){return"fadeIn"===e?yZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function bZ(t,e,i){return"fadeIn"===e?yZ(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 xZ=(t,e)=>({custom:uH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),SZ=Object.assign(Object.assign(Object.assign({},fj),nN),{area:{name:"area",type:"area"}});class AZ extends nZ{constructor(){super(...arguments),this.type=EB.radar,this.transformerConstructor=tV,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(AZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:jH,closePath:!0},"normal",nz.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",nz.Series),this.event.on(NP.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:u(this._spec.startAngle)?ae(this._spec.startAngle):EV},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(Aj(null===(s=_E.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),kj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=_E.getAnimationInKey(e);t.setAnimationConfig(Aj(null==i?void 0:i(n,r),kj(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}}}AZ.type=EB.radar,AZ.mark=SZ,AZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},AZ.transformerConstructor=tV,U(AZ,aN);const kZ=()=>{_E.registerSeries(AZ.type,AZ),pG(),ZN(),QN(),_E.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:_Z(t,e,"in"),enter:_Z(t,e,"in"),exit:_Z(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:yH.disappear.duration},update:[{channel:["points","center"],custom:vZ,customParameters:t,duration:yH.update.duration,easing:yH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),_E.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:bZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:yH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:mZ,customParameters:t,duration:yH.update.duration,easing:yH.update.easing}]}))),_E.registerAnimation("radarGroup",((t,e)=>({appear:xZ(t,"in"),disappear:{duration:yH.disappear.duration}}))),pC(),pZ(),dZ()};class CZ extends sj{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>vi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const wZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(WE)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[XE]:r,[KE]:`${s}_${e}`})),r++}))})),n},MZ={fill:"#bbb",fillOpacity:.2},TZ=Object.assign(Object.assign({},fj),{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"}}),BZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},EZ={grid:{background:!0}};class PZ extends Nj{constructor(){super(...arguments),this.type=EB.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),BZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),EZ)})}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),KP(this._option.dataSet,"objFlat",wZ),KP(this._option.dataSet,"copyDataView",iO),$P(this._option.dataSet,"dataview",Ra),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:aO.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(gE(MZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(PZ.mark.group),this._containerMark=this._createMark(PZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(PZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(PZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(PZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(PZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(PZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(PZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",nz.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",nz.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",nz.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",nz.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",nz.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",nz.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",nz.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",nz.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",nz.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:$E}}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 WB).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:$E}}initTooltip(){this._tooltipHelper=new CZ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}PZ.type=EB.dot,PZ.mark=TZ,PZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class OZ extends sj{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>vi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const RZ=Object.assign(Object.assign({},fj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),IZ=(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 DZ extends Nj{constructor(){super(...arguments),this.type=EB.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),KP(this._option.dataSet,"linkDotInfo",IZ),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:aO.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(DZ.mark.group),this._containerMark=this._createMark(DZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(DZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(DZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",nz.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",nz.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",nz.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",nz.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:$E}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new OZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}DZ.type=EB.link,DZ.mark=RZ,DZ.builtInTheme={link:{arrow:{style:{size:10}}}};const LZ=Object.assign(Object.assign({},fj),{group:{name:"group",type:"group"}}),FZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class zZ extends Eq{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()?JE:uP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle);let o;if(u(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return d(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?QE:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),FZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=u(n)?ae(n):EV;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?ae(r):PV,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField),this._specAngleField=this._angleField.slice(),this._specRadiusField=this._radiusField.slice()}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||u(null==s?void 0:s.startAngle)||u(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=YB(this.angleAxisHelper.dataToPosition([t[JE]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=YB(this.angleAxisHelper.dataToPosition([t[QE]]),this.angleAxisHelper.getScale(0));if(A(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?YB(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(zZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",nz.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[fg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const VZ=()=>{_E.registerAnimation("circularProgress",((t,e)=>({appear:NZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:yH.disappear.duration}})))};class WZ extends Pj{constructor(){super(...arguments),this._supportStack=!0}}const UZ={cornerRadius:!0,roundCap:!0};class GZ extends zZ{constructor(){super(...arguments),this.type=EB.circularProgress,this.transformerConstructor=WZ,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(A(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(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),UZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(GZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:Mj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",nz.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(GZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?JE:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?QE: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",nz.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(Aj(null===(i=_E.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),kj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),kj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}GZ.type=EB.circularProgress,GZ.mark=HZ,GZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},GZ.transformerConstructor=WZ;const YZ=()=>{_E.registerSeries(GZ.type,GZ),Vq(),VZ(),SH(),pZ(),dZ()};function XZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const KZ={type:"fadeIn"};function $Z(t,e="grow"){return!1===e?{}:"fadeIn"===e?KZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:XZ(t)}))(t)}class qZ extends sj{enableByType(t){return"dimension"!==t}}const ZZ=Object.assign(Object.assign({},fj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),JZ={bandWidth:!0,cornerRadius:!0,clamp:!0},QZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class tJ extends Nj{constructor(){super(...arguments),this.type=EB.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),JZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),QZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(tJ.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return YB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?YB(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",nz.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return YB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?YB(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",nz.Series)}}_initTrackMark(){return this._trackMark=this._createMark(tJ.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return YB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",nz.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return YB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",nz.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Aj(null===(i=_E.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),kj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Aj(null===(s=_E.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),kj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new qZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}tJ.type=EB.linearProgress,tJ.mark=ZZ,tJ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const eJ=()=>{BK(),_E.registerAnimation("linearProgress",((t,e)=>({appear:$Z(t,e),enter:$Z(t),disappear:{duration:yH.disappear.duration}}))),SH(),_E.registerSeries(tJ.type,tJ)},iJ=[0],sJ=[20,40],nJ=[200,500],rJ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},aJ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class oJ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const lJ=`${WE}_WORD_CLOUD_TEXT`,hJ=Object.assign(Object.assign({},fj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),cJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class dJ extends zj{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=sJ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:nJ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:iJ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?lJ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:rJ},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||yM(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:iJ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!aJ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new oJ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(dJ.mark.word,{key:KE,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(dJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:iz.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",nz.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",nz.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",nz.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(Aj(_E.getAnimationInKey("wordCloud")(n,s),kj("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 WB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:$E])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new SB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new SB).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[XE])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,NP.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:KE,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:__.createCanvas.bind(__),getTextBounds:pv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:ig,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}dJ.mark=hJ,dJ.builtInTheme={wordCloud:cJ};function uJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||yH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=pJ(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,Ct(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Ct(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},gJ=(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=gJ(t.children,e,t,n))})),s},fJ=(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=fJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},mJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):mJ(t.children,e,i)))})),e};function vJ(t,e){let i,s;if(bJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function bJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*w*T))/(2*w):T/M);return{x:s+S+A*B,y:n+k+C*B,radius:B}}function kJ(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 CJ(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 wJ(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 MJ(t){return{_:t,next:null,prev:null}}function TJ(t,e){const i=(t=G(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];kJ(n,s,r);let a,o,l,h,c,d,u,p=MJ(s),g=MJ(n),f=MJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=pJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:OJ.defaultOpionts.nodeSort;gJ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)gJ([o],BJ(h)),fJ([o],EJ(this._getPadding,.5,a)),gJ([o],PJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);gJ([o],BJ(OJ.defaultOpionts.setRadius)),fJ([o],EJ(Ot,1,a)),d&&fJ([o],EJ(this._getPadding,o.radius/t,a)),gJ([o],PJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}OJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const RJ=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=RJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function IJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){RJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:Ct(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Ct(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function DJ(t){return t.depth}function LJ(t,e){return e-1-t.endDepth}const FJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),zJ=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},HJ={left:DJ,right:LJ,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:DJ,end:LJ},jJ=_t(0,1);class NJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>FJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>FJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},NJ.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):HJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return IJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!d(r.source),l=!d(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&d(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[zJ(s[t.source]),zJ(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Ct(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(v(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*jJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}d(this.options.nodeSortBy)&&n.sort(FJ),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(FJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];VJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),WJ);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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},UJ.defaultOpionts,t):Object.assign({},UJ.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Et(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,u=h?a.map((t=>Pt(t,n))):Pt(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Pt(r,n),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(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=pJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=he({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function GJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:VJ,slice:GJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?GJ:VJ)(t,e,i,s,n)}};class KJ{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({},KJ.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Et(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?YJ(this.options.aspectRatio):null!==(e=XJ[this.options.splitType])&&void 0!==e?e:XJ.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=pJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function $J(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+di?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=$J(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ii(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=qJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function sQ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*nQ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},aQ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||JJ,s=e.lossFunction||ZJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ui(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:rQ(f),arcs:f})}))},oQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:lQ,triangle:lQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function lQ(){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 hQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const cQ=t=>oQ[t]?oQ[t]():oQ.circle(),dQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function uQ(t){return c(t)?t:function(){return t}}class pQ{constructor(t){var e,i;switch(this.options=z({},pQ.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=cQ(this.options.shape),this.getText=null!==(e=uQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=uQ(this.options.fontWeight),this.getTextFontSize=uQ(this.options.fontSize),this.getTextFontStyle=uQ(this.options.fontStyle),this.getTextFontFamily=uQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>dQ(10,50);break;case"random-light":this.getTextColor=()=>dQ(50,90);break;default:this.getTextColor=uQ(this.options.color)}if(d(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=c(this.options.rotate)?t=>{var e;return ae(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():wt(e);return ae(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!d(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class fQ extends pQ{constructor(t){var e;super(z({},fQ.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<=fQ.defaultOptions.minFontSize&&(this.options.minFontSize=fQ.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=gQ[this.options.spiral])&&void 0!==e?e:gQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=uQ(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}=hQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(_Q(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(yQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}_Q(p,this._size)&&(p=bQ(p,this._size))}else if(_Q(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||vQ(p,i))&&(!i||!mQ(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 mQ(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 vQ(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,_Q=(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 bQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},SQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},AQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},kQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=hQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=cQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)AQ(n,SQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)AQ(n,SQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)AQ(n,SQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)AQ(n,SQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)AQ(n,SQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=SQ({x:l,y:h},o,-Math.PI/2,5),e=SQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);AQ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ diff --git a/packages/lark-vchart/package.json b/packages/lark-vchart/package.json index af9183b3d3..9e9d5cc2b2 100644 --- a/packages/lark-vchart/package.json +++ b/packages/lark-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/lark-vchart", - "version": "2.1.3", + "version": "2.1.4", "description": "VChart 飞书小程序组件", "main": "index.js", "files": [ diff --git a/packages/lark-vchart/src/vchart/index.js b/packages/lark-vchart/src/vchart/index.js index 2422440f2d..be26c32aea 100644 --- a/packages/lark-vchart/src/vchart/index.js +++ b/packages/lark-vchart/src/vchart/index.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=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 M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(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(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Ot=t=>0,It=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ie(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{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}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,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 Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{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 Xe(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 Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={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 Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(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=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(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=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(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 ni(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=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{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`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(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}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(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 ni(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:Ke});function oi(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 li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(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 di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(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 Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{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 Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal: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?Ci[8+bi/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 C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=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")+_i(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 wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Fi(){return new zi}function zi(){this.reset()}zi.prototype={constructor:zi,reset:function(){this.s=this.t=0},add:function(t){ji(Hi,t,this.t),ji(this,Hi.s,this.s),this.s?this.t+=Hi.t:this.s=Hi.t},valueOf:function(){return this.s}};var Hi=new zi;function ji(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Ni=1e-6,Ui=Math.PI,Vi=Ui/2,Wi=Ui/4,Gi=2*Ui,Yi=180/Ui,Xi=Ui/180,Ki=Math.abs,$i=Math.atan,qi=Math.atan2,Zi=Math.cos,Ji=Math.exp,Qi=Math.log,ts=Math.pow,es=Math.sin,is=Math.sign||function(t){return t>0?1:t<0?-1:0},ss=Math.sqrt,ns=Math.tan;function rs(t){return t>1?0:t<-1?Ui:Math.acos(t)}function as(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function os(){}function ls(t,e){t&&cs.hasOwnProperty(t.type)&&cs[t.type](t,e)}var hs={Feature:function(t,e){ls(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sUi?t+Math.round(-t/Gi)*Gi:t,e]}function As(t,e,i){return(t%=Gi)?e||i?xs(Cs(t),Ts(e,i)):Cs(t):e||i?Ts(e,i):Ss}function ks(t){return function(e,i){return[(e+=t)>Ui?e-Gi:e<-Ui?e+Gi:e,i]}}function Cs(t){var e=ks(t);return e.invert=ks(-t),e}function Ts(t,e){var i=Zi(t),s=es(t),n=Zi(e),r=es(e);function a(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*i+o*s;return[qi(l*n-c*r,o*i-h*s),as(c*n+l*r)]}return a.invert=function(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*n-l*r;return[qi(l*n+h*r,o*i+c*s),as(c*i-o*s)]},a}function Ms(t,e){(e=fs(e))[0]-=t,bs(e);var i=rs(-e[1]);return((-e[2]<0?-i:i)+Gi-Ni)%Gi}function ws(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:os,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Es(t,e){return Ki(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 Rs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function zs(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 Hs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ws(),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=zs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=es(s),r=[es(i),-Zi(i),0],a=0,o=0;Ls.reset(),1===n?s=Vi+Ni:-1===n&&(s=-Vi-Ni);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ui,M=f*x;if(Ls.add(qi(M*k*es(C),m*S+M*Zi(C))),a+=T?A+k*Gi:A,T^p>=i^_>=i){var w=vs(fs(u),fs(y));bs(w);var E=vs(r,w);bs(E);var B=(T^A>=0?-1:1)*as(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Ni||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(js))}return u}}function js(t){return t.length>1}function Ns(t,e){return((t=t.x)[0]<0?t[1]-Vi-Ni:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-Ni:Vi-e[1])}1===(Os=Fs).length&&(Is=Os,Os=function(t,e){return Fs(Is(t),e)});var Us=Hs((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?Ui:-Ui,l=Ki(r-i);Ki(l-Ui)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ui&&(Ki(i-n)Ni?$i((es(e)*(r=Zi(s))*es(i)-es(s)*(n=Zi(e))*es(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*Vi,s.point(-Ui,n),s.point(0,n),s.point(Ui,n),s.point(Ui,0),s.point(Ui,-n),s.point(0,-n),s.point(-Ui,-n),s.point(-Ui,0),s.point(-Ui,n);else if(Ki(t[0]-e[0])>Ni){var r=t[0]0,n=Ki(e)>Ni;function r(t,i){return Zi(t)*Zi(i)>e}function a(t,i,s){var n=[1,0,0],r=vs(fs(t),fs(i)),a=ms(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=vs(n,r),u=_s(n,h);ys(u,_s(r,c));var p=d,g=ms(u,p),f=ms(p,p),m=g*g-f*(ms(u,u)-1);if(!(m<0)){var v=ss(m),y=_s(p,(-g-v)/f);if(ys(y,u),y=gs(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Ki(y[0]-b)Ui^(b<=y[0]&&y[0]<=x)){var T=_s(p,(-g+v)/f);return ys(T,u),[y,gs(T)]}}}function o(e,i){var n=s?t:Ui-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Hs(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?Ui:-Ui),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Es(e,p)||Es(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&&Es(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=Zi(e),o=es(e),l=s*i;null==n?(n=e+s*Gi,r=e-l/2):(n=Ms(a,n),r=Ms(a,r),(s>0?nr)&&(n+=s*Gi));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 Ki(s[0]-t)0?0:3:Ki(s[0]-i)0?2:1:Ki(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=ws(),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=zs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ps(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(Gs,Math.min(Ws,g)),f=Math.max(Gs,Math.min(Ws,f))],b=[r=Math.max(Gs,Math.min(Ws,r)),a=Math.max(Gs,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&&(_.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 Xs(t){return t}var Ks,$s,qs,Zs,Js=Fi(),Qs=Fi(),tn={point:os,lineStart:os,lineEnd:os,polygonStart:function(){tn.lineStart=en,tn.lineEnd=rn},polygonEnd:function(){tn.lineStart=tn.lineEnd=tn.point=os,Js.add(Ki(Qs)),Qs.reset()},result:function(){var t=Js/2;return Js.reset(),t}};function en(){tn.point=sn}function sn(t,e){tn.point=nn,Ks=qs=t,$s=Zs=e}function nn(t,e){Qs.add(Zs*t-qs*e),qs=t,Zs=e}function rn(){nn(Ks,$s)}var an=tn,on=1/0,ln=on,hn=-on,cn=hn;var dn,un,pn,gn,fn={point:function(t,e){thn&&(hn=t);ecn&&(cn=e)},lineStart:os,lineEnd:os,polygonStart:os,polygonEnd:os,result:function(){var t=[[on,ln],[hn,cn]];return hn=cn=-(ln=on=1/0),t}},mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn=0,Cn={point:Tn,lineStart:Mn,lineEnd:Bn,polygonStart:function(){Cn.lineStart=Pn,Cn.lineEnd=Rn},polygonEnd:function(){Cn.point=Tn,Cn.lineStart=Mn,Cn.lineEnd=Bn},result:function(){var t=kn?[Sn/kn,An/kn]:xn?[_n/xn,bn/xn]:yn?[mn/yn,vn/yn]:[NaN,NaN];return mn=vn=yn=_n=bn=xn=Sn=An=kn=0,t}};function Tn(t,e){mn+=t,vn+=e,++yn}function Mn(){Cn.point=wn}function wn(t,e){Cn.point=En,Tn(pn=t,gn=e)}function En(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Tn(pn=t,gn=e)}function Bn(){Cn.point=Tn}function Pn(){Cn.point=On}function Rn(){In(dn,un)}function On(t,e){Cn.point=In,Tn(dn=pn=t,un=gn=e)}function In(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Sn+=(n=gn*t-pn*e)*(pn+t),An+=n*(gn+e),kn+=3*n,Tn(pn=t,gn=e)}var Ln=Cn;function Dn(t){this._context=t}Dn.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,Gi)}},result:os};var Fn,zn,Hn,jn,Nn,Un=Fi(),Vn={point:os,lineStart:function(){Vn.point=Wn},lineEnd:function(){Fn&&Gn(zn,Hn),Vn.point=os},polygonStart:function(){Fn=!0},polygonEnd:function(){Fn=null},result:function(){var t=+Un;return Un.reset(),t}};function Wn(t,e){Vn.point=Gn,zn=jn=t,Hn=Nn=e}function Gn(t,e){jn-=t,Nn-=e,Un.add(ss(jn*jn+Nn*Nn)),jn=t,Nn=e}var Yn=Vn;function Xn(){this._string=[]}function Kn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $n(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ps(t,i(s))),s.result()}return r.area=function(t){return ps(t,i(an)),an.result()},r.measure=function(t){return ps(t,i(Yn)),Yn.result()},r.bounds=function(t){return ps(t,i(fn)),fn.result()},r.centroid=function(t){return ps(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Xs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Xn):new Dn(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 qn(t){return function(e){var i=new Zn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Zn(){}function Jn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ps(i,t.stream(fn)),e(fn.result()),null!=s&&t.clipExtent(s),t}function Qn(t,e,i){return Jn(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 tr(t,e,i){return Qn(t,[[0,0],e],i)}function er(t,e,i){return Jn(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 ir(t,e,i){return Jn(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)}Xn.prototype={_radius:4.5,_circle:Kn(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=Kn(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}},Zn.prototype={constructor:Zn,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 sr=16,nr=Zi(30*Xi);function rr(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=ss(b*b+x*x+S*S),k=as(S/=A),C=Ki(Ki(S)-1)e||Ki((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Xi:0,E()):[m*Yi,v*Yi,y*Yi]},M.angle=function(t){return arguments.length?(_=t%360*Xi,E()):_*Yi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=rr(o,T=t*t),B()):ss(T)},M.fitExtent=function(t,e){return Qn(M,t,e)},M.fitSize=function(t,e){return tr(M,t,e)},M.fitWidth=function(t,e){return er(M,t,e)},M.fitHeight=function(t,e){return ir(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function dr(t){var e=0,i=Ui/3,s=cr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Xi,i=t[1]*Xi):[e*Yi,i*Yi]},n}function ur(t,e){var i=es(t),s=(i+es(e))/2;if(Ki(s)2?t[2]*Xi:0),e.invert=function(e){return(e=t.invert(e[0]*Xi,e[1]*Xi))[0]*=Yi,e[1]*=Yi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===_r?[[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 xr(t){return ns((Vi+t)/2)}function Sr(t,e){var i=Zi(t),s=t===e?es(t):Qi(i/Zi(e))/Qi(xr(e)/xr(t)),n=i*ts(xr(t),s)/s;if(!s)return _r;function r(t,e){n>0?e<-Vi+Ni&&(e=-Vi+Ni):e>Vi-Ni&&(e=Vi-Ni);var i=n/ts(xr(e),s);return[i*es(s*t),n-i*Zi(s*t)]}return r.invert=function(t,e){var i=n-e,r=is(s)*ss(t*t+i*i),a=qi(t,Ki(i))*is(i);return i*s<0&&(a-=Ui*is(t)*is(i)),[a/s,2*$i(ts(n/r,1/s))-Vi]},r}function Ar(t,e){return[t,e]}function kr(t,e){var i=Zi(t),s=t===e?es(t):(i-Zi(e))/(e-t),n=i/s+t;if(Ki(s)Ni&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Or.invert=mr(as),Ir.invert=mr((function(t){return 2*$i(t)})),Lr.invert=function(t,e){return[-e,2*$i(Ji(t))-Vi]};var zr={exports:{}},Hr=function(t,e){this.p1=t,this.p2=e};Hr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Hr.prototype.run=function(){return this.p2[0]-this.p1[0]},Hr.prototype.slope=function(){return this.rise()/this.run()},Hr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Hr.prototype.isVertical=function(){return!isFinite(this.slope())},Hr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Hr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Hr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Hr.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)},Hr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var jr=Hr,Nr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new jr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Nr(t.slice(0,s),e),o=Nr(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},Ur=Nr;!function(t){var e=Ur;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Xr,e),{tolerance:s}=i;return Vr(t,s)};var $r;!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"}($r||($r={}));const qr=(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a},Zr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return Jr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return Jr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},ta=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",O=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var ea={},ia={};function sa(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function na(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ra(t,e){var i=t+"",s=i.length;return s9999?"+"+ra(e,6):ra(e,4))+"-"+ra(t.getUTCMonth()+1,2)+"-"+ra(t.getUTCDate(),2)+(r?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"."+ra(r,3)+"Z":n?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"Z":s||i?"T"+ra(i,2)+":"+ra(s,2)+"Z":"")}function oa(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 ia;if(h)return h=!1,ea;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=$r.DSV;const s=Wr(ca,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return oa(n).parse(t)},ua=(t,e={},i)=>(i.type=$r.DSV,la(t)),pa=(t,e={},i)=>(i.type=$r.DSV,ha(t));function ga(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return fa(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 fa(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return va(t);default:throw new Error("unknown GeoJSON type")}}function fa(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=ma(t.properties),e.geometry=va(t.geometry),e}function ma(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]=ma(s):e[i]=s})),e):e}function va(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return va(t)})),e):(e.coordinates=ya(t.coordinates),e)}function ya(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return ya(t)}))}function _a(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 ba(t){for(var e,i,s=_a(t),n=0,r=1;r0}function xa(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=ga(t));var r=[];switch(t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,s)})),t;case"FeatureCollection":return xa(t,(function(t){xa(ka(t,s),(function(t){r.push(t)}))})),di(r)}return ka(t,s)}function ka(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,e)})),t;case"LineString":return Ca(_a(t),e),t;case"Polygon":return Ta(_a(t),e),t;case"MultiLineString":return _a(t).forEach((function(t){Ca(t,e)})),t;case"MultiPolygon":return _a(t).forEach((function(t){Ta(t,e)})),t;case"Point":case"MultiPoint":return t}}function Ca(t,e){ba(t)===e&&t.reverse()}function Ta(t,e){ba(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Pa=(t,e={},i)=>{i.type=$r.GEO;const s=Wr(Ea,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Aa(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=wa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=wa.bounds(t);t.bbox=e}})),t.features=l,t},Ra={},Oa=(t,e,i)=>{i.type=$r.GEO;const s=Wr(Ea,Ra,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 Fr(a,t)}))}:Fr(a,o));var a,o;return Pa(r,s,i)},Ia=(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 La=0;function Da(t="dataset"){return La>1e8&&(La=0),t+"_"+La++}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:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class za{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof za||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Zr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}$n();const Ha={},ja={albers:gr,albersusa:function(){var t,e,i,s,n,r,a=gr(),o=pr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=pr().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)}},Na=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ua(t,e){return function i(){const s=e();return s.type=t,s.path=$n().projection(s),s.copy=s.copy||function(){const t=i();return Na.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ga 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=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Za.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Ja(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(Ja(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,Ja(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Ja(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 $a))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Za.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Qa(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ka,this.rootWheelEvent=new $a,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const so=Nt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,fo;function mo(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;tfo){let t,e=uo;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 wo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Fo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Ho(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new jo(i,n),new jo(n,s)]}class jo extends Eo{constructor(t,e){super(),this.type=xo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p1.x):t===bo.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class No{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new jo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===bo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===bo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Uo extends No{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?bo.ROW:bo.COLUMN;return"monotoneY"===t?new Uo(t,s):new No(t,s)}class Go{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,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Xo(new Go(n,s),t),n}function Xo(t,e){return Vo(t,e,1)}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 $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&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 qo(t,e){return Vo(t,e,2)}function Zo(t,e={}){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 qo(new $o(n,s),t),n}function Jo(t){return t<0?-1:1}function Qo(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(Jo(r)+Jo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function tl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function el(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 il{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:el(this,this._t0,tl(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,el(this,tl(this,e=Qo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:el(this,this._t0,e=Qo(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 sl extends il{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function nl(t,e){return Vo(t,e,2)}function rl(t,e={}){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 nl(new il(n,s),t),n}function al(t,e){return Vo(t,e,2)}function ol(t,e={}){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 al(new sl(n,s),t),n}let ll=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class hl extends ll{lineEnd(){this.context.closePath()}}function cl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new ll(r,e,n),t),r}function dl(t,e){return Vo(t,e,1)}function ul(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new hl(r,e,n),t),r}class pl extends Go{lineEnd(){this.context.closePath()}}function gl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return fl(new pl(n,s),t),n}function fl(t,e){return Vo(t,e,1)}function ml(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function vl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Yo(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const yl=vl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const _l=vl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class bl extends Eo{constructor(t,e,i){super(),this.type=xo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Lo(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p2.x):t===bo.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Lo(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new bl(i,a,r),new bl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class xl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new jo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new bl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Sl(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return Zo(t,i);case"monotoneX":return rl(t,i);case"monotoneY":return ol(t,i);case"step":return cl(t,.5,i);case"stepClosed":return ul(t,.5,i);case"stepBefore":return cl(t,0,i);case"stepAfter":return cl(t,1,i);case"catmullRom":return yl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return _l(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return gl(t,i)}}class Al extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.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([lo.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([lo.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([lo.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([lo.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([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new xl(this);wo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];To(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.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=mo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Sl(e,i);"x"===s?this.direction=bo.ROW:"y"===s?this.direction=bo.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[lo.M]=this.moveToTransform,t[lo.L]=this.lineToTransform,t[lo.Q]=this.quadraticCurveToTransform,t[lo.C]=this.bezierCurveToTransform,t[lo.AT]=this.arcToTransform,t[lo.E]=this.ellipseTransform,t[lo.R]=this.rectTransform,t[lo.A]=this.arcTransform,t[lo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),wo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===bo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===bo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),$l=Object.assign(Object.assign({},Nl),{points:[],cornerRadius:0,closePath:!0}),ql=Object.assign(Object.assign({},Nl),{width:100,height:100,spikes:5,thickness:.5}),Zl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Ql=Object.assign(Object.assign({},Nl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),th=Object.assign(Object.assign(Object.assign({},Nl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),eh=Object.assign(Object.assign(Object.assign({},Nl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ih=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Nl),{fill:!0,cornerRadius:0,cornerType:"round"}),sh=Object.assign(Object.assign({},ih),{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});class nh{}const rh=Symbol.for("@visactor/vrender-core/application-state");function ah(){const t=globalThis;return t[rh]||(t[rh]={application:new nh}),t[rh]}const oh=ah().application;class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?oh.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):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?oh.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"},lh.cache.set(t,s),s.dataPromise=oh.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oh.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oh.global.loadBlob(t):"json"===e&&(i.dataPromise=oh.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=oh.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{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 Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Ph=new class extends Th{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Ih(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{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 Ih(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ih(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{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 Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Gh=new class extends Th{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(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 Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+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(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{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 Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{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 ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{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 sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{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 rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(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 dc=new class extends Th{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 cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(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 pc=new class extends Th{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 uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(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 fc=new class extends Th{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 gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(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 vc=new class extends Th{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 mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(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 Ac=new class extends Th{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 Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{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)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),wo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(wo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}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 Ec=[wh,Eh,Ph,Oh,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{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 Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ic(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ic(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ic(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 Rc(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 Rc(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 Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;eqc.set(t,!0)));const Zc=new Map;function Jc(t){if(qc.has(t))return!0;if(Zc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Qc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Zc.set(t,!0)));const td=Xc(),ed=Xc(),id=Xc(),sd=Xc(),nd=Xc(),rd=Xc(),ad=Xc(),od=Xc(),ld=Xc(),hd=Xc(),cd=Xc(),dd=Xc(),ud=Xc(),pd=Xc(),gd=Xc(),fd=Xc(),md=Xc(),vd=Symbol.for("GraphicService"),yd=Symbol.for("GraphicCreator"),_d={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},bd=Object.keys(_d),xd={"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"},Sd=Object.keys(xd),Ad={duration:200,easing:"cubicOut"},kd=Symbol.for("CanvasFactory"),Cd=Symbol.for("Context2dFactory");function Td(t){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.canvasFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Md=1e-4,wd=Math.sqrt(3),Ed=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Rd(t){return"number"==typeof t&&Number.isFinite(t)}const Od=[0,0],Id=[0,0],Ld=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Fd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function zd(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 Hd(t){return(t%=Ut)<0&&(t+=Ut),t}function jd(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+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Vd(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(Bd(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 Yd=[-1,-1,-1],Xd=[-1,-1];function Kd(){const t=Xd[0];Xd[0]=Xd[1],Xd[1]=t}function $d(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(Bd(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,Ed):Math.pow(i,Ed),s=s<0?-Math.pow(-s,Ed):Math.pow(s,Ed);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+wd*Math.sin(e)))/(3*a),h=(-o+i*(s-wd*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,Yd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Kd(),p=zd(e,s,r,o,Xd[0]),u>1&&(g=zd(e,s,r,o,Xd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Yd);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=Fd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Yd[0]=-l,Yd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Yd[0]+t&&a<=Yd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Yd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Jd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function Qd(t,e){let i=Jd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Jd(i-n)):e&&i1&&(i||(h+=Oe(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;tu[0]=S,tu[1]=A,Qd(tu,Boolean(a[6])),S=tu[0],A=tu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case lo.M:u=m,p=v,c=u,d=p;break;case lo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case lo.C:if(i){if(Nd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(jd(c,d,m,v,y,_,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case lo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Ud(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Zd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case lo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case lo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class su{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(su.IsGradientStr(t))try{const e=iu(t)[0];if(e){if("linear"===e.type)return su.ParseLinear(e);if("radial"===e.type)return su.ParseRadial(e);if("conic"===e.type)return su.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:su.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:su.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function au(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ou(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];return 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}function lu(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];return 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}function hu(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];return 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,t}function cu(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 du(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 uu(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function pu(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 gu(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];return Math.abs(g-b)0&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Cu),function(t,e,i){return eu(t,0,!1,e,i)}(this.path.commandList,Cu.x,Cu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Cu);const i=nu(this,this.lineWidth,this.dpr);return function(t,e,i,s){return eu(t,e,!0,i,s)}(this.path.commandList,i,Cu.x,Cu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ku,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}const Mu={WIDTH:500,HEIGHT:500,DPR:1};class wu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Mu.WIDTH,height:n=Mu.HEIGHT,dpr:r=Mu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Eu;wu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Eu||(Eu={}));class Bu{static Get(t,e=Eu.Color1,i=[0,0,0,1]){if(e===Eu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Eu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Pu(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ru(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ou(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ou(t,e,i,s,n)}function Ou(t,e,i,s,n){if(!t||!e)return t&&Pu(t)||e&&Pu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Eu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Eu.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:Pu(a)})))});return o?Ru(r,l,i,s,n):Ru(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 Iu(s,n,i);if("radial"===s.gradient)return Lu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Pu(Fu(r,a,i),s)}function Iu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(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]}function zu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const Hu=[0,0,0,0],ju=[0,0,0,0];function Nu(t,e,i){return Bu.Get(t,Eu.Color255,Hu),Bu.Get(e,Eu.Color255,ju),`rgba(${Math.round(Hu[0]+(ju[0]-Hu[0])*i)},${Math.round(Hu[1]+(ju[1]-Hu[1])*i)},${Math.round(Hu[2]+(ju[2]-Hu[2])*i)},${Hu[3]+(ju[3]-Hu[3])*i})`}class Uu{static GetCanvas(){try{return Uu.canvas||(Uu.canvas=oh.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 Vu extends Ye{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Gu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;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),Ru(o.color,l.color,h,!1)}function Yu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Uu.GetCanvas(),d=Uu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Ku(t){return null==t?void 0:t}class $u{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Ku(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Xu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Ku(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function qu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Zu(t){if(!qu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Zu(t[i])})),e}function Ju(t,e){var i;const s=null!==(i=Zu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];qu(n)&&qu(i)?s[t]=Ju(n,i):s[t]=Zu(i)})),s}class Qu{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Zu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];qu(r)&&qu(n)?t[i]=Ju(r,n):!qu(r)&&qu(a)&&qu(n)?t[i]=Ju(a,n):t[i]=Zu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?tp.PAINT|tp.BOUNDS|tp.PICK:tp.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?tp.PAINT|tp.BOUNDS:tp.PAINT}};class sp{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Ad;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:_o.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:_o.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:_o.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const np=new $u;function rp(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,ap(t),!0)}function ap(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=np.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function op(t){if(t)return t.parentScope&&op(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&ap(t),t}function lp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function hp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function cp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,hp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),lp(null!=e?e:t.ownerStage))}const dp=new Ve,up=new Ge,pp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],gp=["x","y"],fp=["scaleX","scaleY"],mp=["angle"],vp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),yp=new re,_p=[],bp=tp.PAINT|tp.SHAPE|tp.BOUNDS|tp.TRANSFORM|tp.LAYOUT;function xp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Sp(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Sp(s):s})),i}function Ap(t,e){return t===e||!!(xp(t)||xp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function kp(t,e){var i;const s=null!==(i=Sp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];xp(n)&&xp(i)?s[t]=kp(n,i):s[t]=Sp(i)})),s}const Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Tp extends Ga{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,hp(this.stage,this),lp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&op(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(op(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new $u).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Sp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&xp(n)&&xp(s)?e[t]=kp(n,s):e[t]=Sp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Sp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Ap(a,o)||(s.set(n,{prev:a,next:o}),t[n]=Sp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ip[t];return n?n(e,i):null!==(s=ep[t])&&void 0!==s?s:tp.PAINT}(e,i,s):null!==(n=ep[e])&&void 0!==n?n:tp.PAINT;return r&tp.PICK&&(r|=tp.BOUNDS),r===tp.PAINT&&this.needUpdateTag(e)&&(r=tp.SHAPE|tp.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&bp)!==bp?(t&tp.SHAPE?this.addUpdateShapeAndBoundsTag():t&tp.BOUNDS&&this.addUpdateBoundTag(),t&tp.PAINT&&this.addUpdatePaintTag(),t&tp.TRANSFORM&&this.addUpdatePositionTag(),t&tp.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=tp.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&vo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Ep.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];dp.clear();const n=[];s.forEach((t=>{const e=(new Al).fromString(t.d),i={};Sd.forEach((e=>{t[e]&&(i[xd[e]]=t[e])})),n.push({path:e,attribute:i}),dp.union(e.bounds)}));const r=dp.width(),a=dp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Ep.userSymbolMap[t]=l,l}const i=(new Al).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Ep.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return wo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&vo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&vo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&vo.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&vo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=vo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===yo.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===_o.STATE||null!=i&&i>=_o.ANIMATE_BIND&&i<=_o.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===_o.STATE||null!=o&&o>=_o.ANIMATE_BIND&&o<=_o.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Ap(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:_p,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ad}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:_p,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Sp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:_o.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:_p,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:_p,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,scaleX:i=Rl.scaleX,scaleY:s=Rl.scaleY,angle:n=Rl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(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,!0),oh.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Rl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=up.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=oh.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Al).fromString(t):this.pathProxy=new Al,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:oh.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new qa(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ga.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:_o.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:_o.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||oh.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Tu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Tp.userSymbolMap={};const Mp=Symbol.for("@visactor/vrender-core/graphic-class");function wp(){var t;const e=globalThis;return null!==(t=e[Mp])&&void 0!==t||(e[Mp]={Graphic:Tp}),e[Mp]}const Ep=wp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!vp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Lp=Op();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Rp.forEach((t=>{this._defaultTheme[t]=Object.create(Lp[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Rp.forEach((s=>{const n=Object.create(Lp[s]);t&&t[s]&&Ip(n,t[s]),i[s]&&Ip(n,i[s]),e[s]&&Ip(n,e[s]),this.combinedTheme[s]=n})),e.common&&Rp.forEach((t=>{Ip(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 Fp=new Dp;function zp(t,e){return t.glyphHost?zp(t.glyphHost):e?(t.isContainer,e):Hp(t)||t.attachedThemeGraphic&&zp(t.attachedThemeGraphic)||Fp.getTheme()}function Hp(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)):Fp.getTheme()}return null}const jp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Np=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...pp];class Up extends Ep{constructor(t){super(t),this.type="arc",this.numberType=td}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return zp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Np)}needUpdateTag(t){return super.needUpdateTag(t,Np)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const Wp=["segments","points","curveType","curveTension",...pp];class Gp extends Ep{constructor(t){super(t),this.type="area",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return zp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Al;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Gp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gp.NOWORK_ANIMATE_ATTR}}function Yp(t){return new Gp(t)}Gp.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Xp=["radius","startAngle","endAngle",...pp];class Kp extends Ep{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return zp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Xp)}needUpdateTag(t){return super.needUpdateTag(t,Xp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Al,s.arc(0,0,r,a,o),s}clone(){return new Kp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kp.NOWORK_ANIMATE_ATTR}}function $p(t){return new Kp(t)}Kp.NOWORK_ANIMATE_ATTR=Cp;class qp extends Ep{constructor(t){super(t),this.type="glyph",this.numberType=nd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return zp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new qp(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return qp.NOWORK_ANIMATE_ATTR}}function Zp(t){return new qp(t)}var Jp;qp.NOWORK_ANIMATE_ATTR=Cp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Jp||(Jp={}));let Qp=class t extends Ep{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rd,this._childUpdateTag=vo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(rp(this.sharedStateScope,t),cp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===yo.GLOBAL){const i=new re(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&vo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,dx:i=Rl.dx,dy:s=Rl.dy,scaleX:n=Rl.scaleX,scaleY:r=Rl.scaleY,angle:a=Rl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return zp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=vo.CLEAR_BOUNDS,this._childUpdateTag&=vo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&vo.UPDATE_BOUNDS||(this._childUpdateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&vo.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=oh.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&rp(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return ap({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Cp;const eg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...pp];class ig extends Ep{constructor(t){super(t),this.type="image",this.numberType=ad,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return zp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ih[t]}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}clone(){return new ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ig.NOWORK_ANIMATE_ATTR}}function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Cp);const ng=["segments","points","curveType","curveTension",...pp];let rg=class t extends Ep{constructor(t={}){super(t),this.type="line",this.numberType=od}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=bh(i,s,e))}getGraphicTheme(){return zp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,ng)}needUpdateTag(t){return super.needUpdateTag(t,ng)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Al;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ag(t){return new rg(t)}rg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const og=["path","customPath",...pp];class lg extends Ep{constructor(t){super(t),this.type="path",this.numberType=ld}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Al?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Al?this.cache:t.path)}getGraphicTheme(){return zp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Al).fromString(t.path):t.customPath&&(this.cache=new Al,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,og)}needUpdateTag(t){return super.needUpdateTag(t,og)}toCustomPath(){return(new Al).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new lg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lg.NOWORK_ANIMATE_ATTR}}function hg(t){return new lg(t)}lg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const cg=["points","cornerRadius",...pp];class dg extends Ep{constructor(t){super(t),this.type="polygon",this.numberType=hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return zp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,cg)}needUpdateTag(t){return super.needUpdateTag(t,cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Al,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Cp;const pg=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}},gg=["width","x1","y1","height","cornerRadius",...pp];class fg extends Ep{constructor(t){super(t),this.type="rect",this.numberType=dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return zp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,gg)}needUpdateTag(t){return super.needUpdateTag(t,gg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=pg(e);return t=new Al,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fg.NOWORK_ANIMATE_ATTR}}function mg(t){return new fg(t)}fg.NOWORK_ANIMATE_ATTR=Cp;const vg=Symbol.for("EnvContribution"),yg=Symbol.for("VGlobal"),_g="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",bg={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"}},xg=!0,Sg=!1,Ag=/\w|\(|\)|-/,kg=/[.?!,;:/,。?!、;:]/,Cg=/\S/,Tg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=oh.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=wg(t,a)),a}function wg(t,e,i=!1){let s=e;for(;Ag.test(t[s-1])&&Ag.test(t[s])||kg.test(t[s]);)if(s--,s<=0)return i?Eg(t,e):e;return s}function Eg(t,e){let i=e;for(;Ag.test(t[i+1])&&Ag.test(t[i])||kg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=oh.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Pg{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=bg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Rg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Og{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Rg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Mg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Ig extends ig{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(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=ih.width,height:e=ih.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 Lg{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 Ig?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Cg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Ig)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sg;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,Tg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ru(t,s,{AABBBounds:i}):s,Tg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Ig)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Ig?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=bg[this.direction]}store(t){if(t instanceof Ig){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 Lg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Ig?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character,t.ascentDescentMode),new Og(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Fg=!1;try{Fg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Fg=!1}const zg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...pp];class Hg extends Ep{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=pd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return zp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1)))}static splitText(t){if(Fg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Hg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),oh.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Hg.AllSingleCharacter(y)&&(y=Hg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Pg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Hg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Hg.NOWORK_ANIMATE_ATTR}}function jg(t){return new Hg(t)}Hg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);class Ng extends Qp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ug(t){return new Ng(t)}const Vg=["symbolType","size",...pp];let Wg=class t extends Ep{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=fd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return zp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Gc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Al).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Al).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Gg(t){return new Wg(t)}function Yg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Xg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Kg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);class $g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Tl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=md}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return zp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Zg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=oh.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Gc(n,o/Math.abs(r+a),!0,l),i.union(n)}return oh.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new $g(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new $g(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Yg(y,a),e=this.cache.verticalList.length*v,i=Xg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>$c(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Kc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Yg(y,a),A=x.verticalList.length*v,k=Xg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=qg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=qg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Zg.baselineMapAlign}getAlignMapBaseline(){return Zg.alignMapBaseline}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),Zg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Zg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Qg=["heightLimit","lineClamp"];class tf extends Zg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new $g(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 uf extends df{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let pf=0;class gf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=oh.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++pf,t),this.tryRunAnimationFrameNextFrame(),pf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class ff{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var mf=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 vf extends ff{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new uf(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return mf(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class yf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Td(Object.assign({nativeCanvas:oh.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Td(Object.assign({nativeCanvas:oh.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const _f=new yf,bf=Symbol.for("VWindow"),xf=Symbol.for("WindowHandlerContribution");function Sf(t){const e=oh.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Af extends ff{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(t=oh.global,e=Sf){super(),this.handlerFactory=e,this.hooks={onChange:new uf(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class kf{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=oh.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=_f.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=oh.windowFactory)||void 0===s?void 0:s.call(oh))&&void 0!==n?n:new Af(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var Cf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Cf||(Cf={}));const Tf=new Ge;class Mf{constructor(){this.matrix=new Ge}init(t){return this.mode=Cf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Cf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}scale(t,e,i){return this.mode===Cf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Cf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Tf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}translate(t,e){return this.mode===Cf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Cf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const wf=Symbol.for("@visactor/vrender-core/factory-state");function Ef(){const t=globalThis;return t[wf]||(t[wf]={pluginClasses:{}}),t[wf]}class Bf{constructor(){this.global=oh.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Pf=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 Rf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Of(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Ff{constructor(){this.time=So.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(jf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=zp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Kf(t,e,i,s)}}const zf=new Ff,Hf=new Set(["top","center","bottom"]);function jf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Nf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Uf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Uf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Nf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Gf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Hf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Yf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Xf(t){if(!t)return null;const e=Yf(t.naturalWidth,t.videoWidth,t.width),i=Yf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Kf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Xf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Gf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=_f.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),_f.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class $f{constructor(t){this.subRenderContribitions=t,this.time=So.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)}))}}class qf{constructor(){this.time=So.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Zf=new qf;class Jf{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Qf=new Jf,tm={getContributions:()=>[]};class em{constructor(t=[],e=tm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Of(e,Nl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:oh.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:tm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Su.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lf(e,i,Nl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Su.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),Su.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||function(){const t=oh.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class sm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class nm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class am{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const om={getContributions:()=>[]};class lm{constructor(t=om,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new rm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class hm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class cm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=oh.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=oh.global.getRequestAnimationFrame();this.rafId=t((()=>{oh.global.devicePixelRatio!==this.dpr&&(this.dpr=oh.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=oh.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class dm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oh.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const um=new Ve;class pm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&vo.UPDATE_PAINT)||s._updateTag&vo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(um.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(um,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let gm;function fm(){if(null==gm)try{const t=document.createElement("canvas"),e=t.getContext("2d");gm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),gm&&(gm=!!document.createElement)}catch(t){gm=!1}}function mm(){fm();const t=oh.global&&oh.global.env;return t?"browser"===t:gm}function vm(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(au(t),cu(t,t,[n+o,r+l,a+h]),cu(t,t,[y[0],y[1],y[2]]),ou(t,t,g),lu(t,t,p),cu(t,t,[-y[0],-y[1],y[2]]),uu(t,t,[c,d,u]),f){const i=Au.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]}cu(i,i,[s[0],s[1],0]),hu(i,i,f),cu(i,i,[-s[0],-s[1],0]),pu(t,t,i)}}function ym(t){const{alpha:e,beta:i}=t.attribute;return e||i}class _m{constructor(t=lf){this.creator=t,this.hooks={onAttributeUpdate:new uf(["graphic"]),onSetStage:new uf(["graphic","stage"]),onRemove:new uf(["graphic"]),onRelease:new uf(["graphic"]),onAddIncremental:new uf(["graphic","group","stage"]),onClearIncremental:new uf(["graphic","group","stage"]),beforeUpdateAABBBounds:new uf(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uf(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uf(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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=Xg(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=Yg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Gc(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;Gc(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&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const bm="white";class xm extends Qp{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:bm}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new uf(["stage"]),afterRender:new uf(["stage"]),afterClearScreen:new uf(["stage"]),afterClearRect:new uf(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:oh.global,!this.global.env&&mm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:oh.windowFactory)&&void 0!==n?n:()=>new Af(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=oh.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=oh.renderServiceFactory)||void 0===h?void 0:h.call(oh))&&void 0!==c?c:oh.renderService)&&void 0!==d?d:new im,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=oh.pluginServiceFactory)||void 0===p?void 0:p.call(oh))&&void 0!==g?g:oh.pluginService)&&void 0!==f?f:new lm,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:oh.layerService)&&void 0!==v?v:new Mm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:oh.graphicService)&&void 0!==b?b:new _m,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:bm,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,ap(s)),cp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new io(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=Cm.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=Cm.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Cm.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new hm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new cm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new dm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new pm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Cm.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Cm.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Cm.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return ap({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class Sm{constructor(t=xm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Am extends Qp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oh.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=>{oh.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)))}}class km{constructor(t=Am){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let Cm=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Tm(t){const e=oh.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}Cm._pluginClasses=Ef().pluginClasses;class Mm{static GenerateLayerId(){return`${Mm.idprefix}_${Mm.prefix_count++}`}constructor(t=oh.global,e=new km,i=Tm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Mm.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)}}Mm.idprefix="visactor_layer",Mm.prefix_count=0;const wm=Symbol.for("TransformUtil"),Em=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Pm=Symbol.for("StaticLayerHandlerContribution"),Rm=Symbol.for("DynamicLayerHandlerContribution"),Om=Symbol.for("VirtualLayerHandlerContribution"),Im=Symbol.for("@visactor/vrender-core/contribution-store-state");function Lm(){const t=globalThis;return t[Im]||(t[Im]={store:new Map}),t[Im]}const Dm=Symbol("ContributionProvider");class Fm{constructor(t,e){this.serviceIdentifier=t,this.container=e,Nm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function zm(t,e){return new Fm(t,e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).inSingletonScope().whenTargetNamed(e)}function jm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).whenTargetNamed(e)}class Nm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}Nm.store=Lm().store;class Um{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=th.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=wg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Um{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Gm({bind:t}){t(yg).toDynamicValue((({container:t})=>new vf(zm(vg,t)))).inSingletonScope(),t(bf).to(Af),t(Em).toDynamicValue((({container:t})=>new kf(zm(Vm,t)))).inSingletonScope(),t(wm).to(Mf).inSingletonScope(),t(Bm).to(Mm).inSingletonScope()}const Ym=Symbol.for("RenderService"),Xm=Symbol.for("BeforeRenderConstribution");function Km({bind:t}){t(Ym).to(im)}const $m=Symbol.for("GraphicPicker"),qm=Symbol.for("PickerService"),Zm=Symbol.for("BoundsPicker"),Jm=Symbol.for("GlobalPickerService"),Qm=Symbol.for("PickItemInterceptor"),tv=Symbol.for("PickServiceInterceptor"),ev=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ed,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},iv=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class sv extends fg{constructor(t){super(t),this.type="rect3d",this.numberType=ud}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return zp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,rv)}needUpdateTag(t){return super.needUpdateTag(t,rv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Al,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new av(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return av.NOWORK_ANIMATE_ATTR}}function ov(t){return new av(t)}av.NOWORK_ANIMATE_ATTR=Cp;class lv extends Up{constructor(t){super(t),this.type="arc3d",this.numberType=ed}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return lv.NOWORK_ANIMATE_ATTR}}function hv(t){return new lv(t)}lv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);class cv extends dg{constructor(t){super(t),this.type="pyramid3d",this.numberType=cd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return cv.NOWORK_ANIMATE_ATTR}}function dv(t){return new cv(t)}let uv,pv;function gv(t){return uv||(uv=cf("text",{})),uv.initAttributes(t),uv.AABBBounds}function fv(t){return pv||(pv=cf("richtext",{})),pv.setAttributes(t),pv.AABBBounds}cv.NOWORK_ANIMATE_ATTR=Cp;class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class vv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=zp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Su.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class _v{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=ev(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function bv({bind:t,isBound:e}){e(qm)||(t(Jm).toSelf(),t(qm).toService(Jm)),t(_v).toSelf().inSingletonScope(),t(Qm).toService(_v),t(vv).toSelf().inSingletonScope(),t(Qm).toService(vv),t(yv).toSelf().inSingletonScope(),t(Qm).toService(yv),Hm(t,Qm),t(mv).toSelf().inSingletonScope(),t(tv).toService(mv),Hm(t,tv)}function xv({bind:t}){t(vd).to(_m),t(yd).toConstantValue(lf)}const Sv=Symbol.for("AutoEnablePlugins"),Av=Symbol.for("PluginService");class kv{constructor(){this.type="static",this.offscreen=!1,this.global=oh.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Td({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()}}function Cv(t){(function({bind:t}){Hm(t,vg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),Hm(t,Vm)}({bind:t.bind}),function({bind:t}){t(kv).toSelf(),t(Pm).toService(kv)}({bind:t.bind})}const Tv=Ht/2;function Mv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Tv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Tv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Tv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Tv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function wv(t,e){return!(!t&&!e)}function Ev(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Pv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Rv(t,e){return t*e>0}function Ov(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Iv(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*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Fv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=Lv(g,f,u,p,n,t,Number(c)),l=Lv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=Lv(S,A,b,x,r,-n,Number(c)),l=Lv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const zv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Hv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=_f.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])),_f.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,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=_f.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Gg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:zv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=_f.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),_f.free(l),c}_f.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const jv=new Hv;class Nv{constructor(){this.time=So.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:nu(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Fv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Uv=new Nv,Vv=jv,Wv=zf;class Gv{constructor(){this.time=So.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Yv=new Gv,Xv=jv,Kv=zf;class $v extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(jf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const qv=new $v;function Zv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Jv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:nu(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Mv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class Qv{constructor(){this.time=So.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;Zv(p)&&(u.doStroke=!1)}}class ty{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Zv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Mv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ey=new Jv,iy=jv,sy=zf;class ny extends Jv{constructor(){super(...arguments),this.time=So.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)}}const ry=new ny,ay=zf;class oy{constructor(){this.time=So.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class ly{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const hy=new oy,cy=new ly,dy=jv,uy=zf,py=jv,gy=zf;class fy extends Hv{constructor(){super(...arguments),this.time=So.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:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class my{constructor(t){this.groupRenderContribitions=t,this.numberType=rd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:zp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Pv(p,m,g,f,c),w=Ov(p,v,g,f),E=wv(c,u),B=Ev(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Mv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===So.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===So.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=oh.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=zp(t,null==s?void 0:s.theme).group,i=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(i,p||i,n),a.modelMatrix=i,Au.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Au.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var vy,yy=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"}(vy||(vy={}));class _y extends em{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=vy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uf([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return yy(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:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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 yy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return yy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>yy(this,void 0,void 0,(function*(){if(2!==t.count)yield If(t,Nl.zIndex,((i,s)=>{if(this.status===vy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return yy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return yy(this,void 0,void 0,(function*(){this.rendering&&(this.status=vy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=vy.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 yy(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:()=>yy(this,void 0,void 0,(function*(){yield If(t,Nl.zIndex,(t=>yy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const by=Symbol.for("IncrementalDrawContribution"),xy=Symbol.for("ArcRender"),Sy=Symbol.for("Arc3dRender"),Ay=Symbol.for("AreaRender"),ky=Symbol.for("CircleRender"),Cy=Symbol.for("GraphicRender"),Ty=Symbol.for("GroupRender"),My=Symbol.for("LineRender"),wy=Symbol.for("PathRender"),Ey=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Py=Symbol.for("Rect3DRender"),Ry=Symbol.for("SymbolRender"),Oy=Symbol.for("TextRender"),Iy=Symbol.for("RichTextRender"),Ly=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Fy=Symbol.for("ImageRender"),zy=Symbol.for("RenderSelector"),Hy=Symbol.for("DrawContribution"),jy=Symbol.for("StarRender"),Ny=Symbol.for("DrawItemInterceptor"),Uy=new Ve,Vy=new Ve;class Wy{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){Uy.copy(s.dirtyBounds),Vy.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,Su.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Uy),s.backupDirtyBounds.copy(Vy)),!0}}class Gy{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}}class Yy{constructor(){this.order=1,this.interceptors=[new Wy,new Ky,new Xy,new Gy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Au.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const $y=Symbol.for("ArcRenderContribution"),qy=Symbol.for("AreaRenderContribution"),Zy=Symbol.for("CircleRenderContribution"),Jy=Symbol.for("GroupRenderContribution"),Qy=Symbol.for("ImageRenderContribution"),t_=Symbol.for("PathRenderContribution"),e_=Symbol.for("PolygonRenderContribution"),i_=Symbol.for("RectRenderContribution"),s_=Symbol.for("SymbolRenderContribution"),n_=Symbol.for("TextRenderContribution"),r_=Symbol.for("StarRenderContribution"),a_=Symbol.for("CommonRenderContribution"),o_=Symbol.for("InteractiveSubRenderContribution");function l_(t){!function({bind:t}){t(Ff).toSelf().inSingletonScope(),t(Hv).toSelf().inSingletonScope(),t(Hy).to(em),t(by).to(_y),t(Ty).toDynamicValue((({container:t})=>new my(zm(Jy,t)))).inSingletonScope(),t(Cy).toService(Ty),Hm(t,Jy),Hm(t,o_),t($f).toDynamicValue((({container:t})=>new $f(zm(o_,t)))).inSingletonScope(),Hm(t,Cy),t(Yy).toSelf().inSingletonScope(),t(Ny).toService(Yy),Hm(t,Ny)}({bind:t.bind})}class h_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class c_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new h_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function d_(){return new c_}const u_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const p_=function(){const t=globalThis;return t[u_]||(t[u_]={legacyBindingContext:d_(),preloaded:!1}),t[u_]}(),g_=p_.legacyBindingContext;function f_(){p_.preloaded||(p_.preloaded=!0,Gm({bind:g_.bind}),xv({bind:g_.bind}),Km({bind:g_.bind}),bv({bind:g_.bind,isBound:g_.isBound}),function({bind:t}){t(Av).to(lm),jm(t,Sv)}({bind:g_.bind}),Cv(g_),l_(g_))}function m_(){return g_}function v_(t){f_();const[e]=g_.getAll(t);return e}function y_(t,e){return f_(),g_.getNamed(t,e)}function __(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const b_=__((()=>v_(yg)));oh.global=b_;class x_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?oh.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:oh.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Kg("text"===t.type&&t.attribute?t.attribute:zp(t).text)}getTransformOfText(t){const e=zp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=oh.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));oh.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===oh.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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&&oh.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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"===oh.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 S_=()=>{Cm.registerPlugin("HtmlAttributePlugin",x_)};class A_ extends x_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?oh.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&oh.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const k_=()=>{Cm.registerPlugin("ReactAttributePlugin",A_)};class C_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return C_.instance||(C_.instance=new C_),C_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function T_(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function M_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:w_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=T_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:w_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=T_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const O=i*x+B;O>0&&E.wait(O);let I=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(E,e,p,L);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=T_(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:w_.builtInAnimateMap[r],m=t.custom?t.customType:T_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{M_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}w_.builtInAnimateMap={};const E_="appear",B_="disappear",P_="update",R_="highlight",O_="unhighlight";class I_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class L_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyHighlightState(t,e){this.applyState([R_],[{name:R_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([O_],[{name:O_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new L_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new I_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class F_{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-F_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*F_.bounceIn(2*t):.5*F_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){F_[t]=e}}function z_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}F_.quadIn=F_.getPowIn(2),F_.quadOut=F_.getPowOut(2),F_.quadInOut=F_.getPowInOut(2),F_.cubicIn=F_.getPowIn(3),F_.cubicOut=F_.getPowOut(3),F_.cubicInOut=F_.getPowInOut(3),F_.quartIn=F_.getPowIn(4),F_.quartOut=F_.getPowOut(4),F_.quartInOut=F_.getPowInOut(4),F_.quintIn=F_.getPowIn(5),F_.quintOut=F_.getPowOut(5),F_.quintInOut=F_.getPowInOut(5),F_.backIn=F_.getBackIn(1.7),F_.backOut=F_.getBackOut(1.7),F_.backInOut=F_.getBackInOut(1.7),F_.elasticIn=F_.getElasticIn(1,.3),F_.elasticOut=F_.getElasticOut(1,.3),F_.elasticInOut=F_.getElasticInOut(1,.3*1.5),F_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),F_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},F_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)F_[`flicker${t}`]=e=>z_(e,t);for(let t=2;t<10;t++)F_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function H_(t,e,i){return t+(e-t)*i}const j_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=H_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=H_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=H_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=H_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=H_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=H_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=H_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=H_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=H_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ru(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?zu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ru(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?zu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=H_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=H_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=H_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=H_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=H_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=H_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=H_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function N_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:_o.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=F_[s])&&void 0!==n?n:F_.linear:F_.linear,"wait"===t&&(this.onUpdate=Z_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=Z_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Bu.Get(i,Eu.Color255),r=Bu.Get(s,Eu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(j_["fill"===e?"fillPure":"strokePure"])}else j_[e]?t.push(j_[e]):t.push(N_)}else j_[e]?t.push(j_[e]):t.push(N_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tb extends Q_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();$_(this.target,t,_o.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class eb extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ib=new eb;ib.isGlobal=!0;class sb extends Q_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class nb extends sb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class rb extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class ab extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){$_(this.target,this.from,_o.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ob(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class cb{constructor(t=Va.GenAutoIncrementId(),e=ib,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(hb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new Q_(El.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tb(El.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new ab(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(hb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&$_(this.target,this._startProps,_o.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const db=new gf;class ub{constructor(){this.released=!1}tick(t,e){db.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class pb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===wl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=wl.INITIAL,oh.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),oh.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new ub;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==wl.INITIAL&&(this.status=wl.PAUSE,!0)}resume(){return this.status!==wl.INITIAL&&(this.status=wl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=wl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===wl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===wl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,oh.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function fb(){G(Ep,D_),G(Ep,gb)}function mb(){hf("arc",Vp)}function vb(){hf("arc3d",hv)}function yb(){hf("area",Yp)}function _b(){hf("circle",$p)}function bb(){hf("glyph",Zp)}function xb(){hf("group",tg)}function Sb(){hf("image",sg)}function Ab(){hf("line",ag)}function kb(){hf("path",hg)}function Cb(){hf("polygon",ug)}function Tb(){hf("pyramid3d",dv)}function Mb(){hf("rect",mg)}function wb(){hf("rect3d",nv)}function Eb(){hf("richtext",jg)}function Bb(){hf("shadowRoot",Ug)}function Pb(){hf("star",ov)}function Rb(){hf("symbol",Gg)}function Ob(){hf("text",Jg)}function Ib(){hf("wrapText",ef)}function Lb(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Fb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Zf),e(Qf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===So.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===So.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=zp(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=Bv(d,u,h),_=Rv(d,g),b=wv(h),x=Ev(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return wo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Rv(o,c),g=wv(n,r),f=Ev(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||ym(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Au.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Au.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class zb extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=td,this.builtinContributions=[Uv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=Lv(v,y,f,m,n,t,Number(u)),o=Lv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=Lv(C,T,A,k,r,-n,Number(u)),o=Lv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Gu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const Hb=new WeakSet;function jb({bind:t}){Lb(Hb,t)||(t(zb).toDynamicValue((({container:t})=>new zb(zm($y,t)))).inSingletonScope(),t(xy).toService(zb),t(Cy).toService(xy),t($y).toService($f),Hm(t,$y))}const Nb=jb;class Ub extends Fb{constructor(){super(...arguments),this.numberType=ed}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Eu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Lb(Vb,t)||(t(Ub).toDynamicValue((()=>new Ub)).inSingletonScope(),t(Sy).toService(Ub),t(Cy).toService(Sy))}const Gb=Wb;function Yb(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 Xb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?bo.ROW:bo.COLUMN,Number.isFinite(c)||(o=bo.COLUMN),Number.isFinite(d)||(o=bo.ROW);const u=i*(o===bo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Yb(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),Yb(t,l,1,s),o=!1):o=!0}t.closePath()}function $b(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function qb(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=$b(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Yb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=bo.ROW:"y"===s?u=bo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Jb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Qb=new fy,tx=zf;class ex extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Qb,tx],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=zp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,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=Sl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Sl(e,E,{curveTension:b}),n=Sl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=bo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?bo.ROW:null==y.y1?bo.COLUMN:Number.isFinite(S+A)?S>A?bo.ROW:bo.COLUMN:bo.ROW,Xb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),qb(t,i[0]?e.top:e.bottom,l,x===bo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ix=new WeakSet;function sx({bind:t}){Lb(ix,t)||(t(ex).toDynamicValue((({container:t})=>new ex(zm(qy,t)))).inSingletonScope(),t(Ay).toService(ex),t(Cy).toService(Ay),t(qy).toService($f),Hm(t,qy))}const nx=sx;class rx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[Yv,Kv,Xv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const ax=new WeakSet;function ox({bind:t}){Lb(ax,t)||(t(rx).toDynamicValue((({container:t})=>new rx(zm(Zy,t)))).inSingletonScope(),t(ky).toService(rx),t(Cy).toService(ky),t(Zy).toService($f),Hm(t,Zy))}const lx=ox;class hx{constructor(){this.numberType=nd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=zp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const cx=new WeakSet;function dx({bind:t}){Lb(cx,t)||(t(hx).toDynamicValue((()=>new hx)).inSingletonScope(),t(Dy).toService(hx),t(Cy).toService(Dy))}const ux=dx,px=["","repeat-x","repeat-y","repeat"];function gx(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?px[i]:"no-repeat"}function fx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=gx(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const mx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function vx(t){return{backgroundMode:mx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function yx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=fx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function _x(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=fx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?vx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Kf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class bx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ad,this.builtinContributions=[ry,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Mv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),_x(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=yx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,T,!1,k,!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&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=zp(t).image;this._draw(t,a,!1,i)}}const xx=new WeakSet;function Sx({bind:t}){Lb(xx,t)||(t(Fy).toDynamicValue((({container:t})=>new bx(zm(Qy,t)))).inSingletonScope(),t(Cy).toService(Fy),t(Qy).toService($f),Hm(t,Qy))}const Ax=Sx;class kx extends Fb{constructor(){super(...arguments),this.numberType=od}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();qb(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Sl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const Cx=new WeakSet;function Tx({bind:t}){Lb(Cx,t)||(t(kx).toDynamicValue((()=>new kx)).inSingletonScope(),t(My).toService(kx),t(Cy).toService(My))}const Mx=Tx,Ex=jv,Bx=zf;class Px extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ld,this.builtinContributions=[Bx,Ex],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:zp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)wo(t.pathShape.commandList,e,i,s,1,1,f);else{wo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Rx=new WeakSet;function Ox({bind:t}){Lb(Rx,t)||(t(Px).toDynamicValue((({container:t})=>new Px(zm(t_,t)))).inSingletonScope(),t(wy).toService(Px),t(Cy).toService(wy),t(t_).toService($f),Hm(t,t_))}const Ix=Ox;function Lx(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Lx(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lx(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Fx(h,y,_,d,u),A=Fx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=Dx(k,C),M=Fx(h,Dx(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const Nx=new WeakSet;function Ux({bind:t}){Lb(Nx,t)||(t(Ey).toDynamicValue((({container:t})=>new jx(zm(e_,t)))).inSingletonScope(),t(Cy).toService(Ey),t(e_).toService($f),Hm(t,e_))}const Vx=Ux;class Wx extends Fb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Eu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Gx extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=cd}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=zp(t).polygon;this._draw(t,s,!1,i)}}const Yx=new WeakSet;function Xx({bind:t}){Lb(Yx,t)||(t(Gx).toDynamicValue((()=>new Gx)).inSingletonScope(),t(Ly).toService(Gx),t(Cy).toService(Ly))}const Kx=Xx;class $x extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=dd,this.builtinContributions=[ey,sy,iy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Pv(g,f,T,M,h),E=Ov(g,v,T,M,C),B=wv(h,c),P=Ev(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Mv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const qx=new WeakSet;function Zx({bind:t}){Lb(qx,t)||(t($x).toDynamicValue((({container:t})=>new $x(zm(i_,t)))).inSingletonScope(),t(By).toService($x),t(Cy).toService(By),t(ty).toSelf(),t(Qv).toSelf(),t(i_).toService(ty),t(i_).toService(Qv),t(i_).toService($f),Hm(t,i_))}const Jx=Zx;class Qx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=ud}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=zp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Pv(v,y,A,k,d),M=Ov(v,b,A,k,S),w=wv(d),E=Ev(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=zp(t).rect;this._draw(t,s,!1,i)}}const tS=new WeakSet;function eS({bind:t}){Lb(tS,t)||(t(Qx).toDynamicValue((()=>new Qx)).inSingletonScope(),t(Py).toService(Qx),t(Cy).toService(Py))}const iS=eS;const sS=new class extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=gv(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 i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),O?Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,O?(Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),D()}};class nS extends Fb{constructor(){super(),this.numberType=pd,this.builtinContributions=[sS],this.init()}drawShape(t,e,i,s,n){const r=zp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=zp(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(),Mv(e,i-t,s-n,v,y,f,!0)),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=zp(t).richtext;this._draw(t,s,!1,i)}}const rS=new WeakSet;function aS({bind:t}){Lb(rS,t)||(t(nS).toDynamicValue((()=>new nS)).inSingletonScope(),t(Iy).toService(nS),t(Cy).toService(Iy))}const oS=aS;class lS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[gy,py],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const hS=new WeakSet;function cS({bind:t}){Lb(hS,t)||(t(lS).toDynamicValue((({container:t})=>new lS(zm(r_,t)))).inSingletonScope(),t(jy).toService(lS),t(Cy).toService(jy),Hm(t,r_))}const dS=cS;class uS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[hy,uy,dy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:zp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const pS=new WeakSet;function gS({bind:t}){Lb(pS,t)||(t(uS).toDynamicValue((({container:t})=>new uS(zm(s_,t)))).inSingletonScope(),t(Ry).toService(uS),t(Cy).toService(Ry),t(s_).toService($f),Hm(t,s_))}const fS=gS;class mS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[sS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=zp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Su.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Su.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Yg(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const vS=new WeakSet;function yS({bind:t}){Lb(vS,t)||(t(Oy).toDynamicValue((({container:t})=>new mS(zm(n_,t)))).inSingletonScope(),t(Cy).toService(Oy),t(n_).toService($f),Hm(t,n_))}const _S=yS,bS=mm();function xS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function SS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const AS=Symbol.for("MathPickerContribution"),kS=Symbol.for("MathArcPicker"),CS=Symbol.for("MathAreaPicker"),TS=Symbol.for("MathCirclePicker"),MS=Symbol.for("MathImagePicker"),wS=Symbol.for("MathLinePicker"),ES=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),PS=Symbol.for("MathSymbolPicker"),RS=Symbol.for("MathTextPicker"),OS=Symbol.for("MathPolygonPicker"),IS=Symbol.for("MathGlyphPicker"),LS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),FS=Symbol.for("CanvasArc3dPicker"),zS=Symbol.for("CanvasAreaPicker"),HS=Symbol.for("CanvasCirclePicker"),jS=Symbol.for("CanvasImagePicker"),NS=Symbol.for("CanvasGifImagePicker"),US=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),GS=Symbol.for("CanvasRectPicker"),YS=Symbol.for("CanvasRect3dPicker"),XS=Symbol.for("CanvasSymbolPicker"),KS=Symbol.for("CanvasTextPicker"),$S=Symbol.for("CanvasPolygonPicker"),qS=Symbol.for("CanvasPyramid3dPicker"),ZS=Symbol.for("CanvasRichTextPicker"),JS=Symbol.for("CanvasGlyphPicker"),QS=Symbol.for("CanvasGroupPicker"),tA=Symbol.for("CanvasStarPicker"),eA=Symbol.for("CanvasPickerContribution"),iA=m_(),sA=__((()=>v_(Em))),nA=__((()=>v_(wm))),rA=__((()=>v_(vd))),aA=__((()=>v_(Bm)));function oA(){oh.global=b_,oh.graphicUtil=sA,oh.transformUtil=nA,oh.graphicService=rA,oh.layerService=aA,oh.canvasFactory=t=>y_(kd,t),oh.context2dFactory=t=>y_(Cd,t),oh.windowFactory=()=>new Af(oh.global),oh.windowHandlerFactory=t=>function(t){const e=y_(xf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),oh.renderServiceFactory=()=>v_(Ym),oh.renderService=__((()=>v_(Ym))),oh.pluginServiceFactory=()=>v_(Av),oh.pluginService=__((()=>v_(Av))),oh.pickerServiceFactory=()=>v_(qm),oh.layerHandlerFactory=t=>v_("static"===t?Pm:"dynamic"===t?Rm:Om),oh.incrementalDrawContributionFactory=()=>v_(by)}oA();var lA=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 hA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return lA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class cA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class dA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Eu.Color1),this.ambient=i;const s=$t(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=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Bu.Get(e,Eu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const uA=()=>{Cm.registerPlugin("DirectionalLight",dA)};class pA{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=Au.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Au.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return gu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return fu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return mu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;mu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const gA=()=>{Cm.registerPlugin("OrthoCamera",pA)},fA={getContributions:()=>[]},mA={getContributions:()=>[]};class vA{constructor(t=fA,e=mA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:fA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:mA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=zp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=zp(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&&Au.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Su.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class yA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new sm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new nm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new am,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new rm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new Sm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new km,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new sf}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new im(new em([],(t=this.registry.contribution,e=Ny,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class _A{constructor(t={}){this.context=new yA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function bA(t={}){return new _A(t)}class xA extends _A{}class SA extends _A{}class AA extends ex{constructor(){super(...arguments),this.numberType=id}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=zp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=wv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=zp(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=Bv(u,p,c),y=Rv(u,g),_=wv(c),b=Ev(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{};function DA(){MA.preloaded||(MA.preloaded=!0,Gm({bind:wA.bind}),xv({bind:wA.bind}),Km({bind:wA.bind}),bv({bind:wA.bind,isBound:wA.isBound}),Cv(wA),l_(wA))}function FA(t,e){const i=NA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function zA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function HA(t,e){let i=PA.get(t);i||(i=new Map,PA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function jA(t,e,i){const s=HA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function NA(){return DA(),wA}function UA(){Nm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=MA.runtimeGlobal)&&void 0!==t||(MA.runtimeGlobal=new vf(zm(vg,wA))),MA.runtimeGlobal}function WA(t){const e=NA(),i=VA();oh.global=i,oh.canvasFactory=t=>e.getNamed(kd,t),oh.context2dFactory=t=>e.getNamed(Cd,t),oh.windowHandlerFactory=t=>FA(xf,t),oh.windowFactory=()=>new Af(i,(t=>FA(xf,t))),oh.pluginServiceFactory=()=>new lm(zm(Sv,e),{pluginRegistry:t.context.registry.plugin}),oh.incrementalDrawContributionFactory=()=>new _y([],new kA,new AA(zm(qy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,Ny))}function GA(t){var e;const i=NA();UA();const s=i.getAll(Cy),n=HA(t.registry.renderer,EA);jA(t.registry.renderer,EA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),zA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,EA)}function YA(t){var e;const i=NA();UA();const s=i.getAll(Ny),n=null!==(e=RA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,Ny,e)})),n.clear(),RA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(Ny));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(Ny,e),r.add(e)),n.add(e)}))}function XA(t,e){var i;const s=NA();UA();const n=s.getAll(e),r=HA(t.registry.picker,BA);jA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),zA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function KA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=OA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,LA,t.isBound,t.rebind),function(t,e){let i=OA.get(t);i||(i=new WeakSet,OA.set(t,i)),i.add(e)}(t,e))}function $A(t,{app:e,legacy:i=!0,targets:s}={}){KA(NA(),t),i&&(f_(),KA(m_(),t)),UA(),e&&function(t,e){const i=null!=e?e:IA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&YA(t),s&&GA(t),r.forEach((e=>{XA(t,e)}))}(e,s)}function qA(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function ZA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function JA(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 QA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ok(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=pg(t.attribute),n=hk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=hk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=hk(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{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(;n{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 _k(l,e,h),h},fk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return pk(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 pk(t,e)}return[]};const mk=t=>t.map((t=>({x:t.x,y:t.y}))),vk=(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]},yk=t=>{const e=new Ue;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 vk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return vk(t,{x:e.x1,y:n},{x:e.x2,y:n})},_k=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=yk(t);_k(n[0],s,i),_k(n[1],e-s,i)}},bk=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:mk(i)}];const s=[];return _k(i,e,s),s},xk=(t,e)=>{const i=ak(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;rObject.assign({},t))):[]}function Ak(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:Sk(t.touches),configurable:!0},changedTouches:{value:Sk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function kk(t,e){try{return t[e]}catch(t){return}}function Ck(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Ak(t),l=kk(t,"target"),h=kk(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Tk=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Ek(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:wk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Tk(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=wk(i,this.selectionStartCursorIdx),a=wk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=Mk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Ek(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),oh.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),oh.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Pk{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=wk(i,Math.ceil(t)),n=wk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=wk(i.attribute.textConfig,a),h=wk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Rk,[this.formatTextCommandCb]),this.commandCbs.set(Ok,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(oh.global.isMacOS()&&t.metaKey&&"c"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return oh.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(oh.global.isMacOS()&&t.metaKey&&"a"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},Mk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=jg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:fv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||mg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},Mk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=tg({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Ik.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=ag({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=tg({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=fv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=fv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(mg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:fv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Qk=new Jk;class tC{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const eC=()=>{Cm.registerPlugin("ViewTransform3dPlugin",tC)},iC=new Ve;class sC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=zp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nC=()=>{Cm.registerPlugin("FlexLayoutPlugin",sC)};var rC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:rh,ARC3D_NUMBER_TYPE:ed,ARC_NUMBER_TYPE:td,AREA_NUMBER_TYPE:id,AbstractGraphicRender:class{},get AnimateMode(){return Ml},get AnimateStatus(){return Bl},get AnimateStepType(){return El},AppContext:yA,Application:nh,Arc:Up,Arc3d:lv,Arc3dRender:Sy,ArcRender:xy,ArcRenderContribution:$y,Area:Gp,AreaRender:Ay,AreaRenderContribution:qy,get AttributeUpdateType(){return _o},AutoEnablePlugins:Sv,Base3dRender:Wx,BaseCanvas:wu,BaseEnvContribution:hA,BaseRender:Fb,get BaseRenderContributionTime(){return So},BaseWindowHandlerContribution:cA,Basis:$o,BeforeRenderConstribution:Xm,BoundsContext:no,BoundsPicker:Zm,BrowserEntry:_A,CIRCLE_NUMBER_TYPE:sd,CONTRIBUTION_STORE_STATE_SYMBOL:Im,Canvas3DDrawItemInterceptor:Ky,Canvas3DPickItemInterceptor:_v,CanvasFactory:kd,CanvasTextLayout:$g,Circle:Kp,CircleRender:ky,CircleRenderContribution:Zy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Eu},CommonDrawItemInterceptorContribution:Yy,CommonRenderContribution:a_,Context2dFactory:Cd,ContributionProvider:Dm,ContributionRegistry:am,ContributionStore:Nm,CubicBezierCurve:zo,CurveContext:xl,get CurveTypeEnum(){return xo},CustomEvent:qa,CustomPath2D:Al,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:_g,DebugDrawItemInterceptorContribution:Gy,DefaultArcAllocate:zk,DefaultArcAttribute:Ul,DefaultArcRenderContribution:Nv,DefaultAreaAllocate:jk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:fy,DefaultAttribute:Nl,DefaultBaseBackgroundRenderContribution:Ff,DefaultBaseClipRenderAfterContribution:Jf,DefaultBaseClipRenderBeforeContribution:qf,DefaultBaseInteractiveRenderContribution:$f,DefaultBaseTextureRenderContribution:Hv,DefaultCanvasAllocate:yf,DefaultCanvasArc3DRender:Ub,DefaultCanvasArcRender:zb,DefaultCanvasAreaRender:ex,DefaultCanvasCircleRender:rx,DefaultCanvasGroupRender:my,DefaultCanvasImageRender:bx,DefaultCanvasLineRender:kx,DefaultCanvasPathRender:Px,DefaultCanvasPolygonRender:jx,DefaultCanvasPyramid3dRender:Gx,DefaultCanvasRect3dRender:Qx,DefaultCanvasRectRender:$x,DefaultCanvasSymbolRender:uS,DefaultCanvasTextRender:mS,DefaultCircleAllocate:Uk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Gv,DefaultConnectAttribute:Hl,DefaultDebugAttribute:jl,DefaultFillStyle:Ol,DefaultGlobal:vf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Yl,DefaultGraphicAllocate:Lk,DefaultGraphicMemoryManager:Jk,DefaultGraphicService:_m,DefaultGraphicUtil:kf,DefaultGroupAttribute:Gl,DefaultGroupBackgroundRenderContribution:$v,DefaultImageAttribute:ih,DefaultImageRenderContribution:ny,DefaultLayerService:Mm,DefaultLayout:Pl,DefaultLineAllocate:Wk,DefaultLineAttribute:Xl,DefaultMat4Allocate:xu,DefaultMatrixAllocate:bu,DefaultPathAllocate:Yk,DefaultPathAttribute:Kl,DefaultPickService:vA,DefaultPickStyle:Fl,DefaultPolygonAttribute:$l,DefaultRect3dAttribute:Jl,DefaultRectAllocate:Dk,DefaultRectAttribute:Zl,DefaultRectRenderContribution:Jv,DefaultRenderService:im,DefaultRichTextAttribute:eh,DefaultRichTextIconAttribute:sh,DefaultStarAttribute:ql,DefaultStrokeStyle:Ll,DefaultStyle:zl,DefaultSymbolAllocate:Kk,DefaultSymbolAttribute:Ql,DefaultSymbolClipRangeStrokeRenderContribution:ly,DefaultSymbolRenderContribution:oy,DefaultTextAllocate:qk,DefaultTextAttribute:th,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Rl,DefaultTransformUtil:Mf,DefaultWindow:Af,get Direction(){return bo},DirectionalLight:dA,DrawContribution:Hy,DrawItemInterceptor:Ny,DynamicLayerHandlerContribution:Rm,get Edge(){return ch},EditModule:Bk,EmptyContext2d:Tu,EnvContribution:vg,EventManager:Qa,EventSystem:io,EventTarget:to,FACTORY_STATE_SYMBOL:wf,FORMAT_ALL_TEXT_COMMAND:Ok,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Rk,Factory:Cm,FederatedEvent:Ya,FederatedMouseEvent:Xa,FederatedPointerEvent:Ka,FederatedWheelEvent:$a,FlexLayoutPlugin:sC,GLYPH_NUMBER_TYPE:nd,GRAPHIC_CLASS_SYMBOL:Mp,GRAPHIC_REGISTRY_SYMBOL:rf,GRAPHIC_UPDATE_TAG_KEY:pp,GROUP_NUMBER_TYPE:rd,Generator:Va,GlobalPickerService:Jm,Glyph:qp,GlyphRender:Dy,GradientParser:su,Graphic:Ep,GraphicCreator:yd,GraphicFactory:sf,GraphicPicker:$m,GraphicRender:Cy,GraphicService:vd,GraphicUtil:Em,Group:Qp,GroupRender:Ty,GroupRenderContribution:Jy,get GroupUpdateAABBBoundsMode(){return Jp},HtmlAttributePlugin:x_,get IContainPointMode(){return yo},IMAGE_NUMBER_TYPE:ad,Image:ig,ImageRender:Fy,ImageRenderContribution:Qy,IncrementalDrawContribution:by,InteractiveDrawItemInterceptorContribution:Xy,InteractivePickItemInterceptorContribution:yv,InteractiveSubRenderContribution:o_,LINE_NUMBER_TYPE:od,Layer:Am,LayerFactory:km,LayerService:Bm,Line:rg,LineRender:My,Linear:Go,LinearClosed:pl,Mat4Allocate:yu,MatrixAllocate:vu,get MeasureModeEnum(){return Tl},MiniappEntry:SA,MonotoneX:il,MonotoneY:sl,NOWORK_ANIMATE_ATTR:Cp,Node:Ga,NodeEntry:xA,OrthoCamera:pA,PATH_NUMBER_TYPE:ld,POLYGON_NUMBER_TYPE:hd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:cd,Path:lg,PathRender:wy,PathRenderContribution:t_,PerformanceRAF:gf,PickItemInterceptor:Qm,PickServiceInterceptor:tv,PickerRegistry:nm,PickerService:qm,PluginRegistry:rm,PluginService:Av,Polygon:dg,PolygonRender:Ey,PolygonRenderContribution:e_,Pyramid3d:cv,Pyramid3dRender:Ly,RECT3D_NUMBER_TYPE:ud,RECT_NUMBER_TYPE:dd,RICHTEXT_NUMBER_TYPE:pd,RUNTIME_INSTALLER_STATE_SYMBOL:CA,RafBasedSTO:Sh,ReactAttributePlugin:A_,Rect:fg,Rect3DRender:Py,Rect3d:sv,RectRender:By,RectRenderContribution:i_,ReflectSegContext:Uo,RenderSelector:zy,RenderService:Ym,RendererRegistry:sm,ResourceLoader:lh,RichText:Hg,RichTextEditPlugin:Ik,RichTextRender:Iy,STAR_NUMBER_TYPE:gd,get STATUS(){return wl},SVG_ATTRIBUTE_MAP:_d,SVG_ATTRIBUTE_MAP_KEYS:bd,SVG_PARSE_ATTRIBUTE_MAP:xd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Sd,SYMBOL_NUMBER_TYPE:fd,SegContext:No,ShadowPickServiceInterceptorContribution:mv,ShadowRoot:Ng,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:vv,SplitRectAfterRenderContribution:ty,SplitRectBeforeRenderContribution:Qv,Stage:xm,StageFactory:Sm,Star:av,StarRender:jy,StarRenderContribution:r_,StateDefinitionCompiler:$u,StateEngine:Qu,StaticLayerHandlerContribution:Pm,Step:ll,StepClosed:hl,Symbol:Wg,SymbolRender:Ry,SymbolRenderContribution:s_,TEXT_NUMBER_TYPE:md,Text:Zg,get TextDirection(){return Kc},TextMeasureContribution:Vm,TextRender:Oy,TextRenderContribution:n_,Theme:Dp,TransformUtil:wm,get UpdateTag(){return vo},VGlobal:yg,VWindow:bf,ViewTransform3dPlugin:tC,VirtualLayerHandlerContribution:Om,WILDCARD:"*",WindowHandlerContribution:xf,WrapText:tf,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Ou,addArcToBezierPath:To,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:rk,alignSubpath:QA,application:oh,applyTransformOnBezierCurves:ok,arc3dModule:Gb,arcModule:Nb,areaModule:nx,bezier:ko,bezierCurversToPath:lk,binarySplitPolygon:yk,bindArc3dRenderModule:Wb,bindArcRenderModule:jb,bindAreaRenderModule:sx,bindCircleRenderModule:ox,bindContributionProvider:Hm,bindContributionProviderNoSingletonScope:jm,bindGlyphRenderModule:dx,bindImageRenderModule:Sx,bindLineRenderModule:Tx,bindPathRenderModule:Ox,bindPolygonRenderModule:Ux,bindPyramid3dRenderModule:Xx,bindRect3dRenderModule:eS,bindRectRenderModule:Zx,bindRichtextRenderModule:aS,bindStarRenderModule:cS,bindSymbolRenderModule:gS,bindTextRenderModule:yS,boundStroke:Gc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Sl,calculateArcCornerRadius:Dv,calculateLineHeight:Ch,canvasAllocate:_f,centroidOfSubpath:ik,circleBounds:vh,circleModule:lx,clock:Za,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Nu,configureRuntimeApplicationForApp:WA,container:iA,cornerTangents:Lv,createApp:bA,createArc:Vp,createArc3d:hv,createArea:Yp,createBrowserApp:bA,createCanvasEventTransformer:function(t,e,i,s){return Ck(t.parentElement,e,i,s)},createCircle:$p,createColor:ru,createConicalGradient:Yu,createContributionProvider:zm,createEventTransformer:Ck,createGlyph:Zp,createGraphic:cf,createGroup:tg,createImage:sg,createLine:ag,createMat4:_u,createMiniappApp:function(t={}){return new SA(t)},createNodeApp:function(t={}){return new xA(t)},createPath:hg,createPolygon:ug,createPyramid3d:dv,createRect:mg,createRect3d:nv,createRectPath:Mv,createRichText:jg,createShadowRoot:Ug,createStage:function(t){return oA(),(new Sm).create(t)},createStar:ov,createSymbol:Gg,createText:Jg,createWrapText:ef,cubicCalc:Ro,cubicLength:Po,cubicPointAt:Oo,cubicSubdivide:JA,defaultArcAllocate:Hk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Uv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:Nk,defaultBaseBackgroundRenderContribution:zf,defaultBaseClipRenderAfterContribution:Qf,defaultBaseClipRenderBeforeContribution:Zf,defaultBaseTextureRenderContribution:jv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Kv,defaultCircleRenderContribution:Yv,defaultCircleTextureRenderContribution:Xv,defaultGraphicMemoryManager:Qk,defaultGroupBackgroundRenderContribution:qv,defaultImageBackgroundRenderContribution:ay,defaultImageRenderContribution:ry,defaultLineAllocate:Gk,defaultPathAllocate:Xk,defaultRectAllocate:Fk,defaultRectBackgroundRenderContribution:sy,defaultRectRenderContribution:ey,defaultRectTextureRenderContribution:iy,defaultStarBackgroundRenderContribution:gy,defaultStarTextureRenderContribution:py,defaultSymbolAllocate:$k,defaultSymbolBackgroundRenderContribution:uy,defaultSymbolClipRangeStrokeRenderContribution:cy,defaultSymbolRenderContribution:hy,defaultSymbolTextureRenderContribution:dy,defaultTextAllocate:Zk,diff:ZA,divideCubic:Fo,drawArc:Co,drawArcPath:Fv,drawAreaSegments:Xb,drawBackgroundImage:Kf,drawImageWithLayout:_x,drawIncrementalAreaSegments:Jb,drawIncrementalSegments:Zb,drawSegments:qb,enumCommandMap:lo,fillVisible:Bv,findBestMorphingRotation:nk,findConfigIndexByCursorIdx:wk,findCursorIdxByConfigIndex:Ek,findNextGraphic:Lf,flatten_simplify:qA,foreach:Of,foreachAsync:If,genBasisSegments:Zo,genBasisTypeSegments:qo,genLinearClosedSegments:gl,genLinearClosedTypeSegments:fl,genLinearSegments:Yo,genLinearTypeSegments:Xo,genMonotoneXSegments:rl,genMonotoneXTypeSegments:nl,genMonotoneYSegments:ol,genMonotoneYTypeSegments:al,genNumberType:Xc,genStepClosedSegments:ul,genStepSegments:cl,genStepTypeSegments:dl,getApplicationState:ah,getAttributeFromDefaultAttrList:xh,getBackgroundImage:jf,getConicGradientAt:Gu,getContributionStoreState:Lm,getCurrentEnv:function(){return mm()?"browser":"node"},getDefaultCharacterConfig:Mk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Yg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Au.allocate();return cu(o,o,[a[0],a[1],0]),n&&ou(o,o,n),s&&lu(o,o,s),cu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Ef,getGraphicClassState:wp,getGraphicRegistryState:af,getLegacyBindingContext:m_,getModelMatrix:vm,getRichTextBounds:fv,getRuntimeInstallerBindingContext:NA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:TA,getScaledStroke:nu,getTextBounds:gv,getTheme:zp,getThemeFromGroup:Hp,globalTheme:Fp,glyphModule:ux,graphicCreator:lf,graphicService:rA,graphicUtil:sA,identityMat4:au,imageModule:Ax,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:$A,installRuntimeDrawContributionsToApp:YA,installRuntimeGraphicRenderersToApp:GA,installRuntimePickersToApp:XA,interpolateColor:Ru,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Iu,interpolateGradientRadialColor:Lu,interpolatePureColorArray:Fu,interpolatePureColorArrayToStr:zu,intersect:Iv,isBrowserEnv:mm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){fm();const t=oh.global&&oh.global.env;return t?"node"===t:!gm},isSvg:Nc,isXML:Uc,layerService:aA,lineModule:Mx,lookAt:gu,mapToCanvasPointForCanvas:function(t){var e;if(Rd(t._canvasX)&&Rd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:du,mat4Allocate:Au,matrixAllocate:Su,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:pu,newThemeObj:Op,ortho:fu,parsePadding:gh,parseStroke:uh,parseSvgPath:mo,pathModule:Ix,pathToBezierCurves:ak,point:Ko,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:Vx,preLoadAllModule:f_,pyramid3dModule:Kx,quadCalc:Io,quadLength:Do,quadPointAt:Lo,rafBasedSto:Ah,rect3dModule:iS,rectFillVisible:Pv,rectModule:Jx,rectStrokeVisible:Ov,recursiveCallBinarySplit:_k,refreshRuntimeInstallerContributions:UA,registerArc3dGraphic:vb,registerArcGraphic:mb,registerAreaGraphic:yb,registerCircleGraphic:_b,registerDirectionalLight:uA,registerFlexLayoutPlugin:nC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:bb,registerGraphic:hf,registerGroupGraphic:xb,registerHtmlAttributePlugin:S_,registerImageGraphic:Sb,registerLineGraphic:Ab,registerOrthoCamera:gA,registerPathGraphic:kb,registerPolygonGraphic:Cb,registerPyramid3dGraphic:Tb,registerReactAttributePlugin:k_,registerRect3dGraphic:wb,registerRectGraphic:Mb,registerRichtextGraphic:Eb,registerShadowRootGraphic:Bb,registerStarGraphic:Pb,registerSymbolGraphic:Rb,registerTextGraphic:Ob,registerViewTransform3dPlugin:eC,registerWindowEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Ib,renderCommandList:wo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:vx,resolveBackgroundPosition:Gf,resolveBackgroundSizing:Nf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:fx,resolveImageRepeatMode:gx,resolveRenderableImageSize:Xf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:oS,rotateX:ou,rotateY:lu,rotateZ:hu,runFill:wv,runStroke:Ev,scaleMat4:uu,segments:Ao,shouldClipImageByLayout:yx,shouldUseMat4:ym,snapLength:Bo,splitArc:dk,splitArea:gk,splitCircle:uk,splitLine:fk,splitPath:xk,splitPolygon:bk,splitRect:ck,splitToGrids:hk,starModule:dS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Rv,symbolModule:fS,textAttributesToStyle:Kg,textDrawOffsetX:Yg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Xg,textModule:_S,transformMat4:mu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:nA,translate:cu,verticalLayout:$c,vglobal:b_,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oh.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)}))},wrapCanvas:Td,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.context2dFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Qc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Qc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class aC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:nu(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class oC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let lC=!1;function hC(t){lC||(lC=!0,t.bind(DS).toDynamicValue((()=>new oC(xS(t,xy)))).inSingletonScope(),t.bind(eA).toService(DS))}class cC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let dC=!1;function uC(t){dC||(dC=!0,t.bind(kS).toDynamicValue((()=>new cC(xS(t,xy)))).inSingletonScope(),t.bind(AS).toService(kS))}function pC(){if(pC.__loaded)return;pC.__loaded=!0;const t=m_();mb(),Nb({bind:t.bind}),bS?hC(t):uC(t)}pC.__loaded=!1;const gC=pC;class fC extends Fb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class mC extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ed,this.themeType="arc"}}let vC=!1;function yC(t){var e;vC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Sy))&&(vC=!0,t.bind(FS).toDynamicValue((()=>new mC(xS(t,Sy)))).inSingletonScope(),t.bind(eA).toService(FS))}function _C(){if(_C.__loaded)return;_C.__loaded=!0;const t=m_();vb(),uA(),gA(),Gb({bind:t.bind}),yC(t)}_C.__loaded=!1;const bC=_C;class xC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let SC=!1;function AC(t){SC||(SC=!0,t.bind(zS).toDynamicValue((()=>new xC(xS(t,Ay)))).inSingletonScope(),t.bind(eA).toService(zS))}class kC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let CC=!1;function TC(t){CC||(CC=!0,t.bind(CS).toDynamicValue((()=>new kC(xS(t,Ay)))).inSingletonScope(),t.bind(AS).toService(CS))}function MC(){if(MC.__loaded)return;MC.__loaded=!0;const t=m_();yb(),nx({bind:t.bind}),bS?AC(t):TC(t)}MC.__loaded=!1;const wC=MC;class EC{constructor(){this.type="glyph",this.numberType=nd}contains(t,e,i){if(!t.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}}class BC extends EC{constructor(t){super(),this.canvasRenderer=t}}let PC=!1;function RC(t){PC||(PC=!0,t.bind(JS).toDynamicValue((()=>new BC(xS(t,Dy)))).inSingletonScope(),t.bind(eA).toService(JS))}class OC extends EC{constructor(t){super(),this.canvasRenderer=t}}let IC=!1;function LC(t){IC||(IC=!0,t.bind(IS).toDynamicValue((()=>new OC(xS(t,Dy)))).inSingletonScope(),t.bind(AS).toService(IS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=m_();bb(),ux({bind:t.bind}),bS?RC(t):LC(t)}DC.__loaded=!1;const FC=DC;function zC(){zC.__loaded||(zC.__loaded=!0,xb())}zC.__loaded=!1;const HC=zC;class jC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=ad}}let NC=!1;function UC(t){NC||(NC=!0,t.bind(jS).toDynamicValue((()=>new jC(xS(t,Fy)))).inSingletonScope(),t.bind(eA).toService(jS))}class VC{constructor(){this.type="image",this.numberType=ad}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function GC(t){WC||(WC=!0,t.bind(MS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(AS).toService(MS))}function YC(){if(YC.__loaded)return;YC.__loaded=!0;const t=m_();Sb(),Ax({bind:t.bind}),bS?UC(t):GC(t)}YC.__loaded=!1;const XC=YC;class KC extends Fb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class $C extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let qC=!1;function ZC(t){qC||(qC=!0,t.bind(US).toDynamicValue((()=>new $C(xS(t,My)))).inSingletonScope(),t.bind(eA).toService(US))}class JC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let QC=!1;function tT(t){QC||(QC=!0,t.bind(wS).toDynamicValue((()=>new JC(xS(t,My)))).inSingletonScope(),t.bind(AS).toService(wS))}function eT(){if(eT.__loaded)return;eT.__loaded=!0;const t=m_();Ab(),Mx({bind:t.bind}),bS?ZC(t):tT(t)}eT.__loaded=!1;const iT=eT;class sT extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let nT=!1;function rT(t){nT||(nT=!0,t.bind(WS).toDynamicValue((()=>new sT(xS(t,wy)))).inSingletonScope(),t.bind(eA).toService(WS))}class aT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let oT=!1;function lT(t){oT||(oT=!0,t.bind(ES).toDynamicValue((()=>new aT(xS(t,wy)))).inSingletonScope(),t.bind(AS).toService(ES))}function hT(){if(hT.__loaded)return;hT.__loaded=!0;const t=m_();kb(),Ix({bind:t.bind}),bS?rT(t):lT(t)}hT.__loaded=!1;const cT=hT;class dT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let uT=!1;function pT(t){uT||(uT=!0,t.bind($S).toDynamicValue((()=>new dT(xS(t,Ey)))).inSingletonScope(),t.bind(eA).toService($S))}class gT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let fT=!1;function mT(t){fT||(fT=!0,t.bind(OS).toDynamicValue((()=>new gT(xS(t,Ey)))).inSingletonScope(),t.bind(AS).toService(OS))}function vT(){if(vT.__loaded)return;vT.__loaded=!0;const t=m_();Cb(),Vx({bind:t.bind}),bS?pT(t):mT(t)}vT.__loaded=!1;const yT=vT;class _T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=cd,this.themeType="polygon"}}let bT=!1;function xT(t){var e;bT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ly))&&(bT=!0,t.bind(qS).toDynamicValue((()=>new _T(xS(t,Ly)))).inSingletonScope(),t.bind(eA).toService(qS))}function ST(){if(ST.__loaded)return;ST.__loaded=!0;const t=m_();Tb(),uA(),gA(),Kx({bind:t.bind}),xT(t)}ST.__loaded=!1;const AT=ST,kT=new Ve;class CT{constructor(){this.type="rect",this.numberType=dd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:nu(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;kT.setValue(i.x1,i.y1,i.x2,i.y2),kT.expand(-r/2),h=!kT.containsPoint(e)}}return s.highPerformanceRestore(),h}}class TT extends CT{constructor(t){super(),this.canvasRenderer=t}}let MT=!1;function wT(t){MT||(MT=!0,t.bind(GS).toDynamicValue((()=>new TT(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(GS))}class ET extends CT{constructor(t){super(),this.canvasRenderer=t}}let BT=!1;function PT(t){BT||(BT=!0,t.bind(BS).toDynamicValue((()=>new ET(xS(t,By)))).inSingletonScope(),t.bind(AS).toService(BS))}function RT(){if(RT.__loaded)return;RT.__loaded=!0;const t=m_();Mb(),Jx({bind:t.bind}),bS?wT(t):PT(t)}RT.__loaded=!1;const OT=RT;class IT extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=ud,this.themeType="rect"}}let LT=!1;function DT(t){var e;LT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Py))&&(LT=!0,t.bind(YS).toDynamicValue((()=>new IT(xS(t,Py)))).inSingletonScope(),t.bind(eA).toService(YS))}function FT(){if(FT.__loaded)return;FT.__loaded=!0;const t=m_();wb(),iS({bind:t.bind}),DT(t)}FT.__loaded=!1;const zT=FT;class HT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let jT=!1;function NT(t){jT||(jT=!0,t.bind(ZS).toDynamicValue((()=>new HT(xS(t,Iy)))).inSingletonScope(),t.bind(eA).toService(ZS))}class UT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let VT=!1;function WT(t){VT||(VT=!0,t.bind(LS).toDynamicValue((()=>new UT(xS(t,Iy)))).inSingletonScope(),t.bind(AS).toService(LS))}function GT(){if(GT.__loaded)return;GT.__loaded=!0;const t=m_();Eb(),oS({bind:t.bind}),bS?NT(t):WT(t)}GT.__loaded=!1;const YT=GT;function XT(){XT.__loaded||(XT.__loaded=!0,Bb())}XT.__loaded=!1;const KT=XT;class $T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Au.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let qT=!1;function ZT(t){qT||(qT=!0,t.bind(XS).toDynamicValue((()=>new $T(xS(t,Ry)))).inSingletonScope(),t.bind(eA).toService(XS))}class JT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}}let QT=!1;function tM(t){QT||(QT=!0,t.bind(PS).toDynamicValue((()=>new JT(xS(t,Ry)))).inSingletonScope(),t.bind(AS).toService(PS))}function eM(){if(eM.__loaded)return;eM.__loaded=!0;const t=m_();Rb(),fS({bind:t.bind}),bS?ZT(t):tM(t)}eM.__loaded=!1;const iM=eM;class sM extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Xg(a,u,n),v=Yg(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&&Au.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let nM=!1;function rM(t){nM||(nM=!0,t.bind(KS).toDynamicValue((()=>new sM(xS(t,Oy)))).inSingletonScope(),t.bind(eA).toService(KS))}class aM{constructor(){this.type="text",this.numberType=md}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let oM=!1;function lM(t){oM||(oM=!0,t.bind(RS).toDynamicValue((()=>new aM)).inSingletonScope(),t.bind(AS).toService(RS))}function hM(){if(hM.__loaded)return;hM.__loaded=!0;const t=m_();Ob(),_S({bind:t.bind}),bS?rM(t):lM(t)}hM.__loaded=!1;const cM=hM;function dM(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),gM=(t,e)=>(d(mM.warnHandler)&&mM.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),fM=(t,e,i)=>{if(!d(mM.errorHandler))throw new Error(t);mM.errorHandler.call(null,t,e)},mM={silent:!1,warnHandler:!1,errorHandler:!1},vM=mm(),yM=vM&&globalThis?globalThis.document:void 0;function _M(t){return("desktop-browser"===t||"mobile-browser"===t)&&vM}function bM(t){return xM(t)||"mobile-browser"===t}function xM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let SM=0;function AM(){return SM>=9999999&&(SM=0),SM++}function kM(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function CM(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function TM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&TM(t,e)}))}const MM=t=>!u(t)&&!1!==t.visible;function wM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function EM(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 PM=["#ffffff","#000000"];function RM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return OM(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(...PM);for(const n of a)if(t!==n&&OM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function OM(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?IM(t,e)>s:"largeText"===i?IM(t,e)>3:IM(t,e)>4.5}function IM(t,e){const i=LM(t),s=LM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function LM(t){const e=ri(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 DM(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 FM(t,e){return[t[0]*e,t[1]*e]}function zM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function HM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const jM=cf,NM={arc:t=>jM("arc",t),circle:t=>jM("circle",t),group:t=>jM("group",t),image:t=>jM("image",t),line:t=>jM("line",t),path:t=>jM("path",t),polygon:t=>jM("polygon",t),rect:t=>jM("rect",t),richtext:t=>jM("richtext",t),symbol:t=>jM("symbol",t),text:t=>jM("text",t)},UM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 GM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(GM||(GM={}));const YM={[GM.selectedReverse]:{},[GM.selected]:{},[GM.hover]:{},[GM.hoverReverse]:{}},XM={container:"",width:30,height:30,style:{}},KM="scrollDrag",$M=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:gv,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function qM(t,e,i={}){if(!t)return{width:0,height:0};const s=gv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 ZM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function JM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function QM(t,e="type"){const i=ZM(t,e);return"rich"===i?NM.richtext(JM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),NM.text(t))}function tw(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 ew=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function iw(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 sw(t,e){const{dx:i,dy:s}=iw(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const nw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},rw={size:8,stroke:"#000",lineWidth:1,zIndex:1};function aw(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Ae(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Ee(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const ow=Math.sin(Math.PI/10);function lw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function hw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function cw(t){const e={};return TM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return FM(r,(s?-1:1)*(n?-1:1)*t/zM(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function fw(t,e,i){var s;if(hw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function mw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function _w(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function bw(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function xw(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 Sw(t,e){const i=xw(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 Aw(t,e){const i=kw(t),s=kw(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 kw(t,e={x:0,y:0}){return ae.distancePP(t,e)}function Cw(t){return k(t.x)&&k(t.y)}function Tw(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 Mw(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const ww=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function Bw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&Bw(t[i],e)}}var Pw;!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"}(Pw||(Pw={}));const Rw={};function Ow(t){switch(t){case Pw.Linear:case Pw.Log:case Pw.Pow:case Pw.Sqrt:case Pw.Symlog:case Pw.Time:return!0;default:return!1}}function Iw(t){return!!Rw[t]}function Lw(t){switch(t){case Pw.Ordinal:case Pw.Point:case Pw.Band:return!0;default:return!1}}function Dw(t){return t}Object.values(Pw).forEach((t=>{Rw[t]=!0}));const Fw=t=>-Math.log(-t),zw=t=>-Math.exp(-t),Hw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,jw=t=>10===t?Hw:t===Math.E?Math.exp:e=>Math.pow(t,e),Nw=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)),Vw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Ww(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 Gw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Yw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Xw(t,e,i,s){return 1===i&&(i=0),Yw(t,i,s)*(e/(1-i))}function Kw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function $w(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Zw{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=Kw(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=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Jw=Symbol("implicit");class Qw extends Zw{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=Jw}clone(){const t=(new Qw).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!==Jw)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return tE(t,e,r,n)}class iE extends Qw{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=Xw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:eE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new iE(!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:sE}=ai;function nE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=sE(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?sE(t,e):e instanceof si?sE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class rE extends Zw{constructor(t=Dw,e=Dw){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Dw,this._piecewise=Gw,this._interpolate=nE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?$w:Gw,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:Dw),this.rescale(i)):this._clamp!==Dw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const aE=Math.sqrt(50),oE=Math.sqrt(10),lE=Math.sqrt(2),hE=[1,2,5,10],cE=(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=gE(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?uE(0,-(e-1)/s,s):uE((e-1)/s,0,s)},dE=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return cE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return cE(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=uE(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=uE(t,e,l);return n&&r.reverse(),r})),gE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=hE[0];return i>=aE?s=hE[3]:i>=oE?s=hE[2]:i>=lE&&(s=hE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function fE(t,e,i){const s=(e-t)/Math.max(0,i);return gE(s)}function mE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=fE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function yE(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 _E=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),bE=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),xE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=pE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?_E(t,e,n):_E(t,e,qw(n)),h=_E(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),SE=vt(((t,e,i,s,n)=>mE(s(t),s(e),i).map((t=>qw(n(t))))));class AE extends rE{constructor(){super(...arguments),this.type=Pw.Linear}clone(){var t;const e=new AE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return dE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=pE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function CE(t){return e=>-t(-e)}function TE(t=Number.EPSILON){return e=>Math.max(e,t)}class ME extends rE{constructor(){super(Nw(10),jw(10)),this.type=Pw.Log,this._limit=TE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new ME).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=Nw(this._base),s=jw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Fw,this.untransformer=zw):(this._logs=i,this._pows=s,this._limit=TE(),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 Dw}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return bE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(ME,kE);class wE extends AE{constructor(){super(Uw(1),Vw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new wE).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=Vw(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return bE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(wE,kE);class EE{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[lt(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new EE).domain(this._domain).range(this._range).unknown(this._unknown)}}var BE,PE,RE;function OE(t){var e,i;const{type:s}=t;return s===PE.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BE||(BE={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(PE||(PE={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(RE||(RE={}));const IE={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},LE={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DE(t,e){var i;if(!t)return[];const s=VE(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?NE(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>jE(i)?zE(t,i,e):i)).filter(p)}))):i.map((i=>jE(i)?zE(t,i,e):i)).filter(p):[]}return[]}function FE(t,e){var i,s;return NE(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 zE(t,e,i){var s;const n=VE(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=IE[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=LE[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 si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`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 HE=(t,e)=>{if(e&&jE(t)){const i=zE(e,t);if(i)return i}return t};function jE(t){return t&&"palette"===t.type&&!!t.key}function NE(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function UE(t){return _(t)?{dataScheme:t}:t}function VE(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=OE(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 WE extends Qw{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!NE(this._range))return void super.range(this._range);const t=FE(this._range,this._domain);super.range(t)}}const GE={linear:AE,band:iE,point:class extends iE{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:Qw,threshold:EE,colorOrdinal:WE};function YE(t){const e=GE[t];return e?new e:null}function XE(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function KE(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function $E(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qE(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZE(t){return!!y(t)&&(!!t.endsWith("%")&&kM(t.substring(0,t.length-1)))}function JE(t){return!!g(t)&&("percent"in t||"offset"in t)}function QE(t,e,i,s=0){var n,r;return S(t)?t:ZE(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 tB(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]=QE(t[s],e.size,i)}))})),o}function eB(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function iB(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)||ZE(t)||d(t)||JE(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function sB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const nB=(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},rB=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function aB(t,e){return t&&e.key in t?t[e.key]:e.default}function oB(t){return t&&"token"===t.type&&!!t.key}const lB={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},hB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:lB,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},cB={name:"dark",colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},dB=(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]={}),dB(t[s],e.slice(1),i))};function uB(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=UE(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}vB._charts=mB.charts,vB._series=mB.series,vB._components=mB.components,vB._graphicComponents=mB.graphicComponents,vB._marks=mB.marks,vB._regions=mB.regions,vB._animations=mB.animations,vB._implements=mB.implements,vB._chartPlugin=mB.chartPlugin,vB._vChartPlugin=mB.vChartPlugin,vB._componentPlugin=mB.componentPlugin,vB.transforms=mB.transforms,vB.dataParser=mB.dataParser,vB._layout=mB.layout,vB._grammarTransforms=mB.grammarTransforms,vB._stageEventPlugins=mB.stageEventPlugins,vB.registerStageEventPlugin=(t,e)=>{vB._stageEventPlugins[t]=e},vB.getStageEventPlugin=t=>vB._stageEventPlugins[t],vB._interactionTriggers=mB.interactionTriggers,vB.registerInteractionTrigger=(t,e)=>{vB._interactionTriggers[t]=e},vB._composedEventMap=mB.composedEventMap,vB.registerComposedEvent=(t,e)=>{vB._composedEventMap[t]=e},vB._tooltipProcessors=mB.tooltipProcessors,vB.registerTooltipProcessor=(t,e)=>{vB._tooltipProcessors[t]=e},vB.createTooltipProcessor=(t,e)=>{const i=vB._tooltipProcessors[t];return i?new i(e):null},vB._runtimePluginInstallers=mB.runtimePluginInstallers,vB.registerRuntimePluginInstaller=(t,e)=>{vB._runtimePluginInstallers[t]=e},vB.getRuntimePluginInstaller=t=>vB._runtimePluginInstallers[t];const bB=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},xB=bB(),SB={[hB.name]:hB},AB=hB.name,kB=new Map(Object.keys(SB).map((t=>[t,SB[t]]))),CB=new Map,TB=new Map(Object.keys(SB).map((t=>[t,t===AB]))),MB=(t,e)=>{if(!t)return;const i=PB(e);kB.set(t,i),TB.set(t,!0)},wB=(t=AB)=>(TB.has(t)&&!TB.get(t)&&MB(t,kB.get(t)),kB.get(t)),EB=t=>kB.delete(t)&&CB.delete(t)&&TB.delete(t),BB=t=>!!y(t)&&kB.has(t),PB=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:AB;return yB({},wB(i),t)};class RB{static registerInstance(t){RB.instances.set(t.id,t)}static unregisterInstance(t){RB.instances.delete(t.id)}static getInstance(t){return RB.instances.get(t)}static instanceExist(t){return RB.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return RB.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}RB.instances=new Map;class OB{static registerTheme(t,e){MB(t,e)}static getTheme(t,e=!1){return wB(t)}static removeTheme(t){return EB(t)}static themeExist(t){return BB(t)}static getDefaultTheme(){return OB.themes.get(AB)}static setCurrentTheme(t){OB.themeExist(t)&&(OB._currentThemeName=t,RB.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return OB.getTheme(OB._currentThemeName,t)}static getCurrentThemeName(){return OB._currentThemeName}}function IB(t){return y(t)?OB.themeExist(t)?OB.getTheme(t):{}:g(t)?t:{}}OB.themes=kB,OB._currentThemeName=AB;const LB=["animationThreshold","colorScheme","name","padding"];function DB(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];LB.includes(n)?s[n]=r:m(r)?jE(r)?s[n]=HE(r,e):oB(r)?s[n]=aB(i,r):s[n]=DB(r,e,i):s[n]=r})),s}function FB(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]=FB(t[s],e)}return i}return _(t)?t.map((t=>FB(t,e))):t}function zB(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]=zB(t[s],e)}return i}return _(t)?t.map((t=>zB(t,e))):t}function HB(t,...e){return d(t)?t(...e):t}const jB=(t,e,i,s)=>((t,e,i)=>$M(t,e,i,{fontFamily:lB.fontFamily,fontSize:lB.fontSize}))(e,i,s).measure(t),NB="__VCHART",UB=500,VB=500,WB=`${NB}_MEASURE_CANVAS_ID`,GB=`${NB}_DEFAULT_DATA_INDEX`,YB=`${NB}_DEFAULT_DATA_KEY`,XB=`${NB}_DEFAULT_DATA_SERIES_FIELD`,KB=`${NB}_DEFAULT_SERIES_STYLE_NAME`,$B=`${NB}_STACK_KEY`,qB=`${NB}_STACK_START`,ZB=`${NB}_STACK_END`,JB=`${NB}_STACK_START_PERCENT`,QB=`${NB}_STACK_END_PERCENT`,tP=`${NB}_STACK_START_OffsetSilhouette`,eP=`${NB}_STACK_END_OffsetSilhouette`,iP=`${NB}_STACK_TOTAL`,sP=`${NB}_STACK_TOTAL_PERCENT`,nP=`${NB}_STACK_TOTAL_TOP`,rP=`${NB}_STACK_TOTAL_BOTTOM`,aP=`${NB}_MOSAIC_VALUE_START_PERCENT`,oP=`${NB}_MOSAIC_VALUE_END_PERCENT`,lP=`${NB}_MOSAIC_CAT_START_PERCENT`,hP=`${NB}_MOSAIC_CAT_END_PERCENT`,cP=`${NB}_SEGMENT_START`,dP=`${NB}_SEGMENT_END`,uP=`${NB}_KEY`,pP=`${NB}_MAP_LOOK_UP_KEY`;function gP(t,e){for(let i=0;it.key===e))}function mP(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 vP(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},SP(t,a,n[o],l,e,r))})),s?yP(n):n}function yP(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))):yP(t[e].nodes);return t}function _P(t,e){if("values"in t&&t.values.length){const i=bw(t.values,e),s=_w(t.values,QB);t.values.forEach((t=>{t[iP]=i,t[sP]=s}))}else for(const i in t.nodes)_P(t.nodes[i],e)}function bP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][ZB]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)xP(t.nodes[r],e,i,s,n)}function SP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[ZB]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),SP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const AP=(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]=CP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function TP(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function MP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return PP(t(r,i,s,n));if(TP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),PP(e)}return PP(t)}function wP(t={}){const e=Object.assign({},t);if(d(t.style)||TP(t.style)?e.style=(e,i,s,n)=>MP(t.style,e,i,s,n):P(t.style)||(e.style=PP(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||TP(t.state[e])?i[e]=(i,s,n,r)=>MP(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=PP(t.state[e]))})),e.state=i}return e}function EP(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e,s,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}function BP(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),PP(i)}function PP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const RP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},OP=t=>"line"===t||"area"===t,IP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return OP(i)?e:null==e?void 0:e[0]},LP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let DP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=vB.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(vB.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var FP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(FP||(FP={}));const zP=["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 HP,jP,NP;t.ChartEvent=void 0,(HP=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",HP.rendered="rendered",HP.renderFinished="renderFinished",HP.animationFinished="animationFinished",HP.regionSeriesDataFilterOver="regionSeriesDataFilterOver",HP.afterInitData="afterInitData",HP.afterInitEvent="afterInitEvent",HP.afterInitMark="afterInitMark",HP.rawDataUpdate="rawDataUpdate",HP.viewDataFilterOver="viewDataFilterOver",HP.viewDataUpdate="viewDataUpdate",HP.viewDataStatisticsUpdate="viewDataStatisticsUpdate",HP.markDeltaYUpdate="markDeltaYUpdate",HP.viewDataLabelUpdate="viewDataLabelUpdate",HP.scaleDomainUpdate="scaleDomainUpdate",HP.scaleRawDomainUpdate="scaleRawDomainUpdate",HP.scaleUpdate="scaleUpdate",HP.dataZoomChange="dataZoomChange",HP.drill="drill",HP.layoutStart="layoutStart",HP.layoutEnd="layoutEnd",HP.layoutRectUpdate="layoutRectUpdate",HP.playerPlay="playerPlay",HP.playerPause="playerPause",HP.playerEnd="playerEnd",HP.playerChange="playerChange",HP.playerForward="playerForward",HP.playerBackward="playerBackward",HP.scrollBarChange="scrollBarChange",HP.brushStart="brushStart",HP.brushChange="brushChange",HP.brushEnd="brushEnd",HP.brushClear="brushClear",HP.brushActive="brushActive",HP.legendSelectedDataChange="legendSelectedDataChange",HP.legendFilter="legendFilter",HP.legendItemClick="legendItemClick",HP.legendItemHover="legendItemHover",HP.legendItemUnHover="legendItemUnHover",HP.tooltipShow="tooltipShow",HP.tooltipHide="tooltipHide",HP.tooltipRelease="tooltipRelease",HP.afterResize="afterResize",HP.afterRender="afterRender",HP.afterLayout="afterLayout",HP.afterMarkLayoutEnd="afterMarkLayoutEnd",HP.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(jP||(jP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(NP||(NP={}));const UP=[NP.mark,NP.model,NP.chart,NP.vchart];class VP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(NP.vchart,[]),this._levelNodes.set(NP.chart,[]),this._levelNodes.set(NP.model,[]),this._levelNodes.set(NP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const WP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class GP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>IP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||jP.chart);o.get(t)||o.set(t,new VP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||jP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||jP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||jP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?UP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[jP.chart,jP.window,jP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&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 WP[a]&&(a=WP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?NP.model:NP.vchart:NP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=jP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==NP.model&&s!==NP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=NP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case jP.chart:return this._viewBubbles;case jP.window:return this._windowBubbles;case jP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case jP.chart:return this._viewListeners;case jP.window:return this._windowListeners;case jP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return zP.includes(t)||Object.values(FP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&vB.hasInteractionTrigger(e)}}function YP(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function XP(t,e,i){t.getParser(e)||t.registerParser(e,i)}const KP=new Map;let $P;function qP(){$P||($P=new Fa,XP($P,"geojson",Pa),XP($P,"topojson",Oa),YP($P,"simplify",Kr))}function ZP(t,e,i={type:"geojson",centroid:!0}){KP.has(t)&&gM(`map type of '${t}' already exists, will be overwritten.`),qP();const s=new za($P),n=H({},{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}),KP.set(t,s)}function JP(t){KP.has(t)?KP.delete(t):gM(`map type of '${t}' does not exists.`)}function QP(t,e=!1){let i=e;return t.latestData instanceof za&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const tR=(t,e)=>0===t.length?[]:1===t.length?QP(t[0],null==e?void 0:e.deep):t.map((t=>QP(t,null==e?void 0:e.deep)));function eR(e,i,s){YP(i=i instanceof Fa?i:e.dataSet,"copyDataView",tR);const n=new za(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function iR(t,e,i=[]){var s;if(t instanceof za)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new za(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return gM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return gM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),gM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function sR(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var nR,rR,aR,oR;t.TransformLevel=void 0,(nR=t.TransformLevel||(t.TransformLevel={}))[nR.copyDataView=-10]="copyDataView",nR[nR.treemapFilter=-8]="treemapFilter",nR[nR.treemapFlatten=-7]="treemapFlatten",nR[nR.dotObjFlat=-7]="dotObjFlat",nR[nR.linkDotInfo=-7]="linkDotInfo",nR[nR.sankeyLayout=-7]="sankeyLayout",nR[nR.dataZoomFilter=-6]="dataZoomFilter",nR[nR.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(rR||(rR={})),function(t){t.data="data",t.mark="mark"}(aR||(aR={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(oR||(oR={}));const lR=["line","area","trail"];function hR(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(uP,i?t.slice().sort(i):t.slice()),{keys:[uP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const cR=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function dR(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{dR(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function pR(t,e,i,s){const n=hR(t,(t=>i(t))),r=hR(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const gR=`${NB}_BuiltIn_CallBack_Disappear`;var fR;!function(t){t.render="render",t.disappear="disappear"}(fR||(fR={}));const mR=[0,0,0];class vR{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ol),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Ll),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Su.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&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(mu(mR,[e,i,s],this.modelMatrix),e=mR[0],i=mR[1],s=mR[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=ru(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:nu(this,a,this.dpr),r.strokeStyle=ru(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}vR.env="browser";class yR extends wu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=oh.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new vR(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 _R(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,kd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Cd,e.env));r||i.bind(kd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Cd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}yR.env="browser";const bR=_R(yR,vR);class xR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}xR.env="feishu";class SR extends wu{constructor(t){super(t)}init(){this._context=new xR(this,this._dpr)}release(...t){}}SR.env="feishu";const AR=_R(SR,xR);class kR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}kR.env="harmony";class CR extends wu{constructor(t){super(t)}init(){this._context=new kR(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}CR.env="harmony";const TR=_R(CR,kR);class MR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}MR.env="lynx";class wR extends wu{constructor(t){super(t)}init(){this._context=new MR(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}wR.env="lynx";const ER=_R(wR,MR);class BR extends vR{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}BR.env="node";class PR extends wu{constructor(t){super(t)}init(){this._context=new BR(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}PR.env="node";const RR=_R(PR,BR);class OR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(ru(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:nu(this,l,this.dpr)),r.setStrokeStyle(ru(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}OR.env="taro";class IR extends wu{constructor(t){super(t)}init(){this._context=new OR(this,this._dpr)}release(...t){}}IR.env="taro";const LR=_R(IR,OR);class DR extends xR{}DR.env="tt";class FR extends wu{constructor(t){super(t)}init(){this._context=new DR(this,this._dpr)}release(...t){}}FR.env="tt";const zR=_R(FR,DR);class HR extends vR{draw(){}createPattern(t,e){return null}}HR.env="wx";class jR extends wu{constructor(t){super(t)}init(){this._context=new HR(this,this._dpr)}release(...t){}}jR.env="wx";const NR=_R(jR,HR);class UR extends vA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=_f.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;nnew GR(xS(t,ky)))).inSingletonScope(),t.bind(eA).toService(HS))}class KR extends CT{constructor(t){super(),this.canvasRenderer=t}}let $R=!1;class qR extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=gd}}let ZR=!1;function JR(t){var e;ZR||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,jy))&&(ZR=!0,t.bind(tA).toDynamicValue((()=>new qR(xS(t,jy)))).inSingletonScope(),t.bind(eA).toService(tA))}const QR=Xc();Xc();class tO{constructor(){this.type="gif-image",this.numberType=QR}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let eO=!1;function iO(t){eO||(eO=!0,t.bind(NS).toDynamicValue((()=>new tO)).inSingletonScope(),t.bind(eA).toService(NS))}function sO(t){t.isBound(UR)||t.bind(UR).toDynamicValue((()=>new UR(SS(eA,t),xS(t,Hy),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(UR):t.bind(qm).toService(UR)}function nO(t){(function(t){WR||(WR=!0,t.bind(QS).toDynamicValue((()=>new VR)).inSingletonScope(),t.bind(eA).toService(QS),Hm(t.bind.bind(t),eA))})(t),hC(t),yC(t),AC(t),XR(t),RC(t),UC(t),ZC(t),function(t){$R||($R=!0,t.bind(VS).toDynamicValue((()=>new KR(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(VS))}(t),rT(t),pT(t),xT(t),wT(t),DT(t),NT(t),JR(t),ZT(t),rM(t),iO(t),sO(t)}class rO extends cA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${rO.idprefix}_${rO.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=oh.global,this.viewBox=new Ve,this.modelMatrix=new Ge(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(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:rO.GenerateCanvasId(),canvasControled:!0};this.canvas=new yR(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new yR({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function aO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rO))||t.bind(rO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,rO.env))||t.bind(xf).toService(rO).whenTargetNamed(rO.env)}rO.env="browser",rO.idprefix="visactor_window",rO.prefix_count=0;var oO=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 lO{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 hO(t,e=!1){const i=document.createElement("img");if(oh.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class cO extends hA{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 lO(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return hO(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return hO(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return oO(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function dO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,cO))||(t.bind(cO).toSelf().inSingletonScope(),t.bind(vg).toService(cO))}function uO(t=m_(),e=!0){uO.__loaded||(uO.__loaded=!0,dO(t),bR(t),aO(t),e&&nO(t))}uO.__loaded=!1;class pO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new SR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 SR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function gO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,pO))||t.bind(pO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,pO.env))||t.bind(xf).toService(pO).whenTargetNamed(pO.env)}pO.env="feishu";class fO extends vA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Tu(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}}let mO=!1;class vO extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let yO=!1;function _O(t){yO||(yO=!0,t.bind(TS).toDynamicValue((()=>new vO(xS(t,ky)))).inSingletonScope(),t.bind(AS).toService(TS))}function bO(t){(function(t){mO||(mO=!0,Hm(t.bind.bind(t),AS))})(t),function(t){t.isBound(fO)||t.bind(fO).toDynamicValue((()=>new fO(SS(AS,t),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(fO):t.bind(qm).toService(fO)}(t),uC(t),TC(t),_O(t),LC(t),GC(t),tT(t),mT(t),lT(t),PT(t),WT(t),tM(t),lM(t)}class xO{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class SO{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function AO(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function kO(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new xO(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function CO(t,e,i,s){const n=AO(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new SO(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function TO(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function MO(t,e=TO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class wO extends hA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=TO(i),n=null!==(e=t.dpr)&&void 0!==e?e:MO(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return MO(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function EO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,wO))||(t.bind(wO).toSelf().inSingletonScope(),t.bind(vg).toService(wO))}function BO(t=m_(),e=!0){BO.__loaded||(BO.__loaded=!0,EO(t),AR(t),gO(t),e&&bO(t))}BO.__loaded=!1;function PO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function RO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new CR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 CR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return PO(t,"target",s),PO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=RO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=RO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&OO(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),OO(t,"x",_),OO(t,"y",b),OO(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),OO(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),OO(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),OO(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),OO(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),OO(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function LO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,IO))||t.bind(IO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,IO.env))||t.bind(xf).toService(IO).whenTargetNamed(IO.env)}IO.env="harmony";const DO="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function FO(t){return"number"==typeof t&&Number.isFinite(t)}function zO(...t){for(let e=0;e({width:i,height:s})),new SO(t,l,n,i,s,e)}function VO(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=NO(e*s,i*s);if(t)return t}throw new Error(DO)}class WO extends hA{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=HO(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=HO(s),r=null!==(i=t.dpr)&&void 0!==i?i:jO(s),a=function(t,e){if(!FO(t)||!FO(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=UO(VO(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=UO(VO(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return jO(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=zO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=zO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function GO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,WO))||(t.bind(WO).toSelf().inSingletonScope(),t.bind(vg).toService(WO))}function YO(t=m_(),e=!0){YO.__loaded||(YO.__loaded=!0,GO(t),TR(t),LO(t),e&&bO(t))}YO.__loaded=!1;function XO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function KO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new wR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 wR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return XO(t,"target",s),XO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=KO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=KO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&$O(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),$O(t,"x",_),$O(t,"y",b),$O(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),$O(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),$O(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),$O(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),$O(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),$O(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function ZO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qO))||t.bind(qO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,qO.env))||t.bind(xf).toService(qO).whenTargetNamed(qO.env)}qO.env="lynx";function JO(t){return"number"==typeof t&&Number.isFinite(t)}function QO(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=eI(r),o=null!==(i=t.dpr)&&void 0!==i?i:iI(r,a),l=nI(t.width,t.height),h=rI(aI(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=eI(a),l=null!==(n=t.dpr)&&void 0!==n?n:iI(a,o),h=nI(t.width,t.height),c=Math.random().toString(),d=rI(aI(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return iI(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=QO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=QO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function lI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,oI))||(t.bind(oI).toSelf().inSingletonScope(),t.bind(vg).toService(oI))}function hI(t=m_(),e=!0){hI.__loaded||(hI.__loaded=!0,lI(t),ER(t),ZO(t),e&&bO(t))}hI.__loaded=!1;class cI extends cA{get container(){return null}constructor(t=oh.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new PR(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new PR({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function dI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cI))||t.bind(cI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,cI.env))||t.bind(xf).toService(cI).whenTargetNamed(cI.env)}cI.env="node";class uI extends hA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function pI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uI))||(t.bind(uI).toSelf().inSingletonScope(),t.bind(vg).toService(uI))}function gI(t=m_(),e=!0){gI.__loaded||(gI.__loaded=!0,pI(t),RR(t),dI(t))}gI.__loaded=!1;class fI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new IR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 IR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fI))||t.bind(fI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,fI.env))||t.bind(xf).toService(fI).whenTargetNamed(fI.env)}fI.env="taro";class vI extends hA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=CO(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=kO(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function yI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,vI))||(t.bind(vI).toSelf().inSingletonScope(),t.bind(vg).toService(vI))}function _I(t=m_(),e=!0){_I.__loaded||(_I.__loaded=!0,yI(t),LR(t),mI(t),e&&bO(t))}_I.__loaded=!1;class bI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new FR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 FR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function xI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,bI))||t.bind(bI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,bI.env))||t.bind(xf).toService(bI).whenTargetNamed(bI.env)}bI.env="tt";function SI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function AI(t,e=SI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class kI extends hA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=SI(i),n=null!==(e=t.dpr)&&void 0!==e?e:AI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return AI(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function CI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,kI))||(t.bind(kI).toSelf().inSingletonScope(),t.bind(vg).toService(kI))}function TI(t=m_(),e=!0){TI.__loaded||(TI.__loaded=!0,CI(t),zR(t),xI(t),e&&bO(t))}TI.__loaded=!1;class MI{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={}}}function wI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class EI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="wx",this.eventManager=new MI}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new jR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 jR({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return wI(t,"target",o),wI(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function BI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,EI))||t.bind(EI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,EI.env))||t.bind(xf).toService(EI).whenTargetNamed(EI.env)}EI.env="wx";function PI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function RI(t,e=PI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class OI extends hA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=PI(i),n=null!==(e=t.dpr)&&void 0!==e?e:RI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return RI(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function II(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,OI))||(t.bind(OI).toSelf().inSingletonScope(),t.bind(vg).toService(OI))}function LI(t=m_(),e=!0){LI.__loaded||(LI.__loaded=!0,II(t),NR(t),BI(t),e&&bO(t))}LI.__loaded=!1;var DI={},FI={},zI={};Object.defineProperty(zI,"__esModule",{value:!0}),zI.loop=zI.conditional=zI.parse=void 0;zI.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};zI.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};zI.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var HI={};Object.defineProperty(HI,"__esModule",{value:!0}),HI.readBits=HI.readArray=HI.readUnsigned=HI.readString=HI.peekBytes=HI.readBytes=HI.peekByte=HI.readByte=HI.buildStream=void 0;HI.buildStream=function(t){return{data:t,pos:0}};var jI=function(){return function(t){return t.data[t.pos++]}};HI.readByte=jI;HI.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var NI=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};HI.readBytes=NI;HI.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};HI.readString=function(t){return function(e){return Array.from(NI(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};HI.readUnsigned=function(t){return function(e){var i=NI(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};HI.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=NI(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=ZI(t),i=GI(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=ZI(this.attribute.gifImage),e=GI(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=oh.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=oh.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function tL(t){return new QI(t)}class eL extends bx{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=QR,this._renderContribitions=void 0,this.builtinContributions=[iL],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=zp(t).image;this._draw(t,n,!1,i)}}const iL=new class extends Jv{constructor(){super(...arguments),this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let sL=!1;function nL(t){sL||(sL=!0,t.bind(eL).toDynamicValue((()=>new eL(SS(Qy,t)))).inSingletonScope(),t.bind(Cy).toService(eL))}function rL(){lf.RegisterGraphicCreator("gif",tL)}function aL(){if(aL.__loaded)return;aL.__loaded=!0;const t=m_();rL(),nL(t),iO(t)}aL.__loaded=!1;const oL=aL,lL=[{register:mb,bindModule:Nb},{register:vb,bindModule:Gb},{register:yb,bindModule:nx},{register:_b,bindModule:lx},{register:bb,bindModule:ux},{register:xb},{register:Sb,bindModule:Ax},{register:Ab,bindModule:Mx},{register:kb,bindModule:Ix},{register:Cb,bindModule:Vx},{register:Tb,bindModule:Kx},{register:Mb,bindModule:Jx},{register:wb,bindModule:iS},{register:Eb,bindModule:oS},{register:Bb},{register:Pb,bindModule:dS},{register:Rb,bindModule:fS},{register:Ob,bindModule:_S},{register:Ib},{register:rL}];let hL=!1;const cL=[hC,yC,AC,XR,RC,UC,ZC,rT,pT,xT,wT,DT,NT,JR,ZT,rM,iO];function dL(t){return{getContributions:t}}function uL(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function pL(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=NA();i(a),s(a),n(a),UA(),uL(e,{envParams:r,force:!0})}function gL(t,e){pL(t,"browser",{bindEnv:dO,bindCanvasModules:bR,bindWindowContribution:aO},e)}function fL(t,e){pL(t,"node",{bindEnv:pI,bindCanvasModules:RR,bindWindowContribution:dI},e)}function mL(t){WA(t),function(){if(hL)return;const t=NA();hL=!0,lL.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),nL(t),UA()}(),YA(t),GA(t)}function vL(t){WA(t);const e=NA();cL.forEach((t=>t(e))),sO(e),XA(t,eA),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[])),r=VA();oh.pickerServiceFactory=()=>new UR(i,{},s,n),oh.global=r}(t)}function yL(t){WA(t);bO(NA()),XA(t,AS),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[]));oh.pickerServiceFactory=()=>new fO(i,s,n)}(t)}function _L(){if(_L.__loaded)return;_L.__loaded=!0;const t=m_();_b(),lx({bind:t.bind}),bS?XR(t):_O(t)}_L.__loaded=!1;const bL=_L;function xL(){if(xL.__loaded)return;xL.__loaded=!0;const t=m_();Pb(),dS({bind:t.bind}),JR(t)}xL.__loaded=!1;const SL=xL;function AL(){AL.__loaded||(AL.__loaded=!0,Ib())}AL.__loaded=!1;const kL=AL;class CL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,$_(this.target,i,_o.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class wL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class EL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class BL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const PL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class RL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){X_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){X_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class OL extends RL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=PL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r),this.determineUpdateFunction()}}class IL extends RL{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class LL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class DL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const FL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class zL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=FL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class HL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const jL=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class NL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(X_(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class UL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:jL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class VL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:jL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const WL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class GL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:WL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class YL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:WL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const XL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class KL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:XL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class $L extends NL{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:XL(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const qL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class ZL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class JL extends ZL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=qL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}}class QL extends ZL{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const tD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class eD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nD extends sD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class rD extends sD{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class aD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,$_(this.target,{text:n})}}class oD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lD extends oD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class hD extends oD{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class cD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&q_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),X_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class dD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class uD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const pD={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function gD(t,e){for(let i=0;ipD[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&M_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(X_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class mD{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new w_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function vD(t){return new mD(t)}class yD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;$_(this.target,{text:o})}}class _D extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(q_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),q_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),q_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),q_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;q_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:yD});const i=s._titleBottom.attribute.text;q_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:yD})}else q_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),q_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;q_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());q_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class bD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class xD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(q_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:yD}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:yD}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class SD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class AD extends rb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==AD.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class kD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class CD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==CD.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CD.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TD{static createTempCanvas(t,e,i){return b_.createCanvas({width:t,height:e,dpr:i||b_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=TD.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(TD.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class ED extends CD{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class OD extends CD{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=TD.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class ID extends AD{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=b_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=b_.createCanvas({width:i,height:s,dpr:b_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class LD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}$_(this.target,{textConfig:o})}}class DD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class FD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function ND(t,e){X_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class UD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,q_(this.target,m)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class VD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,q_(this.target,d)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class WD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,q_(this.target,p)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class GD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class YD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}}class XD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:VD,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class KD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:WD,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class $D extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class qD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class ZD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class JD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:qD,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class QD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:ZD,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class tF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),X_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ru(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ru(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class eF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=oh.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Al,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=oh.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Fo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Fo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function lF(t){var e,i;const s=null!==(e=m_().getAll(Cy))&&void 0!==e?e:[],n=aF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;oF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=rF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function hF(t,e){var i,s;const n=null!==(i=m_().getAll(e))&&void 0!==i?i:[],r=aF(t.registry.picker,"vrender:legacy-picker"),a=new Set;oF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=rF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const cF=gL,dF=fL,uF={taro:{installEnv:function(t,e){pL(t,"taro",{bindEnv:yI,bindCanvasModules:LR,bindWindowContribution:mI},e)},loadEnv:_I},feishu:{installEnv:function(t,e){pL(t,"feishu",{bindEnv:EO,bindCanvasModules:AR,bindWindowContribution:gO},e)},loadEnv:BO},tt:{installEnv:function(t,e){pL(t,"tt",{bindEnv:CI,bindCanvasModules:zR,bindWindowContribution:xI},e)},loadEnv:TI},wx:{installEnv:function(t,e){pL(t,"wx",{bindEnv:II,bindCanvasModules:NR,bindWindowContribution:BI},e)},loadEnv:LI},lynx:{installEnv:function(t,e){pL(t,"lynx",{bindEnv:lI,bindCanvasModules:ER,bindWindowContribution:ZO},e)},loadEnv:hI},harmony:{installEnv:function(t,e){pL(t,"harmony",{bindEnv:GO,bindCanvasModules:TR,bindWindowContribution:LO},e)},loadEnv:YO}},pF=[nC,eC,S_,k_,uA,gA],gF=[()=>{w_.registerBuiltInAnimate("increaseCount",aD),w_.registerBuiltInAnimate("fromTo",ab),w_.registerBuiltInAnimate("scaleIn",cD),w_.registerBuiltInAnimate("scaleOut",dD),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL),w_.registerBuiltInAnimate("fadeIn",EL),w_.registerBuiltInAnimate("fadeOut",BL),w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("moveIn",nD),w_.registerBuiltInAnimate("moveOut",rD),w_.registerBuiltInAnimate("rotateIn",lD),w_.registerBuiltInAnimate("rotateOut",hD),w_.registerBuiltInAnimate("update",fD),w_.registerBuiltInAnimate("state",uD),w_.registerBuiltInAnimate("labelItemAppear",_D),w_.registerBuiltInAnimate("labelItemDisappear",bD),w_.registerBuiltInAnimate("poptipAppear",xD),w_.registerBuiltInAnimate("poptipDisappear",SD),w_.registerBuiltInAnimate("inputText",yD),w_.registerBuiltInAnimate("inputRichText",LD),w_.registerBuiltInAnimate("outputRichText",DD),w_.registerBuiltInAnimate("slideRichText",zD),w_.registerBuiltInAnimate("slideOutRichText",FD),w_.registerBuiltInAnimate("slideIn",UD),w_.registerBuiltInAnimate("growIn",VD),w_.registerBuiltInAnimate("spinIn",WD),w_.registerBuiltInAnimate("moveScaleIn",XD),w_.registerBuiltInAnimate("moveRotateIn",KD),w_.registerBuiltInAnimate("strokeIn",GD),w_.registerBuiltInAnimate("slideOut",$D),w_.registerBuiltInAnimate("growOut",qD),w_.registerBuiltInAnimate("spinOut",ZD),w_.registerBuiltInAnimate("moveScaleOut",JD),w_.registerBuiltInAnimate("moveRotateOut",QD),w_.registerBuiltInAnimate("strokeOut",YD),w_.registerBuiltInAnimate("pulse",tF),w_.registerBuiltInAnimate("MotionPath",HD),w_.registerBuiltInAnimate("streamLight",eF),w_.registerBuiltInAnimate("dissolve",wD),w_.registerBuiltInAnimate("grayscale",RD),w_.registerBuiltInAnimate("distortion",ED),w_.registerBuiltInAnimate("particle",OD),w_.registerBuiltInAnimate("glitch",PD),w_.registerBuiltInAnimate("gaussianBlur",BD),w_.registerBuiltInAnimate("pixelation",ID)},fb],fF=[gC,bC,wC,bL,FC,oL,HC,XC,iT,cT,yT,AT,OT,zT,YT,KT,iM,cM,kL,SL];function mF(){pF.forEach((t=>t())),gF.forEach((t=>t()))}function vF(t,e){if(!nF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==b_?void 0:b_.env)?b_.envParams:void 0}(e);return void 0===i?fL(t):dF(t,i),mL(t),yL(t),gI(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}function yF(t,e,i){if(!nF(t,e))return t;const s=uF[e];return s.installEnv(t,i),mL(t),function(t){yL(t)}(t),s.loadEnv(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}const _F=Symbol.for("visactor.vrender.sharedAppRegistry");function bF(){var t;const e=globalThis,i=null!==(t=e[_F])&&void 0!==t?t:new Map;return e[_F]=i,i}function xF(t,e){const i=bF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function SF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=bF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function AF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=xF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(SF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>SF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=xF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&SF(t,i,s))}}}(t,s,r,o)}const kF=$A,CF=[];function TF(t){CF.forEach((({module:e,options:i})=>{kF(e,Object.assign(Object.assign({},i),{app:t}))}))}var MF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),lF(t),hF(t,eA),mF(),t):t}(bA(MF(t,["envParams"])),e);return TF(i),i}var EF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},DF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},FF=(t,e)=>{const i=LF(t),s=DF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},zF=(t,e)=>{const i=AF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,IF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},HF="poptipForText";class jF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(HF))&&this._dedupeStagePlugin(HF)}initView(){var e,i,s,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:u,autoPreventDefault:f,background:m}=this._option,v=FF(l,h);b_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=LF(i.mode),n=FF(i.mode,i.modeParams);return zF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=t.releaseAppRef,null===(e=this._option.runtimePluginInstallers)||void 0===e||e.forEach((e=>e(t.app)));try{this._stage=(_=t.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:p(a)?a:!p(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=tg({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(p(c)?c:bM(l))&&!1!==d&&vB.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,g(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=oR.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!_M(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:b_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>dR(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>dR(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{dR(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===oR.before;(e||i)&&(pM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=oR.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=oR.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),pM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=uR(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=pR(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=pR(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=hR(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=hR(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:gR,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{dR(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===rR.appear))?rR.appear:e.every((t=>t===rR.disappear))?rR.disappear:rR.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===jP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=RP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=RP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:IP(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===jP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===jP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===jP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===jP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===jP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{dR(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=uR(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return _M(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{b_.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{dR(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function NF(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:fM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const UF={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}},VF={poptip:H({},UF)};function WF(t){t.crosshair=Y(t.crosshair||{}).map((e=>uB({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function GF(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}=li(l,i.width,i.height);a=t,o=e}else if(h&&_M(e.mode)){let t;t=y(h)?b_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(xM(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}}const YF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function XF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function KF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function $F(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;YF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function qF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var ZF,JF,QF,tz,ez,iz;t.LayoutZIndex=void 0,(ZF=t.LayoutZIndex||(t.LayoutZIndex={}))[ZF.SeriesGroup=0]="SeriesGroup",ZF[ZF.Axis_Grid=50]="Axis_Grid",ZF[ZF.CrossHair_Grid=100]="CrossHair_Grid",ZF[ZF.Region=450]="Region",ZF[ZF.Mark=300]="Mark",ZF[ZF.Node=400]="Node",ZF[ZF.Axis=100]="Axis",ZF[ZF.MarkLine=500]="MarkLine",ZF[ZF.MarkArea=100]="MarkArea",ZF[ZF.MarkPoint=500]="MarkPoint",ZF[ZF.DataZoom=500]="DataZoom",ZF[ZF.ScrollBar=500]="ScrollBar",ZF[ZF.Player=500]="Player",ZF[ZF.Legend=500]="Legend",ZF[ZF.CrossHair=500]="CrossHair",ZF[ZF.Indicator=500]="Indicator",ZF[ZF.Title=500]="Title",ZF[ZF.Label=500]="Label",ZF[ZF.Brush=500]="Brush",ZF[ZF.CustomMark=500]="CustomMark",ZF[ZF.Interaction=700]="Interaction",t.LayoutLevel=void 0,(JF=t.LayoutLevel||(t.LayoutLevel={}))[JF.Indicator=10]="Indicator",JF[JF.Region=20]="Region",JF[JF.Axis=30]="Axis",JF[JF.DataZoom=40]="DataZoom",JF[JF.Player=40]="Player",JF[JF.ScrollBar=40]="ScrollBar",JF[JF.Legend=50]="Legend",JF[JF.Title=70]="Title",JF[JF.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(QF=t.AttributeLevel||(t.AttributeLevel={}))[QF.Default=0]="Default",QF[QF.Theme=1]="Theme",QF[QF.Chart=2]="Chart",QF[QF.Base_Series=3]="Base_Series",QF[QF.Series=4]="Series",QF[QF.Mark=5]="Mark",QF[QF.User_Chart=6]="User_Chart",QF[QF.User_Series=7]="User_Series",QF[QF.User_Mark=8]="User_Mark",QF[QF.User_SeriesStyle=9]="User_SeriesStyle",QF[QF.Built_In=99]="Built_In";class sz{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,H({},sz.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]))))}}sz.defaultMarkInfo={};class nz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class rz{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=>uB({},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 az extends nz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=rz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new sz,this._lastLayoutRect=null,this.id=AM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new DP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${NB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=vB.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class oz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=tB(iB(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QE(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QE(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QE(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QE(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QE(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QE(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QE(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QE(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QE(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(eB(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class lz extends az{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new oz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(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 hz extends rz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class cz extends lz{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=hz,this.modelType="region",this.specKey="region",this.type=cz.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function dz(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 uz(t,e,i){e?t.forEach((t=>{const e=X(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=X(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 pz(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 gz(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),pz(d,!0,p,l),s&&uz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function fz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=yz(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),pz(d,!1,p,o),s&&uz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function vz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=yz(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=yz(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"left",s),r.length&&gz(r,e,i,!0,"left",s),a.length&&fz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"top",s),r.length&&mz(r,e,i,!0,"top",s),a.length&&vz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"right",s),r.length&&gz(r,e,i,!0,"right",s),a.length&&fz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"bottom",s),r.length&&mz(r,e,i,!0,"bottom",s),a.length&&vz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=yz(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=yz(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:fM)("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}}}_z.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(tz||(tz={})),t.STATE_VALUE_ENUM=void 0,(ez=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",ez.STATE_HOVER="hover",ez.STATE_HOVER_REVERSE="hover_reverse",ez.STATE_DIMENSION_HOVER="dimension_hover",ez.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",ez.STATE_SELECTED="selected",ez.STATE_SELECTED_REVERSE="selected_reverse",ez.STATE_SANKEY_EMPHASIS="selected",ez.STATE_SANKEY_EMPHASIS_REVERSE="blur",ez.STATE_HIGHLIGHT="highlight",ez.STATE_BLUR="blur",ez.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(iz||(iz={}));const bz=["linear","radial","conical"],xz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Sz={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{Sz[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class Az extends nz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class kz extends Az{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,lR.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Sz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(NB)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(NB))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Ow(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class Cz extends nz{constructor(){super(...arguments),this.id=AM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=vB.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Tz extends Cz{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Mz=1e3,wz="quadInOut",Ez=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Bz=(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=Ru(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Pz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ak(t):[],n=ak(e);i&&s&&(i.fromTransform&&ok(s,i.fromTransform.clone().getInverse()),ok(s,i.toTransfrom));const[r,a]=rk(s,n);return t?nk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Oz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Iz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Oz.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Eu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Lz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Pz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Bz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):$_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Dz=(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=Rz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Iz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Lz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wz);return c.play(d),c};class Fz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Pz(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&&Bz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const zz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Ez.includes(t))(i)||(e[i]=t[i])})),e},Hz=(t,e,i)=>{const s=zz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=oh.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},jz=(t,e,i)=>{const s=[],n=i?null:zz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:zz(t.attribute);if("rect"===t.type)ck(t,e).forEach((t=>{s.push(oh.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)dk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)uk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=fk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(oh.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?bk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?gk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&xk(t,e).forEach((t=>{"path"in t?s.push(oh.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Hz(t,s,e),s},Uz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Vz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Uz(l.delay,n,a,o),d=Uz(l.duration,n,a,o),u=Uz(l.oneByOne,n,a,o),p=Uz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(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);Dz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Rz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Iz(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:_o.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Lz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mz,null!==(l=i.easing)&&void 0!==l?l:wz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:_o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Fz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Dz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},Wz=(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))))},Gz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},Yz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},Xz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];Yz(t,a,s)},Kz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));Yz(t,r,i)},$z=Symbol("statesClearedBeforeReInit");class qz extends Cz{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Tz(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=tg("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Al)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===tz.enter||t.context.diffState===tz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&Yz(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new kz(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&uB(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Iw(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=YE(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):bz.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Iw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},xz[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)bz.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return hR(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return vB.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[YB],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=hR(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===rR.appear))?rR.appear:t.every((t=>t===rR.disappear))?rR.disappear:t[0];return null!=e?e:rR.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{Gz(t),s.push(...t.getGraphics())})),e.forEach((t=>{Gz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Vz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=Wz(e,n),r=Wz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===rR.exit?rR.exit:i===rR.update?rR.update:rR.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===tz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===tz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=tz.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=tz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=tz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=rR.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=rR.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return cR(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=cR(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!bz.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!Iw(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,LP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=vB.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=vB.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===oR.before||(this._product||this._initProduct(),pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[$z],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?Xz(i,t,!0,a):Kz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[$z]=e:delete s[$z]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===tz.exit&&!e.isExiting)if(e.context.animationState===tz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===tz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=tg({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[$z]=t.currentStates.slice())}))}}var Zz;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(Zz||(Zz={}));class Jz extends qz{constructor(){super(...arguments),this.type=Jz.type,this._marks=[],this._diffState=tz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(gM("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?(gM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return dR(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===tz.update){const t=this.hasAnimation(),e=LP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=tz.update}render(){this._isCommited&&(pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}Jz.type="group";const Qz={measureText:jB};class tH{static instance(){return tH.instance_||(tH.instance_=new tH),tH.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 eH{constructor(){this.id=AM(),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))?gM("不要重复添加相同的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 iH extends eH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const sH=(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"},nH=(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 rH extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=Za.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Za.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||sH(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=nH(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=Za.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=nH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=sH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Za.now()-i>this.config.press.time&&nH(s[0],t){oh.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class oH extends aH{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 C=oh.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 T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class lH extends aH{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=oh.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 hH extends sb{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&M_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(X_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));$_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const cH={type:"fadeIn"};function dH(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 cH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}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"},state:{duration:300,easing:"linear"}},pH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},gH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},fH=()=>{vB.registerAnimation("scaleInOut",(()=>pH))},mH=()=>{vB.registerAnimation("fadeInOut",(()=>gH))},vH=(t,e)=>({appear:dH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:hH,duration:uH.update.duration,easing:uH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),yH=()=>{vB.registerAnimation("line",vH)},_H=()=>{w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL)},bH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class xH{constructor(t){this._markSet=new sz,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const SH={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class AH extends xH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},SH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}AH.type="element-highlight",AH.defaultOptions=SH;const kH=()=>{vB.registerInteractionTrigger(AH.type,AH)},CH={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class TH extends xH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},CH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),Xz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}TH.type="element-select",TH.defaultOptions=CH;const MH=()=>{vB.registerInteractionTrigger(TH.type,TH)};class wH extends eH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const EH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},BH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...BH(t))})),s},PH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(EH(t,r),!1)};class RH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>vB.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>vB.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>vB.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return vB.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>vB.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){vB.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}static getFunction(t){return t?tH.instance().getFunction(t):null}static getFunctionList(){return tH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=vB.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=vB.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,KP.get(e);var e}static registerSVG(t,e,i){const s=vB.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=vB.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){RB.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=AM(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=fR.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=$F(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?vB.getSeriesBuiltInTheme(e):vB.getComponentBuiltInTheme(e);i=i?uB({},s,i[e]):s}s===t.length-1&&p(i)&&(i=DB({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},Bw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=_M(v);if(S?uO(iA):"node"===v&&gI(iA),S&&f&&(this._container=y(f)?b_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=OB.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=vB.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===i.type&&A.push("scrollbar");const C=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new jF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new GP(this,this._compiler),this._event=new DP(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),RB.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=uB({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=FB(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;RH.getFunctionList()&&RH.getFunctionList().length&&(t=zB(t,RH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=vB.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=vB.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=vB.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return GF(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:UB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:VB})}_initDataSet(t){this._dataSet=t instanceof Fa?t:new Fa,XP(this._dataSet,"dataview",Ia),XP(this._dataSet,"array",s),YP(this._dataSet,"copyDataView",tR);for(const t in vB.transforms)YP(this._dataSet,t,vB.transforms[t]);for(const t in vB.dataParser)XP(this._dataSet,t,vB.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),XF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?rR.none:rR.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,RB.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{EH(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof za?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=iR(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?uB({},t[n][e.index],i):i):t[n]=s?uB({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?uB({},t[n][r],i):i)}else t.id===e&&(t[n]=s?uB({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=uB({},t.getSpec(),e));const r=t.updateSpec(e),a=XF(r),o=KF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=yB({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=IB(this._currentThemeName),this._currentTheme=o(a,l);else{const t=yB({},IB(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),IB(n),IB(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(VF.poptip,UF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!_M(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return IB(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!OB.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield NF(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(!_M(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(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}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)?b_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?sB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 gM("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?sB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(gM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tH.instance().getFunction(t)}registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}getFunctionList(){return tH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=vB.getChartPlugins();t.length>0&&(this._chartPlugin=new iH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=vB.getVChartPlugins();e.length>0&&(this._vChartPlugin=new wH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=fR.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=fR.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}RH.InstanceManager=RB,RH.ThemeManager=OB,RH.globalConfig={uniqueTooltip:!0},RH.Utils=Qz,RH.vglobal=b_;vB.registerRegion("region",cz),vB.registerLayout("base",_z),KT(),HC(),vB.registerMark(Jz.type,Jz),vB.registerStageEventPlugin("gesture",rH),kH(),MH(),MB(cB.name,cB);const OH="monotone",IH="linear",LH="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class DH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function FH(t,e){return e("component",t)}function zH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=vB.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const HH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},jH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},NH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},UH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=zH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},VH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const WH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function GH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=XH(UH(h,r,a,c),d,g),o.value=XH(UH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=UH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function YH(t,e,i,s,n,r,a){if(d(e)){GH(t,e(n,a),i,s,r,a)}else e&&GH(t,e,i,s,r,a)}const XH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class KH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{YH(a,t,e,i,s,n,r)})):d(t)?YH(a,t,e,i,s,n,r):t&&GH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:UH(r.visible,t,n),value:XH(UH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:UH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=UH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&WH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const $H={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},qH=(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=gP([],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 ZH(a,n,o)},ZH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{kM(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=>{kM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=$H[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},JH=(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=>{kM(t[e])||(t[e]=0)}))})),t},QH=`${NB}_HIERARCHY_DEPTH`,tj=`${NB}_HIERARCHY_ROOT`,ej=`${NB}_HIERARCHY_ROOT_INDEX`;function ij(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function sj(t,e,i){t&&(i.needDefaultSeriesField&&(t[XB]=i.defaultSeriesField),t[GB]=e,t[YB]=i.getKey(t,e,i))}function nj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function rj(t,e,i,s=0,n,r){void 0===r&&(r=e),sj(t,e,i),t[QH]=s,t[tj]=n||t[i.categoryField],t[ej]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>rj(e,s,i,t[QH]+1,t[tj],r)))}const aj={label:{name:"label",type:"text"}},oj=`${NB}_rect_x`,lj=`${NB}_rect_x1`,hj=`${NB}_rect_y`,cj=`${NB}_rect_y1`,dj={data:!0},uj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},pj=[...Object.keys(uH),"normal"];function gj(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 _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=uB({},o[e],a);return _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function fj(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),bj(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function mj(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function vj(t,e){var i;return null!==(i=null==t?void 0:t[GB])&&void 0!==i?i:e.context.graphicIndex}function yj(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 _j(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function bj(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),bj(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),bj(t[s],e,i))}function xj(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Sj extends rz{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=OE(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=vB.getSeriesMarkMap(o)?function(t,e,i){const s=vB.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=uB({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return uB({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=uB({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>uB({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Aj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(uj[e]||(t[e]=!0),t)),{}),kj={compileOnlyKeys:uj,dataRelatedKeys:Aj,seriesOnlyKeys:{tooltip:!0}},Cj={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Tj=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,Mj=(t,e,i)=>{const s=Tj(t),n=Tj(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function wj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class Ej extends az{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${NB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Sj,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=xj(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"invalidTravel",JH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=iR(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=eR(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=eR(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Tz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=ZH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){YP(this._dataSet,"dimensionStatistics",qH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new za(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&&gP(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){YP(this._dataSet,"dimensionStatistics",qH);const s=new za(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=gP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&gP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new za(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)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!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,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:bM(s)||xM(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=uB(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=uB(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=bH(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=bH(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=bH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:XB;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:KB,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,KB,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(vB.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new KH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,wj(i))}_getSpecUpdatePolicy(){return kj}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},dj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Mj(t[i],e[i],Cj)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Mj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?wj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&wj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof za||sR(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();xj(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:XB,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WE).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DE(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:XB}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,uB({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:YB}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==ZB&&t!==QB&&t!==qB&&t!==JB||(t=this.getStackValueField()),null!==(e=mP(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>kM(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:XB]}}function Bj(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Ow(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 Pj(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}}}Ej.mark=aj,Ej.transformerConstructor=Sj;class Rj extends Ej{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);Ow(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:`${NB}_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(ZB),this.setFieldX2(qB)):(this.setFieldY(ZB),this.setFieldY2(qB))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(QB),this.setFieldX2(JB)):(this.setFieldY(QB),this.setFieldY2(JB))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(eP),this.setFieldX2(tP)):(this.setFieldY(eP),this.setFieldY2(tP))}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)&&(Bj("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Oj(t){return"bottom"===t||"top"===t}function Ij(t){return"left"===t||"right"===t}function Lj(t){return"z"===t}function Dj(t,e){return qE(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Fj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function zj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Oj(t)?"linear":"band":Oj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Hj=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):["linear","log","symlog"].includes(e)?FH("axisLinear",i):{})&&void 0!==s?s:{},r=Oj(t)?FH("axisX",i):Ij(t)?FH("axisY",i):FH("axisZ",i);return uB({},FH("axis",i),n,r)};class jj{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:fM)("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:fM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Lw(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Oj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Nj extends jj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Uj=(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))},Vj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},Wj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Lw(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:Gj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,Yj=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class Xj extends jj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Uj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:jP.canvas}),callback:this.onMouseOut}),bM(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),bM(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Kj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Kj||(Kj={}));const $j={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qj={sampling:!0,samplingFactor:!0};class Zj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark($j.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:LH,curveType:IH,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===OH?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark($j.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:yj(this._spec,$j.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new za(this._option.dataSet,{name:`${NB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[$j.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,uB({},this._spec[$j.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Jj=Object.assign(Object.assign({},aj),$j),Qj=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>Qj(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},tN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class eN extends qz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return tN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(Iw(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Qj(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[YB]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const iN=new Uint32Array(33),sN=new Uint32Array(33);sN[0]=0,iN[0]=~sN[0];for(let t=1;t<=32;++t)sN[t]=sN[t-1]<<1|1,iN[t]=~sN[t];function nN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&iN[31&o]&sN[1+(31&l)])return!0}else{if(i[h]&iN[31&o])return!0;if(i[c]&sN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,iN[31&o]&sN[1+(31&l)]);else for(s(h,iN[31&o]),s(c,sN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,sN[31&a]|iN[1+(31&o)]);else for(n(l,sN[31&a]),n(h,iN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function rN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function aN(t,e,i=!1){return i?rN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function oN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=aN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=rN(t,r)),e.getRange(r)))}function lN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return lN(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return lN(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 lN(t,e,n,s,h,c)}return!1}const cN=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],dN=["top","inside-top","inside"];function uN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const pN={mode:"same-time",duration:300,easing:"linear"};function gN(t){return 3===t||4===t}function fN(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 mN=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 vN(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)}}class yN extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class _N extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const bN=(t,e)=>Math.ceil(t)>Math.floor(e),xN=([t,e],[i,s])=>s>t&&e>i;function SN(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const AN=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class kN extends Qp{constructor(t,e){super(t),this._skipRenderAttributes=AN,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{MN(t,e,i)})),e}function wN(t,e){e&&(null==t||t.onComplete.push(e))}function EN(t){t.forEach((t=>{t()}))}function BN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var PN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(GM.hover,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(TM(this,(t=>{P(t.states)||(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void TM(this,(t=>{P(t.states)||(t.removeState(GM.selectedReverse),t.removeState(GM.selected))}));P(e.states)||(e.addState(GM.selected,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[vN(g,f,c,d,a,o),vN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=NM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Al)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),EN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(pN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=MN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=MN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}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):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return QM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&bN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&bN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(SN([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!xN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(aN(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;TN(i,null==n?void 0:n.attribute),TN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{ON[t]=e};var LN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};DN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const FN=()=>{IN("line",DN),IN("area",DN)};var zN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}HN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const jN=()=>{IN("symbol",HN),IN("line-data",HN)};class NN extends eN{constructor(){super(...arguments),this.type=NN.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)===PE.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}NN.type="line";const UN=()=>{vB.registerMark(NN.type,NN),KT(),iT(),FN(),jN(),_H(),vB.registerGraphicComponent("line",ag)};class VN extends qz{constructor(){super(...arguments),this.type=VN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}VN.type="symbol";const WN=()=>{vB.registerMark(VN.type,VN),KT(),iM(),jN(),vB.registerGraphicComponent("symbol",Gg)};class GN extends Sj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function YN(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function XN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function KN(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 $N(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 qN(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 ZN(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 JN=t=>t.map(((t,e)=>({index:e,value:t}))),QN=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},tU=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=$M(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return JN(v)};class sU{constructor(t){this.id=AM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class nU extends sU{constructor(){super(nU.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Ow(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&YN(c)&&YN(d)))return;const u=XN(t,c),p=XN(e,d);if(!0===u.break&&!0===p.break)return;const{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(!$N(u,p))return}else if(0===_&&0===b){if(!$N(p,u))return}else if(y||A)if(y&&!A){if(!KN(u,p))return}else if(A&&!y){if(!KN(p,u))return}else{if(f===b)return;if(f>b){if(!qN(u,p))return}else if(!qN(p,u))return}else{if(0===f&&0===_){if(!ZN(u,p))return}else if(0===b&&0===g&&!ZN(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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){YP(e.getOption().dataSet,"tickAlign",iU);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}nU.pluginType="component",nU.type="AxisSyncPlugin";const rU={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function aU(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 oU(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 lU(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const hU=t=>"band"===t||"ordinal"===t||"point"===t;function cU(t,e){return{id:t,label:t,value:e,rawValue:t}}function dU(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class uU extends eH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const pU=`${NB}_ARC_TRANSFORM_VALUE`,gU=`${NB}_ARC_RATIO`,fU=`${NB}_ARC_START_ANGLE`,mU=`${NB}_ARC_END_ANGLE`,vU=`${NB}_ARC_K`,yU=`${NB}_ARC_MIDDLE_ANGLE`,_U=`${NB}_ARC_QUADRANT`,bU=`${NB}_ARC_RADIAN`,xU=-Math.PI/2,SU=3*Math.PI/2,AU=.6,kU=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},CU=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):"linear"===e?FH("axisLinear",i):{})&&void 0!==s?s:{},r=FH("angle"===t?"axisAngle":"axisRadius",i);return uB({},FH("axis",i),n,r)};function TU(t,e,i,s){switch(t){case r.cartesianBandAxis:return Hj(Dj(i,["z"]),"band",e);case r.cartesianLinearAxis:return Hj(Dj(i,["z"]),"linear",e);case r.cartesianLogAxis:return Hj(Dj(i,["z"]),"log",e);case r.cartesianSymlogAxis:return Hj(Dj(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return Hj(Dj(i),void 0,e);case r.polarBandAxis:return CU(i.orient,"band",e);case r.polarLinearAxis:return CU(i.orient,"linear",e);case r.polarAxis:return CU(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>Oj(t.orient)));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>Ij(t.orient)));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return MU(i,FH(t,e));default:return FH(t,e)}}const MU=(t,e)=>{var i;const s=uB({},e,e[Fj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class wU extends rz{getTheme(t,e){return TU(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({},iB(e)),{[s]:0}))}}class EU extends lz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=wU,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof qa||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:jP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new uU(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;EH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=BH(t),s=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}EH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var BU,PU;EU.transformerConstructor=wU,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(BU||(BU={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(PU||(PU={}));class RU extends qz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?EH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(EH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=vB.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(FP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}RU.type="component";const OU=()=>{vB.registerMark(RU.type,RU)};var IU,LU;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(IU||(IU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(LU||(LU={}));const DU={[LU.selectedReverse]:{},[LU.selected]:{},[LU.hover]:{},[LU.hoverReverse]:{}},FU=t=>t,zU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class HU extends EU{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?BU.circleAxis:BU.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?PU.circleAxisGrid:PU.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=gj(null===(h=vB.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&Tw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Ow(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Ow(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return Tw(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=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=Mw(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()})),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(Tw(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||zU[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=wP(s=t.domainLine)).startSymbol=wP(s.startSymbol),s.endSymbol=wP(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(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 PP(uB({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:PP(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return PP(uB({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:PP(t.tick.style)),t.tick.state&&(i.tick.state=EP(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 PP(uB({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:PP(t.subTick.style)),t.subTick.state&&(i.subTick.state=EP(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=rU[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:uB({},d,PP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:PP(h.style)}),h.state&&(i.title.state.shape=EP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:PP(o.style)}),o.state&&(i.title.state.background=EP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=EP(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=PP(t.background.style)),t.background.state&&(i.panel.state=EP(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:HB(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 PP(uB({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:PP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:HB(t.subGrid.alternateColor),style:PP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=zH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){XP(this._option.dataSet,"scale",FU);const i=this.registerTicksTransform();return new za(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===IU.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}HU.specKey="axes";const jU=()=>{OU(),vB.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},NU=[nU];class UU extends HU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{const e=this.getOrient();Oj(e)?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Ij(e)?dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Lj(e)&&dU(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=uB({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(uB({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Oj(this.getOrient()),n=t=>{var e;return(s?!Oj(t.getOrient()):Oj(t.getOrient()))&&Ow(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&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Dj(i,["z"]),Lj(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(!lU(e))return null;const{axisType:t,componentName:s}=zj(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=>Ij(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(!lU(t))return;const{axisType:s,componentName:n}=zj(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=vB.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Oj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Lj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(NU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Oj(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&&!Oj(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Lj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Ij(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Oj(this.getOrient())?t.fieldX:Lj(this.getOrient())?t.fieldZ:t.fieldY,Ow(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(FP.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(Oj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Oj(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return Tw(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]:Oj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Lj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();Tw(this._regions,(e=>{Oj(t)?dU(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Ij(t)?dU(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Lj(t)&&dU(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Oj(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=Oj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=uB(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Oj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return cU(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Ow(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}UU.type=r.cartesianAxis,UU.specKey="axes";class VU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=cU(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=>cU(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const WU=(t,e,i,s)=>{const n=eU(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},GU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,YU=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?JN([s[s.length-1]]):JN([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=WU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=KU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=WU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!GU(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?YU(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function qU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=$U(e,t,!1,!!n),o=$U(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class ZU extends kN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${IU.grid}-sub`:`${IU.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=$U(t,o,!1,!!a)}const u=NM.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=gw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=NM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}ZU.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class JU{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=zM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return FM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class QU extends nb{onBind(){var t;const e=vD(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;TN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class tV extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;TN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function eV(){HC(),iT(),YT(),cM(),w_.registerBuiltInAnimate("axisEnter",QU),w_.registerBuiltInAnimate("axisUpdate",tV)}HC(),cT();class iV extends ZU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},ZU.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=UM,endAngle:r=VM}=this.attribute;i=pw(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function sV(){HC(),iT(),yT(),iM()}function nV(){HC(),iT(),gC(),iM()}G(iV,JU),sV();class rV extends kN{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=NM.line;Y(i)[0].cornerRadius&&(t=NM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=NM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}rV.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}}},nV();class aV extends rV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function oV(){HC(),OT(),iM(),YT(),cM()}var lV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:Y(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+E,i=1===j?(t-e)/2+E+I/2:b[0]+E-(T/2+e/2-E)+I/2;if(V(i,"center"),A){const t=i-I/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-I-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,G=lV(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Al)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},hV.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}hV.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const cV=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(GM.hover,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.hoverReverse,!0)})),s):i},dV=(t,e,i)=>i?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),null):i,uV=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(GM.selected)?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.selectedReverse),t.removeState(GM.selected))})),null):s.name&&!P(s.states)?(s.addState(GM.selected,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.selectedReverse,!0)})),s):i},pV={type:"default",duration:300,easing:"linear"};class gV extends CN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cV(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=NM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),EN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(TM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=MN(this),{delay:a=0,duration:o=pV.duration,easing:l=pV.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};TN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=MN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(pV)}_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=NM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=IU.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=NM.group({x:0,y:0,pickable:!1});t.name=IU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=NM.group({x:0,y:0,pickable:!1});i.name=IU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=NM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=IU.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=YM;else{const t=this.data[s],e=H({},YM,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=NM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=IU.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=YM;else{const i=H({},YM,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=NM.group({x:0,y:0,pickable:!1});return r.name=`${IU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=QM(this._getLabelAttribute(t,e,n,i));if(a.name=IU.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=YM;else{const s=H({},YM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new hV(Object.assign({},e));i.name=IU.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/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 f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},nw.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},TM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=ZA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},TN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const fV={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&&fw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function mV(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function vV(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fV[n]||fV.parity;if(s.length>=3&&mw(s,r)){do{s=a(s,r)}while(s.length>=3&&mw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);fw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),vV(l,s,n,(t=>fw(t,l,r))),vV(h,s,o,(t=>fw(t,h,r)||!(!n||t===l)&&fw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function _V(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},SV(t,e.attribute.angle)),{angle:xV(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({},AV(t,e.attribute.angle)),{angle:xV(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function xV(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function SV(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=xV(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 AV(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=xV(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 kV(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=hw(h),m=lw(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function CV(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var TV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=NM.group({zIndex:999});e.name=IU.axisBreak,e.id=this._getNodeId(`${IU.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},rw,s),a=null!==(e=r.size)&&void 0!==e?e:rw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=NM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=IU.axisBreakSymbol;const h=NM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=IU.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=NM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=IU.background,n.id=this._getNodeId("background"),n.states=H({},DU,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new hV(Object.assign({},t));e.name=IU.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=TV(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},DU,l),symbol:H({},DU,l)});const d=new rV(c);d.name=IU.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=TV(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=HM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},DU,c.text),shape:H({},DU,c.shape),panel:H({},DU,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=TV(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=HM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return SV(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return AV(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=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),bV(i,t),!_V(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=hw(a),l=lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=CV(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=CV(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);kV(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&yV(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(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=NM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=IU.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=qM(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=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}MV.defaultAttributes=nw,G(MV,JU);const wV={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},EV={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}}},BV={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}}},PV={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}}};class RV extends UU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new iE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,XU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Xw(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{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(RV.type,RV,!1)},IV=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function LV(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,FV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function zV(t,e,i="count"){const s=FV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const HV=Math.sqrt(50),jV=Math.sqrt(10),NV=Math.sqrt(2);class UV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=oU(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=Oj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(DV),e.sort(DV),{domain:LV(t,e),scope:zV(t,e,i)}}(r,dM(t),this._spec.breaks[0].scopeType);e=dM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=oU(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=HV?10:n>=jV?5:n>=NV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}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=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function VV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function WV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Ow(t.type))return JN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return JN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=VV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=VV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=VV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=eU(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=eU(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?YV.greedy:YV.parity;for(;l.length>=3&&mw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;fw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),WV(t,l,a,(e=>fw(e,t,i))),WV(n,l,o,(e=>fw(e,n,i)||!(!a||e===t)&&fw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return JN(m)},YV={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&fw(i,t,e)||(i=t,0))))}},XV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class KV extends UU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Lj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Oj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=ZE(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=dM(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}KV.type=r.cartesianLinearAxis,KV.specKey="axes",KV.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(KV,UV);const $V=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(KV.type,KV)},qV=`${NB}_hide_`;function ZV(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const JV=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[qV]&&(ZV(t,!0),t[qV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[qV]=!0,ZV(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},QV=()=>{vB.registerGrammarTransform("symbolOverlap",{transform:JV,runType:"afterEncode"})},tW={min:$,max:K,average:xw,sum:bw};function eW(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function iW(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 sW(t,e,i,s){return iW(t,e,i,"min",s)}function nW(t,e,i,s){return iW(t,e,i,"max",s)}function rW(t,e,i,s){return iW(t,e,i,"average",s)}function aW(t,e,i,s){return iW(t,e,i,"sum",s)}const oW=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=eW;if("min"===n?l=sW:"max"===n?l=nW:"average"===n?l=rW:"sum"===n&&(l=aW),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[]},lW=()=>{vB.registerGrammarTransform("dataSampling",{transform:oW})};class hW extends Rj{constructor(){super(...arguments),this.type=PE.line,this.transformerConstructor=GN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),fj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}hW.type=PE.line,hW.mark=Jj,hW.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},hW.transformerConstructor=GN,G(hW,Zj);class cW{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{sR(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof za)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];gM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];gM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class dW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{CM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{gP(e,[{key:t,operations:Ow(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&&gP(e,[{key:i.field,operations:Ow(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?YE("colorOrdinal"):YE(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(CM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),CM(s.domain)?e.reRender=!0:V(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(!CM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Ow(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Ow(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;Ow(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(Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Ow(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class uW{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&Xz(t,i,!0,l):a&&Xz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&Xz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Kz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Kz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const pW={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},gW={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class fW extends nz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=AM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:UB,height:VB},this._viewRect={width:UB,height:VB},this._viewBox={x1:0,y1:0,x2:UB,y2:VB},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._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(gW).some((t=>!u(e[t])))},this._paddingSpec=iB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new DP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new cW(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new uW;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=vB.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(gj({},fj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=vB.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=vB.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof az)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 qz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof qz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&sR(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=GF(this._spec,this._option,{width:UB,height:VB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DE(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new dW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){$F(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DE(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=iB(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{$F(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);KF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),$F(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);KF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),$F(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(pW[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return pW[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!pW[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;pW[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];$F(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=tB(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(FP.AFTER_MARK_RENDER_END,e)};this._event.on(FP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:IP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(OP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===Kj.dimensionHover||s===Kj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Lw(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Lw(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const mW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},vW={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class yW{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},vW),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):dB(t,a,c.spec),dB(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(vB.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(vB.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=vB.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=vB.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=vB.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):HH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=HH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class _W extends yW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&uB(i,qF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class bW extends _W{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),WF(t)}}const xW=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=vP(t,!0);for(const e in o)for(const i in o[e].nodes)xP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)bP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&_P(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class AW{_beforeInit(){this._dataSet&&YP(this._dataSet,"stackSplit",xW)}_initStack(){this._stack=new SW(this),this._stack.init()}}const kW={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:Kj.dimensionHover};class CW extends xH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},kW,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=IP(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}CW.type="dimension-hover",CW.defaultOptions=kW;const TW=()=>{vB.registerInteractionTrigger(CW.type,CW)},MW=()=>{vB.registerComposedEvent(Kj.dimensionHover,Xj),vB.registerComposedEvent(Kj.dimensionClick,Nj)},wW=t=>t.fieldX[0],EW=t=>t.fieldY[0],BW=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},PW=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},RW=(t,e)=>t?e?wW:BW:e?EW:PW,OW=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=Yj(t,(t=>Oj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=Yj(t,(t=>Ij(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Lw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=IW(t,i,RW(e,Lw(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=IW(t,i,RW(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},IW=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:LW(t,s,i)},LW=(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=Wj(e,t,"cartesian",null!=i?i:Oj(t.getOrient())?wW:EW);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},DW=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Lw(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Ow(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=aU(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};zW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&FW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),FW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=zH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},zW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},HW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=jW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},jW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},NW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return DW(c,r,e),c.xField.cacheInfo?HW(c.xField):c.yField.cacheInfo?HW(c.yField):void 0},UW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],VW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&UW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(WW(s).every((t=>{var e;return!WH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},WW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},GW={dom:`${NB}_TOOLTIP_HANDLER_DOM`,canvas:`${NB}_TOOLTIP_HANDLER_CANVAS`},YW={key:"其他",value:"..."};var XW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(XW||(XW={}));class KW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=VW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},YW),t):YW;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&WH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class $W extends KW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Lw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const qW=()=>{vB.registerTooltipProcessor("dimension",$W)};class ZW extends KW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,yo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(IP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const JW=()=>{vB.registerTooltipProcessor("mark",ZW)};class QW extends KW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const tG=()=>{vB.registerTooltipProcessor("group",QW)};class eG extends fW{constructor(){super(...arguments),this.transformerConstructor=bW,this.type="line",this.seriesType=PE.line}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}eG.type="line",eG.seriesType=PE.line,eG.transformerConstructor=bW,G(eG,AW);const iG=[...tN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class sG extends eN{constructor(){super(...arguments),this.type=sG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return iG}_getIgnoreAttributes(){return[]}}sG.type="area";const nG=()=>{vB.registerMark(sG.type,sG),KT(),wC(),FN(),jN(),_H(),vB.registerGraphicComponent("area",Yp)};class rG extends KH{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 aG=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}}),oG=()=>{vB.registerAnimation("area",vH),yH(),fH()};class lG extends GN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=uB({},f.style,g.style),l.state=uB({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function hG(){HC(),OT()}function cG(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const dG={debounce:St,throttle:At};hG();let uG=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=cG(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:dG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(KM,{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",dG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(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]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};uG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class pG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=pG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(KM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new uG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}SG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class AG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,SG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new SG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,VF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class kG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class CG extends kG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class TG extends kG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function MG(t){t.isBound(AG)||(t.bind(AG).toSelf().inSingletonScope(),t.bind(o_).toService(AG)),t.isBound(CG)||(t.bind(CG).toSelf(),t.bind(Sv).toService(CG)),t.isBound(TG)||(t.bind(TG).toSelf(),t.bind(Sv).toService(TG))}class wG extends kN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}HC(),iT();class EG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HC(),OT();class BG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},BG.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})}}BG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},HC(),gC();class PG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}PG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},HC(),gC();class RG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},RG.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=UM,endAngle:s=VM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}RG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},HC(),cT();class OG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},OG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}OG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class IG{isInValidValue(t){const{startAngle:e=UM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=UM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return uw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function LG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=LG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var zG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=NM.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=NM.circle(t)}h.name=IU.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},DU,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=zG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=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:y,textAlign:"center"},l),state:{text:H({},DU,d.text),shape:H({},DU,d.shape),panel:H({},DU,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=LG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&DG(e,c,i)}else e.AABBBounds.width()>r&&DG(e,r,i)}else o>a.x&&h.x2>n.x2?(DG(e,n.x2-o,i),r&&FG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}HG.defaultAttributes=nw,G(HG,IG);const jG=(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=$M(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=dw(r,uw(s,r,e,n));return o=a,l=uw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return JN(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=jG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=UG(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 JN(c)},UG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&QN(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var VG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new YG(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):gN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=gN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=gN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=gN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?gN(t.quadrant)?"left":"right":gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.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*(gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),EN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}$G.defaultAttributes={pickable:!1};var qG,ZG,JG,QG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(tY,IG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(qG||(qG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(ZG||(ZG={})),function(t){t.dataZoomChange="dataZoomChange"}(JG||(JG={}));const eY="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",iY={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:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},sY={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}},nY=0,rY=1,aY=2,oY=3,lY=4,hY=5,cY=5,dY=999,uY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var pY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:aY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:aY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:nY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:hY},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:hY},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},sY.horizontal),{zIndex:hY}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},sY.horizontal),{zIndex:hY}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:hY},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:hY},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},sY.vertical),{zIndex:hY}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:hY},sY.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:rY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:lY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return qA(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=pY(c,["formatMethod"]),{formatMethod:g}=d,f=pY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:uY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:uY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:uY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:uY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:cY}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:cY}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new hV(e),s.name=i,t.add(s)),s}}const fY={debounce:St,throttle:At};class mY extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=qG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=qG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=qG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=cG();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===qG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===qG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===qG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===qG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(ZG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===qG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:fY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=cG();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=qG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}oV(),OT(),iM(),wC(),iT();let vY=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new gY(this._getRendererAttrs()),this._interaction=new mY(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(ZG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(ZG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(JG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(ZG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(JG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var yY,_Y,bY,xY;function SY(){HC(),oV(),fb()}vY.defaultAttributes=iY,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"}(yY||(yY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(_Y||(_Y={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(bY||(bY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xY||(xY={}));class AY extends kN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cV(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(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:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},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=NM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=NM.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=NM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),EN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=MN(this);this.markerAnimate("exit");const n=MN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function kY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function CY(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;TN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function TY(t,e,i,s){t&&(CY(t.startSymbol,e,i,s),kY(t).forEach((t=>CY(t,e,i,s))),CY(t.endSymbol,e,i,s))}function MY(t,e,i,s){t&&(CY(t.getTextShape(),e,i,s),CY(t.getBgRect(),e,i,s))}function wY(t,e,i,s){var n,r,a,o;t&&(TN(t,{fillOpacity:0,strokeOpacity:0},{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 EY(t,e,i,s){t&&(wY(t.startSymbol,e,i,s),kY(t).forEach((t=>wY(t,e,i,s))),wY(t.endSymbol,e,i,s))}function BY(t,e,i,s){t&&(wY(t.getTextShape(),e,i,s),wY(t.getBgRect(),e,i,s))}function PY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;CY(t.startSymbol,s,r,n);const h=kY(t);h.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),CY(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;CY(t.getTextShape(),e,l,n),CY(t.getBgRect(),e,l,n)}))}function RY(t,e,i,s,n){TY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function OY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function IY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function LY(t,e,i,s,n,r){var a;TY(t,n,s,r),CY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?MY(i,n,s,r):CY(i,n,s,r)}function DY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;CY(t.startSymbol,n,o,r);const u=kY(t);u.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),CY(e,n+o+l,h,r),CY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(CY(i.getTextShape(),n+o+l+h+c,d,r),CY(i.getBgRect(),n+o+l+c,d,r)):CY(i,n+o+l+c,d,r)}function FY(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?PY(t,e,s,r,a):"fadeIn"===i&&RY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?PY(t,e,s,n,a):"fadeIn"===i&&RY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){EY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function zY(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&&OY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&OY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function HY(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&&IY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&IY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function jY(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?LY(n,r,e,i,s,o):"callIn"===t&&DY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?LY(n,r,e,i,s,a):"callIn"===t&&DY(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;EY(t,n,s,r),wY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?BY(i,n,s,r):wY(i,n,s,r)}(n,r,e,t,i,s)}}const NY={type:"clipIn",duration:500,easing:"linear",delay:0},UY={type:"fadeIn",duration:500,easing:"linear",delay:0},VY={type:"callIn",duration:500,easing:"linear",delay:0},WY={type:"fadeOut",duration:500,easing:"linear",delay:0};class GY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new hV(Object.assign(Object.assign({},h),{state:{panel:H({},YM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},YM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},YM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},YM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class YY extends AY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=NY,this.defaultExitAnimation=WY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;sw(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(YY,GY);const XY=.001,KY={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:yY.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]}},$Y={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"}}},qY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:bY.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]}},ZY={interactive:!0,label:{position:_Y.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}},JY={interactive:!0,label:{autoRotate:!0,position:bY.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}},QY={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"}},tX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},eX={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 iX(){sX._animate=FY}SY(),sV(),fb();class sX extends YY{markerAnimate(t){sX._animate&&this._animationConfig&&sX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},sX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(wM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return EM(Math.abs(e),Math.PI/2,XY)||EM(Math.abs(e),3*Math.PI/2,XY)?BM(i,e,t):wM(e)?$Y.postiveXAxis[t]:$Y.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new rV({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",sX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(sX.defaultAttributes.label)}}function nX(){rX._animate=zY}sX.defaultAttributes=KY,SY(),yT(),fb();class rX extends AY{markerAnimate(t){rX._animate&&this._animationConfig&&rX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},tX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=NM.polygon(Object.assign({points:e},i));n.states=H({},YM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",rX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},YM,null==i?void 0:i.area)),this._updateMarkLabels(rX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}rX.defaultAttributes=ZY,G(rX,GY),SY(),nV(),fb();class aX extends YY{markerAnimate(t){aX._animate&&this._animationConfig&&aX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},aX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case bY.arcInnerStart:l=n;case bY.arcOuterStart:l=n;break;case bY.arcInnerEnd:l=r;case bY.arcOuterEnd:l=r;break;case bY.center:case bY.arcInnerMiddle:case bY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return QY[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new aV({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",aX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(aX.defaultAttributes.label)}}aX.defaultAttributes=qY,SY(),gC(),fb();class oX extends AY{markerAnimate(t){oX._animate&&this._animationConfig&&oX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},oX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case bY.center:h=(s+n)/2,c=(r+a)/2;break;case bY.arcInnerStart:h=s,c=r;break;case bY.arcOuterStart:h=n,c=r;break;case bY.arcInnerEnd:h=s,c=a;break;case bY.arcOuterEnd:h=n,c=a;break;case bY.arcInnerMiddle:h=s,c=(r+a)/2;break;case bY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},QY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=NM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},YM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",oX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},YM,null==o?void 0:o.area)),this._updateMarkLabels(oX.defaultAttributes.label)}isValidPoints(){return!0}}function lX(){hX._animate=jY}oX.defaultAttributes=JY,G(oX,GY),SY(),sV(),nV(),iM(),XC(),iT(),fb();class hX extends AY{markerAnimate(t){hX._animate&&this._animationConfig&&hX._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},hX.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=VY,this.defaultExitAnimation=WY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return EM(Math.abs(s),Math.PI/2,XY)||EM(Math.abs(s),3*Math.PI/2,XY)?BM(t,s,n):wM(s)?eX.postiveXAxis[n]:eX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=xY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},YM,null==p?void 0:p.textBackground),text:H({},YM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},YM,null==p?void 0:p.itemContent));const v=wM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=NM.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"text"===n?o=new hV(Object.assign(Object.assign({},i),{state:{panel:H({},YM,null==s?void 0:s.textBackground),text:H({},YM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=NM.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"image"===n?(o=NM.image(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},YM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=EM(c,0,XY)||EM(d,0,XY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=ew(e-u,t-d),o=ew(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(yX.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(yX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===yX.focus||"focus"===o){const s=a.hasState(mX.focus);a.toggleState(mX.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover,mX.focus],t),this._setLegendItemState(e,mX.selected,t)})):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover,mX.focus],t),this._setLegendItemState(e,mX.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(mX.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(mX.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(vX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[mX.selected,mX.selectedHover],t),this._setLegendItemState(a,mX.unSelected,t)):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t))}else this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover],t),this._setLegendItemState(e,mX.unSelected,t))}))}this._dispatchLegendEvent(vX.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,mX.selected),this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover])):(this._removeLegendItemState(e,[mX.selected,mX.selectedHover]),this._setLegendItemState(e,mX.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=pX,spaceRow:l=gX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=NM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=NM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,yX.item,t,M)):(M=NM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,yX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?mX.selected:mX.unSelected);const w=NM.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=NM.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,yX.itemShape,t,M,S.state),s.addState(e?mX.selected:mX.unSelected),w.add(s)}let I=0;if(d){const e=R(g,"size",10);E=NM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,yX.focus,t,M),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=QM(Object.assign(Object.assign({x:P/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,yX.itemLabel,t,M,A.state),D.addState(e?mX.selected:mX.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=QM(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,yX.itemValue,t,M,k.state),r.addState(e?mX.selected:mX.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-O-I),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.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 j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new uX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new uX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new uG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new uG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=pX,spaceRow:o=gX}=n,l=this._itemsContainer,{space:h=fX,defaultCurrent:c=1}=r,d=SX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=NM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=pX,spaceRow:a=gX}=s,o=this._itemsContainer,{space:l=fX,defaultCurrent:h=1}=n,c=SX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=NM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=NM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(mX.selected)?this._setLegendItemState(t,mX.selectedHover,e):this._setLegendItemState(t,mX.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===yX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(vX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(mX.unSelectedHover)||t.hasState(mX.selectedHover))&&(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(mX.unSelectedHover)&&!t.hasState(mX.selectedHover)||(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===yX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(vX.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!==yX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(vX.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!==yX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(mX.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},AX,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(mX.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var CX;function TX(t){return _(t)?t:[t,t]}function MX(t){return t?"ew-resize":"ns-resize"}kX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:pX,spaceRow:gX,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:fX,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"}(CX||(CX={})),bX();class wX extends kN{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:H({},wX.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=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(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?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:TX(d)[0],endValue:TX(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=NM.group({x:0,y:0});f.name=CX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=NM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=CX.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=NM.group({x:g?v:0,y:g?0:v});f.add(y);const _=NM.group({x:0,y:0});let b;if(_.name=CX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=NM.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=CX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=NM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=CX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=TX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(v.name=CX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=CX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(i.name=CX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=CX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=NM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=CX.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":MX(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=NM.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=CX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return NM.symbol(t)}_renderHandlerText(t,e){return NM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":MX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=NM.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=NM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===CX.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===CX.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===CX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===CX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}wX.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}}},xX(),bX();class EX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 BX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}EX.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"}}},xX(),bX(),cT();class PX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PX.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=NM.group({x:0,y:0});this._innerView.add(x);const S=new wX({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:BX(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 C=NM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);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))}}PX.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)"}},HC(),cM(),YT();let RX=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},XM),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,O-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},XM),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GO&&(G=O),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(I)||p(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(I)||p(M.align)){const t=M.align?M.align:I,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};RX.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 OX={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"}}};HC(),cM(),YT();let IX=class extends kN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(OX,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=QM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=qM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&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 LX extends Wg{constructor(t){super(t)}}var DX,FX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(DX||(DX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(FX||(FX={}));class zX extends kN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},zX.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"},zX.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"},zX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.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 LX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new LX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new LX(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(DX.OnPlay)},this.pause=()=>{this._dispatchEvent(DX.OnPause)},this.forward=()=>{this._dispatchEvent(DX.OnForward)},this.backward=()=>{this._dispatchEvent(DX.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()}}zX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},zX.defaultAttributes={[FX.Start]:{},[FX.Pause]:{},[FX.Backward]:{},[FX.Forward]:{}};const HX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},jX=[200,10];var NX,UX;!function(t){t.Default="default",t.Reverse="reverse"}(NX||(NX={})),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"}(UX||(UX={}));const VX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),WX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),GX=t=>"top"===t||"bottom"===t;class YX extends kN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YX.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(GX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:jX[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:jX[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 wX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=GX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new zX(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=GX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:jX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(GX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(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:GX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:GX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function XX(){bX(),HC(),iM()}YX.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({},HX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},HX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},HX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},HX),{key:"backward",position:"start"})}},XX();class KX extends YX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},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:NX.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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(VX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||WX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===NX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(UX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(UX.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(UX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.change),this.dispatchCustomEvent(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var $X,qX=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())}))};XX();class ZX extends YX{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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change))},this.play=()=>qX(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(UX.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.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(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}($X||($X={}));const JX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},QX=5;const tK={debounce:St,throttle:At};HC(),yT();let eK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=JX.updateTrigger,endTrigger:i=JX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:tK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=JX.trigger,resetTrigger:i=JX.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent($X.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent($X.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=QX}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent($X.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent($X.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent($X.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=QX}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=JX.updateTrigger,endTrigger:s=JX.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=NM.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};eK.defaultAttributes=JX;const iK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},sK=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}},nK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},rK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];HC(),OT(),iM(),cM(),YT();let aK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},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=oi(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",H({symbolType:"circle"},u.shape,{visible:MM(u)&&MM(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:MM(u)&&MM(u.value)},sK(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:MM(u)&&MM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:MM(u)&&MM(u.value)},sK(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},XM),u.value),visible:MM(u)&&MM(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=MM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=MM(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]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!MM(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)+(MM(n.key)?r+n.key.spacing:0)+(MM(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&&(tw(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:MM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),tw(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(MM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(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(MM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},sK(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},sK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},XM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(MM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},sK(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},sK(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=>rK.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)&&MM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=MM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=$M(d),y=$M(u);let _=0;if(MM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(MM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return iK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return iK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};aK.defaultAttributes=nK;class oK extends KV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{Oj(this.getOrient())?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=uB({},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 za(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Tz(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.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=>cU(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=>cU(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}oK.type=r.cartesianTimeAxis,oK.specKey="axes",oK.builtInTheme={axis:EV,axisX:BV,axisY:PV};class lK extends KV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new ME}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}lK.type=r.cartesianLogAxis,lK.specKey="axes",lK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(lK,UV);class hK extends KV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new wE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}hK.type=r.cartesianSymlogAxis,hK.specKey="axes",hK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(hK,UV);class cK extends Rj{constructor(){super(...arguments),this.type=PE.area,this.transformerConstructor=lG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(cK.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===OH?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XE(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XE(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[ZB]},"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(gj(null===(e=vB.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),fj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),fj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new rG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}cK.type=PE.area,cK.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},cK.mark=aG,cK.transformerConstructor=lG,G(cK,Zj);class dK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(t)}}class uK extends fW{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="area",this.seriesType=PE.area}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}uK.type="area",uK.seriesType=PE.area,uK.transformerConstructor=dK,G(uK,AW);function pK(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 gK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:pK(t,e)}),fK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:pK(t,e)}),mK={type:"fadeIn"},vK={type:"growCenterIn"};function yK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mK;case"scaleIn":return vK;default:return gK(t)}}class _K extends qz{constructor(){super(...arguments),this.type=_K.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}_K.type="rect";const bK=()=>{KT(),OT(),IN("rect",WG),vB.registerMark(_K.type,_K),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),vB.registerGraphicComponent("rect",mg)},xK=Object.assign(Object.assign({},aj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function SK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=nB(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[oj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):XE(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[lj]):XE(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=XE(this._dataToPosX(t),e,i),n=XE(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[hj]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XE(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[cj]):XE(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=XE(this._dataToPosY(t),e,i),n=XE(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),CK)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},TK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:yj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(TK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}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(YP(this._option.dataSet,"addVChartProperty",NH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};YP(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new za(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new Tz(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_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=cj,s=hj,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=lj,s=oj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=vP(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)SK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=XE(this[r](t),l,i),u=XE(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!KE(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[qB],n=e[ZB],r=e[JB],d=e[QB];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?hj:oj],i=e[a?cj:lj];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[qB]:s,[ZB]:o}),c?{[JB]:u,[QB]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(mg(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>XE(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>XE(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Pj(this);this._barMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),fj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=nB(this._spec.barWidth,a)),l&&(c=Math.max(c,nB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,nB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=nB(null!==(l=i[r-1])&&void 0!==l?l:X(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 _=Ow(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}TK.type=PE.bar,TK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},TK.mark=xK,TK.transformerConstructor=kK;const MK=()=>{lW(),bK(),vB.registerAnimation("bar",((t,e)=>({appear:yK(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),OV(),$V(),vB.registerSeries(TK.type,TK)};class wK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(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 EK extends fW{constructor(){super(...arguments),this.transformerConstructor=wK,this.type="bar",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}EK.type="bar",EK.seriesType=PE.bar,EK.transformerConstructor=wK,G(EK,AW);const BK=[10,20],PK=Pw.Linear,RK="circle",OK=Pw.Ordinal,IK=["circle","square","triangle","diamond","star"],LK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},DK=Object.assign(Object.assign({},aj),{point:{name:"point",type:"symbol"}});class FK extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const zK={sizeField:!0};class HK extends Rj{constructor(){super(...arguments),this.type=PE.scatter,this.transformerConstructor=FK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),zK)})}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=`${NB}_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=`${NB}_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:PK,defaultRange:BK},"size")}getShapeAttribute(t,e){return u(e)?RK:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:OK,defaultRange:IK},"shape")}initMark(){this._symbolMark=this._createMark(HK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,HK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Pj(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(gj(null===(i=vB.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),fj("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:RK},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}HK.type=PE.scatter,HK.mark=DK,HK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},HK.transformerConstructor=FK;const jK=()=>{WN(),vB.registerAnimation("scatter",((t,e)=>Object.assign({appear:LK(0,e)},pH))),OV(),$V(),vB.registerSeries(HK.type,HK)};class NK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class UK extends fW{constructor(){super(...arguments),this.transformerConstructor=NK,this.type="scatter",this.seriesType=PE.scatter}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}UK.type="scatter",UK.seriesType=PE.scatter,UK.transformerConstructor=NK,G(UK,AW);class VK extends Ej{constructor(){super(...arguments),this.type=PE.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=`${NB}_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 WK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[GB]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[pP]=a||r})),s};class GK extends KH{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 YK extends qz{constructor(){super(...arguments),this.type=YK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}YK.type="path";const XK=()=>{vB.registerMark(YK.type,YK),KT(),cT(),vB.registerGraphicComponent("path",hg)},KK=Object.assign(Object.assign({},aj),{area:{name:"area",type:"path"}});class $K{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ua(i,e):ja[i]?(Ha[i]||(Ha[i]=Ua(i,ja[i])),Ha[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class qK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class ZK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function JK(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:qK}:bM(e)||xM(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:ZK}:null}const QK={debounce:St,throttle:At};class t${constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=bM(this._renderMode)||xM(this._renderMode),JK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return JK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,QK[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,QK[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){JK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:NP.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:NP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=QK[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=QK[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:NP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp)}))}}class e$ extends EU{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${NB}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=uB(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new $K(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===PE.map||e.type===PE.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),Tw(this._regions,(t=>{var e;if(t.type===PE.map||t.type===PE.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==PE.map&&e.type!==PE.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[pP],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}e$.type=r.geoCoordinate,G(e$,t$);const i$=()=>{vB.registerComponent(e$.type,e$)};class s$ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class n$ extends VK{constructor(){super(...arguments),this.type=PE.map,this.transformerConstructor=s$,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 !`),KP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),YP(this._dataSet,"copyDataView",tR),YP(this._dataSet,"map",WK),YP(this._dataSet,"lookup",jH);const s=KP.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new za(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:pP,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new Tz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(n$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:yj(this._spec,n$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:XB])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:XB]):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(gj(null===(t=vB.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),fj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new GK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[GB]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[GB],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return GB}getActiveMarks(){return[this._pathMark]}}n$.type=PE.map,n$.mark=KK,n$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},n$.transformerConstructor=s$;const r$=`${NB}_waterfall_default_seriesField`,a$=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[nP]=!0:delete t[nP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=o$([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}=l$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=o$(r,t,s,o,u,c,e,i),o.push(s)})),o};function o$(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}=l$(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===r$)&&(t[r$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function l$(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?gM("total.collectCountField error"):n=e[a].start;o<0?gM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const h$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},c$={type:"fadeIn"},d$={type:"growCenterIn"};function u$(t,e){switch(e){case"fadeIn":return c$;case"scaleIn":return d$;default:return gK(t,!1)}}class p$ extends qz{constructor(){super(...arguments),this.type=p$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return ag(t)}}p$.type="rule";const g$=()=>{vB.registerMark(p$.type,p$),KT(),iT(),vB.registerGraphicComponent("line",ag)},f$=Object.assign(Object.assign({},xK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),m$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:v$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function v$(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)=>v$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y${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 za(e instanceof Fa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),YP(e,"dimensionTree",m$),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 _$ extends kK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const b$={rect:T$,symbol:k$,arc:w$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=k$(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:E$,line:B$,area:B$,rect3d:T$,arc3d:w$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function x$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=b$[t])&&void 0!==i?i:b$.point;return e.series.type===PE.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=A$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:P$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function S$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==PE.sankey){const{formatFunc:t,args:n}=zH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function A$(t){return d(t)?e=>t(e.data):t}function k$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=A$(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:C$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function C$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function T$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=A$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:M$(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function M$(t){const e=[{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"]}}];return e}function w$(t){var e;const{labelSpec:i}=t,s=null!==(e=A$(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 E$(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=S$(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),Jg(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 B$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[XB]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function P$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const R$={calculationMode:!0};class O$ extends TK{constructor(){super(...arguments),this.type=PE.waterfall,this.transformerConstructor=_$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&_P(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),R$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y$(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=r$)}getSeriesKeys(){return this._seriesField===r$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),YP(this._dataSet,"waterfallFillTotal",h$),YP(this._dataSet,"waterfall",a$),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=eR(this.getViewData(),this._dataSet,{name:`${NB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Tz(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:qB,endAs:ZB,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Pj(this);this._barMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),fj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(O$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return E$(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?XE(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):XE(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&KE([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}O$.type=PE.waterfall,O$.mark=f$,O$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},O$.transformerConstructor=_$;const I$=()=>{g$(),bK(),vB.registerAnimation("waterfall",((t,e)=>({appear:u$(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(O$.type,O$)},L$=`${NB}_BOX_PLOT_OUTLIER_VALUE`;var D$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(D$||(D$={}));const F$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[L$]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class z$ extends KH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return this.series.getOutliersField();if(t===D$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case D$.MIN:return this.series.getMinField();case D$.MAX:return this.series.getMaxField();case D$.MEDIAN:return this.series.getMedianField();case D$.Q1:return this.series.getQ1Field();case D$.Q3:return this.series.getQ3Field();case D$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return e[L$];if(t===D$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case D$.MIN:return e[this.series.getMinField()];case D$.MAX:return e[this.series.getMaxField()];case D$.MEDIAN:return e[this.series.getMedianField()];case D$.Q1:return e[this.series.getQ1Field()];case D$.Q3:return e[this.series.getQ3Field()];case D$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[L$])}getDefaultContentList(t){return[{key:this.getContentKey(D$.OUTLIER),value:this.getContentValue(D$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(D$.MAX),value:this.getContentValue(D$.MAX)},{key:this.getContentKey(D$.Q3),value:this.getContentValue(D$.Q3)},{key:this.getContentKey(D$.MEDIAN),value:this.getContentValue(D$.MEDIAN)},{key:this.getContentKey(D$.Q1),value:this.getContentValue(D$.Q1)},{key:this.getContentKey(D$.MIN),value:this.getContentValue(D$.MIN)},{key:this.getContentKey(D$.SERIES_FIELD),value:this.getContentValue(D$.SERIES_FIELD)}]}}const H$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class j$ extends qz{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==tz.enter&&t.context.diffState!==tz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{H$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Zp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=vB.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const N$=()=>{vB.registerGraphicComponent("glyph",Zp),KT(),FC()},U$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],V$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class W$ extends j${constructor(){super(...arguments),this.type=W$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=U$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=V$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}W$.type="boxPlot";const G$=Object.assign(Object.assign({},aj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),Y$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},X$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},K$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),$$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=K$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=K$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=K$(t,"box").attribute.width,i=K$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=K$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=K$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=K$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=K$(t,"box").attribute.height,i=K$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},q$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=K$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=K$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=K$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=K$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=K$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=K$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=K$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=K$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=K$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class Z$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return Y$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class J$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return X$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class Q$ extends Z${computeAttribute(){return Y$(q$)(this.target,this.params,this.params.options)}}class tq extends J${computeAttribute(){return X$(q$)(this.target,this.params,this.params.options)}}class eq extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const iq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class sq extends Rj{constructor(){super(...arguments),this.type=PE.boxPlot,this.transformerConstructor=eq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),iq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(sq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(sq.mark.outlier,{key:GB,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}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=>XE(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XE(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XE(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XE(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XE(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"foldOutlierData",F$),YP(this._dataSet,"addVChartProperty",NH);const t=new za(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${NB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._outlierData=new Tz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=nB(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,nB(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,nB(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=nB(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Ow(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Pj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=vB.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(fj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(gj(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(gj(null===(a=vB.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new z$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}sq.type=PE.boxPlot,sq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},sq.mark=G$,sq.transformerConstructor=eq;const nq=()=>{N$(),iT(),OT(),vB.registerGraphicComponent("line",(t=>ag(t))),vB.registerGraphicComponent("rect",(t=>mg(t))),vB.registerMark(W$.type,W$),WN(),fH(),OV(),$V(),w_.registerBuiltInAnimate("boxplotScaleIn",Z$),w_.registerBuiltInAnimate("boxplotScaleOut",J$),w_.registerBuiltInAnimate("barBoxplotScaleIn",Q$),w_.registerBuiltInAnimate("barBoxplotScaleOut",tq),vB.registerSeries(sq.type,sq)};class rq extends qz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=rq.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?jg(t):Jg(t)}}rq.type="text";const aq=()=>{vB.registerMark(rq.type,rq),KT(),cM(),YT(),vB.registerGraphicComponent("text",Jg),vB.registerGraphicComponent("richtext",jg)};class oq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const lq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),hq={type:"fadeIn"},cq=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function dq(t,e){return"fadeIn"===e?hq:lq(t)}const uq=Object.assign(Object.assign({},xK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class pq extends kK{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 gq extends TK{constructor(){super(...arguments),this.type=PE.rangeColumn,this._barMarkType="rect",this._barName=PE.bar,this.transformerConstructor=pq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(gq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,gq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(gq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(gq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Pj(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(gj(null===(i=vB.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),fj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(gj(null===(n=vB.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),fj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new oq(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)}}gq.type=PE.rangeColumn,gq.mark=uq,gq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},gq.transformerConstructor=pq;const fq=()=>{bK(),aq(),vB.registerAnimation("rangeColumn",((t,e)=>({appear:dq(t,e),enter:lq(t),exit:cq(t),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(gq.type,gq)};var mq,vq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(mq||(mq={})),function(t){t.middle="middle",t.start="start",t.end="end"}(vq||(vq={}));class yq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const _q=Object.assign({},aG);class bq extends cK{constructor(){super(...arguments),this.type=PE.rangeArea}initMark(){this._areaMark=this._createMark(bq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new yq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}bq.type=PE.rangeArea,bq.mark=_q;class xq extends Ej{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=AU,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Ow(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:[]};Ow(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)&&Bj(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Sq(t){return kM(t)?Number.parseFloat(t):0}const Aq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&kq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[pU],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[pU]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},kq=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===Sq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Sq(i[e])),0)));function Cq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const Tq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Cq(t,!0,rR.appear)}),Mq={type:"fadeIn"},wq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Cq(t,!0,rR.enter)}),Eq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Cq(t,!0,rR.exit)});function Bq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Mq;case"growRadius":return Tq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Tq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Pq extends qz{constructor(t,e){super(t,e),this.type=Rq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[yU])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Rq extends Pq{constructor(){super(...arguments),this.type=Rq.type}}Rq.type="arc";const Oq=()=>{KT(),gC(),IN("arc",XG),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),vB.registerGraphicComponent("arc",Vp),vB.registerMark(Rq.type,Rq)},Iq=Object.assign(Object.assign({},aj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Lq extends Sj{_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=uB({},this._theme,i,t);const n=(t,e)=>uB({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Dq=`${NB}_LABEL_VISIBLE`,Fq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},zq={outerRadius:!0};class Hq extends xq{constructor(){super(...arguments),this.transformerConstructor=Lq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:QE(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:QE(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=xU,this._endAngle=SU,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[yU];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;YP(this._dataSet,"pie",Aq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:fU,asEndAngle:mU,asRatio:gU,asMiddleAngle:yU,asRadian:bU,asQuadrant:_U,asK:vU,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Hq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ew(fU)(t)}endAngleScale(t){return Ew(mU)(t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$E(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$E(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ew(Dq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),zq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Fq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[yU];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===rR.appear)return this._startAngle;if(i===rR.disappear)return this._endAngle;const r=[rR.disappear,rR.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[GB];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=gj(null===(i=vB.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Hq.transformerConstructor=Lq,Hq.mark=Iq,Hq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class jq extends Hq{constructor(){super(...arguments),this.type=PE.pie}}jq.type=PE.pie;const Nq=()=>{Oq(),vB.registerAnimation("pie",((t,e)=>({appear:Bq(t,e),enter:wq(t),exit:Eq(t),disappear:{duration:uH.disappear.duration}}))),vB.registerAnimation("emptyCircle",((t,e)=>({appear:Bq(t,e)}))),vB.registerSeries(jq.type,jq)};function Uq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const Vq=t=>({type:Uq(t.growField),options:{overall:!0}}),Wq={type:"fadeIn"},Gq=t=>({type:Uq(t.growField)}),Yq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function Xq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Wq;case"growAngle":return Vq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return Vq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const Kq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class $q extends xq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Kq)})}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(ZB),this.setInnerRadiusField(qB)}setValueFieldToPercent(){this.setRadiusField(QB),this.setInnerRadiusField(JB)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const qq=Object.assign(Object.assign({},aj),{rose:{name:"rose",type:"arc"}});class Zq extends Sj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class Jq extends HU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=vB.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=xU,this._endAngle=SU,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QE(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QE(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:aU(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Ow(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>cU(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=AU,e=0;const i=this.getChart().getSpec();return Tw(this.getRegions(),(s=>{const n=s;if(r=n.type,[PE.rose,PE.radar,PE.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(uB({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(uB({},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)}}Jq.type=r.polarAxis,Jq.specKey="axes";const Qq={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},tZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class eZ extends Jq{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}eZ.type=r.polarLinearAxis,eZ.specKey="axes",eZ.builtInTheme={axis:EV,axisLinear:XV,axisAngle:tZ,axisRadius:Qq},G(eZ,UV);const iZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(eZ.type,eZ)};class sZ extends Jq{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new iE}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,NG),t}transformScaleDomain(){}}sZ.type=r.polarBandAxis,sZ.specKey="axes",sZ.builtInTheme={axis:EV,axisBand:wV,axisAngle:tZ,axisRadius:Qq},G(sZ,VU);const nZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(sZ.type,sZ)};class rZ extends $q{constructor(){super(...arguments),this.type=PE.rose,this.transformerConstructor=Zq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(rZ.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,rZ.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XE(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XE(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(gj(null===(i=vB.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),fj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}rZ.type=PE.rose,rZ.mark=qq,rZ.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},rZ.transformerConstructor=Zq;const aZ=()=>{vB.registerSeries(rZ.type,rZ),Oq(),vB.registerAnimation("rose",((t,e)=>({appear:Xq(t,e),enter:Gq(t),exit:Yq(t),disappear:{duration:uH.disappear.duration}}))),nZ(),iZ()};class oZ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,vw(this._fromAngle,this._toAngle)&&vw(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lZ extends hH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!Cw(t)&&!Cw(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const hZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function cZ(t,e,i){return"fadeIn"===e?hZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function dZ(t,e,i){return"fadeIn"===e?hZ(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 uZ=(t,e)=>({custom:oH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),pZ=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}});class gZ extends $q{constructor(){super(...arguments),this.type=PE.radar,this.transformerConstructor=GN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(gZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:IH,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):xU},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(gj(null===(s=vB.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),fj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=vB.getAnimationInKey(e);t.setAnimationConfig(gj(null==i?void 0:i(n,r),fj(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}}}gZ.type=PE.radar,gZ.mark=pZ,gZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},gZ.transformerConstructor=GN,G(gZ,Zj);const fZ=()=>{vB.registerSeries(gZ.type,gZ),nG(),UN(),WN(),vB.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:cZ(t,e,"in"),enter:cZ(t,e,"in"),exit:cZ(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{channel:["points","center"],custom:lZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),vB.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:oZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing}]}))),vB.registerAnimation("radarGroup",((t,e)=>({appear:uZ(t,"in"),disappear:{duration:uH.disappear.duration}}))),gC(),nZ(),iZ()};class mZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const vZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(NB)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[GB]:r,[YB]:`${s}_${e}`})),r++}))})),n},yZ={fill:"#bbb",fillOpacity:.2},_Z=Object.assign(Object.assign({},aj),{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"}}),bZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},xZ={grid:{background:!0}};class SZ extends Rj{constructor(){super(...arguments),this.type=PE.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)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),bZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),xZ)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),YP(this._option.dataSet,"objFlat",vZ),YP(this._option.dataSet,"copyDataView",tR),XP(this._option.dataSet,"dataview",Ia),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(uB(yZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(SZ.mark.group),this._containerMark=this._createMark(SZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(SZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(SZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(SZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(SZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(SZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(SZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}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 WE).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:XB}}initTooltip(){this._tooltipHelper=new mZ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}SZ.type=PE.dot,SZ.mark=_Z,SZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class AZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const kZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),CZ=(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 TZ extends Rj{constructor(){super(...arguments),this.type=PE.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),YP(this._option.dataSet,"linkDotInfo",CZ),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(TZ.mark.group),this._containerMark=this._createMark(TZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(TZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(TZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new AZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}TZ.type=PE.link,TZ.mark=kZ,TZ.builtInTheme={link:{arrow:{style:{size:10}}}};const MZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"}}),wZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class EZ extends xq{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()?qB:cP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?ZB:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),wZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):xU;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):SU,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=XE(this.angleAxisHelper.dataToPosition([t[qB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XE(this.angleAxisHelper.dataToPosition([t[ZB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?XE(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(EZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[mg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const OZ=()=>{vB.registerAnimation("circularProgress",((t,e)=>({appear:RZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:uH.disappear.duration}})))};class IZ extends Sj{constructor(){super(...arguments),this._supportStack=!0}}const LZ={cornerRadius:!0,roundCap:!0};class DZ extends EZ{constructor(){super(...arguments),this.type=PE.circularProgress,this.transformerConstructor=IZ,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()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),LZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(DZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:yj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(DZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?qB:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?ZB: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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}DZ.type=PE.circularProgress,DZ.mark=BZ,DZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},DZ.transformerConstructor=IZ;const FZ=()=>{vB.registerSeries(DZ.type,DZ),Oq(),OZ(),mH(),nZ(),iZ()};function zZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const HZ={type:"fadeIn"};function jZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?HZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:zZ(t)}))(t)}class NZ extends KH{enableByType(t){return"dimension"!==t}}const UZ=Object.assign(Object.assign({},aj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),VZ={bandWidth:!0,cornerRadius:!0,clamp:!0},WZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class GZ extends Rj{constructor(){super(...arguments),this.type=PE.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),VZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),WZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(GZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return XE(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(GZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new NZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}GZ.type=PE.linearProgress,GZ.mark=UZ,GZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const YZ=()=>{bK(),vB.registerAnimation("linearProgress",((t,e)=>({appear:jZ(t,e),enter:jZ(t),disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(GZ.type,GZ)},XZ=[0],KZ=[20,40],$Z=[200,500],qZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},ZZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class JZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const QZ=`${NB}_WORD_CLOUD_TEXT`,tJ=Object.assign(Object.assign({},aj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),eJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class iJ extends Ej{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=KZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:$Z,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:XZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?QZ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:qZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||_M(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:XZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!ZZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new JZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(iJ.mark.word,{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(iJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(gj(vB.getAnimationInKey("wordCloud")(n,s),fj("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 WE).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:XB])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new AE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new AE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[GB])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:YB,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:b_.createCanvas.bind(b_),getTextBounds:gv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:sg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}iJ.mark=tJ,iJ.builtInTheme={wordCloud:eJ};function sJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||uH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=nJ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},rJ=(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=rJ(t.children,e,t,n))})),s},aJ=(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=aJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},oJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):oJ(t.children,e,i)))})),e};function lJ(t,e){let i,s;if(dJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function dJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function fJ(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 mJ(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 vJ(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 yJ(t){return{_:t,next:null,prev:null}}function _J(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];fJ(n,s,r);let a,o,l,h,c,d,u,p=yJ(s),g=yJ(n),f=yJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=nJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:AJ.defaultOpionts.nodeSort;rJ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)rJ([o],bJ(h)),aJ([o],xJ(this._getPadding,.5,a)),rJ([o],SJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);rJ([o],bJ(AJ.defaultOpionts.setRadius)),aJ([o],xJ(Ot,1,a)),c&&aJ([o],xJ(this._getPadding,o.radius/t,a)),rJ([o],SJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}AJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const kJ=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=kJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function CJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){kJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function TJ(t){return t.depth}function MJ(t,e){return e-1-t.endDepth}const wJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),EJ=(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},BJ={left:TJ,right:MJ,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:TJ,end:MJ},PJ=bt(0,1);class RJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>wJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>wJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},RJ.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):BJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return CJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[EJ(s[t.source]),EJ(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*PJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(wJ),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(wJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];OJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),IJ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},LJ.defaultOpionts,t):Object.assign({},LJ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(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]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(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-(_(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=nJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function DJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:OJ,slice:DJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?DJ:OJ)(t,e,i,s,n)}};class HJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},HJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?FJ(this.options.aspectRatio):null!==(e=zJ[this.options.splitType])&&void 0!==e?e:zJ.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=nJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function jJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=jJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=NJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function KJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*$J({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},ZJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||VJ,s=e.lossFunction||UJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:qJ(f),arcs:f})}))},JJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:QJ,triangle:QJ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function QJ(){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 tQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const eQ=t=>JJ[t]?JJ[t]():JJ.circle(),iQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function sQ(t){return d(t)?t:function(){return t}}class nQ{constructor(t){var e,i;switch(this.options=H({},nQ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=eQ(this.options.shape),this.getText=null!==(e=sQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=sQ(this.options.fontWeight),this.getTextFontSize=sQ(this.options.fontSize),this.getTextFontStyle=sQ(this.options.fontStyle),this.getTextFontFamily=sQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>iQ(10,50);break;case"random-light":this.getTextColor=()=>iQ(50,90);break;default:this.getTextColor=sQ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class aQ extends nQ{constructor(t){var e;super(H({},aQ.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<=aQ.defaultOptions.minFontSize&&(this.options.minFontSize=aQ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=rQ[this.options.spiral])&&void 0!==e?e:rQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=sQ(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}=tQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(hQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}cQ(p,this._size)&&(p=dQ(p,this._size))}else if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||lQ(p,i))&&(!i||!oQ(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 oQ(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 lQ(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,cQ=(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 dQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},pQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},gQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},fQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=tQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=eQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)gQ(n,pQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)gQ(n,pQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=pQ({x:l,y:h},o,-Math.PI/2,5),e=pQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);gQ(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=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 M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(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(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Ot=t=>0,It=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ie(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{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}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,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 Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{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 Xe(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 Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={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 Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(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=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(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=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(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 ni(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=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{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`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(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}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(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 ni(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:Ke});function oi(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 li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(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 di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(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 Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{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 Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal: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?Ci[8+bi/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 C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=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")+_i(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 wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Fi(){return new zi}function zi(){this.reset()}zi.prototype={constructor:zi,reset:function(){this.s=this.t=0},add:function(t){ji(Hi,t,this.t),ji(this,Hi.s,this.s),this.s?this.t+=Hi.t:this.s=Hi.t},valueOf:function(){return this.s}};var Hi=new zi;function ji(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Ni=1e-6,Ui=Math.PI,Vi=Ui/2,Wi=Ui/4,Gi=2*Ui,Yi=180/Ui,Xi=Ui/180,Ki=Math.abs,$i=Math.atan,qi=Math.atan2,Zi=Math.cos,Ji=Math.exp,Qi=Math.log,ts=Math.pow,es=Math.sin,is=Math.sign||function(t){return t>0?1:t<0?-1:0},ss=Math.sqrt,ns=Math.tan;function rs(t){return t>1?0:t<-1?Ui:Math.acos(t)}function as(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function os(){}function ls(t,e){t&&cs.hasOwnProperty(t.type)&&cs[t.type](t,e)}var hs={Feature:function(t,e){ls(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sUi?t+Math.round(-t/Gi)*Gi:t,e]}function As(t,e,i){return(t%=Gi)?e||i?xs(Cs(t),Ts(e,i)):Cs(t):e||i?Ts(e,i):Ss}function ks(t){return function(e,i){return[(e+=t)>Ui?e-Gi:e<-Ui?e+Gi:e,i]}}function Cs(t){var e=ks(t);return e.invert=ks(-t),e}function Ts(t,e){var i=Zi(t),s=es(t),n=Zi(e),r=es(e);function a(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*i+o*s;return[qi(l*n-c*r,o*i-h*s),as(c*n+l*r)]}return a.invert=function(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*n-l*r;return[qi(l*n+h*r,o*i+c*s),as(c*i-o*s)]},a}function Ms(t,e){(e=fs(e))[0]-=t,bs(e);var i=rs(-e[1]);return((-e[2]<0?-i:i)+Gi-Ni)%Gi}function ws(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:os,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Es(t,e){return Ki(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 Rs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function zs(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 Hs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ws(),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=zs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=es(s),r=[es(i),-Zi(i),0],a=0,o=0;Ls.reset(),1===n?s=Vi+Ni:-1===n&&(s=-Vi-Ni);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ui,M=f*x;if(Ls.add(qi(M*k*es(C),m*S+M*Zi(C))),a+=T?A+k*Gi:A,T^p>=i^_>=i){var w=vs(fs(u),fs(y));bs(w);var E=vs(r,w);bs(E);var B=(T^A>=0?-1:1)*as(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Ni||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(js))}return u}}function js(t){return t.length>1}function Ns(t,e){return((t=t.x)[0]<0?t[1]-Vi-Ni:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-Ni:Vi-e[1])}1===(Os=Fs).length&&(Is=Os,Os=function(t,e){return Fs(Is(t),e)});var Us=Hs((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?Ui:-Ui,l=Ki(r-i);Ki(l-Ui)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ui&&(Ki(i-n)Ni?$i((es(e)*(r=Zi(s))*es(i)-es(s)*(n=Zi(e))*es(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*Vi,s.point(-Ui,n),s.point(0,n),s.point(Ui,n),s.point(Ui,0),s.point(Ui,-n),s.point(0,-n),s.point(-Ui,-n),s.point(-Ui,0),s.point(-Ui,n);else if(Ki(t[0]-e[0])>Ni){var r=t[0]0,n=Ki(e)>Ni;function r(t,i){return Zi(t)*Zi(i)>e}function a(t,i,s){var n=[1,0,0],r=vs(fs(t),fs(i)),a=ms(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=vs(n,r),u=_s(n,h);ys(u,_s(r,c));var p=d,g=ms(u,p),f=ms(p,p),m=g*g-f*(ms(u,u)-1);if(!(m<0)){var v=ss(m),y=_s(p,(-g-v)/f);if(ys(y,u),y=gs(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Ki(y[0]-b)Ui^(b<=y[0]&&y[0]<=x)){var T=_s(p,(-g+v)/f);return ys(T,u),[y,gs(T)]}}}function o(e,i){var n=s?t:Ui-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Hs(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?Ui:-Ui),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Es(e,p)||Es(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&&Es(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=Zi(e),o=es(e),l=s*i;null==n?(n=e+s*Gi,r=e-l/2):(n=Ms(a,n),r=Ms(a,r),(s>0?nr)&&(n+=s*Gi));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 Ki(s[0]-t)0?0:3:Ki(s[0]-i)0?2:1:Ki(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=ws(),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=zs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ps(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(Gs,Math.min(Ws,g)),f=Math.max(Gs,Math.min(Ws,f))],b=[r=Math.max(Gs,Math.min(Ws,r)),a=Math.max(Gs,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&&(_.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 Xs(t){return t}var Ks,$s,qs,Zs,Js=Fi(),Qs=Fi(),tn={point:os,lineStart:os,lineEnd:os,polygonStart:function(){tn.lineStart=en,tn.lineEnd=rn},polygonEnd:function(){tn.lineStart=tn.lineEnd=tn.point=os,Js.add(Ki(Qs)),Qs.reset()},result:function(){var t=Js/2;return Js.reset(),t}};function en(){tn.point=sn}function sn(t,e){tn.point=nn,Ks=qs=t,$s=Zs=e}function nn(t,e){Qs.add(Zs*t-qs*e),qs=t,Zs=e}function rn(){nn(Ks,$s)}var an=tn,on=1/0,ln=on,hn=-on,cn=hn;var dn,un,pn,gn,fn={point:function(t,e){thn&&(hn=t);ecn&&(cn=e)},lineStart:os,lineEnd:os,polygonStart:os,polygonEnd:os,result:function(){var t=[[on,ln],[hn,cn]];return hn=cn=-(ln=on=1/0),t}},mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn=0,Cn={point:Tn,lineStart:Mn,lineEnd:Bn,polygonStart:function(){Cn.lineStart=Pn,Cn.lineEnd=Rn},polygonEnd:function(){Cn.point=Tn,Cn.lineStart=Mn,Cn.lineEnd=Bn},result:function(){var t=kn?[Sn/kn,An/kn]:xn?[_n/xn,bn/xn]:yn?[mn/yn,vn/yn]:[NaN,NaN];return mn=vn=yn=_n=bn=xn=Sn=An=kn=0,t}};function Tn(t,e){mn+=t,vn+=e,++yn}function Mn(){Cn.point=wn}function wn(t,e){Cn.point=En,Tn(pn=t,gn=e)}function En(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Tn(pn=t,gn=e)}function Bn(){Cn.point=Tn}function Pn(){Cn.point=On}function Rn(){In(dn,un)}function On(t,e){Cn.point=In,Tn(dn=pn=t,un=gn=e)}function In(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Sn+=(n=gn*t-pn*e)*(pn+t),An+=n*(gn+e),kn+=3*n,Tn(pn=t,gn=e)}var Ln=Cn;function Dn(t){this._context=t}Dn.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,Gi)}},result:os};var Fn,zn,Hn,jn,Nn,Un=Fi(),Vn={point:os,lineStart:function(){Vn.point=Wn},lineEnd:function(){Fn&&Gn(zn,Hn),Vn.point=os},polygonStart:function(){Fn=!0},polygonEnd:function(){Fn=null},result:function(){var t=+Un;return Un.reset(),t}};function Wn(t,e){Vn.point=Gn,zn=jn=t,Hn=Nn=e}function Gn(t,e){jn-=t,Nn-=e,Un.add(ss(jn*jn+Nn*Nn)),jn=t,Nn=e}var Yn=Vn;function Xn(){this._string=[]}function Kn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $n(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ps(t,i(s))),s.result()}return r.area=function(t){return ps(t,i(an)),an.result()},r.measure=function(t){return ps(t,i(Yn)),Yn.result()},r.bounds=function(t){return ps(t,i(fn)),fn.result()},r.centroid=function(t){return ps(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Xs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Xn):new Dn(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 qn(t){return function(e){var i=new Zn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Zn(){}function Jn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ps(i,t.stream(fn)),e(fn.result()),null!=s&&t.clipExtent(s),t}function Qn(t,e,i){return Jn(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 tr(t,e,i){return Qn(t,[[0,0],e],i)}function er(t,e,i){return Jn(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 ir(t,e,i){return Jn(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)}Xn.prototype={_radius:4.5,_circle:Kn(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=Kn(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}},Zn.prototype={constructor:Zn,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 sr=16,nr=Zi(30*Xi);function rr(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=ss(b*b+x*x+S*S),k=as(S/=A),C=Ki(Ki(S)-1)e||Ki((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Xi:0,E()):[m*Yi,v*Yi,y*Yi]},M.angle=function(t){return arguments.length?(_=t%360*Xi,E()):_*Yi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=rr(o,T=t*t),B()):ss(T)},M.fitExtent=function(t,e){return Qn(M,t,e)},M.fitSize=function(t,e){return tr(M,t,e)},M.fitWidth=function(t,e){return er(M,t,e)},M.fitHeight=function(t,e){return ir(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function dr(t){var e=0,i=Ui/3,s=cr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Xi,i=t[1]*Xi):[e*Yi,i*Yi]},n}function ur(t,e){var i=es(t),s=(i+es(e))/2;if(Ki(s)2?t[2]*Xi:0),e.invert=function(e){return(e=t.invert(e[0]*Xi,e[1]*Xi))[0]*=Yi,e[1]*=Yi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===_r?[[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 xr(t){return ns((Vi+t)/2)}function Sr(t,e){var i=Zi(t),s=t===e?es(t):Qi(i/Zi(e))/Qi(xr(e)/xr(t)),n=i*ts(xr(t),s)/s;if(!s)return _r;function r(t,e){n>0?e<-Vi+Ni&&(e=-Vi+Ni):e>Vi-Ni&&(e=Vi-Ni);var i=n/ts(xr(e),s);return[i*es(s*t),n-i*Zi(s*t)]}return r.invert=function(t,e){var i=n-e,r=is(s)*ss(t*t+i*i),a=qi(t,Ki(i))*is(i);return i*s<0&&(a-=Ui*is(t)*is(i)),[a/s,2*$i(ts(n/r,1/s))-Vi]},r}function Ar(t,e){return[t,e]}function kr(t,e){var i=Zi(t),s=t===e?es(t):(i-Zi(e))/(e-t),n=i/s+t;if(Ki(s)Ni&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Or.invert=mr(as),Ir.invert=mr((function(t){return 2*$i(t)})),Lr.invert=function(t,e){return[-e,2*$i(Ji(t))-Vi]};var zr={exports:{}},Hr=function(t,e){this.p1=t,this.p2=e};Hr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Hr.prototype.run=function(){return this.p2[0]-this.p1[0]},Hr.prototype.slope=function(){return this.rise()/this.run()},Hr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Hr.prototype.isVertical=function(){return!isFinite(this.slope())},Hr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Hr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Hr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Hr.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)},Hr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var jr=Hr,Nr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new jr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Nr(t.slice(0,s),e),o=Nr(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},Ur=Nr;!function(t){var e=Ur;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Xr,e),{tolerance:s}=i;return Vr(t,s)};var $r;!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"}($r||($r={}));const qr=(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a},Zr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return Jr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return Jr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},ta=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",O=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var ea={},ia={};function sa(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function na(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ra(t,e){var i=t+"",s=i.length;return s9999?"+"+ra(e,6):ra(e,4))+"-"+ra(t.getUTCMonth()+1,2)+"-"+ra(t.getUTCDate(),2)+(r?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"."+ra(r,3)+"Z":n?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"Z":s||i?"T"+ra(i,2)+":"+ra(s,2)+"Z":"")}function oa(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 ia;if(h)return h=!1,ea;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=$r.DSV;const s=Wr(ca,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return oa(n).parse(t)},ua=(t,e={},i)=>(i.type=$r.DSV,la(t)),pa=(t,e={},i)=>(i.type=$r.DSV,ha(t));function ga(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return fa(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 fa(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return va(t);default:throw new Error("unknown GeoJSON type")}}function fa(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=ma(t.properties),e.geometry=va(t.geometry),e}function ma(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]=ma(s):e[i]=s})),e):e}function va(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return va(t)})),e):(e.coordinates=ya(t.coordinates),e)}function ya(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return ya(t)}))}function _a(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 ba(t){for(var e,i,s=_a(t),n=0,r=1;r0}function xa(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=ga(t));var r=[];switch(t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,s)})),t;case"FeatureCollection":return xa(t,(function(t){xa(ka(t,s),(function(t){r.push(t)}))})),di(r)}return ka(t,s)}function ka(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,e)})),t;case"LineString":return Ca(_a(t),e),t;case"Polygon":return Ta(_a(t),e),t;case"MultiLineString":return _a(t).forEach((function(t){Ca(t,e)})),t;case"MultiPolygon":return _a(t).forEach((function(t){Ta(t,e)})),t;case"Point":case"MultiPoint":return t}}function Ca(t,e){ba(t)===e&&t.reverse()}function Ta(t,e){ba(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Pa=(t,e={},i)=>{i.type=$r.GEO;const s=Wr(Ea,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Aa(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=wa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=wa.bounds(t);t.bbox=e}})),t.features=l,t},Ra={},Oa=(t,e,i)=>{i.type=$r.GEO;const s=Wr(Ea,Ra,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 Fr(a,t)}))}:Fr(a,o));var a,o;return Pa(r,s,i)},Ia=(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 La=0;function Da(t="dataset"){return La>1e8&&(La=0),t+"_"+La++}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:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class za{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof za||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Zr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}$n();const Ha={},ja={albers:gr,albersusa:function(){var t,e,i,s,n,r,a=gr(),o=pr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=pr().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)}},Na=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ua(t,e){return function i(){const s=e();return s.type=t,s.path=$n().projection(s),s.copy=s.copy||function(){const t=i();return Na.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ga 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=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Za.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Ja(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(Ja(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,Ja(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Ja(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 $a))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Za.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Qa(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ka,this.rootWheelEvent=new $a,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const so=Nt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,fo;function mo(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;tfo){let t,e=uo;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 wo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Fo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Ho(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new jo(i,n),new jo(n,s)]}class jo extends Eo{constructor(t,e){super(),this.type=xo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p1.x):t===bo.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class No{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new jo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===bo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===bo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Uo extends No{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?bo.ROW:bo.COLUMN;return"monotoneY"===t?new Uo(t,s):new No(t,s)}class Go{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,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Xo(new Go(n,s),t),n}function Xo(t,e){return Vo(t,e,1)}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 $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&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 qo(t,e){return Vo(t,e,2)}function Zo(t,e={}){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 qo(new $o(n,s),t),n}function Jo(t){return t<0?-1:1}function Qo(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(Jo(r)+Jo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function tl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function el(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 il{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:el(this,this._t0,tl(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,el(this,tl(this,e=Qo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:el(this,this._t0,e=Qo(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 sl extends il{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function nl(t,e){return Vo(t,e,2)}function rl(t,e={}){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 nl(new il(n,s),t),n}function al(t,e){return Vo(t,e,2)}function ol(t,e={}){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 al(new sl(n,s),t),n}let ll=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class hl extends ll{lineEnd(){this.context.closePath()}}function cl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new ll(r,e,n),t),r}function dl(t,e){return Vo(t,e,1)}function ul(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new hl(r,e,n),t),r}class pl extends Go{lineEnd(){this.context.closePath()}}function gl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return fl(new pl(n,s),t),n}function fl(t,e){return Vo(t,e,1)}function ml(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function vl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Yo(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const yl=vl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const _l=vl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class bl extends Eo{constructor(t,e,i){super(),this.type=xo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Lo(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p2.x):t===bo.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Lo(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new bl(i,a,r),new bl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class xl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new jo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new bl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Sl(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return Zo(t,i);case"monotoneX":return rl(t,i);case"monotoneY":return ol(t,i);case"step":return cl(t,.5,i);case"stepClosed":return ul(t,.5,i);case"stepBefore":return cl(t,0,i);case"stepAfter":return cl(t,1,i);case"catmullRom":return yl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return _l(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return gl(t,i)}}class Al extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.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([lo.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([lo.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([lo.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([lo.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([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new xl(this);wo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];To(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.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=mo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Sl(e,i);"x"===s?this.direction=bo.ROW:"y"===s?this.direction=bo.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[lo.M]=this.moveToTransform,t[lo.L]=this.lineToTransform,t[lo.Q]=this.quadraticCurveToTransform,t[lo.C]=this.bezierCurveToTransform,t[lo.AT]=this.arcToTransform,t[lo.E]=this.ellipseTransform,t[lo.R]=this.rectTransform,t[lo.A]=this.arcTransform,t[lo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),wo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===bo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===bo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),$l=Object.assign(Object.assign({},Nl),{points:[],cornerRadius:0,closePath:!0}),ql=Object.assign(Object.assign({},Nl),{width:100,height:100,spikes:5,thickness:.5}),Zl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Ql=Object.assign(Object.assign({},Nl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),th=Object.assign(Object.assign(Object.assign({},Nl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),eh=Object.assign(Object.assign(Object.assign({},Nl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ih=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Nl),{fill:!0,cornerRadius:0,cornerType:"round"}),sh=Object.assign(Object.assign({},ih),{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});class nh{}const rh=Symbol.for("@visactor/vrender-core/application-state");function ah(){const t=globalThis;return t[rh]||(t[rh]={application:new nh}),t[rh]}const oh=ah().application;class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?oh.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):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?oh.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"},lh.cache.set(t,s),s.dataPromise=oh.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oh.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oh.global.loadBlob(t):"json"===e&&(i.dataPromise=oh.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=oh.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{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 Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Ph=new class extends Th{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Ih(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{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 Ih(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ih(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{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 Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Gh=new class extends Th{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(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 Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+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(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{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 Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{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 ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{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 sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{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 rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(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 dc=new class extends Th{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 cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(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 pc=new class extends Th{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 uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(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 fc=new class extends Th{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 gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(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 vc=new class extends Th{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 mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(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 Ac=new class extends Th{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 Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{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)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),wo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(wo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}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 Ec=[wh,Eh,Ph,Oh,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{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 Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ic(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ic(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ic(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 Rc(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 Rc(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 Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;eqc.set(t,!0)));const Zc=new Map;function Jc(t){if(qc.has(t))return!0;if(Zc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Qc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Zc.set(t,!0)));const td=Xc(),ed=Xc(),id=Xc(),sd=Xc(),nd=Xc(),rd=Xc(),ad=Xc(),od=Xc(),ld=Xc(),hd=Xc(),cd=Xc(),dd=Xc(),ud=Xc(),pd=Xc(),gd=Xc(),fd=Xc(),md=Xc(),vd=Symbol.for("GraphicService"),yd=Symbol.for("GraphicCreator"),_d={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},bd=Object.keys(_d),xd={"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"},Sd=Object.keys(xd),Ad={duration:200,easing:"cubicOut"},kd=Symbol.for("CanvasFactory"),Cd=Symbol.for("Context2dFactory");function Td(t){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.canvasFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Md=1e-4,wd=Math.sqrt(3),Ed=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Rd(t){return"number"==typeof t&&Number.isFinite(t)}const Od=[0,0],Id=[0,0],Ld=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Fd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function zd(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 Hd(t){return(t%=Ut)<0&&(t+=Ut),t}function jd(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+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Vd(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(Bd(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 Yd=[-1,-1,-1],Xd=[-1,-1];function Kd(){const t=Xd[0];Xd[0]=Xd[1],Xd[1]=t}function $d(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(Bd(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,Ed):Math.pow(i,Ed),s=s<0?-Math.pow(-s,Ed):Math.pow(s,Ed);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+wd*Math.sin(e)))/(3*a),h=(-o+i*(s-wd*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,Yd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Kd(),p=zd(e,s,r,o,Xd[0]),u>1&&(g=zd(e,s,r,o,Xd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Yd);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=Fd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Yd[0]=-l,Yd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Yd[0]+t&&a<=Yd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Yd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Jd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function Qd(t,e){let i=Jd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Jd(i-n)):e&&i1&&(i||(h+=Oe(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;tu[0]=S,tu[1]=A,Qd(tu,Boolean(a[6])),S=tu[0],A=tu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case lo.M:u=m,p=v,c=u,d=p;break;case lo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case lo.C:if(i){if(Nd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(jd(c,d,m,v,y,_,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case lo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Ud(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Zd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case lo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case lo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class su{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(su.IsGradientStr(t))try{const e=iu(t)[0];if(e){if("linear"===e.type)return su.ParseLinear(e);if("radial"===e.type)return su.ParseRadial(e);if("conic"===e.type)return su.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:su.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:su.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function au(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ou(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];return 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}function lu(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];return 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}function hu(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];return 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,t}function cu(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 du(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 uu(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function pu(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 gu(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];return Math.abs(g-b)0&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Cu),function(t,e,i){return eu(t,0,!1,e,i)}(this.path.commandList,Cu.x,Cu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Cu);const i=nu(this,this.lineWidth,this.dpr);return function(t,e,i,s){return eu(t,e,!0,i,s)}(this.path.commandList,i,Cu.x,Cu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ku,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}const Mu={WIDTH:500,HEIGHT:500,DPR:1};class wu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Mu.WIDTH,height:n=Mu.HEIGHT,dpr:r=Mu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Eu;wu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Eu||(Eu={}));class Bu{static Get(t,e=Eu.Color1,i=[0,0,0,1]){if(e===Eu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Eu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Pu(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ru(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ou(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ou(t,e,i,s,n)}function Ou(t,e,i,s,n){if(!t||!e)return t&&Pu(t)||e&&Pu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Eu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Eu.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:Pu(a)})))});return o?Ru(r,l,i,s,n):Ru(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 Iu(s,n,i);if("radial"===s.gradient)return Lu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Pu(Fu(r,a,i),s)}function Iu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(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]}function zu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const Hu=[0,0,0,0],ju=[0,0,0,0];function Nu(t,e,i){return Bu.Get(t,Eu.Color255,Hu),Bu.Get(e,Eu.Color255,ju),`rgba(${Math.round(Hu[0]+(ju[0]-Hu[0])*i)},${Math.round(Hu[1]+(ju[1]-Hu[1])*i)},${Math.round(Hu[2]+(ju[2]-Hu[2])*i)},${Hu[3]+(ju[3]-Hu[3])*i})`}class Uu{static GetCanvas(){try{return Uu.canvas||(Uu.canvas=oh.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 Vu extends Ye{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Gu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;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),Ru(o.color,l.color,h,!1)}function Yu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Uu.GetCanvas(),d=Uu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Ku(t){return null==t?void 0:t}class $u{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Ku(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Xu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Ku(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function qu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Zu(t){if(!qu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Zu(t[i])})),e}function Ju(t,e){var i;const s=null!==(i=Zu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];qu(n)&&qu(i)?s[t]=Ju(n,i):s[t]=Zu(i)})),s}class Qu{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Zu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];qu(r)&&qu(n)?t[i]=Ju(r,n):!qu(r)&&qu(a)&&qu(n)?t[i]=Ju(a,n):t[i]=Zu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?tp.PAINT|tp.BOUNDS|tp.PICK:tp.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?tp.PAINT|tp.BOUNDS:tp.PAINT}};class sp{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Ad;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:_o.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:_o.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:_o.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const np=new $u;function rp(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,ap(t),!0)}function ap(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=np.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function op(t){if(t)return t.parentScope&&op(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&ap(t),t}function lp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function hp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function cp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,hp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),lp(null!=e?e:t.ownerStage))}const dp=new Ve,up=new Ge,pp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],gp=["x","y"],fp=["scaleX","scaleY"],mp=["angle"],vp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),yp=new re,_p=[],bp=tp.PAINT|tp.SHAPE|tp.BOUNDS|tp.TRANSFORM|tp.LAYOUT;function xp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Sp(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Sp(s):s})),i}function Ap(t,e){return t===e||!!(xp(t)||xp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function kp(t,e){var i;const s=null!==(i=Sp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];xp(n)&&xp(i)?s[t]=kp(n,i):s[t]=Sp(i)})),s}const Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Tp extends Ga{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,hp(this.stage,this),lp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&op(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(op(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new $u).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Sp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&xp(n)&&xp(s)?e[t]=kp(n,s):e[t]=Sp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Sp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Ap(a,o)||(s.set(n,{prev:a,next:o}),t[n]=Sp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ip[t];return n?n(e,i):null!==(s=ep[t])&&void 0!==s?s:tp.PAINT}(e,i,s):null!==(n=ep[e])&&void 0!==n?n:tp.PAINT;return r&tp.PICK&&(r|=tp.BOUNDS),r===tp.PAINT&&this.needUpdateTag(e)&&(r=tp.SHAPE|tp.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&bp)!==bp?(t&tp.SHAPE?this.addUpdateShapeAndBoundsTag():t&tp.BOUNDS&&this.addUpdateBoundTag(),t&tp.PAINT&&this.addUpdatePaintTag(),t&tp.TRANSFORM&&this.addUpdatePositionTag(),t&tp.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=tp.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&vo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Ep.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];dp.clear();const n=[];s.forEach((t=>{const e=(new Al).fromString(t.d),i={};Sd.forEach((e=>{t[e]&&(i[xd[e]]=t[e])})),n.push({path:e,attribute:i}),dp.union(e.bounds)}));const r=dp.width(),a=dp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Ep.userSymbolMap[t]=l,l}const i=(new Al).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Ep.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return wo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&vo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&vo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&vo.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&vo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=vo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===yo.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===_o.STATE||null!=i&&i>=_o.ANIMATE_BIND&&i<=_o.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===_o.STATE||null!=o&&o>=_o.ANIMATE_BIND&&o<=_o.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Ap(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:_p,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ad}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:_p,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Sp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:_o.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:_p,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:_p,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,scaleX:i=Rl.scaleX,scaleY:s=Rl.scaleY,angle:n=Rl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(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,!0),oh.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Rl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=up.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=oh.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Al).fromString(t):this.pathProxy=new Al,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:oh.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new qa(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ga.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:_o.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:_o.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||oh.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Tu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Tp.userSymbolMap={};const Mp=Symbol.for("@visactor/vrender-core/graphic-class");function wp(){var t;const e=globalThis;return null!==(t=e[Mp])&&void 0!==t||(e[Mp]={Graphic:Tp}),e[Mp]}const Ep=wp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!vp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Lp=Op();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Rp.forEach((t=>{this._defaultTheme[t]=Object.create(Lp[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Rp.forEach((s=>{const n=Object.create(Lp[s]);t&&t[s]&&Ip(n,t[s]),i[s]&&Ip(n,i[s]),e[s]&&Ip(n,e[s]),this.combinedTheme[s]=n})),e.common&&Rp.forEach((t=>{Ip(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 Fp=new Dp;function zp(t,e){return t.glyphHost?zp(t.glyphHost):e?(t.isContainer,e):Hp(t)||t.attachedThemeGraphic&&zp(t.attachedThemeGraphic)||Fp.getTheme()}function Hp(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)):Fp.getTheme()}return null}const jp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Np=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...pp];class Up extends Ep{constructor(t){super(t),this.type="arc",this.numberType=td}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return zp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Np)}needUpdateTag(t){return super.needUpdateTag(t,Np)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const Wp=["segments","points","curveType","curveTension",...pp];class Gp extends Ep{constructor(t){super(t),this.type="area",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return zp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Al;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Gp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gp.NOWORK_ANIMATE_ATTR}}function Yp(t){return new Gp(t)}Gp.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Xp=["radius","startAngle","endAngle",...pp];class Kp extends Ep{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return zp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Xp)}needUpdateTag(t){return super.needUpdateTag(t,Xp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Al,s.arc(0,0,r,a,o),s}clone(){return new Kp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kp.NOWORK_ANIMATE_ATTR}}function $p(t){return new Kp(t)}Kp.NOWORK_ANIMATE_ATTR=Cp;class qp extends Ep{constructor(t){super(t),this.type="glyph",this.numberType=nd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return zp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new qp(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return qp.NOWORK_ANIMATE_ATTR}}function Zp(t){return new qp(t)}var Jp;qp.NOWORK_ANIMATE_ATTR=Cp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Jp||(Jp={}));let Qp=class t extends Ep{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rd,this._childUpdateTag=vo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(rp(this.sharedStateScope,t),cp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===yo.GLOBAL){const i=new re(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&vo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,dx:i=Rl.dx,dy:s=Rl.dy,scaleX:n=Rl.scaleX,scaleY:r=Rl.scaleY,angle:a=Rl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return zp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=vo.CLEAR_BOUNDS,this._childUpdateTag&=vo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&vo.UPDATE_BOUNDS||(this._childUpdateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&vo.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=oh.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&rp(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return ap({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Cp;const eg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...pp];class ig extends Ep{constructor(t){super(t),this.type="image",this.numberType=ad,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return zp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ih[t]}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}clone(){return new ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ig.NOWORK_ANIMATE_ATTR}}function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Cp);const ng=["segments","points","curveType","curveTension",...pp];let rg=class t extends Ep{constructor(t={}){super(t),this.type="line",this.numberType=od}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=bh(i,s,e))}getGraphicTheme(){return zp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,ng)}needUpdateTag(t){return super.needUpdateTag(t,ng)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Al;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ag(t){return new rg(t)}rg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const og=["path","customPath",...pp];class lg extends Ep{constructor(t){super(t),this.type="path",this.numberType=ld}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Al?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Al?this.cache:t.path)}getGraphicTheme(){return zp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Al).fromString(t.path):t.customPath&&(this.cache=new Al,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,og)}needUpdateTag(t){return super.needUpdateTag(t,og)}toCustomPath(){return(new Al).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new lg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lg.NOWORK_ANIMATE_ATTR}}function hg(t){return new lg(t)}lg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const cg=["points","cornerRadius",...pp];class dg extends Ep{constructor(t){super(t),this.type="polygon",this.numberType=hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return zp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,cg)}needUpdateTag(t){return super.needUpdateTag(t,cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Al,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Cp;const pg=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}},gg=["width","x1","y1","height","cornerRadius",...pp];class fg extends Ep{constructor(t){super(t),this.type="rect",this.numberType=dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return zp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,gg)}needUpdateTag(t){return super.needUpdateTag(t,gg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=pg(e);return t=new Al,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fg.NOWORK_ANIMATE_ATTR}}function mg(t){return new fg(t)}fg.NOWORK_ANIMATE_ATTR=Cp;const vg=Symbol.for("EnvContribution"),yg=Symbol.for("VGlobal"),_g="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",bg={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"}},xg=!0,Sg=!1,Ag=/\w|\(|\)|-/,kg=/[.?!,;:/,。?!、;:]/,Cg=/\S/,Tg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=oh.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=wg(t,a)),a}function wg(t,e,i=!1){let s=e;for(;Ag.test(t[s-1])&&Ag.test(t[s])||kg.test(t[s]);)if(s--,s<=0)return i?Eg(t,e):e;return s}function Eg(t,e){let i=e;for(;Ag.test(t[i+1])&&Ag.test(t[i])||kg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=oh.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Pg{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=bg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Rg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Og{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Rg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Mg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Ig extends ig{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(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=ih.width,height:e=ih.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 Lg{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 Ig?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Cg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Ig)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sg;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,Tg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ru(t,s,{AABBBounds:i}):s,Tg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Ig)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Ig?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=bg[this.direction]}store(t){if(t instanceof Ig){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 Lg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Ig?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character,t.ascentDescentMode),new Og(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Fg=!1;try{Fg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Fg=!1}const zg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...pp];class Hg extends Ep{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=pd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return zp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1)))}static splitText(t){if(Fg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Hg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),oh.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Hg.AllSingleCharacter(y)&&(y=Hg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Pg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Hg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Hg.NOWORK_ANIMATE_ATTR}}function jg(t){return new Hg(t)}Hg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);class Ng extends Qp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ug(t){return new Ng(t)}const Vg=["symbolType","size",...pp];let Wg=class t extends Ep{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=fd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return zp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Gc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Al).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Al).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Gg(t){return new Wg(t)}function Yg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Xg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Kg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);class $g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Tl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=md}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return zp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Zg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=oh.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Gc(n,o/Math.abs(r+a),!0,l),i.union(n)}return oh.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new $g(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new $g(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Yg(y,a),e=this.cache.verticalList.length*v,i=Xg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>$c(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Kc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Yg(y,a),A=x.verticalList.length*v,k=Xg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=qg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=qg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Zg.baselineMapAlign}getAlignMapBaseline(){return Zg.alignMapBaseline}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),Zg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Zg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Qg=["heightLimit","lineClamp"];class tf extends Zg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new $g(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 uf extends df{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let pf=0;class gf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=oh.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++pf,t),this.tryRunAnimationFrameNextFrame(),pf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class ff{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var mf=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 vf extends ff{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new uf(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return mf(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class yf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Td(Object.assign({nativeCanvas:oh.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Td(Object.assign({nativeCanvas:oh.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const _f=new yf,bf=Symbol.for("VWindow"),xf=Symbol.for("WindowHandlerContribution");function Sf(t){const e=oh.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Af extends ff{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(t=oh.global,e=Sf){super(),this.handlerFactory=e,this.hooks={onChange:new uf(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class kf{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=oh.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=_f.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=oh.windowFactory)||void 0===s?void 0:s.call(oh))&&void 0!==n?n:new Af(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var Cf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Cf||(Cf={}));const Tf=new Ge;class Mf{constructor(){this.matrix=new Ge}init(t){return this.mode=Cf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Cf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}scale(t,e,i){return this.mode===Cf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Cf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Tf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}translate(t,e){return this.mode===Cf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Cf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const wf=Symbol.for("@visactor/vrender-core/factory-state");function Ef(){const t=globalThis;return t[wf]||(t[wf]={pluginClasses:{}}),t[wf]}class Bf{constructor(){this.global=oh.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Pf=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 Rf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Of(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Ff{constructor(){this.time=So.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(jf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=zp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Kf(t,e,i,s)}}const zf=new Ff,Hf=new Set(["top","center","bottom"]);function jf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Nf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Uf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Uf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Nf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Gf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Hf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Yf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Xf(t){if(!t)return null;const e=Yf(t.naturalWidth,t.videoWidth,t.width),i=Yf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Kf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Xf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Gf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=_f.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),_f.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class $f{constructor(t){this.subRenderContribitions=t,this.time=So.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)}))}}class qf{constructor(){this.time=So.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Zf=new qf;class Jf{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Qf=new Jf,tm={getContributions:()=>[]};class em{constructor(t=[],e=tm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Of(e,Nl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:oh.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:tm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Su.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lf(e,i,Nl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Su.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),Su.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||function(){const t=oh.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class sm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class nm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class am{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const om={getContributions:()=>[]};class lm{constructor(t=om,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new rm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class hm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class cm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=oh.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=oh.global.getRequestAnimationFrame();this.rafId=t((()=>{oh.global.devicePixelRatio!==this.dpr&&(this.dpr=oh.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=oh.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class dm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oh.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const um=new Ve;class pm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&vo.UPDATE_PAINT)||s._updateTag&vo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(um.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(um,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let gm;function fm(){if(null==gm)try{const t=document.createElement("canvas"),e=t.getContext("2d");gm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),gm&&(gm=!!document.createElement)}catch(t){gm=!1}}function mm(){fm();const t=oh.global&&oh.global.env;return t?"browser"===t:gm}function vm(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(au(t),cu(t,t,[n+o,r+l,a+h]),cu(t,t,[y[0],y[1],y[2]]),ou(t,t,g),lu(t,t,p),cu(t,t,[-y[0],-y[1],y[2]]),uu(t,t,[c,d,u]),f){const i=Au.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]}cu(i,i,[s[0],s[1],0]),hu(i,i,f),cu(i,i,[-s[0],-s[1],0]),pu(t,t,i)}}function ym(t){const{alpha:e,beta:i}=t.attribute;return e||i}class _m{constructor(t=lf){this.creator=t,this.hooks={onAttributeUpdate:new uf(["graphic"]),onSetStage:new uf(["graphic","stage"]),onRemove:new uf(["graphic"]),onRelease:new uf(["graphic"]),onAddIncremental:new uf(["graphic","group","stage"]),onClearIncremental:new uf(["graphic","group","stage"]),beforeUpdateAABBBounds:new uf(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uf(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uf(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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=Xg(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=Yg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Gc(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;Gc(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&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const bm="white";class xm extends Qp{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:bm}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new uf(["stage"]),afterRender:new uf(["stage"]),afterClearScreen:new uf(["stage"]),afterClearRect:new uf(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:oh.global,!this.global.env&&mm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:oh.windowFactory)&&void 0!==n?n:()=>new Af(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=oh.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=oh.renderServiceFactory)||void 0===h?void 0:h.call(oh))&&void 0!==c?c:oh.renderService)&&void 0!==d?d:new im,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=oh.pluginServiceFactory)||void 0===p?void 0:p.call(oh))&&void 0!==g?g:oh.pluginService)&&void 0!==f?f:new lm,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:oh.layerService)&&void 0!==v?v:new Mm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:oh.graphicService)&&void 0!==b?b:new _m,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:bm,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,ap(s)),cp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new io(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=Cm.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=Cm.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Cm.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new hm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new cm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new dm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new pm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Cm.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Cm.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Cm.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return ap({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class Sm{constructor(t=xm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Am extends Qp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oh.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=>{oh.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)))}}class km{constructor(t=Am){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let Cm=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Tm(t){const e=oh.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}Cm._pluginClasses=Ef().pluginClasses;class Mm{static GenerateLayerId(){return`${Mm.idprefix}_${Mm.prefix_count++}`}constructor(t=oh.global,e=new km,i=Tm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Mm.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)}}Mm.idprefix="visactor_layer",Mm.prefix_count=0;const wm=Symbol.for("TransformUtil"),Em=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Pm=Symbol.for("StaticLayerHandlerContribution"),Rm=Symbol.for("DynamicLayerHandlerContribution"),Om=Symbol.for("VirtualLayerHandlerContribution"),Im=Symbol.for("@visactor/vrender-core/contribution-store-state");function Lm(){const t=globalThis;return t[Im]||(t[Im]={store:new Map}),t[Im]}const Dm=Symbol("ContributionProvider");class Fm{constructor(t,e){this.serviceIdentifier=t,this.container=e,Nm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function zm(t,e){return new Fm(t,e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).inSingletonScope().whenTargetNamed(e)}function jm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).whenTargetNamed(e)}class Nm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}Nm.store=Lm().store;class Um{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=th.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=wg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Um{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Gm({bind:t}){t(yg).toDynamicValue((({container:t})=>new vf(zm(vg,t)))).inSingletonScope(),t(bf).to(Af),t(Em).toDynamicValue((({container:t})=>new kf(zm(Vm,t)))).inSingletonScope(),t(wm).to(Mf).inSingletonScope(),t(Bm).to(Mm).inSingletonScope()}const Ym=Symbol.for("RenderService"),Xm=Symbol.for("BeforeRenderConstribution");function Km({bind:t}){t(Ym).to(im)}const $m=Symbol.for("GraphicPicker"),qm=Symbol.for("PickerService"),Zm=Symbol.for("BoundsPicker"),Jm=Symbol.for("GlobalPickerService"),Qm=Symbol.for("PickItemInterceptor"),tv=Symbol.for("PickServiceInterceptor"),ev=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ed,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},iv=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class sv extends fg{constructor(t){super(t),this.type="rect3d",this.numberType=ud}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return zp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,rv)}needUpdateTag(t){return super.needUpdateTag(t,rv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Al,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new av(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return av.NOWORK_ANIMATE_ATTR}}function ov(t){return new av(t)}av.NOWORK_ANIMATE_ATTR=Cp;class lv extends Up{constructor(t){super(t),this.type="arc3d",this.numberType=ed}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return lv.NOWORK_ANIMATE_ATTR}}function hv(t){return new lv(t)}lv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);class cv extends dg{constructor(t){super(t),this.type="pyramid3d",this.numberType=cd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return cv.NOWORK_ANIMATE_ATTR}}function dv(t){return new cv(t)}let uv,pv;function gv(t){return uv||(uv=cf("text",{})),uv.initAttributes(t),uv.AABBBounds}function fv(t){return pv||(pv=cf("richtext",{})),pv.setAttributes(t),pv.AABBBounds}cv.NOWORK_ANIMATE_ATTR=Cp;class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class vv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=zp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Su.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class _v{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=ev(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function bv({bind:t,isBound:e}){e(qm)||(t(Jm).toSelf(),t(qm).toService(Jm)),t(_v).toSelf().inSingletonScope(),t(Qm).toService(_v),t(vv).toSelf().inSingletonScope(),t(Qm).toService(vv),t(yv).toSelf().inSingletonScope(),t(Qm).toService(yv),Hm(t,Qm),t(mv).toSelf().inSingletonScope(),t(tv).toService(mv),Hm(t,tv)}function xv({bind:t}){t(vd).to(_m),t(yd).toConstantValue(lf)}const Sv=Symbol.for("AutoEnablePlugins"),Av=Symbol.for("PluginService");class kv{constructor(){this.type="static",this.offscreen=!1,this.global=oh.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Td({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()}}function Cv(t){(function({bind:t}){Hm(t,vg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),Hm(t,Vm)}({bind:t.bind}),function({bind:t}){t(kv).toSelf(),t(Pm).toService(kv)}({bind:t.bind})}const Tv=Ht/2;function Mv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Tv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Tv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Tv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Tv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function wv(t,e){return!(!t&&!e)}function Ev(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Pv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Rv(t,e){return t*e>0}function Ov(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Iv(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*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Fv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=Lv(g,f,u,p,n,t,Number(c)),l=Lv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=Lv(S,A,b,x,r,-n,Number(c)),l=Lv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const zv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Hv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=_f.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])),_f.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,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=_f.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Gg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:zv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=_f.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),_f.free(l),c}_f.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const jv=new Hv;class Nv{constructor(){this.time=So.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:nu(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Fv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Uv=new Nv,Vv=jv,Wv=zf;class Gv{constructor(){this.time=So.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Yv=new Gv,Xv=jv,Kv=zf;class $v extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(jf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const qv=new $v;function Zv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Jv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:nu(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Mv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class Qv{constructor(){this.time=So.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;Zv(p)&&(u.doStroke=!1)}}class ty{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Zv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Mv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ey=new Jv,iy=jv,sy=zf;class ny extends Jv{constructor(){super(...arguments),this.time=So.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)}}const ry=new ny,ay=zf;class oy{constructor(){this.time=So.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class ly{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const hy=new oy,cy=new ly,dy=jv,uy=zf,py=jv,gy=zf;class fy extends Hv{constructor(){super(...arguments),this.time=So.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:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class my{constructor(t){this.groupRenderContribitions=t,this.numberType=rd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:zp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Pv(p,m,g,f,c),w=Ov(p,v,g,f),E=wv(c,u),B=Ev(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Mv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===So.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===So.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=oh.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=zp(t,null==s?void 0:s.theme).group,i=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(i,p||i,n),a.modelMatrix=i,Au.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Au.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var vy,yy=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"}(vy||(vy={}));class _y extends em{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=vy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uf([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return yy(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:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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 yy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return yy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>yy(this,void 0,void 0,(function*(){if(2!==t.count)yield If(t,Nl.zIndex,((i,s)=>{if(this.status===vy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return yy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return yy(this,void 0,void 0,(function*(){this.rendering&&(this.status=vy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=vy.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 yy(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:()=>yy(this,void 0,void 0,(function*(){yield If(t,Nl.zIndex,(t=>yy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const by=Symbol.for("IncrementalDrawContribution"),xy=Symbol.for("ArcRender"),Sy=Symbol.for("Arc3dRender"),Ay=Symbol.for("AreaRender"),ky=Symbol.for("CircleRender"),Cy=Symbol.for("GraphicRender"),Ty=Symbol.for("GroupRender"),My=Symbol.for("LineRender"),wy=Symbol.for("PathRender"),Ey=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Py=Symbol.for("Rect3DRender"),Ry=Symbol.for("SymbolRender"),Oy=Symbol.for("TextRender"),Iy=Symbol.for("RichTextRender"),Ly=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Fy=Symbol.for("ImageRender"),zy=Symbol.for("RenderSelector"),Hy=Symbol.for("DrawContribution"),jy=Symbol.for("StarRender"),Ny=Symbol.for("DrawItemInterceptor"),Uy=new Ve,Vy=new Ve;class Wy{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){Uy.copy(s.dirtyBounds),Vy.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,Su.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Uy),s.backupDirtyBounds.copy(Vy)),!0}}class Gy{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}}class Yy{constructor(){this.order=1,this.interceptors=[new Wy,new Ky,new Xy,new Gy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Au.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const $y=Symbol.for("ArcRenderContribution"),qy=Symbol.for("AreaRenderContribution"),Zy=Symbol.for("CircleRenderContribution"),Jy=Symbol.for("GroupRenderContribution"),Qy=Symbol.for("ImageRenderContribution"),t_=Symbol.for("PathRenderContribution"),e_=Symbol.for("PolygonRenderContribution"),i_=Symbol.for("RectRenderContribution"),s_=Symbol.for("SymbolRenderContribution"),n_=Symbol.for("TextRenderContribution"),r_=Symbol.for("StarRenderContribution"),a_=Symbol.for("CommonRenderContribution"),o_=Symbol.for("InteractiveSubRenderContribution");function l_(t){!function({bind:t}){t(Ff).toSelf().inSingletonScope(),t(Hv).toSelf().inSingletonScope(),t(Hy).to(em),t(by).to(_y),t(Ty).toDynamicValue((({container:t})=>new my(zm(Jy,t)))).inSingletonScope(),t(Cy).toService(Ty),Hm(t,Jy),Hm(t,o_),t($f).toDynamicValue((({container:t})=>new $f(zm(o_,t)))).inSingletonScope(),Hm(t,Cy),t(Yy).toSelf().inSingletonScope(),t(Ny).toService(Yy),Hm(t,Ny)}({bind:t.bind})}class h_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class c_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new h_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function d_(){return new c_}const u_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const p_=function(){const t=globalThis;return t[u_]||(t[u_]={legacyBindingContext:d_(),preloaded:!1}),t[u_]}(),g_=p_.legacyBindingContext;function f_(){p_.preloaded||(p_.preloaded=!0,Gm({bind:g_.bind}),xv({bind:g_.bind}),Km({bind:g_.bind}),bv({bind:g_.bind,isBound:g_.isBound}),function({bind:t}){t(Av).to(lm),jm(t,Sv)}({bind:g_.bind}),Cv(g_),l_(g_))}function m_(){return g_}function v_(t){f_();const[e]=g_.getAll(t);return e}function y_(t,e){return f_(),g_.getNamed(t,e)}function __(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const b_=__((()=>v_(yg)));oh.global=b_;class x_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?oh.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:oh.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Kg("text"===t.type&&t.attribute?t.attribute:zp(t).text)}getTransformOfText(t){const e=zp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=oh.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));oh.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===oh.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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&&oh.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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"===oh.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 S_=()=>{Cm.registerPlugin("HtmlAttributePlugin",x_)};class A_ extends x_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?oh.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&oh.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const k_=()=>{Cm.registerPlugin("ReactAttributePlugin",A_)};class C_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return C_.instance||(C_.instance=new C_),C_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function T_(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function M_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:w_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=T_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:w_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=T_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const O=i*x+B;O>0&&E.wait(O);let I=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(E,e,p,L);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=T_(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:w_.builtInAnimateMap[r],m=t.custom?t.customType:T_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{M_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}w_.builtInAnimateMap={};const E_="appear",B_="disappear",P_="update",R_="highlight",O_="unhighlight";class I_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class L_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyHighlightState(t,e){this.applyState([R_],[{name:R_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([O_],[{name:O_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new L_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new I_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class F_{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-F_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*F_.bounceIn(2*t):.5*F_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){F_[t]=e}}function z_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}F_.quadIn=F_.getPowIn(2),F_.quadOut=F_.getPowOut(2),F_.quadInOut=F_.getPowInOut(2),F_.cubicIn=F_.getPowIn(3),F_.cubicOut=F_.getPowOut(3),F_.cubicInOut=F_.getPowInOut(3),F_.quartIn=F_.getPowIn(4),F_.quartOut=F_.getPowOut(4),F_.quartInOut=F_.getPowInOut(4),F_.quintIn=F_.getPowIn(5),F_.quintOut=F_.getPowOut(5),F_.quintInOut=F_.getPowInOut(5),F_.backIn=F_.getBackIn(1.7),F_.backOut=F_.getBackOut(1.7),F_.backInOut=F_.getBackInOut(1.7),F_.elasticIn=F_.getElasticIn(1,.3),F_.elasticOut=F_.getElasticOut(1,.3),F_.elasticInOut=F_.getElasticInOut(1,.3*1.5),F_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),F_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},F_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)F_[`flicker${t}`]=e=>z_(e,t);for(let t=2;t<10;t++)F_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function H_(t,e,i){return t+(e-t)*i}const j_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=H_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=H_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=H_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=H_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=H_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=H_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=H_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=H_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=H_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ru(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?zu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ru(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?zu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=H_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=H_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=H_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=H_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=H_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=H_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=H_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function N_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:_o.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=F_[s])&&void 0!==n?n:F_.linear:F_.linear,"wait"===t&&(this.onUpdate=Z_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=Z_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Bu.Get(i,Eu.Color255),r=Bu.Get(s,Eu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(j_["fill"===e?"fillPure":"strokePure"])}else j_[e]?t.push(j_[e]):t.push(N_)}else j_[e]?t.push(j_[e]):t.push(N_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tb extends Q_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();$_(this.target,t,_o.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class eb extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ib=new eb;ib.isGlobal=!0;class sb extends Q_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class nb extends sb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class rb extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class ab extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){$_(this.target,this.from,_o.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ob(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class cb{constructor(t=Va.GenAutoIncrementId(),e=ib,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(hb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new Q_(El.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tb(El.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new ab(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(hb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&$_(this.target,this._startProps,_o.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const db=new gf;class ub{constructor(){this.released=!1}tick(t,e){db.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class pb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===wl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=wl.INITIAL,oh.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),oh.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new ub;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==wl.INITIAL&&(this.status=wl.PAUSE,!0)}resume(){return this.status!==wl.INITIAL&&(this.status=wl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=wl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===wl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===wl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,oh.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function fb(){G(Ep,D_),G(Ep,gb)}function mb(){hf("arc",Vp)}function vb(){hf("arc3d",hv)}function yb(){hf("area",Yp)}function _b(){hf("circle",$p)}function bb(){hf("glyph",Zp)}function xb(){hf("group",tg)}function Sb(){hf("image",sg)}function Ab(){hf("line",ag)}function kb(){hf("path",hg)}function Cb(){hf("polygon",ug)}function Tb(){hf("pyramid3d",dv)}function Mb(){hf("rect",mg)}function wb(){hf("rect3d",nv)}function Eb(){hf("richtext",jg)}function Bb(){hf("shadowRoot",Ug)}function Pb(){hf("star",ov)}function Rb(){hf("symbol",Gg)}function Ob(){hf("text",Jg)}function Ib(){hf("wrapText",ef)}function Lb(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Fb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Zf),e(Qf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===So.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===So.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=zp(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=Bv(d,u,h),_=Rv(d,g),b=wv(h),x=Ev(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return wo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Rv(o,c),g=wv(n,r),f=Ev(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||ym(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Au.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Au.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class zb extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=td,this.builtinContributions=[Uv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=Lv(v,y,f,m,n,t,Number(u)),o=Lv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=Lv(C,T,A,k,r,-n,Number(u)),o=Lv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Gu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const Hb=new WeakSet;function jb({bind:t}){Lb(Hb,t)||(t(zb).toDynamicValue((({container:t})=>new zb(zm($y,t)))).inSingletonScope(),t(xy).toService(zb),t(Cy).toService(xy),t($y).toService($f),Hm(t,$y))}const Nb=jb;class Ub extends Fb{constructor(){super(...arguments),this.numberType=ed}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Eu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Lb(Vb,t)||(t(Ub).toDynamicValue((()=>new Ub)).inSingletonScope(),t(Sy).toService(Ub),t(Cy).toService(Sy))}const Gb=Wb;function Yb(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 Xb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?bo.ROW:bo.COLUMN,Number.isFinite(c)||(o=bo.COLUMN),Number.isFinite(d)||(o=bo.ROW);const u=i*(o===bo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Yb(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),Yb(t,l,1,s),o=!1):o=!0}t.closePath()}function $b(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function qb(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=$b(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Yb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=bo.ROW:"y"===s?u=bo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Jb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Qb=new fy,tx=zf;class ex extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Qb,tx],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=zp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,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=Sl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Sl(e,E,{curveTension:b}),n=Sl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=bo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?bo.ROW:null==y.y1?bo.COLUMN:Number.isFinite(S+A)?S>A?bo.ROW:bo.COLUMN:bo.ROW,Xb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),qb(t,i[0]?e.top:e.bottom,l,x===bo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ix=new WeakSet;function sx({bind:t}){Lb(ix,t)||(t(ex).toDynamicValue((({container:t})=>new ex(zm(qy,t)))).inSingletonScope(),t(Ay).toService(ex),t(Cy).toService(Ay),t(qy).toService($f),Hm(t,qy))}const nx=sx;class rx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[Yv,Kv,Xv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const ax=new WeakSet;function ox({bind:t}){Lb(ax,t)||(t(rx).toDynamicValue((({container:t})=>new rx(zm(Zy,t)))).inSingletonScope(),t(ky).toService(rx),t(Cy).toService(ky),t(Zy).toService($f),Hm(t,Zy))}const lx=ox;class hx{constructor(){this.numberType=nd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=zp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const cx=new WeakSet;function dx({bind:t}){Lb(cx,t)||(t(hx).toDynamicValue((()=>new hx)).inSingletonScope(),t(Dy).toService(hx),t(Cy).toService(Dy))}const ux=dx,px=["","repeat-x","repeat-y","repeat"];function gx(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?px[i]:"no-repeat"}function fx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=gx(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const mx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function vx(t){return{backgroundMode:mx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function yx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=fx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function _x(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=fx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?vx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Kf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class bx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ad,this.builtinContributions=[ry,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Mv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),_x(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=yx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,T,!1,k,!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&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=zp(t).image;this._draw(t,a,!1,i)}}const xx=new WeakSet;function Sx({bind:t}){Lb(xx,t)||(t(Fy).toDynamicValue((({container:t})=>new bx(zm(Qy,t)))).inSingletonScope(),t(Cy).toService(Fy),t(Qy).toService($f),Hm(t,Qy))}const Ax=Sx;class kx extends Fb{constructor(){super(...arguments),this.numberType=od}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();qb(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Sl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const Cx=new WeakSet;function Tx({bind:t}){Lb(Cx,t)||(t(kx).toDynamicValue((()=>new kx)).inSingletonScope(),t(My).toService(kx),t(Cy).toService(My))}const Mx=Tx,Ex=jv,Bx=zf;class Px extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ld,this.builtinContributions=[Bx,Ex],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:zp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)wo(t.pathShape.commandList,e,i,s,1,1,f);else{wo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Rx=new WeakSet;function Ox({bind:t}){Lb(Rx,t)||(t(Px).toDynamicValue((({container:t})=>new Px(zm(t_,t)))).inSingletonScope(),t(wy).toService(Px),t(Cy).toService(wy),t(t_).toService($f),Hm(t,t_))}const Ix=Ox;function Lx(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Lx(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lx(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Fx(h,y,_,d,u),A=Fx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=Dx(k,C),M=Fx(h,Dx(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const Nx=new WeakSet;function Ux({bind:t}){Lb(Nx,t)||(t(Ey).toDynamicValue((({container:t})=>new jx(zm(e_,t)))).inSingletonScope(),t(Cy).toService(Ey),t(e_).toService($f),Hm(t,e_))}const Vx=Ux;class Wx extends Fb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Eu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Gx extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=cd}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=zp(t).polygon;this._draw(t,s,!1,i)}}const Yx=new WeakSet;function Xx({bind:t}){Lb(Yx,t)||(t(Gx).toDynamicValue((()=>new Gx)).inSingletonScope(),t(Ly).toService(Gx),t(Cy).toService(Ly))}const Kx=Xx;class $x extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=dd,this.builtinContributions=[ey,sy,iy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Pv(g,f,T,M,h),E=Ov(g,v,T,M,C),B=wv(h,c),P=Ev(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Mv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const qx=new WeakSet;function Zx({bind:t}){Lb(qx,t)||(t($x).toDynamicValue((({container:t})=>new $x(zm(i_,t)))).inSingletonScope(),t(By).toService($x),t(Cy).toService(By),t(ty).toSelf(),t(Qv).toSelf(),t(i_).toService(ty),t(i_).toService(Qv),t(i_).toService($f),Hm(t,i_))}const Jx=Zx;class Qx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=ud}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=zp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Pv(v,y,A,k,d),M=Ov(v,b,A,k,S),w=wv(d),E=Ev(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=zp(t).rect;this._draw(t,s,!1,i)}}const tS=new WeakSet;function eS({bind:t}){Lb(tS,t)||(t(Qx).toDynamicValue((()=>new Qx)).inSingletonScope(),t(Py).toService(Qx),t(Cy).toService(Py))}const iS=eS;const sS=new class extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=gv(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 i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),O?Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,O?(Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),D()}};class nS extends Fb{constructor(){super(),this.numberType=pd,this.builtinContributions=[sS],this.init()}drawShape(t,e,i,s,n){const r=zp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=zp(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(),Mv(e,i-t,s-n,v,y,f,!0)),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=zp(t).richtext;this._draw(t,s,!1,i)}}const rS=new WeakSet;function aS({bind:t}){Lb(rS,t)||(t(nS).toDynamicValue((()=>new nS)).inSingletonScope(),t(Iy).toService(nS),t(Cy).toService(Iy))}const oS=aS;class lS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[gy,py],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const hS=new WeakSet;function cS({bind:t}){Lb(hS,t)||(t(lS).toDynamicValue((({container:t})=>new lS(zm(r_,t)))).inSingletonScope(),t(jy).toService(lS),t(Cy).toService(jy),Hm(t,r_))}const dS=cS;class uS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[hy,uy,dy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:zp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const pS=new WeakSet;function gS({bind:t}){Lb(pS,t)||(t(uS).toDynamicValue((({container:t})=>new uS(zm(s_,t)))).inSingletonScope(),t(Ry).toService(uS),t(Cy).toService(Ry),t(s_).toService($f),Hm(t,s_))}const fS=gS;class mS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[sS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=zp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Su.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Su.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Yg(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const vS=new WeakSet;function yS({bind:t}){Lb(vS,t)||(t(Oy).toDynamicValue((({container:t})=>new mS(zm(n_,t)))).inSingletonScope(),t(Cy).toService(Oy),t(n_).toService($f),Hm(t,n_))}const _S=yS,bS=mm();function xS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function SS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const AS=Symbol.for("MathPickerContribution"),kS=Symbol.for("MathArcPicker"),CS=Symbol.for("MathAreaPicker"),TS=Symbol.for("MathCirclePicker"),MS=Symbol.for("MathImagePicker"),wS=Symbol.for("MathLinePicker"),ES=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),PS=Symbol.for("MathSymbolPicker"),RS=Symbol.for("MathTextPicker"),OS=Symbol.for("MathPolygonPicker"),IS=Symbol.for("MathGlyphPicker"),LS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),FS=Symbol.for("CanvasArc3dPicker"),zS=Symbol.for("CanvasAreaPicker"),HS=Symbol.for("CanvasCirclePicker"),jS=Symbol.for("CanvasImagePicker"),NS=Symbol.for("CanvasGifImagePicker"),US=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),GS=Symbol.for("CanvasRectPicker"),YS=Symbol.for("CanvasRect3dPicker"),XS=Symbol.for("CanvasSymbolPicker"),KS=Symbol.for("CanvasTextPicker"),$S=Symbol.for("CanvasPolygonPicker"),qS=Symbol.for("CanvasPyramid3dPicker"),ZS=Symbol.for("CanvasRichTextPicker"),JS=Symbol.for("CanvasGlyphPicker"),QS=Symbol.for("CanvasGroupPicker"),tA=Symbol.for("CanvasStarPicker"),eA=Symbol.for("CanvasPickerContribution"),iA=m_(),sA=__((()=>v_(Em))),nA=__((()=>v_(wm))),rA=__((()=>v_(vd))),aA=__((()=>v_(Bm)));function oA(){oh.global=b_,oh.graphicUtil=sA,oh.transformUtil=nA,oh.graphicService=rA,oh.layerService=aA,oh.canvasFactory=t=>y_(kd,t),oh.context2dFactory=t=>y_(Cd,t),oh.windowFactory=()=>new Af(oh.global),oh.windowHandlerFactory=t=>function(t){const e=y_(xf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),oh.renderServiceFactory=()=>v_(Ym),oh.renderService=__((()=>v_(Ym))),oh.pluginServiceFactory=()=>v_(Av),oh.pluginService=__((()=>v_(Av))),oh.pickerServiceFactory=()=>v_(qm),oh.layerHandlerFactory=t=>v_("static"===t?Pm:"dynamic"===t?Rm:Om),oh.incrementalDrawContributionFactory=()=>v_(by)}oA();var lA=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 hA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return lA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class cA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class dA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Eu.Color1),this.ambient=i;const s=$t(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=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Bu.Get(e,Eu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const uA=()=>{Cm.registerPlugin("DirectionalLight",dA)};class pA{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=Au.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Au.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return gu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return fu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return mu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;mu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const gA=()=>{Cm.registerPlugin("OrthoCamera",pA)},fA={getContributions:()=>[]},mA={getContributions:()=>[]};class vA{constructor(t=fA,e=mA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:fA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:mA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=zp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=zp(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&&Au.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Su.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class yA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new sm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new nm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new am,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new rm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new Sm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new km,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new sf}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new im(new em([],(t=this.registry.contribution,e=Ny,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class _A{constructor(t={}){this.context=new yA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function bA(t={}){return new _A(t)}class xA extends _A{}class SA extends _A{}class AA extends ex{constructor(){super(...arguments),this.numberType=id}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=zp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=wv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=zp(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=Bv(u,p,c),y=Rv(u,g),_=wv(c),b=Ev(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{};function DA(){MA.preloaded||(MA.preloaded=!0,Gm({bind:wA.bind}),xv({bind:wA.bind}),Km({bind:wA.bind}),bv({bind:wA.bind,isBound:wA.isBound}),Cv(wA),l_(wA))}function FA(t,e){const i=NA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function zA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function HA(t,e){let i=PA.get(t);i||(i=new Map,PA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function jA(t,e,i){const s=HA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function NA(){return DA(),wA}function UA(){Nm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=MA.runtimeGlobal)&&void 0!==t||(MA.runtimeGlobal=new vf(zm(vg,wA))),MA.runtimeGlobal}function WA(t){const e=NA(),i=VA();oh.global=i,oh.canvasFactory=t=>e.getNamed(kd,t),oh.context2dFactory=t=>e.getNamed(Cd,t),oh.windowHandlerFactory=t=>FA(xf,t),oh.windowFactory=()=>new Af(i,(t=>FA(xf,t))),oh.pluginServiceFactory=()=>new lm(zm(Sv,e),{pluginRegistry:t.context.registry.plugin}),oh.incrementalDrawContributionFactory=()=>new _y([],new kA,new AA(zm(qy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,Ny))}function GA(t){var e;const i=NA();UA();const s=i.getAll(Cy),n=HA(t.registry.renderer,EA);jA(t.registry.renderer,EA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),zA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,EA)}function YA(t){var e;const i=NA();UA();const s=i.getAll(Ny),n=null!==(e=RA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,Ny,e)})),n.clear(),RA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(Ny));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(Ny,e),r.add(e)),n.add(e)}))}function XA(t,e){var i;const s=NA();UA();const n=s.getAll(e),r=HA(t.registry.picker,BA);jA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),zA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function KA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=OA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,LA,t.isBound,t.rebind),function(t,e){let i=OA.get(t);i||(i=new WeakSet,OA.set(t,i)),i.add(e)}(t,e))}function $A(t,{app:e,legacy:i=!0,targets:s}={}){KA(NA(),t),i&&(f_(),KA(m_(),t)),UA(),e&&function(t,e){const i=null!=e?e:IA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&YA(t),s&&GA(t),r.forEach((e=>{XA(t,e)}))}(e,s)}function qA(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function ZA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function JA(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 QA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ok(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=pg(t.attribute),n=hk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=hk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=hk(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{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(;n{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 _k(l,e,h),h},fk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return pk(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 pk(t,e)}return[]};const mk=t=>t.map((t=>({x:t.x,y:t.y}))),vk=(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]},yk=t=>{const e=new Ue;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 vk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return vk(t,{x:e.x1,y:n},{x:e.x2,y:n})},_k=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=yk(t);_k(n[0],s,i),_k(n[1],e-s,i)}},bk=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:mk(i)}];const s=[];return _k(i,e,s),s},xk=(t,e)=>{const i=ak(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;rObject.assign({},t))):[]}function Ak(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:Sk(t.touches),configurable:!0},changedTouches:{value:Sk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function kk(t,e){try{return t[e]}catch(t){return}}function Ck(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Ak(t),l=kk(t,"target"),h=kk(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Tk=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Ek(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:wk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Tk(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=wk(i,this.selectionStartCursorIdx),a=wk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=Mk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Ek(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),oh.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),oh.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Pk{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=wk(i,Math.ceil(t)),n=wk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=wk(i.attribute.textConfig,a),h=wk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Rk,[this.formatTextCommandCb]),this.commandCbs.set(Ok,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(oh.global.isMacOS()&&t.metaKey&&"c"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return oh.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(oh.global.isMacOS()&&t.metaKey&&"a"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},Mk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=jg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:fv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||mg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},Mk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=tg({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Ik.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=ag({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=tg({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=fv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=fv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(mg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:fv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Qk=new Jk;class tC{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const eC=()=>{Cm.registerPlugin("ViewTransform3dPlugin",tC)},iC=new Ve;class sC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=zp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nC=()=>{Cm.registerPlugin("FlexLayoutPlugin",sC)};var rC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:rh,ARC3D_NUMBER_TYPE:ed,ARC_NUMBER_TYPE:td,AREA_NUMBER_TYPE:id,AbstractGraphicRender:class{},get AnimateMode(){return Ml},get AnimateStatus(){return Bl},get AnimateStepType(){return El},AppContext:yA,Application:nh,Arc:Up,Arc3d:lv,Arc3dRender:Sy,ArcRender:xy,ArcRenderContribution:$y,Area:Gp,AreaRender:Ay,AreaRenderContribution:qy,get AttributeUpdateType(){return _o},AutoEnablePlugins:Sv,Base3dRender:Wx,BaseCanvas:wu,BaseEnvContribution:hA,BaseRender:Fb,get BaseRenderContributionTime(){return So},BaseWindowHandlerContribution:cA,Basis:$o,BeforeRenderConstribution:Xm,BoundsContext:no,BoundsPicker:Zm,BrowserEntry:_A,CIRCLE_NUMBER_TYPE:sd,CONTRIBUTION_STORE_STATE_SYMBOL:Im,Canvas3DDrawItemInterceptor:Ky,Canvas3DPickItemInterceptor:_v,CanvasFactory:kd,CanvasTextLayout:$g,Circle:Kp,CircleRender:ky,CircleRenderContribution:Zy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Eu},CommonDrawItemInterceptorContribution:Yy,CommonRenderContribution:a_,Context2dFactory:Cd,ContributionProvider:Dm,ContributionRegistry:am,ContributionStore:Nm,CubicBezierCurve:zo,CurveContext:xl,get CurveTypeEnum(){return xo},CustomEvent:qa,CustomPath2D:Al,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:_g,DebugDrawItemInterceptorContribution:Gy,DefaultArcAllocate:zk,DefaultArcAttribute:Ul,DefaultArcRenderContribution:Nv,DefaultAreaAllocate:jk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:fy,DefaultAttribute:Nl,DefaultBaseBackgroundRenderContribution:Ff,DefaultBaseClipRenderAfterContribution:Jf,DefaultBaseClipRenderBeforeContribution:qf,DefaultBaseInteractiveRenderContribution:$f,DefaultBaseTextureRenderContribution:Hv,DefaultCanvasAllocate:yf,DefaultCanvasArc3DRender:Ub,DefaultCanvasArcRender:zb,DefaultCanvasAreaRender:ex,DefaultCanvasCircleRender:rx,DefaultCanvasGroupRender:my,DefaultCanvasImageRender:bx,DefaultCanvasLineRender:kx,DefaultCanvasPathRender:Px,DefaultCanvasPolygonRender:jx,DefaultCanvasPyramid3dRender:Gx,DefaultCanvasRect3dRender:Qx,DefaultCanvasRectRender:$x,DefaultCanvasSymbolRender:uS,DefaultCanvasTextRender:mS,DefaultCircleAllocate:Uk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Gv,DefaultConnectAttribute:Hl,DefaultDebugAttribute:jl,DefaultFillStyle:Ol,DefaultGlobal:vf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Yl,DefaultGraphicAllocate:Lk,DefaultGraphicMemoryManager:Jk,DefaultGraphicService:_m,DefaultGraphicUtil:kf,DefaultGroupAttribute:Gl,DefaultGroupBackgroundRenderContribution:$v,DefaultImageAttribute:ih,DefaultImageRenderContribution:ny,DefaultLayerService:Mm,DefaultLayout:Pl,DefaultLineAllocate:Wk,DefaultLineAttribute:Xl,DefaultMat4Allocate:xu,DefaultMatrixAllocate:bu,DefaultPathAllocate:Yk,DefaultPathAttribute:Kl,DefaultPickService:vA,DefaultPickStyle:Fl,DefaultPolygonAttribute:$l,DefaultRect3dAttribute:Jl,DefaultRectAllocate:Dk,DefaultRectAttribute:Zl,DefaultRectRenderContribution:Jv,DefaultRenderService:im,DefaultRichTextAttribute:eh,DefaultRichTextIconAttribute:sh,DefaultStarAttribute:ql,DefaultStrokeStyle:Ll,DefaultStyle:zl,DefaultSymbolAllocate:Kk,DefaultSymbolAttribute:Ql,DefaultSymbolClipRangeStrokeRenderContribution:ly,DefaultSymbolRenderContribution:oy,DefaultTextAllocate:qk,DefaultTextAttribute:th,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Rl,DefaultTransformUtil:Mf,DefaultWindow:Af,get Direction(){return bo},DirectionalLight:dA,DrawContribution:Hy,DrawItemInterceptor:Ny,DynamicLayerHandlerContribution:Rm,get Edge(){return ch},EditModule:Bk,EmptyContext2d:Tu,EnvContribution:vg,EventManager:Qa,EventSystem:io,EventTarget:to,FACTORY_STATE_SYMBOL:wf,FORMAT_ALL_TEXT_COMMAND:Ok,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Rk,Factory:Cm,FederatedEvent:Ya,FederatedMouseEvent:Xa,FederatedPointerEvent:Ka,FederatedWheelEvent:$a,FlexLayoutPlugin:sC,GLYPH_NUMBER_TYPE:nd,GRAPHIC_CLASS_SYMBOL:Mp,GRAPHIC_REGISTRY_SYMBOL:rf,GRAPHIC_UPDATE_TAG_KEY:pp,GROUP_NUMBER_TYPE:rd,Generator:Va,GlobalPickerService:Jm,Glyph:qp,GlyphRender:Dy,GradientParser:su,Graphic:Ep,GraphicCreator:yd,GraphicFactory:sf,GraphicPicker:$m,GraphicRender:Cy,GraphicService:vd,GraphicUtil:Em,Group:Qp,GroupRender:Ty,GroupRenderContribution:Jy,get GroupUpdateAABBBoundsMode(){return Jp},HtmlAttributePlugin:x_,get IContainPointMode(){return yo},IMAGE_NUMBER_TYPE:ad,Image:ig,ImageRender:Fy,ImageRenderContribution:Qy,IncrementalDrawContribution:by,InteractiveDrawItemInterceptorContribution:Xy,InteractivePickItemInterceptorContribution:yv,InteractiveSubRenderContribution:o_,LINE_NUMBER_TYPE:od,Layer:Am,LayerFactory:km,LayerService:Bm,Line:rg,LineRender:My,Linear:Go,LinearClosed:pl,Mat4Allocate:yu,MatrixAllocate:vu,get MeasureModeEnum(){return Tl},MiniappEntry:SA,MonotoneX:il,MonotoneY:sl,NOWORK_ANIMATE_ATTR:Cp,Node:Ga,NodeEntry:xA,OrthoCamera:pA,PATH_NUMBER_TYPE:ld,POLYGON_NUMBER_TYPE:hd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:cd,Path:lg,PathRender:wy,PathRenderContribution:t_,PerformanceRAF:gf,PickItemInterceptor:Qm,PickServiceInterceptor:tv,PickerRegistry:nm,PickerService:qm,PluginRegistry:rm,PluginService:Av,Polygon:dg,PolygonRender:Ey,PolygonRenderContribution:e_,Pyramid3d:cv,Pyramid3dRender:Ly,RECT3D_NUMBER_TYPE:ud,RECT_NUMBER_TYPE:dd,RICHTEXT_NUMBER_TYPE:pd,RUNTIME_INSTALLER_STATE_SYMBOL:CA,RafBasedSTO:Sh,ReactAttributePlugin:A_,Rect:fg,Rect3DRender:Py,Rect3d:sv,RectRender:By,RectRenderContribution:i_,ReflectSegContext:Uo,RenderSelector:zy,RenderService:Ym,RendererRegistry:sm,ResourceLoader:lh,RichText:Hg,RichTextEditPlugin:Ik,RichTextRender:Iy,STAR_NUMBER_TYPE:gd,get STATUS(){return wl},SVG_ATTRIBUTE_MAP:_d,SVG_ATTRIBUTE_MAP_KEYS:bd,SVG_PARSE_ATTRIBUTE_MAP:xd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Sd,SYMBOL_NUMBER_TYPE:fd,SegContext:No,ShadowPickServiceInterceptorContribution:mv,ShadowRoot:Ng,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:vv,SplitRectAfterRenderContribution:ty,SplitRectBeforeRenderContribution:Qv,Stage:xm,StageFactory:Sm,Star:av,StarRender:jy,StarRenderContribution:r_,StateDefinitionCompiler:$u,StateEngine:Qu,StaticLayerHandlerContribution:Pm,Step:ll,StepClosed:hl,Symbol:Wg,SymbolRender:Ry,SymbolRenderContribution:s_,TEXT_NUMBER_TYPE:md,Text:Zg,get TextDirection(){return Kc},TextMeasureContribution:Vm,TextRender:Oy,TextRenderContribution:n_,Theme:Dp,TransformUtil:wm,get UpdateTag(){return vo},VGlobal:yg,VWindow:bf,ViewTransform3dPlugin:tC,VirtualLayerHandlerContribution:Om,WILDCARD:"*",WindowHandlerContribution:xf,WrapText:tf,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Ou,addArcToBezierPath:To,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:rk,alignSubpath:QA,application:oh,applyTransformOnBezierCurves:ok,arc3dModule:Gb,arcModule:Nb,areaModule:nx,bezier:ko,bezierCurversToPath:lk,binarySplitPolygon:yk,bindArc3dRenderModule:Wb,bindArcRenderModule:jb,bindAreaRenderModule:sx,bindCircleRenderModule:ox,bindContributionProvider:Hm,bindContributionProviderNoSingletonScope:jm,bindGlyphRenderModule:dx,bindImageRenderModule:Sx,bindLineRenderModule:Tx,bindPathRenderModule:Ox,bindPolygonRenderModule:Ux,bindPyramid3dRenderModule:Xx,bindRect3dRenderModule:eS,bindRectRenderModule:Zx,bindRichtextRenderModule:aS,bindStarRenderModule:cS,bindSymbolRenderModule:gS,bindTextRenderModule:yS,boundStroke:Gc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Sl,calculateArcCornerRadius:Dv,calculateLineHeight:Ch,canvasAllocate:_f,centroidOfSubpath:ik,circleBounds:vh,circleModule:lx,clock:Za,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Nu,configureRuntimeApplicationForApp:WA,container:iA,cornerTangents:Lv,createApp:bA,createArc:Vp,createArc3d:hv,createArea:Yp,createBrowserApp:bA,createCanvasEventTransformer:function(t,e,i,s){return Ck(t.parentElement,e,i,s)},createCircle:$p,createColor:ru,createConicalGradient:Yu,createContributionProvider:zm,createEventTransformer:Ck,createGlyph:Zp,createGraphic:cf,createGroup:tg,createImage:sg,createLine:ag,createMat4:_u,createMiniappApp:function(t={}){return new SA(t)},createNodeApp:function(t={}){return new xA(t)},createPath:hg,createPolygon:ug,createPyramid3d:dv,createRect:mg,createRect3d:nv,createRectPath:Mv,createRichText:jg,createShadowRoot:Ug,createStage:function(t){return oA(),(new Sm).create(t)},createStar:ov,createSymbol:Gg,createText:Jg,createWrapText:ef,cubicCalc:Ro,cubicLength:Po,cubicPointAt:Oo,cubicSubdivide:JA,defaultArcAllocate:Hk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Uv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:Nk,defaultBaseBackgroundRenderContribution:zf,defaultBaseClipRenderAfterContribution:Qf,defaultBaseClipRenderBeforeContribution:Zf,defaultBaseTextureRenderContribution:jv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Kv,defaultCircleRenderContribution:Yv,defaultCircleTextureRenderContribution:Xv,defaultGraphicMemoryManager:Qk,defaultGroupBackgroundRenderContribution:qv,defaultImageBackgroundRenderContribution:ay,defaultImageRenderContribution:ry,defaultLineAllocate:Gk,defaultPathAllocate:Xk,defaultRectAllocate:Fk,defaultRectBackgroundRenderContribution:sy,defaultRectRenderContribution:ey,defaultRectTextureRenderContribution:iy,defaultStarBackgroundRenderContribution:gy,defaultStarTextureRenderContribution:py,defaultSymbolAllocate:$k,defaultSymbolBackgroundRenderContribution:uy,defaultSymbolClipRangeStrokeRenderContribution:cy,defaultSymbolRenderContribution:hy,defaultSymbolTextureRenderContribution:dy,defaultTextAllocate:Zk,diff:ZA,divideCubic:Fo,drawArc:Co,drawArcPath:Fv,drawAreaSegments:Xb,drawBackgroundImage:Kf,drawImageWithLayout:_x,drawIncrementalAreaSegments:Jb,drawIncrementalSegments:Zb,drawSegments:qb,enumCommandMap:lo,fillVisible:Bv,findBestMorphingRotation:nk,findConfigIndexByCursorIdx:wk,findCursorIdxByConfigIndex:Ek,findNextGraphic:Lf,flatten_simplify:qA,foreach:Of,foreachAsync:If,genBasisSegments:Zo,genBasisTypeSegments:qo,genLinearClosedSegments:gl,genLinearClosedTypeSegments:fl,genLinearSegments:Yo,genLinearTypeSegments:Xo,genMonotoneXSegments:rl,genMonotoneXTypeSegments:nl,genMonotoneYSegments:ol,genMonotoneYTypeSegments:al,genNumberType:Xc,genStepClosedSegments:ul,genStepSegments:cl,genStepTypeSegments:dl,getApplicationState:ah,getAttributeFromDefaultAttrList:xh,getBackgroundImage:jf,getConicGradientAt:Gu,getContributionStoreState:Lm,getCurrentEnv:function(){return mm()?"browser":"node"},getDefaultCharacterConfig:Mk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Yg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Au.allocate();return cu(o,o,[a[0],a[1],0]),n&&ou(o,o,n),s&&lu(o,o,s),cu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Ef,getGraphicClassState:wp,getGraphicRegistryState:af,getLegacyBindingContext:m_,getModelMatrix:vm,getRichTextBounds:fv,getRuntimeInstallerBindingContext:NA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:TA,getScaledStroke:nu,getTextBounds:gv,getTheme:zp,getThemeFromGroup:Hp,globalTheme:Fp,glyphModule:ux,graphicCreator:lf,graphicService:rA,graphicUtil:sA,identityMat4:au,imageModule:Ax,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:$A,installRuntimeDrawContributionsToApp:YA,installRuntimeGraphicRenderersToApp:GA,installRuntimePickersToApp:XA,interpolateColor:Ru,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Iu,interpolateGradientRadialColor:Lu,interpolatePureColorArray:Fu,interpolatePureColorArrayToStr:zu,intersect:Iv,isBrowserEnv:mm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){fm();const t=oh.global&&oh.global.env;return t?"node"===t:!gm},isSvg:Nc,isXML:Uc,layerService:aA,lineModule:Mx,lookAt:gu,mapToCanvasPointForCanvas:function(t){var e;if(Rd(t._canvasX)&&Rd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:du,mat4Allocate:Au,matrixAllocate:Su,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:pu,newThemeObj:Op,ortho:fu,parsePadding:gh,parseStroke:uh,parseSvgPath:mo,pathModule:Ix,pathToBezierCurves:ak,point:Ko,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:Vx,preLoadAllModule:f_,pyramid3dModule:Kx,quadCalc:Io,quadLength:Do,quadPointAt:Lo,rafBasedSto:Ah,rect3dModule:iS,rectFillVisible:Pv,rectModule:Jx,rectStrokeVisible:Ov,recursiveCallBinarySplit:_k,refreshRuntimeInstallerContributions:UA,registerArc3dGraphic:vb,registerArcGraphic:mb,registerAreaGraphic:yb,registerCircleGraphic:_b,registerDirectionalLight:uA,registerFlexLayoutPlugin:nC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:bb,registerGraphic:hf,registerGroupGraphic:xb,registerHtmlAttributePlugin:S_,registerImageGraphic:Sb,registerLineGraphic:Ab,registerOrthoCamera:gA,registerPathGraphic:kb,registerPolygonGraphic:Cb,registerPyramid3dGraphic:Tb,registerReactAttributePlugin:k_,registerRect3dGraphic:wb,registerRectGraphic:Mb,registerRichtextGraphic:Eb,registerShadowRootGraphic:Bb,registerStarGraphic:Pb,registerSymbolGraphic:Rb,registerTextGraphic:Ob,registerViewTransform3dPlugin:eC,registerWindowEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Ib,renderCommandList:wo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:vx,resolveBackgroundPosition:Gf,resolveBackgroundSizing:Nf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:fx,resolveImageRepeatMode:gx,resolveRenderableImageSize:Xf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:oS,rotateX:ou,rotateY:lu,rotateZ:hu,runFill:wv,runStroke:Ev,scaleMat4:uu,segments:Ao,shouldClipImageByLayout:yx,shouldUseMat4:ym,snapLength:Bo,splitArc:dk,splitArea:gk,splitCircle:uk,splitLine:fk,splitPath:xk,splitPolygon:bk,splitRect:ck,splitToGrids:hk,starModule:dS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Rv,symbolModule:fS,textAttributesToStyle:Kg,textDrawOffsetX:Yg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Xg,textModule:_S,transformMat4:mu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:nA,translate:cu,verticalLayout:$c,vglobal:b_,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oh.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)}))},wrapCanvas:Td,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.context2dFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Qc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Qc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class aC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:nu(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class oC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let lC=!1;function hC(t){lC||(lC=!0,t.bind(DS).toDynamicValue((()=>new oC(xS(t,xy)))).inSingletonScope(),t.bind(eA).toService(DS))}class cC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let dC=!1;function uC(t){dC||(dC=!0,t.bind(kS).toDynamicValue((()=>new cC(xS(t,xy)))).inSingletonScope(),t.bind(AS).toService(kS))}function pC(){if(pC.__loaded)return;pC.__loaded=!0;const t=m_();mb(),Nb({bind:t.bind}),bS?hC(t):uC(t)}pC.__loaded=!1;const gC=pC;class fC extends Fb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class mC extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ed,this.themeType="arc"}}let vC=!1;function yC(t){var e;vC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Sy))&&(vC=!0,t.bind(FS).toDynamicValue((()=>new mC(xS(t,Sy)))).inSingletonScope(),t.bind(eA).toService(FS))}function _C(){if(_C.__loaded)return;_C.__loaded=!0;const t=m_();vb(),uA(),gA(),Gb({bind:t.bind}),yC(t)}_C.__loaded=!1;const bC=_C;class xC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let SC=!1;function AC(t){SC||(SC=!0,t.bind(zS).toDynamicValue((()=>new xC(xS(t,Ay)))).inSingletonScope(),t.bind(eA).toService(zS))}class kC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let CC=!1;function TC(t){CC||(CC=!0,t.bind(CS).toDynamicValue((()=>new kC(xS(t,Ay)))).inSingletonScope(),t.bind(AS).toService(CS))}function MC(){if(MC.__loaded)return;MC.__loaded=!0;const t=m_();yb(),nx({bind:t.bind}),bS?AC(t):TC(t)}MC.__loaded=!1;const wC=MC;class EC{constructor(){this.type="glyph",this.numberType=nd}contains(t,e,i){if(!t.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}}class BC extends EC{constructor(t){super(),this.canvasRenderer=t}}let PC=!1;function RC(t){PC||(PC=!0,t.bind(JS).toDynamicValue((()=>new BC(xS(t,Dy)))).inSingletonScope(),t.bind(eA).toService(JS))}class OC extends EC{constructor(t){super(),this.canvasRenderer=t}}let IC=!1;function LC(t){IC||(IC=!0,t.bind(IS).toDynamicValue((()=>new OC(xS(t,Dy)))).inSingletonScope(),t.bind(AS).toService(IS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=m_();bb(),ux({bind:t.bind}),bS?RC(t):LC(t)}DC.__loaded=!1;const FC=DC;function zC(){zC.__loaded||(zC.__loaded=!0,xb())}zC.__loaded=!1;const HC=zC;class jC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=ad}}let NC=!1;function UC(t){NC||(NC=!0,t.bind(jS).toDynamicValue((()=>new jC(xS(t,Fy)))).inSingletonScope(),t.bind(eA).toService(jS))}class VC{constructor(){this.type="image",this.numberType=ad}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function GC(t){WC||(WC=!0,t.bind(MS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(AS).toService(MS))}function YC(){if(YC.__loaded)return;YC.__loaded=!0;const t=m_();Sb(),Ax({bind:t.bind}),bS?UC(t):GC(t)}YC.__loaded=!1;const XC=YC;class KC extends Fb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class $C extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let qC=!1;function ZC(t){qC||(qC=!0,t.bind(US).toDynamicValue((()=>new $C(xS(t,My)))).inSingletonScope(),t.bind(eA).toService(US))}class JC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let QC=!1;function tT(t){QC||(QC=!0,t.bind(wS).toDynamicValue((()=>new JC(xS(t,My)))).inSingletonScope(),t.bind(AS).toService(wS))}function eT(){if(eT.__loaded)return;eT.__loaded=!0;const t=m_();Ab(),Mx({bind:t.bind}),bS?ZC(t):tT(t)}eT.__loaded=!1;const iT=eT;class sT extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let nT=!1;function rT(t){nT||(nT=!0,t.bind(WS).toDynamicValue((()=>new sT(xS(t,wy)))).inSingletonScope(),t.bind(eA).toService(WS))}class aT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let oT=!1;function lT(t){oT||(oT=!0,t.bind(ES).toDynamicValue((()=>new aT(xS(t,wy)))).inSingletonScope(),t.bind(AS).toService(ES))}function hT(){if(hT.__loaded)return;hT.__loaded=!0;const t=m_();kb(),Ix({bind:t.bind}),bS?rT(t):lT(t)}hT.__loaded=!1;const cT=hT;class dT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let uT=!1;function pT(t){uT||(uT=!0,t.bind($S).toDynamicValue((()=>new dT(xS(t,Ey)))).inSingletonScope(),t.bind(eA).toService($S))}class gT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let fT=!1;function mT(t){fT||(fT=!0,t.bind(OS).toDynamicValue((()=>new gT(xS(t,Ey)))).inSingletonScope(),t.bind(AS).toService(OS))}function vT(){if(vT.__loaded)return;vT.__loaded=!0;const t=m_();Cb(),Vx({bind:t.bind}),bS?pT(t):mT(t)}vT.__loaded=!1;const yT=vT;class _T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=cd,this.themeType="polygon"}}let bT=!1;function xT(t){var e;bT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ly))&&(bT=!0,t.bind(qS).toDynamicValue((()=>new _T(xS(t,Ly)))).inSingletonScope(),t.bind(eA).toService(qS))}function ST(){if(ST.__loaded)return;ST.__loaded=!0;const t=m_();Tb(),uA(),gA(),Kx({bind:t.bind}),xT(t)}ST.__loaded=!1;const AT=ST,kT=new Ve;class CT{constructor(){this.type="rect",this.numberType=dd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:nu(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;kT.setValue(i.x1,i.y1,i.x2,i.y2),kT.expand(-r/2),h=!kT.containsPoint(e)}}return s.highPerformanceRestore(),h}}class TT extends CT{constructor(t){super(),this.canvasRenderer=t}}let MT=!1;function wT(t){MT||(MT=!0,t.bind(GS).toDynamicValue((()=>new TT(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(GS))}class ET extends CT{constructor(t){super(),this.canvasRenderer=t}}let BT=!1;function PT(t){BT||(BT=!0,t.bind(BS).toDynamicValue((()=>new ET(xS(t,By)))).inSingletonScope(),t.bind(AS).toService(BS))}function RT(){if(RT.__loaded)return;RT.__loaded=!0;const t=m_();Mb(),Jx({bind:t.bind}),bS?wT(t):PT(t)}RT.__loaded=!1;const OT=RT;class IT extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=ud,this.themeType="rect"}}let LT=!1;function DT(t){var e;LT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Py))&&(LT=!0,t.bind(YS).toDynamicValue((()=>new IT(xS(t,Py)))).inSingletonScope(),t.bind(eA).toService(YS))}function FT(){if(FT.__loaded)return;FT.__loaded=!0;const t=m_();wb(),iS({bind:t.bind}),DT(t)}FT.__loaded=!1;const zT=FT;class HT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let jT=!1;function NT(t){jT||(jT=!0,t.bind(ZS).toDynamicValue((()=>new HT(xS(t,Iy)))).inSingletonScope(),t.bind(eA).toService(ZS))}class UT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let VT=!1;function WT(t){VT||(VT=!0,t.bind(LS).toDynamicValue((()=>new UT(xS(t,Iy)))).inSingletonScope(),t.bind(AS).toService(LS))}function GT(){if(GT.__loaded)return;GT.__loaded=!0;const t=m_();Eb(),oS({bind:t.bind}),bS?NT(t):WT(t)}GT.__loaded=!1;const YT=GT;function XT(){XT.__loaded||(XT.__loaded=!0,Bb())}XT.__loaded=!1;const KT=XT;class $T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Au.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let qT=!1;function ZT(t){qT||(qT=!0,t.bind(XS).toDynamicValue((()=>new $T(xS(t,Ry)))).inSingletonScope(),t.bind(eA).toService(XS))}class JT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}}let QT=!1;function tM(t){QT||(QT=!0,t.bind(PS).toDynamicValue((()=>new JT(xS(t,Ry)))).inSingletonScope(),t.bind(AS).toService(PS))}function eM(){if(eM.__loaded)return;eM.__loaded=!0;const t=m_();Rb(),fS({bind:t.bind}),bS?ZT(t):tM(t)}eM.__loaded=!1;const iM=eM;class sM extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Xg(a,u,n),v=Yg(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&&Au.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let nM=!1;function rM(t){nM||(nM=!0,t.bind(KS).toDynamicValue((()=>new sM(xS(t,Oy)))).inSingletonScope(),t.bind(eA).toService(KS))}class aM{constructor(){this.type="text",this.numberType=md}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let oM=!1;function lM(t){oM||(oM=!0,t.bind(RS).toDynamicValue((()=>new aM)).inSingletonScope(),t.bind(AS).toService(RS))}function hM(){if(hM.__loaded)return;hM.__loaded=!0;const t=m_();Ob(),_S({bind:t.bind}),bS?rM(t):lM(t)}hM.__loaded=!1;const cM=hM;function dM(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),gM=(t,e)=>(d(mM.warnHandler)&&mM.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),fM=(t,e,i)=>{if(!d(mM.errorHandler))throw new Error(t);mM.errorHandler.call(null,t,e)},mM={silent:!1,warnHandler:!1,errorHandler:!1},vM=mm(),yM=vM&&globalThis?globalThis.document:void 0;function _M(t){return("desktop-browser"===t||"mobile-browser"===t)&&vM}function bM(t){return xM(t)||"mobile-browser"===t}function xM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let SM=0;function AM(){return SM>=9999999&&(SM=0),SM++}function kM(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function CM(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function TM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&TM(t,e)}))}const MM=t=>!u(t)&&!1!==t.visible;function wM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function EM(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 PM=["#ffffff","#000000"];function RM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return OM(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(...PM);for(const n of a)if(t!==n&&OM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function OM(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?IM(t,e)>s:"largeText"===i?IM(t,e)>3:IM(t,e)>4.5}function IM(t,e){const i=LM(t),s=LM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function LM(t){const e=ri(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 DM(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 FM(t,e){return[t[0]*e,t[1]*e]}function zM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function HM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const jM=cf,NM={arc:t=>jM("arc",t),circle:t=>jM("circle",t),group:t=>jM("group",t),image:t=>jM("image",t),line:t=>jM("line",t),path:t=>jM("path",t),polygon:t=>jM("polygon",t),rect:t=>jM("rect",t),richtext:t=>jM("richtext",t),symbol:t=>jM("symbol",t),text:t=>jM("text",t)},UM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 GM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(GM||(GM={}));const YM={[GM.selectedReverse]:{},[GM.selected]:{},[GM.hover]:{},[GM.hoverReverse]:{}},XM={container:"",width:30,height:30,style:{}},KM="scrollDrag",$M=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:gv,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function qM(t,e,i={}){if(!t)return{width:0,height:0};const s=gv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 ZM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function JM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function QM(t,e="type"){const i=ZM(t,e);return"rich"===i?NM.richtext(JM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),NM.text(t))}function tw(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 ew=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function iw(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 sw(t,e){const{dx:i,dy:s}=iw(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const nw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},rw={size:8,stroke:"#000",lineWidth:1,zIndex:1};function aw(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Ae(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Ee(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const ow=Math.sin(Math.PI/10);function lw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function hw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function cw(t){const e={};return TM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return FM(r,(s?-1:1)*(n?-1:1)*t/zM(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function fw(t,e,i){var s;if(hw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function mw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function _w(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function bw(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function xw(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 Sw(t,e){const i=xw(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 Aw(t,e){const i=kw(t),s=kw(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 kw(t,e={x:0,y:0}){return ae.distancePP(t,e)}function Cw(t){return k(t.x)&&k(t.y)}function Tw(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 Mw(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const ww=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function Bw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&Bw(t[i],e)}}var Pw;!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"}(Pw||(Pw={}));const Rw={};function Ow(t){switch(t){case Pw.Linear:case Pw.Log:case Pw.Pow:case Pw.Sqrt:case Pw.Symlog:case Pw.Time:return!0;default:return!1}}function Iw(t){return!!Rw[t]}function Lw(t){switch(t){case Pw.Ordinal:case Pw.Point:case Pw.Band:return!0;default:return!1}}function Dw(t){return t}Object.values(Pw).forEach((t=>{Rw[t]=!0}));const Fw=t=>-Math.log(-t),zw=t=>-Math.exp(-t),Hw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,jw=t=>10===t?Hw:t===Math.E?Math.exp:e=>Math.pow(t,e),Nw=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)),Vw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Ww(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 Gw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Yw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Xw(t,e,i,s){return 1===i&&(i=0),Yw(t,i,s)*(e/(1-i))}function Kw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function $w(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Zw{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=Kw(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=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Jw=Symbol("implicit");class Qw extends Zw{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=Jw}clone(){const t=(new Qw).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!==Jw)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return tE(t,e,r,n)}class iE extends Qw{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=Xw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:eE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new iE(!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:sE}=ai;function nE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=sE(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?sE(t,e):e instanceof si?sE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class rE extends Zw{constructor(t=Dw,e=Dw){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Dw,this._piecewise=Gw,this._interpolate=nE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?$w:Gw,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:Dw),this.rescale(i)):this._clamp!==Dw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const aE=Math.sqrt(50),oE=Math.sqrt(10),lE=Math.sqrt(2),hE=[1,2,5,10],cE=(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=gE(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?uE(0,-(e-1)/s,s):uE((e-1)/s,0,s)},dE=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return cE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return cE(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=uE(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=uE(t,e,l);return n&&r.reverse(),r})),gE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=hE[0];return i>=aE?s=hE[3]:i>=oE?s=hE[2]:i>=lE&&(s=hE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function fE(t,e,i){const s=(e-t)/Math.max(0,i);return gE(s)}function mE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=fE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function yE(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 _E=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),bE=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),xE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=pE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?_E(t,e,n):_E(t,e,qw(n)),h=_E(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),SE=vt(((t,e,i,s,n)=>mE(s(t),s(e),i).map((t=>qw(n(t))))));class AE extends rE{constructor(){super(...arguments),this.type=Pw.Linear}clone(){var t;const e=new AE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return dE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=pE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function CE(t){return e=>-t(-e)}function TE(t=Number.EPSILON){return e=>Math.max(e,t)}class ME extends rE{constructor(){super(Nw(10),jw(10)),this.type=Pw.Log,this._limit=TE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new ME).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=Nw(this._base),s=jw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Fw,this.untransformer=zw):(this._logs=i,this._pows=s,this._limit=TE(),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 Dw}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return bE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(ME,kE);class wE extends AE{constructor(){super(Uw(1),Vw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new wE).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=Vw(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return bE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(wE,kE);class EE{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[lt(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new EE).domain(this._domain).range(this._range).unknown(this._unknown)}}var BE,PE,RE;function OE(t){var e,i;const{type:s}=t;return s===PE.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BE||(BE={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(PE||(PE={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(RE||(RE={}));const IE={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},LE={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DE(t,e){var i;if(!t)return[];const s=VE(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?NE(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>jE(i)?zE(t,i,e):i)).filter(p)}))):i.map((i=>jE(i)?zE(t,i,e):i)).filter(p):[]}return[]}function FE(t,e){var i,s;return NE(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 zE(t,e,i){var s;const n=VE(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=IE[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=LE[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 si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`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 HE=(t,e)=>{if(e&&jE(t)){const i=zE(e,t);if(i)return i}return t};function jE(t){return t&&"palette"===t.type&&!!t.key}function NE(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function UE(t){return _(t)?{dataScheme:t}:t}function VE(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=OE(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 WE extends Qw{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!NE(this._range))return void super.range(this._range);const t=FE(this._range,this._domain);super.range(t)}}const GE={linear:AE,band:iE,point:class extends iE{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:Qw,threshold:EE,colorOrdinal:WE};function YE(t){const e=GE[t];return e?new e:null}function XE(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function KE(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function $E(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qE(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZE(t){return!!y(t)&&(!!t.endsWith("%")&&kM(t.substring(0,t.length-1)))}function JE(t){return!!g(t)&&("percent"in t||"offset"in t)}function QE(t,e,i,s=0){var n,r;return S(t)?t:ZE(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 tB(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]=QE(t[s],e.size,i)}))})),o}function eB(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function iB(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)||ZE(t)||d(t)||JE(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function sB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const nB=(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},rB=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function aB(t,e){return t&&e.key in t?t[e.key]:e.default}function oB(t){return t&&"token"===t.type&&!!t.key}const lB={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},hB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:lB,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},cB={name:"dark",colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},dB=(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]={}),dB(t[s],e.slice(1),i))};function uB(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=UE(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}vB._charts=mB.charts,vB._series=mB.series,vB._components=mB.components,vB._graphicComponents=mB.graphicComponents,vB._marks=mB.marks,vB._regions=mB.regions,vB._animations=mB.animations,vB._implements=mB.implements,vB._chartPlugin=mB.chartPlugin,vB._vChartPlugin=mB.vChartPlugin,vB._componentPlugin=mB.componentPlugin,vB.transforms=mB.transforms,vB.dataParser=mB.dataParser,vB._layout=mB.layout,vB._grammarTransforms=mB.grammarTransforms,vB._stageEventPlugins=mB.stageEventPlugins,vB.registerStageEventPlugin=(t,e)=>{vB._stageEventPlugins[t]=e},vB.getStageEventPlugin=t=>vB._stageEventPlugins[t],vB._interactionTriggers=mB.interactionTriggers,vB.registerInteractionTrigger=(t,e)=>{vB._interactionTriggers[t]=e},vB._composedEventMap=mB.composedEventMap,vB.registerComposedEvent=(t,e)=>{vB._composedEventMap[t]=e},vB._tooltipProcessors=mB.tooltipProcessors,vB.registerTooltipProcessor=(t,e)=>{vB._tooltipProcessors[t]=e},vB.createTooltipProcessor=(t,e)=>{const i=vB._tooltipProcessors[t];return i?new i(e):null},vB._runtimePluginInstallers=mB.runtimePluginInstallers,vB.registerRuntimePluginInstaller=(t,e)=>{vB._runtimePluginInstallers[t]=e},vB.getRuntimePluginInstaller=t=>vB._runtimePluginInstallers[t];const bB=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}},conversionArrow:{line:{style:{stroke:"black"}},symbol:{style:{fill:"black"}},text:{style:{fontSize:12,fill:"#606773"}}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},xB=bB(),SB={[hB.name]:hB},AB=hB.name,kB=new Map(Object.keys(SB).map((t=>[t,SB[t]]))),CB=new Map,TB=new Map(Object.keys(SB).map((t=>[t,t===AB]))),MB=(t,e)=>{if(!t)return;const i=PB(e);kB.set(t,i),TB.set(t,!0)},wB=(t=AB)=>(TB.has(t)&&!TB.get(t)&&MB(t,kB.get(t)),kB.get(t)),EB=t=>kB.delete(t)&&CB.delete(t)&&TB.delete(t),BB=t=>!!y(t)&&kB.has(t),PB=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:AB;return yB({},wB(i),t)};class RB{static registerInstance(t){RB.instances.set(t.id,t)}static unregisterInstance(t){RB.instances.delete(t.id)}static getInstance(t){return RB.instances.get(t)}static instanceExist(t){return RB.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return RB.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}RB.instances=new Map;class OB{static registerTheme(t,e){MB(t,e)}static getTheme(t,e=!1){return wB(t)}static removeTheme(t){return EB(t)}static themeExist(t){return BB(t)}static getDefaultTheme(){return OB.themes.get(AB)}static setCurrentTheme(t){OB.themeExist(t)&&(OB._currentThemeName=t,RB.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return OB.getTheme(OB._currentThemeName,t)}static getCurrentThemeName(){return OB._currentThemeName}}function IB(t){return y(t)?OB.themeExist(t)?OB.getTheme(t):{}:g(t)?t:{}}OB.themes=kB,OB._currentThemeName=AB;const LB=["animationThreshold","colorScheme","name","padding"];function DB(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];LB.includes(n)?s[n]=r:m(r)?jE(r)?s[n]=HE(r,e):oB(r)?s[n]=aB(i,r):s[n]=DB(r,e,i):s[n]=r})),s}function FB(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]=FB(t[s],e)}return i}return _(t)?t.map((t=>FB(t,e))):t}function zB(t,e){var i;if(!t)return t;if(y(t))return null!==(i=e.getFunction(t))&&void 0!==i?i:t;if(m(t)){const i={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=zB(t[s],e));return i}return _(t)?t.map((t=>zB(t,e))):t}function HB(t,...e){return d(t)?t(...e):t}const jB=(t,e,i,s)=>((t,e,i)=>$M(t,e,i,{fontFamily:lB.fontFamily,fontSize:lB.fontSize}))(e,i,s).measure(t),NB="__VCHART",UB=500,VB=500,WB=`${NB}_MEASURE_CANVAS_ID`,GB=`${NB}_DEFAULT_DATA_INDEX`,YB=`${NB}_DEFAULT_DATA_KEY`,XB=`${NB}_DEFAULT_DATA_SERIES_FIELD`,KB=`${NB}_DEFAULT_SERIES_STYLE_NAME`,$B=`${NB}_STACK_KEY`,qB=`${NB}_STACK_START`,ZB=`${NB}_STACK_END`,JB=`${NB}_STACK_START_PERCENT`,QB=`${NB}_STACK_END_PERCENT`,tP=`${NB}_STACK_START_OffsetSilhouette`,eP=`${NB}_STACK_END_OffsetSilhouette`,iP=`${NB}_STACK_TOTAL`,sP=`${NB}_STACK_TOTAL_PERCENT`,nP=`${NB}_STACK_TOTAL_TOP`,rP=`${NB}_STACK_TOTAL_BOTTOM`,aP=`${NB}_MOSAIC_VALUE_START_PERCENT`,oP=`${NB}_MOSAIC_VALUE_END_PERCENT`,lP=`${NB}_MOSAIC_CAT_START_PERCENT`,hP=`${NB}_MOSAIC_CAT_END_PERCENT`,cP=`${NB}_SEGMENT_START`,dP=`${NB}_SEGMENT_END`,uP=`${NB}_KEY`,pP=`${NB}_MAP_LOOK_UP_KEY`;function gP(t,e){for(let i=0;it.key===e))}function mP(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 vP(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},SP(t,a,n[o],l,e,r))})),s?yP(n):n}function yP(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))):yP(t[e].nodes);return t}function _P(t,e){if("values"in t&&t.values.length){const i=bw(t.values,e),s=_w(t.values,QB);t.values.forEach((t=>{t[iP]=i,t[sP]=s}))}else for(const i in t.nodes)_P(t.nodes[i],e)}function bP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][ZB]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)xP(t.nodes[r],e,i,s,n)}function SP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[ZB]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),SP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const AP=(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]=CP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function TP(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function MP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return PP(t(r,i,s,n));if(TP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),PP(e)}return PP(t)}function wP(t={}){const e=Object.assign({},t);if(d(t.style)||TP(t.style)?e.style=(e,i,s,n)=>MP(t.style,e,i,s,n):P(t.style)||(e.style=PP(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||TP(t.state[e])?i[e]=(i,s,n,r)=>MP(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=PP(t.state[e]))})),e.state=i}return e}function EP(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e,s,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}function BP(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),PP(i)}function PP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const RP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},OP=t=>"line"===t||"area"===t,IP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return OP(i)?e:null==e?void 0:e[0]},LP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let DP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=vB.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(vB.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var FP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(FP||(FP={}));const zP=["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 HP,jP,NP;t.ChartEvent=void 0,(HP=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",HP.rendered="rendered",HP.renderFinished="renderFinished",HP.animationFinished="animationFinished",HP.regionSeriesDataFilterOver="regionSeriesDataFilterOver",HP.afterInitData="afterInitData",HP.afterInitEvent="afterInitEvent",HP.afterInitMark="afterInitMark",HP.rawDataUpdate="rawDataUpdate",HP.viewDataFilterOver="viewDataFilterOver",HP.viewDataUpdate="viewDataUpdate",HP.viewDataStatisticsUpdate="viewDataStatisticsUpdate",HP.markDeltaYUpdate="markDeltaYUpdate",HP.viewDataLabelUpdate="viewDataLabelUpdate",HP.scaleDomainUpdate="scaleDomainUpdate",HP.scaleRawDomainUpdate="scaleRawDomainUpdate",HP.scaleUpdate="scaleUpdate",HP.dataZoomChange="dataZoomChange",HP.drill="drill",HP.layoutStart="layoutStart",HP.layoutEnd="layoutEnd",HP.layoutRectUpdate="layoutRectUpdate",HP.playerPlay="playerPlay",HP.playerPause="playerPause",HP.playerEnd="playerEnd",HP.playerChange="playerChange",HP.playerForward="playerForward",HP.playerBackward="playerBackward",HP.scrollBarChange="scrollBarChange",HP.brushStart="brushStart",HP.brushChange="brushChange",HP.brushEnd="brushEnd",HP.brushClear="brushClear",HP.brushActive="brushActive",HP.legendSelectedDataChange="legendSelectedDataChange",HP.legendFilter="legendFilter",HP.legendItemClick="legendItemClick",HP.legendItemHover="legendItemHover",HP.legendItemUnHover="legendItemUnHover",HP.tooltipShow="tooltipShow",HP.tooltipHide="tooltipHide",HP.tooltipRelease="tooltipRelease",HP.afterResize="afterResize",HP.afterRender="afterRender",HP.afterLayout="afterLayout",HP.afterMarkLayoutEnd="afterMarkLayoutEnd",HP.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(jP||(jP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(NP||(NP={}));const UP=[NP.mark,NP.model,NP.chart,NP.vchart];class VP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(NP.vchart,[]),this._levelNodes.set(NP.chart,[]),this._levelNodes.set(NP.model,[]),this._levelNodes.set(NP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const WP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class GP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>IP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||jP.chart);o.get(t)||o.set(t,new VP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||jP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||jP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||jP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?UP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[jP.chart,jP.window,jP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&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 WP[a]&&(a=WP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?NP.model:NP.vchart:NP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=jP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==NP.model&&s!==NP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=NP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case jP.chart:return this._viewBubbles;case jP.window:return this._windowBubbles;case jP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case jP.chart:return this._viewListeners;case jP.window:return this._windowListeners;case jP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return zP.includes(t)||Object.values(FP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&vB.hasInteractionTrigger(e)}}function YP(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function XP(t,e,i){t.getParser(e)||t.registerParser(e,i)}const KP=new Map;let $P;function qP(){$P||($P=new Fa,XP($P,"geojson",Pa),XP($P,"topojson",Oa),YP($P,"simplify",Kr))}function ZP(t,e,i={type:"geojson",centroid:!0}){KP.has(t)&&gM(`map type of '${t}' already exists, will be overwritten.`),qP();const s=new za($P),n=H({},{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}),KP.set(t,s)}function JP(t){KP.has(t)?KP.delete(t):gM(`map type of '${t}' does not exists.`)}function QP(t,e=!1){let i=e;return t.latestData instanceof za&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const tR=(t,e)=>0===t.length?[]:1===t.length?QP(t[0],null==e?void 0:e.deep):t.map((t=>QP(t,null==e?void 0:e.deep)));function eR(e,i,s){YP(i=i instanceof Fa?i:e.dataSet,"copyDataView",tR);const n=new za(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function iR(t,e,i=[]){var s;if(t instanceof za)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new za(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return gM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return gM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),gM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function sR(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var nR,rR,aR,oR;t.TransformLevel=void 0,(nR=t.TransformLevel||(t.TransformLevel={}))[nR.copyDataView=-10]="copyDataView",nR[nR.treemapFilter=-8]="treemapFilter",nR[nR.treemapFlatten=-7]="treemapFlatten",nR[nR.dotObjFlat=-7]="dotObjFlat",nR[nR.linkDotInfo=-7]="linkDotInfo",nR[nR.sankeyLayout=-7]="sankeyLayout",nR[nR.dataZoomFilter=-6]="dataZoomFilter",nR[nR.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(rR||(rR={})),function(t){t.data="data",t.mark="mark"}(aR||(aR={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(oR||(oR={}));const lR=["line","area","trail"];function hR(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(uP,i?t.slice().sort(i):t.slice()),{keys:[uP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const cR=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function dR(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{dR(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function pR(t,e,i,s){const n=hR(t,(t=>i(t))),r=hR(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const gR=`${NB}_BuiltIn_CallBack_Disappear`;var fR;!function(t){t.render="render",t.disappear="disappear"}(fR||(fR={}));const mR=[0,0,0];class vR{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ol),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Ll),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Su.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&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(mu(mR,[e,i,s],this.modelMatrix),e=mR[0],i=mR[1],s=mR[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=ru(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:nu(this,a,this.dpr),r.strokeStyle=ru(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}vR.env="browser";class yR extends wu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=oh.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new vR(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 _R(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,kd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Cd,e.env));r||i.bind(kd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Cd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}yR.env="browser";const bR=_R(yR,vR);class xR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}xR.env="feishu";class SR extends wu{constructor(t){super(t)}init(){this._context=new xR(this,this._dpr)}release(...t){}}SR.env="feishu";const AR=_R(SR,xR);class kR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}kR.env="harmony";class CR extends wu{constructor(t){super(t)}init(){this._context=new kR(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}CR.env="harmony";const TR=_R(CR,kR);class MR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}MR.env="lynx";class wR extends wu{constructor(t){super(t)}init(){this._context=new MR(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}wR.env="lynx";const ER=_R(wR,MR);class BR extends vR{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}BR.env="node";class PR extends wu{constructor(t){super(t)}init(){this._context=new BR(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}PR.env="node";const RR=_R(PR,BR);class OR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(ru(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:nu(this,l,this.dpr)),r.setStrokeStyle(ru(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}OR.env="taro";class IR extends wu{constructor(t){super(t)}init(){this._context=new OR(this,this._dpr)}release(...t){}}IR.env="taro";const LR=_R(IR,OR);class DR extends xR{}DR.env="tt";class FR extends wu{constructor(t){super(t)}init(){this._context=new DR(this,this._dpr)}release(...t){}}FR.env="tt";const zR=_R(FR,DR);class HR extends vR{draw(){}createPattern(t,e){return null}}HR.env="wx";class jR extends wu{constructor(t){super(t)}init(){this._context=new HR(this,this._dpr)}release(...t){}}jR.env="wx";const NR=_R(jR,HR);class UR extends vA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=_f.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;nnew GR(xS(t,ky)))).inSingletonScope(),t.bind(eA).toService(HS))}class KR extends CT{constructor(t){super(),this.canvasRenderer=t}}let $R=!1;class qR extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=gd}}let ZR=!1;function JR(t){var e;ZR||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,jy))&&(ZR=!0,t.bind(tA).toDynamicValue((()=>new qR(xS(t,jy)))).inSingletonScope(),t.bind(eA).toService(tA))}const QR=Xc();Xc();class tO{constructor(){this.type="gif-image",this.numberType=QR}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let eO=!1;function iO(t){eO||(eO=!0,t.bind(NS).toDynamicValue((()=>new tO)).inSingletonScope(),t.bind(eA).toService(NS))}function sO(t){t.isBound(UR)||t.bind(UR).toDynamicValue((()=>new UR(SS(eA,t),xS(t,Hy),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(UR):t.bind(qm).toService(UR)}function nO(t){(function(t){WR||(WR=!0,t.bind(QS).toDynamicValue((()=>new VR)).inSingletonScope(),t.bind(eA).toService(QS),Hm(t.bind.bind(t),eA))})(t),hC(t),yC(t),AC(t),XR(t),RC(t),UC(t),ZC(t),function(t){$R||($R=!0,t.bind(VS).toDynamicValue((()=>new KR(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(VS))}(t),rT(t),pT(t),xT(t),wT(t),DT(t),NT(t),JR(t),ZT(t),rM(t),iO(t),sO(t)}class rO extends cA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${rO.idprefix}_${rO.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=oh.global,this.viewBox=new Ve,this.modelMatrix=new Ge(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(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:rO.GenerateCanvasId(),canvasControled:!0};this.canvas=new yR(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new yR({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function aO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rO))||t.bind(rO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,rO.env))||t.bind(xf).toService(rO).whenTargetNamed(rO.env)}rO.env="browser",rO.idprefix="visactor_window",rO.prefix_count=0;var oO=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 lO{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 hO(t,e=!1){const i=document.createElement("img");if(oh.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class cO extends hA{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 lO(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return hO(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return hO(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return oO(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function dO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,cO))||(t.bind(cO).toSelf().inSingletonScope(),t.bind(vg).toService(cO))}function uO(t=m_(),e=!0){uO.__loaded||(uO.__loaded=!0,dO(t),bR(t),aO(t),e&&nO(t))}uO.__loaded=!1;class pO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new SR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 SR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function gO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,pO))||t.bind(pO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,pO.env))||t.bind(xf).toService(pO).whenTargetNamed(pO.env)}pO.env="feishu";class fO extends vA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Tu(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}}let mO=!1;class vO extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let yO=!1;function _O(t){yO||(yO=!0,t.bind(TS).toDynamicValue((()=>new vO(xS(t,ky)))).inSingletonScope(),t.bind(AS).toService(TS))}function bO(t){(function(t){mO||(mO=!0,Hm(t.bind.bind(t),AS))})(t),function(t){t.isBound(fO)||t.bind(fO).toDynamicValue((()=>new fO(SS(AS,t),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(fO):t.bind(qm).toService(fO)}(t),uC(t),TC(t),_O(t),LC(t),GC(t),tT(t),mT(t),lT(t),PT(t),WT(t),tM(t),lM(t)}class xO{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class SO{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function AO(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function kO(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new xO(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function CO(t,e,i,s){const n=AO(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new SO(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function TO(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function MO(t,e=TO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class wO extends hA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=TO(i),n=null!==(e=t.dpr)&&void 0!==e?e:MO(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return MO(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function EO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,wO))||(t.bind(wO).toSelf().inSingletonScope(),t.bind(vg).toService(wO))}function BO(t=m_(),e=!0){BO.__loaded||(BO.__loaded=!0,EO(t),AR(t),gO(t),e&&bO(t))}BO.__loaded=!1;function PO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function RO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new CR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 CR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return PO(t,"target",s),PO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=RO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=RO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&OO(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),OO(t,"x",_),OO(t,"y",b),OO(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),OO(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),OO(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),OO(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),OO(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),OO(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function LO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,IO))||t.bind(IO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,IO.env))||t.bind(xf).toService(IO).whenTargetNamed(IO.env)}IO.env="harmony";const DO="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function FO(t){return"number"==typeof t&&Number.isFinite(t)}function zO(...t){for(let e=0;e({width:i,height:s})),new SO(t,l,n,i,s,e)}function VO(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=NO(e*s,i*s);if(t)return t}throw new Error(DO)}class WO extends hA{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=HO(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=HO(s),r=null!==(i=t.dpr)&&void 0!==i?i:jO(s),a=function(t,e){if(!FO(t)||!FO(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=UO(VO(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=UO(VO(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return jO(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=zO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=zO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function GO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,WO))||(t.bind(WO).toSelf().inSingletonScope(),t.bind(vg).toService(WO))}function YO(t=m_(),e=!0){YO.__loaded||(YO.__loaded=!0,GO(t),TR(t),LO(t),e&&bO(t))}YO.__loaded=!1;function XO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function KO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new wR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 wR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return XO(t,"target",s),XO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=KO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=KO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&$O(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),$O(t,"x",_),$O(t,"y",b),$O(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),$O(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),$O(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),$O(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),$O(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),$O(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function ZO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qO))||t.bind(qO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,qO.env))||t.bind(xf).toService(qO).whenTargetNamed(qO.env)}qO.env="lynx";function JO(t){return"number"==typeof t&&Number.isFinite(t)}function QO(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=eI(r),o=null!==(i=t.dpr)&&void 0!==i?i:iI(r,a),l=nI(t.width,t.height),h=rI(aI(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=eI(a),l=null!==(n=t.dpr)&&void 0!==n?n:iI(a,o),h=nI(t.width,t.height),c=Math.random().toString(),d=rI(aI(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return iI(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=QO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=QO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function lI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,oI))||(t.bind(oI).toSelf().inSingletonScope(),t.bind(vg).toService(oI))}function hI(t=m_(),e=!0){hI.__loaded||(hI.__loaded=!0,lI(t),ER(t),ZO(t),e&&bO(t))}hI.__loaded=!1;class cI extends cA{get container(){return null}constructor(t=oh.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new PR(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new PR({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function dI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cI))||t.bind(cI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,cI.env))||t.bind(xf).toService(cI).whenTargetNamed(cI.env)}cI.env="node";class uI extends hA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function pI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uI))||(t.bind(uI).toSelf().inSingletonScope(),t.bind(vg).toService(uI))}function gI(t=m_(),e=!0){gI.__loaded||(gI.__loaded=!0,pI(t),RR(t),dI(t))}gI.__loaded=!1;class fI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new IR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 IR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fI))||t.bind(fI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,fI.env))||t.bind(xf).toService(fI).whenTargetNamed(fI.env)}fI.env="taro";class vI extends hA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=CO(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=kO(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function yI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,vI))||(t.bind(vI).toSelf().inSingletonScope(),t.bind(vg).toService(vI))}function _I(t=m_(),e=!0){_I.__loaded||(_I.__loaded=!0,yI(t),LR(t),mI(t),e&&bO(t))}_I.__loaded=!1;class bI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new FR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 FR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function xI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,bI))||t.bind(bI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,bI.env))||t.bind(xf).toService(bI).whenTargetNamed(bI.env)}bI.env="tt";function SI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function AI(t,e=SI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class kI extends hA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=SI(i),n=null!==(e=t.dpr)&&void 0!==e?e:AI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return AI(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function CI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,kI))||(t.bind(kI).toSelf().inSingletonScope(),t.bind(vg).toService(kI))}function TI(t=m_(),e=!0){TI.__loaded||(TI.__loaded=!0,CI(t),zR(t),xI(t),e&&bO(t))}TI.__loaded=!1;class MI{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={}}}function wI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class EI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="wx",this.eventManager=new MI}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new jR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 jR({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return wI(t,"target",o),wI(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function BI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,EI))||t.bind(EI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,EI.env))||t.bind(xf).toService(EI).whenTargetNamed(EI.env)}EI.env="wx";function PI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function RI(t,e=PI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class OI extends hA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=PI(i),n=null!==(e=t.dpr)&&void 0!==e?e:RI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return RI(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function II(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,OI))||(t.bind(OI).toSelf().inSingletonScope(),t.bind(vg).toService(OI))}function LI(t=m_(),e=!0){LI.__loaded||(LI.__loaded=!0,II(t),NR(t),BI(t),e&&bO(t))}LI.__loaded=!1;var DI={},FI={},zI={};Object.defineProperty(zI,"__esModule",{value:!0}),zI.loop=zI.conditional=zI.parse=void 0;zI.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};zI.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};zI.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var HI={};Object.defineProperty(HI,"__esModule",{value:!0}),HI.readBits=HI.readArray=HI.readUnsigned=HI.readString=HI.peekBytes=HI.readBytes=HI.peekByte=HI.readByte=HI.buildStream=void 0;HI.buildStream=function(t){return{data:t,pos:0}};var jI=function(){return function(t){return t.data[t.pos++]}};HI.readByte=jI;HI.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var NI=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};HI.readBytes=NI;HI.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};HI.readString=function(t){return function(e){return Array.from(NI(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};HI.readUnsigned=function(t){return function(e){var i=NI(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};HI.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=NI(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=ZI(t),i=GI(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=ZI(this.attribute.gifImage),e=GI(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=oh.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=oh.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function tL(t){return new QI(t)}class eL extends bx{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=QR,this._renderContribitions=void 0,this.builtinContributions=[iL],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=zp(t).image;this._draw(t,n,!1,i)}}const iL=new class extends Jv{constructor(){super(...arguments),this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let sL=!1;function nL(t){sL||(sL=!0,t.bind(eL).toDynamicValue((()=>new eL(SS(Qy,t)))).inSingletonScope(),t.bind(Cy).toService(eL))}function rL(){lf.RegisterGraphicCreator("gif",tL)}function aL(){if(aL.__loaded)return;aL.__loaded=!0;const t=m_();rL(),nL(t),iO(t)}aL.__loaded=!1;const oL=aL,lL=[{register:mb,bindModule:Nb},{register:vb,bindModule:Gb},{register:yb,bindModule:nx},{register:_b,bindModule:lx},{register:bb,bindModule:ux},{register:xb},{register:Sb,bindModule:Ax},{register:Ab,bindModule:Mx},{register:kb,bindModule:Ix},{register:Cb,bindModule:Vx},{register:Tb,bindModule:Kx},{register:Mb,bindModule:Jx},{register:wb,bindModule:iS},{register:Eb,bindModule:oS},{register:Bb},{register:Pb,bindModule:dS},{register:Rb,bindModule:fS},{register:Ob,bindModule:_S},{register:Ib},{register:rL}];let hL=!1;const cL=[hC,yC,AC,XR,RC,UC,ZC,rT,pT,xT,wT,DT,NT,JR,ZT,rM,iO];function dL(t){return{getContributions:t}}function uL(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function pL(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=NA();i(a),s(a),n(a),UA(),uL(e,{envParams:r,force:!0})}function gL(t,e){pL(t,"browser",{bindEnv:dO,bindCanvasModules:bR,bindWindowContribution:aO},e)}function fL(t,e){pL(t,"node",{bindEnv:pI,bindCanvasModules:RR,bindWindowContribution:dI},e)}function mL(t){WA(t),function(){if(hL)return;const t=NA();hL=!0,lL.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),nL(t),UA()}(),YA(t),GA(t)}function vL(t){WA(t);const e=NA();cL.forEach((t=>t(e))),sO(e),XA(t,eA),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[])),r=VA();oh.pickerServiceFactory=()=>new UR(i,{},s,n),oh.global=r}(t)}function yL(t){WA(t);bO(NA()),XA(t,AS),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[]));oh.pickerServiceFactory=()=>new fO(i,s,n)}(t)}function _L(){if(_L.__loaded)return;_L.__loaded=!0;const t=m_();_b(),lx({bind:t.bind}),bS?XR(t):_O(t)}_L.__loaded=!1;const bL=_L;function xL(){if(xL.__loaded)return;xL.__loaded=!0;const t=m_();Pb(),dS({bind:t.bind}),JR(t)}xL.__loaded=!1;const SL=xL;function AL(){AL.__loaded||(AL.__loaded=!0,Ib())}AL.__loaded=!1;const kL=AL;class CL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,$_(this.target,i,_o.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class wL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class EL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class BL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const PL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class RL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){X_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){X_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class OL extends RL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=PL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r),this.determineUpdateFunction()}}class IL extends RL{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class LL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class DL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const FL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class zL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=FL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class HL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const jL=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class NL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(X_(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class UL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:jL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class VL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:jL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const WL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class GL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:WL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class YL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:WL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const XL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class KL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:XL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class $L extends NL{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:XL(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const qL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class ZL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class JL extends ZL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=qL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}}class QL extends ZL{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const tD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class eD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nD extends sD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class rD extends sD{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class aD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,$_(this.target,{text:n})}}class oD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lD extends oD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class hD extends oD{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class cD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&q_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),X_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class dD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class uD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const pD={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function gD(t,e){for(let i=0;ipD[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&M_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(X_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class mD{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new w_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function vD(t){return new mD(t)}class yD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;$_(this.target,{text:o})}}class _D extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(q_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),q_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),q_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),q_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;q_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:yD});const i=s._titleBottom.attribute.text;q_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:yD})}else q_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),q_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;q_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());q_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class bD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class xD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(q_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:yD}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:yD}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class SD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class AD extends rb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==AD.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class kD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class CD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==CD.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CD.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TD{static createTempCanvas(t,e,i){return b_.createCanvas({width:t,height:e,dpr:i||b_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=TD.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(TD.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class ED extends CD{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class OD extends CD{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=TD.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class ID extends AD{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=b_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=b_.createCanvas({width:i,height:s,dpr:b_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class LD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}$_(this.target,{textConfig:o})}}class DD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class FD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function ND(t,e){X_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class UD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,q_(this.target,m)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class VD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,q_(this.target,d)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class WD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,q_(this.target,p)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class GD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class YD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}}class XD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:VD,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class KD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:WD,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class $D extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class qD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class ZD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class JD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:qD,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class QD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:ZD,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class tF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),X_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ru(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ru(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class eF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=oh.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Al,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=oh.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Fo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Fo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function lF(t){var e,i;const s=null!==(e=m_().getAll(Cy))&&void 0!==e?e:[],n=aF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;oF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=rF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function hF(t,e){var i,s;const n=null!==(i=m_().getAll(e))&&void 0!==i?i:[],r=aF(t.registry.picker,"vrender:legacy-picker"),a=new Set;oF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=rF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const cF=gL,dF=fL,uF={taro:{installEnv:function(t,e){pL(t,"taro",{bindEnv:yI,bindCanvasModules:LR,bindWindowContribution:mI},e)},loadEnv:_I},feishu:{installEnv:function(t,e){pL(t,"feishu",{bindEnv:EO,bindCanvasModules:AR,bindWindowContribution:gO},e)},loadEnv:BO},tt:{installEnv:function(t,e){pL(t,"tt",{bindEnv:CI,bindCanvasModules:zR,bindWindowContribution:xI},e)},loadEnv:TI},wx:{installEnv:function(t,e){pL(t,"wx",{bindEnv:II,bindCanvasModules:NR,bindWindowContribution:BI},e)},loadEnv:LI},lynx:{installEnv:function(t,e){pL(t,"lynx",{bindEnv:lI,bindCanvasModules:ER,bindWindowContribution:ZO},e)},loadEnv:hI},harmony:{installEnv:function(t,e){pL(t,"harmony",{bindEnv:GO,bindCanvasModules:TR,bindWindowContribution:LO},e)},loadEnv:YO}},pF=[nC,eC,S_,k_,uA,gA],gF=[()=>{w_.registerBuiltInAnimate("increaseCount",aD),w_.registerBuiltInAnimate("fromTo",ab),w_.registerBuiltInAnimate("scaleIn",cD),w_.registerBuiltInAnimate("scaleOut",dD),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL),w_.registerBuiltInAnimate("fadeIn",EL),w_.registerBuiltInAnimate("fadeOut",BL),w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("moveIn",nD),w_.registerBuiltInAnimate("moveOut",rD),w_.registerBuiltInAnimate("rotateIn",lD),w_.registerBuiltInAnimate("rotateOut",hD),w_.registerBuiltInAnimate("update",fD),w_.registerBuiltInAnimate("state",uD),w_.registerBuiltInAnimate("labelItemAppear",_D),w_.registerBuiltInAnimate("labelItemDisappear",bD),w_.registerBuiltInAnimate("poptipAppear",xD),w_.registerBuiltInAnimate("poptipDisappear",SD),w_.registerBuiltInAnimate("inputText",yD),w_.registerBuiltInAnimate("inputRichText",LD),w_.registerBuiltInAnimate("outputRichText",DD),w_.registerBuiltInAnimate("slideRichText",zD),w_.registerBuiltInAnimate("slideOutRichText",FD),w_.registerBuiltInAnimate("slideIn",UD),w_.registerBuiltInAnimate("growIn",VD),w_.registerBuiltInAnimate("spinIn",WD),w_.registerBuiltInAnimate("moveScaleIn",XD),w_.registerBuiltInAnimate("moveRotateIn",KD),w_.registerBuiltInAnimate("strokeIn",GD),w_.registerBuiltInAnimate("slideOut",$D),w_.registerBuiltInAnimate("growOut",qD),w_.registerBuiltInAnimate("spinOut",ZD),w_.registerBuiltInAnimate("moveScaleOut",JD),w_.registerBuiltInAnimate("moveRotateOut",QD),w_.registerBuiltInAnimate("strokeOut",YD),w_.registerBuiltInAnimate("pulse",tF),w_.registerBuiltInAnimate("MotionPath",HD),w_.registerBuiltInAnimate("streamLight",eF),w_.registerBuiltInAnimate("dissolve",wD),w_.registerBuiltInAnimate("grayscale",RD),w_.registerBuiltInAnimate("distortion",ED),w_.registerBuiltInAnimate("particle",OD),w_.registerBuiltInAnimate("glitch",PD),w_.registerBuiltInAnimate("gaussianBlur",BD),w_.registerBuiltInAnimate("pixelation",ID)},fb],fF=[gC,bC,wC,bL,FC,oL,HC,XC,iT,cT,yT,AT,OT,zT,YT,KT,iM,cM,kL,SL];function mF(){pF.forEach((t=>t())),gF.forEach((t=>t()))}function vF(t,e){if(!nF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==b_?void 0:b_.env)?b_.envParams:void 0}(e);return void 0===i?fL(t):dF(t,i),mL(t),yL(t),gI(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}function yF(t,e,i){if(!nF(t,e))return t;const s=uF[e];return s.installEnv(t,i),mL(t),function(t){yL(t)}(t),s.loadEnv(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}const _F=Symbol.for("visactor.vrender.sharedAppRegistry");function bF(){var t;const e=globalThis,i=null!==(t=e[_F])&&void 0!==t?t:new Map;return e[_F]=i,i}function xF(t,e){const i=bF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function SF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=bF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function AF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=xF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(SF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>SF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=xF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&SF(t,i,s))}}}(t,s,r,o)}const kF=$A,CF=[];function TF(t){CF.forEach((({module:e,options:i})=>{kF(e,Object.assign(Object.assign({},i),{app:t}))}))}var MF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),lF(t),hF(t,eA),mF(),t):t}(bA(MF(t,["envParams"])),e);return TF(i),i}var EF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},DF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},FF=(t,e)=>{const i=LF(t),s=DF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},zF=(t,e)=>{const i=AF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,IF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},HF="poptipForText";class jF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(HF))&&this._dedupeStagePlugin(HF)}initView(){var e,i,s,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:u,autoPreventDefault:f,background:m}=this._option,v=FF(l,h);b_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=LF(i.mode),n=FF(i.mode,i.modeParams);return zF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=t.releaseAppRef,null===(e=this._option.runtimePluginInstallers)||void 0===e||e.forEach((e=>e(t.app)));try{this._stage=(_=t.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:p(a)?a:!p(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=tg({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(p(c)?c:bM(l))&&!1!==d&&vB.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,g(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=oR.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!_M(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:b_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>dR(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>dR(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{dR(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===oR.before;(e||i)&&(pM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=oR.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=oR.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),pM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=uR(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=pR(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=pR(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=hR(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=hR(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:gR,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{dR(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===rR.appear))?rR.appear:e.every((t=>t===rR.disappear))?rR.disappear:rR.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===jP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=RP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=RP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:IP(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===jP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===jP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===jP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===jP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===jP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{dR(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=uR(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return _M(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{b_.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{dR(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function NF(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:fM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const UF={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}},VF={poptip:H({},UF)};function WF(t){t.crosshair=Y(t.crosshair||{}).map((e=>uB({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function GF(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}=li(l,i.width,i.height);a=t,o=e}else if(h&&_M(e.mode)){let t;t=y(h)?b_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(xM(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}}const YF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function XF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function KF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function $F(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;YF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function qF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var ZF,JF,QF,tz,ez,iz;t.LayoutZIndex=void 0,(ZF=t.LayoutZIndex||(t.LayoutZIndex={}))[ZF.SeriesGroup=0]="SeriesGroup",ZF[ZF.Axis_Grid=50]="Axis_Grid",ZF[ZF.CrossHair_Grid=100]="CrossHair_Grid",ZF[ZF.Region=450]="Region",ZF[ZF.Mark=300]="Mark",ZF[ZF.Node=400]="Node",ZF[ZF.Axis=100]="Axis",ZF[ZF.MarkLine=500]="MarkLine",ZF[ZF.MarkArea=100]="MarkArea",ZF[ZF.MarkPoint=500]="MarkPoint",ZF[ZF.DataZoom=500]="DataZoom",ZF[ZF.ScrollBar=500]="ScrollBar",ZF[ZF.Player=500]="Player",ZF[ZF.Legend=500]="Legend",ZF[ZF.CrossHair=500]="CrossHair",ZF[ZF.Indicator=500]="Indicator",ZF[ZF.Title=500]="Title",ZF[ZF.Label=500]="Label",ZF[ZF.Brush=500]="Brush",ZF[ZF.CustomMark=500]="CustomMark",ZF[ZF.Interaction=700]="Interaction",t.LayoutLevel=void 0,(JF=t.LayoutLevel||(t.LayoutLevel={}))[JF.Indicator=10]="Indicator",JF[JF.Region=20]="Region",JF[JF.Axis=30]="Axis",JF[JF.DataZoom=40]="DataZoom",JF[JF.Player=40]="Player",JF[JF.ScrollBar=40]="ScrollBar",JF[JF.Legend=50]="Legend",JF[JF.Title=70]="Title",JF[JF.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(QF=t.AttributeLevel||(t.AttributeLevel={}))[QF.Default=0]="Default",QF[QF.Theme=1]="Theme",QF[QF.Chart=2]="Chart",QF[QF.Base_Series=3]="Base_Series",QF[QF.Series=4]="Series",QF[QF.Mark=5]="Mark",QF[QF.User_Chart=6]="User_Chart",QF[QF.User_Series=7]="User_Series",QF[QF.User_Mark=8]="User_Mark",QF[QF.User_SeriesStyle=9]="User_SeriesStyle",QF[QF.Built_In=99]="Built_In";class sz{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,H({},sz.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]))))}}sz.defaultMarkInfo={};class nz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class rz{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=>uB({},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 az extends nz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=rz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new sz,this._lastLayoutRect=null,this.id=AM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new DP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${NB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=vB.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class oz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=tB(iB(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QE(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QE(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QE(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QE(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QE(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QE(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QE(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QE(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QE(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(eB(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class lz extends az{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new oz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(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 hz extends rz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class cz extends lz{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=hz,this.modelType="region",this.specKey="region",this.type=cz.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function dz(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 uz(t,e,i){e?t.forEach((t=>{const e=X(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=X(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 pz(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 gz(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),pz(d,!0,p,l),s&&uz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function fz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=yz(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),pz(d,!1,p,o),s&&uz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function vz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=yz(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=yz(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"left",s),r.length&&gz(r,e,i,!0,"left",s),a.length&&fz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"top",s),r.length&&mz(r,e,i,!0,"top",s),a.length&&vz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"right",s),r.length&&gz(r,e,i,!0,"right",s),a.length&&fz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"bottom",s),r.length&&mz(r,e,i,!0,"bottom",s),a.length&&vz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=yz(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=yz(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:fM)("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}}}_z.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(tz||(tz={})),t.STATE_VALUE_ENUM=void 0,(ez=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",ez.STATE_HOVER="hover",ez.STATE_HOVER_REVERSE="hover_reverse",ez.STATE_DIMENSION_HOVER="dimension_hover",ez.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",ez.STATE_SELECTED="selected",ez.STATE_SELECTED_REVERSE="selected_reverse",ez.STATE_SANKEY_EMPHASIS="selected",ez.STATE_SANKEY_EMPHASIS_REVERSE="blur",ez.STATE_HIGHLIGHT="highlight",ez.STATE_BLUR="blur",ez.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(iz||(iz={}));const bz=["linear","radial","conical"],xz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Sz={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{Sz[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class Az extends nz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class kz extends Az{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,lR.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Sz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(NB)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(NB))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Ow(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class Cz extends nz{constructor(){super(...arguments),this.id=AM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=vB.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Tz extends Cz{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Mz=1e3,wz="quadInOut",Ez=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Bz=(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=Ru(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Pz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ak(t):[],n=ak(e);i&&s&&(i.fromTransform&&ok(s,i.fromTransform.clone().getInverse()),ok(s,i.toTransfrom));const[r,a]=rk(s,n);return t?nk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Oz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Iz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Oz.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Eu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Lz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Pz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Bz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):$_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Dz=(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=Rz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Iz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Lz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wz);return c.play(d),c};class Fz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Pz(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&&Bz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const zz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Ez.includes(t))(i)||(e[i]=t[i])})),e},Hz=(t,e,i)=>{const s=zz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=oh.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},jz=(t,e,i)=>{const s=[],n=i?null:zz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:zz(t.attribute);if("rect"===t.type)ck(t,e).forEach((t=>{s.push(oh.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)dk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)uk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=fk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(oh.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?bk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?gk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&xk(t,e).forEach((t=>{"path"in t?s.push(oh.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Hz(t,s,e),s},Uz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Vz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Uz(l.delay,n,a,o),d=Uz(l.duration,n,a,o),u=Uz(l.oneByOne,n,a,o),p=Uz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(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);Dz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Rz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Iz(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:_o.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Lz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mz,null!==(l=i.easing)&&void 0!==l?l:wz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:_o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Fz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Dz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},Wz=(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))))},Gz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},Yz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},Xz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];Yz(t,a,s)},Kz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));Yz(t,r,i)},$z=Symbol("statesClearedBeforeReInit");class qz extends Cz{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Tz(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=tg("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Al)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===tz.enter||t.context.diffState===tz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&Yz(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new kz(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&uB(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Iw(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=YE(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):bz.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Iw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},xz[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)bz.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return hR(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return vB.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[YB],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=hR(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===rR.appear))?rR.appear:t.every((t=>t===rR.disappear))?rR.disappear:t[0];return null!=e?e:rR.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{Gz(t),s.push(...t.getGraphics())})),e.forEach((t=>{Gz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Vz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=Wz(e,n),r=Wz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===rR.exit?rR.exit:i===rR.update?rR.update:rR.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===tz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===tz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=tz.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=tz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=tz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=rR.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=rR.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return cR(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=cR(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!bz.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!Iw(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,LP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=vB.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=vB.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===oR.before||(this._product||this._initProduct(),pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[$z],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?Xz(i,t,!0,a):Kz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[$z]=e:delete s[$z]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===tz.exit&&!e.isExiting)if(e.context.animationState===tz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===tz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=tg({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[$z]=t.currentStates.slice())}))}}var Zz;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(Zz||(Zz={}));class Jz extends qz{constructor(){super(...arguments),this.type=Jz.type,this._marks=[],this._diffState=tz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(gM("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?(gM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return dR(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===tz.update){const t=this.hasAnimation(),e=LP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=tz.update}render(){this._isCommited&&(pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}Jz.type="group";const Qz={measureText:jB};class tH{static instance(){return tH.instance_||(tH.instance_=new tH),tH.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 eH{constructor(){this.id=AM(),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))?gM("不要重复添加相同的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 iH extends eH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const sH=(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"},nH=(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 rH extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=Za.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Za.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||sH(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=nH(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=Za.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=nH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=sH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Za.now()-i>this.config.press.time&&nH(s[0],t){oh.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class oH extends aH{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 C=oh.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 T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class lH extends aH{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=oh.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 hH extends sb{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&M_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(X_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));$_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const cH={type:"fadeIn"};function dH(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 cH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}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"},state:{duration:300,easing:"linear"}},pH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},gH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},fH=()=>{vB.registerAnimation("scaleInOut",(()=>pH))},mH=()=>{vB.registerAnimation("fadeInOut",(()=>gH))},vH=(t,e)=>({appear:dH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:hH,duration:uH.update.duration,easing:uH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),yH=()=>{vB.registerAnimation("line",vH)},_H=()=>{w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL)},bH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class xH{constructor(t){this._markSet=new sz,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const SH={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class AH extends xH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},SH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}AH.type="element-highlight",AH.defaultOptions=SH;const kH=()=>{vB.registerInteractionTrigger(AH.type,AH)},CH={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class TH extends xH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},CH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),Xz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}TH.type="element-select",TH.defaultOptions=CH;const MH=()=>{vB.registerInteractionTrigger(TH.type,TH)};class wH extends eH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const EH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},BH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...BH(t))})),s},PH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(EH(t,r),!1)};class RH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>vB.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>vB.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>vB.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return vB.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>vB.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){vB.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}static getFunction(t){return t?tH.instance().getFunction(t):null}static getFunctionList(){return tH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=vB.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=vB.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,KP.get(e);var e}static registerSVG(t,e,i){const s=vB.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=vB.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){RB.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=AM(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=fR.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=$F(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{var n;if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?vB.getSeriesBuiltInTheme(e):vB.getComponentBuiltInTheme(e);i=i?uB({},s,i[e]):s}s===t.length-1&&p(i)&&(i=DB({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e],(null===(n=this.getFunctionList())||void 0===n?void 0:n.length)&&(i=zB(i,this)))})),this._cachedProcessedTheme[e]=i,i},Bw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=_M(v);if(S?uO(iA):"node"===v&&gI(iA),S&&f&&(this._container=y(f)?b_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=OB.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=vB.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===i.type&&A.push("scrollbar");const C=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new jF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new GP(this,this._compiler),this._event=new DP(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),RB.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=uB({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=FB(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;RH.getFunctionList()&&RH.getFunctionList().length&&(t=zB(t,RH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=vB.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=vB.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=vB.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return GF(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:UB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:VB})}_initDataSet(t){this._dataSet=t instanceof Fa?t:new Fa,XP(this._dataSet,"dataview",Ia),XP(this._dataSet,"array",s),YP(this._dataSet,"copyDataView",tR);for(const t in vB.transforms)YP(this._dataSet,t,vB.transforms[t]);for(const t in vB.dataParser)XP(this._dataSet,t,vB.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),XF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?rR.none:rR.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,RB.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{EH(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof za?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=iR(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?uB({},t[n][e.index],i):i):t[n]=s?uB({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?uB({},t[n][r],i):i)}else t.id===e&&(t[n]=s?uB({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=uB({},t.getSpec(),e));const r=t.updateSpec(e),a=XF(r),o=KF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=yB({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=IB(this._currentThemeName),this._currentTheme=o(a,l);else{const t=yB({},IB(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),IB(n),IB(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(VF.poptip,UF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!_M(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return IB(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!OB.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield NF(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(!_M(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(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}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)?b_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?sB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 gM("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?sB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(gM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tH.instance().getFunction(t)}registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}getFunctionList(){return tH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=vB.getChartPlugins();t.length>0&&(this._chartPlugin=new iH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=vB.getVChartPlugins();e.length>0&&(this._vChartPlugin=new wH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=fR.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=fR.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}RH.InstanceManager=RB,RH.ThemeManager=OB,RH.globalConfig={uniqueTooltip:!0},RH.Utils=Qz,RH.vglobal=b_;vB.registerRegion("region",cz),vB.registerLayout("base",_z),KT(),HC(),vB.registerMark(Jz.type,Jz),vB.registerStageEventPlugin("gesture",rH),kH(),MH(),MB(cB.name,cB);const OH="monotone",IH="linear",LH="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class DH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function FH(t,e){return e("component",t)}function zH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=vB.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const HH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},jH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},NH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},UH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=zH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},VH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const WH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function GH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=XH(UH(h,r,a,c),d,g),o.value=XH(UH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=UH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function YH(t,e,i,s,n,r,a){if(d(e)){GH(t,e(n,a),i,s,r,a)}else e&&GH(t,e,i,s,r,a)}const XH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class KH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{YH(a,t,e,i,s,n,r)})):d(t)?YH(a,t,e,i,s,n,r):t&&GH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:UH(r.visible,t,n),value:XH(UH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:UH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=UH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&WH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const $H={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},qH=(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=gP([],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 ZH(a,n,o)},ZH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{kM(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=>{kM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=$H[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},JH=(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=>{kM(t[e])||(t[e]=0)}))})),t},QH=`${NB}_HIERARCHY_DEPTH`,tj=`${NB}_HIERARCHY_ROOT`,ej=`${NB}_HIERARCHY_ROOT_INDEX`;function ij(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function sj(t,e,i){t&&(i.needDefaultSeriesField&&(t[XB]=i.defaultSeriesField),t[GB]=e,t[YB]=i.getKey(t,e,i))}function nj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function rj(t,e,i,s=0,n,r){void 0===r&&(r=e),sj(t,e,i),t[QH]=s,t[tj]=n||t[i.categoryField],t[ej]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>rj(e,s,i,t[QH]+1,t[tj],r)))}const aj={label:{name:"label",type:"text"}},oj=`${NB}_rect_x`,lj=`${NB}_rect_x1`,hj=`${NB}_rect_y`,cj=`${NB}_rect_y1`,dj={data:!0},uj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},pj=[...Object.keys(uH),"normal"];function gj(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 _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=uB({},o[e],a);return _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function fj(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),bj(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function mj(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function vj(t,e){var i;return null!==(i=null==t?void 0:t[GB])&&void 0!==i?i:e.context.graphicIndex}function yj(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 _j(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function bj(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),bj(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),bj(t[s],e,i))}function xj(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Sj extends rz{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=OE(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=vB.getSeriesMarkMap(o)?function(t,e,i){const s=vB.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=uB({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return uB({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=uB({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>uB({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Aj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(uj[e]||(t[e]=!0),t)),{}),kj={compileOnlyKeys:uj,dataRelatedKeys:Aj,seriesOnlyKeys:{tooltip:!0}},Cj={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Tj=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,Mj=(t,e,i)=>{const s=Tj(t),n=Tj(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function wj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class Ej extends az{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${NB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Sj,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=xj(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"invalidTravel",JH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=iR(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=eR(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=eR(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Tz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=ZH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){YP(this._dataSet,"dimensionStatistics",qH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new za(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&&gP(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){YP(this._dataSet,"dimensionStatistics",qH);const s=new za(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=gP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&gP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new za(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)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!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,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:bM(s)||xM(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=uB(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=uB(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=bH(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=bH(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=bH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:XB;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:KB,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,KB,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(vB.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new KH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,wj(i))}_getSpecUpdatePolicy(){return kj}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},dj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Mj(t[i],e[i],Cj)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Mj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?wj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&wj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof za||sR(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();xj(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:XB,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WE).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DE(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:XB}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,uB({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:YB}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==ZB&&t!==QB&&t!==qB&&t!==JB||(t=this.getStackValueField()),null!==(e=mP(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>kM(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:XB]}}function Bj(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Ow(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 Pj(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}}}Ej.mark=aj,Ej.transformerConstructor=Sj;class Rj extends Ej{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);Ow(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:`${NB}_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(ZB),this.setFieldX2(qB)):(this.setFieldY(ZB),this.setFieldY2(qB))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(QB),this.setFieldX2(JB)):(this.setFieldY(QB),this.setFieldY2(JB))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(eP),this.setFieldX2(tP)):(this.setFieldY(eP),this.setFieldY2(tP))}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)&&(Bj("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Oj(t){return"bottom"===t||"top"===t}function Ij(t){return"left"===t||"right"===t}function Lj(t){return"z"===t}function Dj(t,e){return qE(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Fj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function zj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Oj(t)?"linear":"band":Oj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Hj=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):["linear","log","symlog"].includes(e)?FH("axisLinear",i):{})&&void 0!==s?s:{},r=Oj(t)?FH("axisX",i):Ij(t)?FH("axisY",i):FH("axisZ",i);return uB({},FH("axis",i),n,r)};class jj{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:fM)("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:fM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Lw(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Oj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Nj extends jj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Uj=(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))},Vj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},Wj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Lw(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:Gj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,Yj=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class Xj extends jj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Uj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:jP.canvas}),callback:this.onMouseOut}),bM(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),bM(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Kj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Kj||(Kj={}));const $j={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qj={sampling:!0,samplingFactor:!0};class Zj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark($j.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:LH,curveType:IH,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===OH?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark($j.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:yj(this._spec,$j.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new za(this._option.dataSet,{name:`${NB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[$j.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,uB({},this._spec[$j.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Jj=Object.assign(Object.assign({},aj),$j),Qj=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>Qj(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},tN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class eN extends qz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return tN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(Iw(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Qj(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[YB]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const iN=new Uint32Array(33),sN=new Uint32Array(33);sN[0]=0,iN[0]=~sN[0];for(let t=1;t<=32;++t)sN[t]=sN[t-1]<<1|1,iN[t]=~sN[t];function nN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&iN[31&o]&sN[1+(31&l)])return!0}else{if(i[h]&iN[31&o])return!0;if(i[c]&sN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,iN[31&o]&sN[1+(31&l)]);else for(s(h,iN[31&o]),s(c,sN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,sN[31&a]|iN[1+(31&o)]);else for(n(l,sN[31&a]),n(h,iN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function rN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function aN(t,e,i=!1){return i?rN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function oN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=aN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=rN(t,r)),e.getRange(r)))}function lN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return lN(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return lN(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 lN(t,e,n,s,h,c)}return!1}const cN=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],dN=["top","inside-top","inside"];function uN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const pN={mode:"same-time",duration:300,easing:"linear"};function gN(t){return 3===t||4===t}function fN(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 mN=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 vN(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)}}class yN extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class _N extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const bN=(t,e)=>Math.ceil(t)>Math.floor(e),xN=([t,e],[i,s])=>s>t&&e>i;function SN(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const AN=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class kN extends Qp{constructor(t,e){super(t),this._skipRenderAttributes=AN,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{MN(t,e,i)})),e}function wN(t,e){e&&(null==t||t.onComplete.push(e))}function EN(t){t.forEach((t=>{t()}))}function BN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var PN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(GM.hover,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(TM(this,(t=>{P(t.states)||(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void TM(this,(t=>{P(t.states)||(t.removeState(GM.selectedReverse),t.removeState(GM.selected))}));P(e.states)||(e.addState(GM.selected,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[vN(g,f,c,d,a,o),vN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=NM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Al)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),EN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(pN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=MN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=MN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}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):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return QM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&bN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&bN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(SN([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!xN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(aN(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;TN(i,null==n?void 0:n.attribute),TN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{ON[t]=e};var LN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};DN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const FN=()=>{IN("line",DN),IN("area",DN)};var zN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}HN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const jN=()=>{IN("symbol",HN),IN("line-data",HN)};class NN extends eN{constructor(){super(...arguments),this.type=NN.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)===PE.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}NN.type="line";const UN=()=>{vB.registerMark(NN.type,NN),KT(),iT(),FN(),jN(),_H(),vB.registerGraphicComponent("line",ag)};class VN extends qz{constructor(){super(...arguments),this.type=VN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}VN.type="symbol";const WN=()=>{vB.registerMark(VN.type,VN),KT(),iM(),jN(),vB.registerGraphicComponent("symbol",Gg)};class GN extends Sj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function YN(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function XN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function KN(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 $N(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 qN(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 ZN(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 JN=t=>t.map(((t,e)=>({index:e,value:t}))),QN=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},tU=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=$M(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return JN(v)};class sU{constructor(t){this.id=AM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class nU extends sU{constructor(){super(nU.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Ow(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&YN(c)&&YN(d)))return;const u=XN(t,c),p=XN(e,d);if(!0===u.break&&!0===p.break)return;const{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(!$N(u,p))return}else if(0===_&&0===b){if(!$N(p,u))return}else if(y||A)if(y&&!A){if(!KN(u,p))return}else if(A&&!y){if(!KN(p,u))return}else{if(f===b)return;if(f>b){if(!qN(u,p))return}else if(!qN(p,u))return}else{if(0===f&&0===_){if(!ZN(u,p))return}else if(0===b&&0===g&&!ZN(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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){YP(e.getOption().dataSet,"tickAlign",iU);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}nU.pluginType="component",nU.type="AxisSyncPlugin";const rU={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function aU(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 oU(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 lU(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const hU=t=>"band"===t||"ordinal"===t||"point"===t;function cU(t,e){return{id:t,label:t,value:e,rawValue:t}}function dU(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class uU extends eH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const pU=`${NB}_ARC_TRANSFORM_VALUE`,gU=`${NB}_ARC_RATIO`,fU=`${NB}_ARC_START_ANGLE`,mU=`${NB}_ARC_END_ANGLE`,vU=`${NB}_ARC_K`,yU=`${NB}_ARC_MIDDLE_ANGLE`,_U=`${NB}_ARC_QUADRANT`,bU=`${NB}_ARC_RADIAN`,xU=-Math.PI/2,SU=3*Math.PI/2,AU=.6,kU=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},CU=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):"linear"===e?FH("axisLinear",i):{})&&void 0!==s?s:{},r=FH("angle"===t?"axisAngle":"axisRadius",i);return uB({},FH("axis",i),n,r)};function TU(t,e,i,s){switch(t){case r.cartesianBandAxis:return Hj(Dj(i,["z"]),"band",e);case r.cartesianLinearAxis:return Hj(Dj(i,["z"]),"linear",e);case r.cartesianLogAxis:return Hj(Dj(i,["z"]),"log",e);case r.cartesianSymlogAxis:return Hj(Dj(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return Hj(Dj(i),void 0,e);case r.polarBandAxis:return CU(i.orient,"band",e);case r.polarLinearAxis:return CU(i.orient,"linear",e);case r.polarAxis:return CU(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>Oj(t.orient)));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>Ij(t.orient)));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return MU(i,FH(t,e));default:return FH(t,e)}}const MU=(t,e)=>{var i;const s=uB({},e,e[Fj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class wU extends rz{getTheme(t,e){return TU(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({},iB(e)),{[s]:0}))}}class EU extends lz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=wU,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof qa||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:jP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new uU(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;EH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=BH(t),s=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}EH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var BU,PU;EU.transformerConstructor=wU,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(BU||(BU={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(PU||(PU={}));class RU extends qz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?EH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(EH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?(this._component.setAttributes(i),this._product&&this._component.parent!==this._product&&this._product.appendChild(this._component)):(this._component=vB.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(FP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}RU.type="component";const OU=()=>{vB.registerMark(RU.type,RU)};var IU,LU;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(IU||(IU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(LU||(LU={}));const DU={[LU.selectedReverse]:{},[LU.selected]:{},[LU.hover]:{},[LU.hoverReverse]:{}},FU=t=>t,zU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class HU extends EU{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?BU.circleAxis:BU.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?PU.circleAxisGrid:PU.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=gj(null===(h=vB.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&Tw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Ow(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Ow(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return Tw(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=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=Mw(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()})),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(Tw(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||zU[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=wP(s=t.domainLine)).startSymbol=wP(s.startSymbol),s.endSymbol=wP(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(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 PP(uB({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:PP(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return PP(uB({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:PP(t.tick.style)),t.tick.state&&(i.tick.state=EP(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 PP(uB({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:PP(t.subTick.style)),t.subTick.state&&(i.subTick.state=EP(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=rU[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:uB({},d,PP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:PP(h.style)}),h.state&&(i.title.state.shape=EP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:PP(o.style)}),o.state&&(i.title.state.background=EP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=EP(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=PP(t.background.style)),t.background.state&&(i.panel.state=EP(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:HB(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 PP(uB({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:PP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:HB(t.subGrid.alternateColor),style:PP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=zH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){XP(this._option.dataSet,"scale",FU);const i=this.registerTicksTransform();return new za(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===IU.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}HU.specKey="axes";const jU=()=>{OU(),vB.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},NU=[nU];class UU extends HU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{const e=this.getOrient();Oj(e)?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Ij(e)?dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Lj(e)&&dU(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._clearContinuousBarBandwidthCache=()=>{this._continuousBarBandwidthCache=void 0},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=uB({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(uB({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Oj(this.getOrient()),n=t=>{var e;return(s?!Oj(t.getOrient()):Oj(t.getOrient()))&&Ow(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&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Dj(i,["z"]),Lj(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(!lU(e))return null;const{axisType:t,componentName:s}=zj(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=>Ij(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(!lU(t))return;const{axisType:s,componentName:n}=zj(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=vB.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Oj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Lj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(NU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Oj(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&&!Oj(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Lj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Ij(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Oj(this.getOrient())?t.fieldX:Lj(this.getOrient())?t.fieldZ:t.fieldY,Ow(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getBandwidth:(t=0)=>this._getContinuousBarBandwidth(t),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}_getContinuousBarBandwidth(t=0){if(0!==t||!Ow(this._scale.type))return;const e=this._scales[0],i=e.domain(),s=e.range(),n=+(null==i?void 0:i[0]),r=+(null==i?void 0:i[i.length-1]),a=+(null==s?void 0:s[0]),o=+(null==s?void 0:s[s.length-1]);if(!(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(a)&&Number.isFinite(o)&&n!==r))return;const l=this._continuousBarBandwidthCache;if(l&&l.scale===e&&l.domainStart===n&&l.domainEnd===r&&l.rangeStart===a&&l.rangeEnd===o)return l.bandWidth;const h=new Set,c=this.getOrient();Tw(this._regions,(t=>{var e,i,s,n;if(t.type!==PE.bar)return;const r=t,a=Oj(c)&&"vertical"===r.direction?r.fieldX[0]:Ij(c)&&"horizontal"===r.direction?r.fieldY[0]:void 0,o=a?null===(n=null===(s=null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.latestData)||void 0===s?void 0:s[a])||void 0===n?void 0:n.values:void 0;null==o||o.forEach((t=>{const e=+t;Number.isFinite(e)&&h.add(e)}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const d=Array.from(h).sort(((t,e)=>t-e));if(d.length<2)return;let u=1/0,p=d[0];for(let t=1;t0&&i{if(t===this._axisMark&&!1===this._isLayout&&(Oj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Oj(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return Tw(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]:Oj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Lj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();Tw(this._regions,(e=>{Oj(t)?dU(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Ij(t)?dU(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Lj(t)&&dU(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Oj(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=Oj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=uB(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Oj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return cU(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Ow(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),Tw(this._regions,(t=>{var e,i;null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i||i.target.addListener("change",this._clearContinuousBarBandwidthCache)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}UU.type=r.cartesianAxis,UU.specKey="axes";class VU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=cU(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=>cU(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const WU=(t,e,i,s)=>{const n=eU(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},GU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,YU=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?JN([s[s.length-1]]):JN([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=WU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=KU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=WU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!GU(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?YU(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function qU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=$U(e,t,!1,!!n),o=$U(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class ZU extends kN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${IU.grid}-sub`:`${IU.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=$U(t,o,!1,!!a)}const u=NM.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=gw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=NM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}ZU.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class JU{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=zM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return FM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class QU extends nb{onBind(){var t;const e=vD(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;TN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class tV extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;TN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function eV(){HC(),iT(),YT(),cM(),w_.registerBuiltInAnimate("axisEnter",QU),w_.registerBuiltInAnimate("axisUpdate",tV)}HC(),cT();class iV extends ZU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},ZU.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=UM,endAngle:r=VM}=this.attribute;i=pw(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function sV(){HC(),iT(),yT(),iM()}function nV(){HC(),iT(),gC(),iM()}G(iV,JU),sV();class rV extends kN{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=NM.line;Y(i)[0].cornerRadius&&(t=NM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=NM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}rV.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}}},nV();class aV extends rV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function oV(){HC(),OT(),iM(),YT(),cM()}var lV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:Y(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+E,i=1===j?(t-e)/2+E+I/2:b[0]+E-(T/2+e/2-E)+I/2;if(V(i,"center"),A){const t=i-I/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-I-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,G=lV(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Al)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},hV.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}hV.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const cV=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(GM.hover,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.hoverReverse,!0)})),s):i},dV=(t,e,i)=>i?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),null):i,uV=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(GM.selected)?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.selectedReverse),t.removeState(GM.selected))})),null):s.name&&!P(s.states)?(s.addState(GM.selected,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.selectedReverse,!0)})),s):i},pV={type:"default",duration:300,easing:"linear"};class gV extends CN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cV(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=NM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),EN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(TM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=MN(this),{delay:a=0,duration:o=pV.duration,easing:l=pV.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};TN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=MN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(pV)}_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=NM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=IU.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=NM.group({x:0,y:0,pickable:!1});t.name=IU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=NM.group({x:0,y:0,pickable:!1});i.name=IU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=NM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=IU.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=YM;else{const t=this.data[s],e=H({},YM,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=NM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=IU.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=YM;else{const i=H({},YM,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=NM.group({x:0,y:0,pickable:!1});return r.name=`${IU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=QM(this._getLabelAttribute(t,e,n,i));if(a.name=IU.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=YM;else{const s=H({},YM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new hV(Object.assign({},e));i.name=IU.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/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 f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},nw.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},TM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=ZA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},TN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const fV={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&&fw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function mV(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function vV(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fV[n]||fV.parity;if(s.length>=3&&mw(s,r)){do{s=a(s,r)}while(s.length>=3&&mw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);fw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),vV(l,s,n,(t=>fw(t,l,r))),vV(h,s,o,(t=>fw(t,h,r)||!(!n||t===l)&&fw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function _V(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},SV(t,e.attribute.angle)),{angle:xV(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({},AV(t,e.attribute.angle)),{angle:xV(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function xV(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function SV(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=xV(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 AV(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=xV(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 kV(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=hw(h),m=lw(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function CV(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var TV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=NM.group({zIndex:999});e.name=IU.axisBreak,e.id=this._getNodeId(`${IU.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},rw,s),a=null!==(e=r.size)&&void 0!==e?e:rw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=NM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=IU.axisBreakSymbol;const h=NM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=IU.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=NM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=IU.background,n.id=this._getNodeId("background"),n.states=H({},DU,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new hV(Object.assign({},t));e.name=IU.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=TV(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},DU,l),symbol:H({},DU,l)});const d=new rV(c);d.name=IU.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=TV(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=HM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},DU,c.text),shape:H({},DU,c.shape),panel:H({},DU,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=TV(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=HM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return SV(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return AV(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=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),bV(i,t),!_V(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=hw(a),l=lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=CV(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=CV(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);kV(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&yV(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(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=NM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=IU.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=qM(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=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}MV.defaultAttributes=nw,G(MV,JU);const wV={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},EV={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}}},BV={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}}},PV={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}}};class RV extends UU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new iE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,XU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Xw(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{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(RV.type,RV,!1)},IV=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function LV(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,FV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function zV(t,e,i="count"){const s=FV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const HV=Math.sqrt(50),jV=Math.sqrt(10),NV=Math.sqrt(2);class UV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=oU(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=Oj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(DV),e.sort(DV),{domain:LV(t,e),scope:zV(t,e,i)}}(r,dM(t),this._spec.breaks[0].scopeType);e=dM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=oU(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=HV?10:n>=jV?5:n>=NV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}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=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function VV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function WV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Ow(t.type))return JN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return JN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=VV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=VV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=VV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=eU(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=eU(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?YV.greedy:YV.parity;for(;l.length>=3&&mw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;fw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),WV(t,l,a,(e=>fw(e,t,i))),WV(n,l,o,(e=>fw(e,n,i)||!(!a||e===t)&&fw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return JN(m)},YV={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&fw(i,t,e)||(i=t,0))))}},XV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class KV extends UU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Lj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Oj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=ZE(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=dM(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}KV.type=r.cartesianLinearAxis,KV.specKey="axes",KV.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(KV,UV);const $V=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(KV.type,KV)},qV=`${NB}_hide_`;function ZV(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const JV=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[qV]&&(ZV(t,!0),t[qV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[qV]=!0,ZV(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},QV=()=>{vB.registerGrammarTransform("symbolOverlap",{transform:JV,runType:"afterEncode"})},tW={min:$,max:K,average:xw,sum:bw};function eW(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function iW(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 sW(t,e,i,s){return iW(t,e,i,"min",s)}function nW(t,e,i,s){return iW(t,e,i,"max",s)}function rW(t,e,i,s){return iW(t,e,i,"average",s)}function aW(t,e,i,s){return iW(t,e,i,"sum",s)}const oW=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=eW;if("min"===n?l=sW:"max"===n?l=nW:"average"===n?l=rW:"sum"===n&&(l=aW),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[]},lW=()=>{vB.registerGrammarTransform("dataSampling",{transform:oW})};class hW extends Rj{constructor(){super(...arguments),this.type=PE.line,this.transformerConstructor=GN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),fj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}hW.type=PE.line,hW.mark=Jj,hW.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},hW.transformerConstructor=GN,G(hW,Zj);class cW{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{sR(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof za)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];gM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];gM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class dW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{CM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{gP(e,[{key:t,operations:Ow(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&&gP(e,[{key:i.field,operations:Ow(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?YE("colorOrdinal"):YE(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(CM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),CM(s.domain)?e.reRender=!0:V(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(!CM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Ow(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Ow(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;Ow(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(Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Ow(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class uW{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&Xz(t,i,!0,l):a&&Xz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&Xz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Kz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Kz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const pW={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},gW={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class fW extends nz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=AM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:UB,height:VB},this._viewRect={width:UB,height:VB},this._viewBox={x1:0,y1:0,x2:UB,y2:VB},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._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(gW).some((t=>!u(e[t])))},this._paddingSpec=iB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new DP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new cW(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new uW;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=vB.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(gj({},fj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=vB.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=vB.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof az)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 qz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof qz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&sR(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=GF(this._spec,this._option,{width:UB,height:VB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DE(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new dW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){$F(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DE(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=iB(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{$F(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);KF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),$F(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);KF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),$F(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(pW[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return pW[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!pW[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;pW[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];$F(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=tB(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(FP.AFTER_MARK_RENDER_END,e)};this._event.on(FP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:IP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(OP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===Kj.dimensionHover||s===Kj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Lw(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Lw(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const mW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},vW={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class yW{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},vW),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):dB(t,a,c.spec),dB(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(vB.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(vB.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=vB.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=vB.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=vB.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):HH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=HH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class _W extends yW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&uB(i,qF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class bW extends _W{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),WF(t)}}const xW=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=vP(t,!0);for(const e in o)for(const i in o[e].nodes)xP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)bP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&_P(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class AW{_beforeInit(){this._dataSet&&YP(this._dataSet,"stackSplit",xW)}_initStack(){this._stack=new SW(this),this._stack.init()}}const kW={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:Kj.dimensionHover};class CW extends xH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},kW,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=IP(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}CW.type="dimension-hover",CW.defaultOptions=kW;const TW=()=>{vB.registerInteractionTrigger(CW.type,CW)},MW=()=>{vB.registerComposedEvent(Kj.dimensionHover,Xj),vB.registerComposedEvent(Kj.dimensionClick,Nj)},wW=t=>t.fieldX[0],EW=t=>t.fieldY[0],BW=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},PW=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},RW=(t,e)=>t?e?wW:BW:e?EW:PW,OW=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=Yj(t,(t=>Oj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=Yj(t,(t=>Ij(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Lw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=IW(t,i,RW(e,Lw(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=IW(t,i,RW(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},IW=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:LW(t,s,i)},LW=(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=Wj(e,t,"cartesian",null!=i?i:Oj(t.getOrient())?wW:EW);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},DW=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Lw(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Ow(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=aU(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};zW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&FW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),FW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=zH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},zW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},HW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=jW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},jW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},NW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return DW(c,r,e),c.xField.cacheInfo?HW(c.xField):c.yField.cacheInfo?HW(c.yField):void 0},UW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],VW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&UW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(WW(s).every((t=>{var e;return!WH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},WW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},GW={dom:`${NB}_TOOLTIP_HANDLER_DOM`,canvas:`${NB}_TOOLTIP_HANDLER_CANVAS`},YW={key:"其他",value:"..."};var XW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(XW||(XW={}));class KW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=VW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},YW),t):YW;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&WH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class $W extends KW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Lw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const qW=()=>{vB.registerTooltipProcessor("dimension",$W)};class ZW extends KW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,yo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(IP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const JW=()=>{vB.registerTooltipProcessor("mark",ZW)};class QW extends KW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const tG=()=>{vB.registerTooltipProcessor("group",QW)};class eG extends fW{constructor(){super(...arguments),this.transformerConstructor=bW,this.type="line",this.seriesType=PE.line}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}eG.type="line",eG.seriesType=PE.line,eG.transformerConstructor=bW,G(eG,AW);const iG=[...tN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class sG extends eN{constructor(){super(...arguments),this.type=sG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return iG}_getIgnoreAttributes(){return[]}}sG.type="area";const nG=()=>{vB.registerMark(sG.type,sG),KT(),wC(),FN(),jN(),_H(),vB.registerGraphicComponent("area",Yp)};class rG extends KH{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 aG=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}}),oG=()=>{vB.registerAnimation("area",vH),yH(),fH()};class lG extends GN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=uB({},f.style,g.style),l.state=uB({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function hG(){HC(),OT()}function cG(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const dG={debounce:St,throttle:At};hG();let uG=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=cG(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:dG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(KM,{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",dG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(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]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};uG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class pG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=pG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(KM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new uG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}SG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class AG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,SG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new SG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,VF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class kG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class CG extends kG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class TG extends kG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function MG(t){t.isBound(AG)||(t.bind(AG).toSelf().inSingletonScope(),t.bind(o_).toService(AG)),t.isBound(CG)||(t.bind(CG).toSelf(),t.bind(Sv).toService(CG)),t.isBound(TG)||(t.bind(TG).toSelf(),t.bind(Sv).toService(TG))}class wG extends kN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}HC(),iT();class EG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HC(),OT();class BG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},BG.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})}}BG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},HC(),gC();class PG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}PG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},HC(),gC();class RG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},RG.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=UM,endAngle:s=VM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}RG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},HC(),cT();class OG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},OG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}OG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class IG{isInValidValue(t){const{startAngle:e=UM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=UM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return uw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function LG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=LG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var zG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=NM.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=NM.circle(t)}h.name=IU.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},DU,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=zG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=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:y,textAlign:"center"},l),state:{text:H({},DU,d.text),shape:H({},DU,d.shape),panel:H({},DU,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=LG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&DG(e,c,i)}else e.AABBBounds.width()>r&&DG(e,r,i)}else o>a.x&&h.x2>n.x2?(DG(e,n.x2-o,i),r&&FG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}HG.defaultAttributes=nw,G(HG,IG);const jG=(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=$M(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=dw(r,uw(s,r,e,n));return o=a,l=uw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return JN(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=jG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=UG(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 JN(c)},UG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&QN(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var VG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new YG(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):gN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=gN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=gN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=gN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?gN(t.quadrant)?"left":"right":gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.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*(gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),EN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}$G.defaultAttributes={pickable:!1};var qG,ZG,JG,QG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(tY,IG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(qG||(qG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(ZG||(ZG={})),function(t){t.dataZoomChange="dataZoomChange"}(JG||(JG={}));const eY="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",iY={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:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},sY={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}},nY=0,rY=1,aY=2,oY=3,lY=4,hY=5,cY=5,dY=999,uY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var pY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:aY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:aY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:nY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:hY},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:hY},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},sY.horizontal),{zIndex:hY}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},sY.horizontal),{zIndex:hY}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:hY},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:hY},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},sY.vertical),{zIndex:hY}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:hY},sY.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:rY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:lY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return qA(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=pY(c,["formatMethod"]),{formatMethod:g}=d,f=pY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:uY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:uY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:uY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:uY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:cY}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:cY}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new hV(e),s.name=i,t.add(s)),s}}const fY={debounce:St,throttle:At};class mY extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=qG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=qG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=qG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=cG();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===qG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===qG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===qG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===qG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(ZG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===qG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:fY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=cG();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=qG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}oV(),OT(),iM(),wC(),iT();let vY=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new gY(this._getRendererAttrs()),this._interaction=new mY(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(ZG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(ZG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(JG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(ZG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(JG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var yY,_Y,bY,xY;function SY(){HC(),oV(),fb()}vY.defaultAttributes=iY,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"}(yY||(yY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(_Y||(_Y={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(bY||(bY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xY||(xY={}));class AY extends kN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cV(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(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:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},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=NM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=NM.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=NM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),EN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=MN(this);this.markerAnimate("exit");const n=MN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function kY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function CY(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;TN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function TY(t,e,i,s){t&&(CY(t.startSymbol,e,i,s),kY(t).forEach((t=>CY(t,e,i,s))),CY(t.endSymbol,e,i,s))}function MY(t,e,i,s){t&&(CY(t.getTextShape(),e,i,s),CY(t.getBgRect(),e,i,s))}function wY(t,e,i,s){var n,r,a,o;t&&(TN(t,{fillOpacity:0,strokeOpacity:0},{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 EY(t,e,i,s){t&&(wY(t.startSymbol,e,i,s),kY(t).forEach((t=>wY(t,e,i,s))),wY(t.endSymbol,e,i,s))}function BY(t,e,i,s){t&&(wY(t.getTextShape(),e,i,s),wY(t.getBgRect(),e,i,s))}function PY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;CY(t.startSymbol,s,r,n);const h=kY(t);h.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),CY(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;CY(t.getTextShape(),e,l,n),CY(t.getBgRect(),e,l,n)}))}function RY(t,e,i,s,n){TY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function OY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function IY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function LY(t,e,i,s,n,r){var a;TY(t,n,s,r),CY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?MY(i,n,s,r):CY(i,n,s,r)}function DY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;CY(t.startSymbol,n,o,r);const u=kY(t);u.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),CY(e,n+o+l,h,r),CY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(CY(i.getTextShape(),n+o+l+h+c,d,r),CY(i.getBgRect(),n+o+l+c,d,r)):CY(i,n+o+l+c,d,r)}function FY(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?PY(t,e,s,r,a):"fadeIn"===i&&RY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?PY(t,e,s,n,a):"fadeIn"===i&&RY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){EY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function zY(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&&OY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&OY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function HY(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&&IY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&IY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function jY(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?LY(n,r,e,i,s,o):"callIn"===t&&DY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?LY(n,r,e,i,s,a):"callIn"===t&&DY(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;EY(t,n,s,r),wY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?BY(i,n,s,r):wY(i,n,s,r)}(n,r,e,t,i,s)}}const NY={type:"clipIn",duration:500,easing:"linear",delay:0},UY={type:"fadeIn",duration:500,easing:"linear",delay:0},VY={type:"callIn",duration:500,easing:"linear",delay:0},WY={type:"fadeOut",duration:500,easing:"linear",delay:0};class GY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new hV(Object.assign(Object.assign({},h),{state:{panel:H({},YM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},YM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},YM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},YM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class YY extends AY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=NY,this.defaultExitAnimation=WY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;sw(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(YY,GY);const XY=.001,KY={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:yY.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]}},$Y={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"}}},qY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:bY.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]}},ZY={interactive:!0,label:{position:_Y.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}},JY={interactive:!0,label:{autoRotate:!0,position:bY.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}},QY={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"}},tX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},eX={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 iX(){sX._animate=FY}SY(),sV(),fb();class sX extends YY{markerAnimate(t){sX._animate&&this._animationConfig&&sX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},sX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(wM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return EM(Math.abs(e),Math.PI/2,XY)||EM(Math.abs(e),3*Math.PI/2,XY)?BM(i,e,t):wM(e)?$Y.postiveXAxis[t]:$Y.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new rV({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",sX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(sX.defaultAttributes.label)}}function nX(){rX._animate=zY}sX.defaultAttributes=KY,SY(),yT(),fb();class rX extends AY{markerAnimate(t){rX._animate&&this._animationConfig&&rX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},tX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=NM.polygon(Object.assign({points:e},i));n.states=H({},YM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",rX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},YM,null==i?void 0:i.area)),this._updateMarkLabels(rX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}rX.defaultAttributes=ZY,G(rX,GY),SY(),nV(),fb();class aX extends YY{markerAnimate(t){aX._animate&&this._animationConfig&&aX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},aX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case bY.arcInnerStart:l=n;case bY.arcOuterStart:l=n;break;case bY.arcInnerEnd:l=r;case bY.arcOuterEnd:l=r;break;case bY.center:case bY.arcInnerMiddle:case bY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return QY[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new aV({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",aX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(aX.defaultAttributes.label)}}aX.defaultAttributes=qY,SY(),gC(),fb();class oX extends AY{markerAnimate(t){oX._animate&&this._animationConfig&&oX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},oX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case bY.center:h=(s+n)/2,c=(r+a)/2;break;case bY.arcInnerStart:h=s,c=r;break;case bY.arcOuterStart:h=n,c=r;break;case bY.arcInnerEnd:h=s,c=a;break;case bY.arcOuterEnd:h=n,c=a;break;case bY.arcInnerMiddle:h=s,c=(r+a)/2;break;case bY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},QY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=NM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},YM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",oX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},YM,null==o?void 0:o.area)),this._updateMarkLabels(oX.defaultAttributes.label)}isValidPoints(){return!0}}function lX(){hX._animate=jY}oX.defaultAttributes=JY,G(oX,GY),SY(),sV(),nV(),iM(),XC(),iT(),fb();class hX extends AY{markerAnimate(t){hX._animate&&this._animationConfig&&hX._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},hX.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=VY,this.defaultExitAnimation=WY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return EM(Math.abs(s),Math.PI/2,XY)||EM(Math.abs(s),3*Math.PI/2,XY)?BM(t,s,n):wM(s)?eX.postiveXAxis[n]:eX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=xY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},YM,null==p?void 0:p.textBackground),text:H({},YM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},YM,null==p?void 0:p.itemContent));const v=wM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=NM.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"text"===n?o=new hV(Object.assign(Object.assign({},i),{state:{panel:H({},YM,null==s?void 0:s.textBackground),text:H({},YM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=NM.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"image"===n?(o=NM.image(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},YM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=EM(c,0,XY)||EM(d,0,XY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=ew(e-u,t-d),o=ew(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(yX.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(yX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===yX.focus||"focus"===o){const s=a.hasState(mX.focus);a.toggleState(mX.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover,mX.focus],t),this._setLegendItemState(e,mX.selected,t)})):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover,mX.focus],t),this._setLegendItemState(e,mX.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(mX.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(mX.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(vX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[mX.selected,mX.selectedHover],t),this._setLegendItemState(a,mX.unSelected,t)):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t))}else this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover],t),this._setLegendItemState(e,mX.unSelected,t))}))}this._dispatchLegendEvent(vX.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,mX.selected),this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover])):(this._removeLegendItemState(e,[mX.selected,mX.selectedHover]),this._setLegendItemState(e,mX.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=pX,spaceRow:l=gX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=NM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=NM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,yX.item,t,M)):(M=NM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,yX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?mX.selected:mX.unSelected);const w=NM.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=NM.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,yX.itemShape,t,M,S.state),s.addState(e?mX.selected:mX.unSelected),w.add(s)}let I=0;if(d){const e=R(g,"size",10);E=NM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,yX.focus,t,M),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=QM(Object.assign(Object.assign({x:P/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,yX.itemLabel,t,M,A.state),D.addState(e?mX.selected:mX.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=QM(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,yX.itemValue,t,M,k.state),r.addState(e?mX.selected:mX.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-O-I),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.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 j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new uX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new uX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new uG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new uG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=pX,spaceRow:o=gX}=n,l=this._itemsContainer,{space:h=fX,defaultCurrent:c=1}=r,d=SX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=NM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=pX,spaceRow:a=gX}=s,o=this._itemsContainer,{space:l=fX,defaultCurrent:h=1}=n,c=SX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=NM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=NM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(mX.selected)?this._setLegendItemState(t,mX.selectedHover,e):this._setLegendItemState(t,mX.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===yX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(vX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(mX.unSelectedHover)||t.hasState(mX.selectedHover))&&(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(mX.unSelectedHover)&&!t.hasState(mX.selectedHover)||(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===yX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(vX.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!==yX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(vX.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!==yX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(mX.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},AX,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(mX.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var CX;function TX(t){return _(t)?t:[t,t]}function MX(t){return t?"ew-resize":"ns-resize"}kX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:pX,spaceRow:gX,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:fX,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"}(CX||(CX={})),bX();class wX extends kN{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:H({},wX.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=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(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?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:TX(d)[0],endValue:TX(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=NM.group({x:0,y:0});f.name=CX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=NM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=CX.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=NM.group({x:g?v:0,y:g?0:v});f.add(y);const _=NM.group({x:0,y:0});let b;if(_.name=CX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=NM.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=CX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=NM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=CX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=TX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(v.name=CX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=CX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(i.name=CX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=CX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=NM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=CX.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":MX(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=NM.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=CX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return NM.symbol(t)}_renderHandlerText(t,e){return NM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":MX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=NM.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=NM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===CX.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===CX.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===CX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===CX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}wX.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}}},xX(),bX();class EX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 BX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}EX.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"}}},xX(),bX(),cT();class PX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PX.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=NM.group({x:0,y:0});this._innerView.add(x);const S=new wX({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:BX(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 C=NM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);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))}}PX.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)"}},HC(),cM(),YT();let RX=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},XM),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,O-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},XM),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GO&&(G=O),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(I)||p(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(I)||p(M.align)){const t=M.align?M.align:I,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};RX.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 OX={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"}}};HC(),cM(),YT();let IX=class extends kN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(OX,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=QM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=qM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&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 LX extends Wg{constructor(t){super(t)}}var DX,FX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(DX||(DX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(FX||(FX={}));class zX extends kN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},zX.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"},zX.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"},zX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.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 LX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new LX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new LX(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(DX.OnPlay)},this.pause=()=>{this._dispatchEvent(DX.OnPause)},this.forward=()=>{this._dispatchEvent(DX.OnForward)},this.backward=()=>{this._dispatchEvent(DX.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()}}zX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},zX.defaultAttributes={[FX.Start]:{},[FX.Pause]:{},[FX.Backward]:{},[FX.Forward]:{}};const HX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},jX=[200,10];var NX,UX;!function(t){t.Default="default",t.Reverse="reverse"}(NX||(NX={})),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"}(UX||(UX={}));const VX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),WX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),GX=t=>"top"===t||"bottom"===t;class YX extends kN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YX.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(GX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:jX[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:jX[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 wX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=GX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new zX(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=GX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:jX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(GX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(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:GX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:GX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function XX(){bX(),HC(),iM()}YX.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({},HX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},HX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},HX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},HX),{key:"backward",position:"start"})}},XX();class KX extends YX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},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:NX.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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(VX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||WX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===NX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(UX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(UX.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(UX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.change),this.dispatchCustomEvent(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var $X,qX=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())}))};XX();class ZX extends YX{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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change))},this.play=()=>qX(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(UX.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.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(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}($X||($X={}));const JX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},QX=5;const tK={debounce:St,throttle:At};HC(),yT();let eK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=JX.updateTrigger,endTrigger:i=JX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:tK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=JX.trigger,resetTrigger:i=JX.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent($X.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent($X.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=QX}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent($X.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent($X.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent($X.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=QX}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=JX.updateTrigger,endTrigger:s=JX.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=NM.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};eK.defaultAttributes=JX;const iK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},sK=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}},nK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},rK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];HC(),OT(),iM(),cM(),YT();let aK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},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=oi(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",H({symbolType:"circle"},u.shape,{visible:MM(u)&&MM(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:MM(u)&&MM(u.value)},sK(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:MM(u)&&MM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:MM(u)&&MM(u.value)},sK(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},XM),u.value),visible:MM(u)&&MM(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=MM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=MM(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]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!MM(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)+(MM(n.key)?r+n.key.spacing:0)+(MM(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&&(tw(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:MM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),tw(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(MM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(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(MM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},sK(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},sK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},XM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(MM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},sK(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},sK(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=>rK.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)&&MM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=MM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=$M(d),y=$M(u);let _=0;if(MM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(MM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return iK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return iK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};aK.defaultAttributes=nK;class oK extends KV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{Oj(this.getOrient())?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=uB({},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 za(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Tz(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.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=>cU(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=>cU(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}oK.type=r.cartesianTimeAxis,oK.specKey="axes",oK.builtInTheme={axis:EV,axisX:BV,axisY:PV};class lK extends KV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new ME}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}lK.type=r.cartesianLogAxis,lK.specKey="axes",lK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(lK,UV);class hK extends KV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new wE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}hK.type=r.cartesianSymlogAxis,hK.specKey="axes",hK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(hK,UV);class cK extends Rj{constructor(){super(...arguments),this.type=PE.area,this.transformerConstructor=lG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(cK.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===OH?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XE(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XE(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[ZB]},"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(gj(null===(e=vB.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),fj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),fj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new rG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}cK.type=PE.area,cK.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},cK.mark=aG,cK.transformerConstructor=lG,G(cK,Zj);class dK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(t)}}class uK extends fW{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="area",this.seriesType=PE.area}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}uK.type="area",uK.seriesType=PE.area,uK.transformerConstructor=dK,G(uK,AW);function pK(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 gK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:pK(t,e)}),fK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:pK(t,e)}),mK={type:"fadeIn"},vK={type:"growCenterIn"};function yK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mK;case"scaleIn":return vK;default:return gK(t)}}class _K extends qz{constructor(){super(...arguments),this.type=_K.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}_K.type="rect";const bK=()=>{KT(),OT(),IN("rect",WG),vB.registerMark(_K.type,_K),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),vB.registerGraphicComponent("rect",mg)},xK=Object.assign(Object.assign({},aj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function SK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=nB(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[oj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):XE(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[lj]):XE(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=XE(this._dataToPosX(t),e,i),n=XE(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[hj]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XE(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[cj]):XE(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=XE(this._dataToPosY(t),e,i),n=XE(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),CK)})}getStatisticFields(){var t;const e=super.getStatisticFields(),i="horizontal"===this.direction?this.getYAxisHelper():this.getXAxisHelper(),s="horizontal"===this.direction?this._fieldY:this._fieldX,n=null===(t=null==i?void 0:i.getScale)||void 0===t?void 0:t.call(i,0);return n&&Ow(n.type)&&s.forEach((t=>{const i=e.find((e=>e.key===t));i?i.operations.includes("values")||i.operations.push("values"):e.push({key:t,operations:["values"]})})),e}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},TK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:yj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(TK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}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(YP(this._option.dataSet,"addVChartProperty",NH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};YP(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new za(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new Tz(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_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=cj,s=hj,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=lj,s=oj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=vP(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)SK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=XE(this[r](t),l,i),u=XE(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!KE(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[qB],n=e[ZB],r=e[JB],d=e[QB];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?hj:oj],i=e[a?cj:lj];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[qB]:s,[ZB]:o}),c?{[JB]:u,[QB]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(mg(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>XE(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>XE(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Pj(this);this._barMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),fj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i;const s=this._groups?this._groups.fields.length:1,n=u(e)?s:Math.min(s,e),r=p(this._spec.barWidth)&&n===s,a=r&&"number"==typeof this._spec.barWidth&&"string"!=typeof this._spec.barMinWidth&&"string"!=typeof this._spec.barMaxWidth||null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,n-1),o=null!=a?a:6,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=!t.isContinuous||u(a)||r?o:.5*o;return r&&(c=nB(this._spec.barWidth,o)),l&&(c=Math.max(c,nB(this._spec.barMinWidth,o))),h&&(c=Math.min(c,nB(this._spec.barMaxWidth,o))),c}_getPosition(t,e,i,s){var n,r,a,o,l,h;let c,d,g;"horizontal"===t?(c=this.getYAxisHelper(),d="height",g="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(c=this.getXAxisHelper(),d="width",g="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const f=c.getScale(0),m=this._groups?this._groups.fields.length:1,v=u(i)?m:Math.min(m,i),y=null!==(r=null===(n=c.getBandwidth)||void 0===n?void 0:n.call(c,v-1))&&void 0!==r?r:6,_=v===m?this._barMark.getAttribute(d,e):y;if(v>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 h=t[r],d=null!==(o=null===(a=c.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=nB(null!==(l=i[r-1])&&void 0!==l?l:X(i),y),g=d.indexOf(e[h]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return f.scale(e[t[0]])+(null!==(h=c.getBandwidth(0))&&void 0!==h?h:y)/2-s/2+n}const b=Ow(f.type||"band");return g(e,v)+.5*(y-_)+(b?-y/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}TK.type=PE.bar,TK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},TK.mark=xK,TK.transformerConstructor=kK;const MK=()=>{lW(),bK(),vB.registerAnimation("bar",((t,e)=>({appear:yK(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),OV(),$V(),vB.registerSeries(TK.type,TK)};class wK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(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 EK extends fW{constructor(){super(...arguments),this.transformerConstructor=wK,this.type="bar",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}EK.type="bar",EK.seriesType=PE.bar,EK.transformerConstructor=wK,G(EK,AW);const BK=[10,20],PK=Pw.Linear,RK="circle",OK=Pw.Ordinal,IK=["circle","square","triangle","diamond","star"],LK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},DK=Object.assign(Object.assign({},aj),{point:{name:"point",type:"symbol"}});class FK extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const zK={sizeField:!0};class HK extends Rj{constructor(){super(...arguments),this.type=PE.scatter,this.transformerConstructor=FK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),zK)})}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=`${NB}_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=`${NB}_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:PK,defaultRange:BK},"size")}getShapeAttribute(t,e){return u(e)?RK:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:OK,defaultRange:IK},"shape")}initMark(){this._symbolMark=this._createMark(HK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,HK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Pj(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(gj(null===(i=vB.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),fj("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:RK},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}HK.type=PE.scatter,HK.mark=DK,HK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},HK.transformerConstructor=FK;const jK=()=>{WN(),vB.registerAnimation("scatter",((t,e)=>Object.assign({appear:LK(0,e)},pH))),OV(),$V(),vB.registerSeries(HK.type,HK)};class NK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class UK extends fW{constructor(){super(...arguments),this.transformerConstructor=NK,this.type="scatter",this.seriesType=PE.scatter}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}UK.type="scatter",UK.seriesType=PE.scatter,UK.transformerConstructor=NK,G(UK,AW);class VK extends Ej{constructor(){super(...arguments),this.type=PE.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=`${NB}_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 WK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[GB]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[pP]=a||r})),s};class GK extends KH{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 YK extends qz{constructor(){super(...arguments),this.type=YK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}YK.type="path";const XK=()=>{vB.registerMark(YK.type,YK),KT(),cT(),vB.registerGraphicComponent("path",hg)},KK=Object.assign(Object.assign({},aj),{area:{name:"area",type:"path"}});class $K{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ua(i,e):ja[i]?(Ha[i]||(Ha[i]=Ua(i,ja[i])),Ha[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class qK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class ZK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function JK(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:qK}:bM(e)||xM(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:ZK}:null}const QK={debounce:St,throttle:At};class t${constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=bM(this._renderMode)||xM(this._renderMode),JK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return JK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,QK[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,QK[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){JK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:NP.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:NP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=QK[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=QK[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:NP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp)}))}}class e$ extends EU{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${NB}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=uB(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new $K(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===PE.map||e.type===PE.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),Tw(this._regions,(t=>{var e;if(t.type===PE.map||t.type===PE.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==PE.map&&e.type!==PE.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[pP],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}e$.type=r.geoCoordinate,G(e$,t$);const i$=()=>{vB.registerComponent(e$.type,e$)};class s$ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class n$ extends VK{constructor(){super(...arguments),this.type=PE.map,this.transformerConstructor=s$,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 !`),KP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),YP(this._dataSet,"copyDataView",tR),YP(this._dataSet,"map",WK),YP(this._dataSet,"lookup",jH);const s=KP.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new za(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:pP,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new Tz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(n$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:yj(this._spec,n$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:XB])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:XB]):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(gj(null===(t=vB.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),fj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new GK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[GB]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[GB],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return GB}getActiveMarks(){return[this._pathMark]}}n$.type=PE.map,n$.mark=KK,n$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},n$.transformerConstructor=s$;const r$=`${NB}_waterfall_default_seriesField`,a$=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[nP]=!0:delete t[nP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=o$([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}=l$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=o$(r,t,s,o,u,c,e,i),o.push(s)})),o};function o$(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}=l$(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===r$)&&(t[r$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function l$(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?gM("total.collectCountField error"):n=e[a].start;o<0?gM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const h$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},c$={type:"fadeIn"},d$={type:"growCenterIn"};function u$(t,e){switch(e){case"fadeIn":return c$;case"scaleIn":return d$;default:return gK(t,!1)}}class p$ extends qz{constructor(){super(...arguments),this.type=p$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return ag(t)}}p$.type="rule";const g$=()=>{vB.registerMark(p$.type,p$),KT(),iT(),vB.registerGraphicComponent("line",ag)},f$=Object.assign(Object.assign({},xK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),m$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:v$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function v$(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)=>v$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y${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 za(e instanceof Fa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),YP(e,"dimensionTree",m$),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 _$ extends kK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const b$={rect:T$,symbol:k$,arc:w$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=k$(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:E$,line:B$,area:B$,rect3d:T$,arc3d:w$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function x$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=b$[t])&&void 0!==i?i:b$.point;return e.series.type===PE.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=A$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:P$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function S$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==PE.sankey){const{formatFunc:t,args:n}=zH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function A$(t){return d(t)?e=>t(e.data):t}function k$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=A$(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:C$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function C$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function T$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=A$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:M$(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function M$(t){const e=[{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"]}}];return e}function w$(t){var e;const{labelSpec:i}=t,s=null!==(e=A$(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 E$(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=S$(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),Jg(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 B$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[XB]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function P$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const R$={calculationMode:!0};class O$ extends TK{constructor(){super(...arguments),this.type=PE.waterfall,this.transformerConstructor=_$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&_P(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),R$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y$(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=r$)}getSeriesKeys(){return this._seriesField===r$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),YP(this._dataSet,"waterfallFillTotal",h$),YP(this._dataSet,"waterfall",a$),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=eR(this.getViewData(),this._dataSet,{name:`${NB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Tz(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:qB,endAs:ZB,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Pj(this);this._barMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),fj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(O$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return E$(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?XE(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):XE(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&KE([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}O$.type=PE.waterfall,O$.mark=f$,O$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},O$.transformerConstructor=_$;const I$=()=>{g$(),bK(),vB.registerAnimation("waterfall",((t,e)=>({appear:u$(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(O$.type,O$)},L$=`${NB}_BOX_PLOT_OUTLIER_VALUE`;var D$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(D$||(D$={}));const F$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[L$]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class z$ extends KH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return this.series.getOutliersField();if(t===D$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case D$.MIN:return this.series.getMinField();case D$.MAX:return this.series.getMaxField();case D$.MEDIAN:return this.series.getMedianField();case D$.Q1:return this.series.getQ1Field();case D$.Q3:return this.series.getQ3Field();case D$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return e[L$];if(t===D$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case D$.MIN:return e[this.series.getMinField()];case D$.MAX:return e[this.series.getMaxField()];case D$.MEDIAN:return e[this.series.getMedianField()];case D$.Q1:return e[this.series.getQ1Field()];case D$.Q3:return e[this.series.getQ3Field()];case D$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[L$])}getDefaultContentList(t){return[{key:this.getContentKey(D$.OUTLIER),value:this.getContentValue(D$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(D$.MAX),value:this.getContentValue(D$.MAX)},{key:this.getContentKey(D$.Q3),value:this.getContentValue(D$.Q3)},{key:this.getContentKey(D$.MEDIAN),value:this.getContentValue(D$.MEDIAN)},{key:this.getContentKey(D$.Q1),value:this.getContentValue(D$.Q1)},{key:this.getContentKey(D$.MIN),value:this.getContentValue(D$.MIN)},{key:this.getContentKey(D$.SERIES_FIELD),value:this.getContentValue(D$.SERIES_FIELD)}]}}const H$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class j$ extends qz{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==tz.enter&&t.context.diffState!==tz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{H$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Zp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=vB.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const N$=()=>{vB.registerGraphicComponent("glyph",Zp),KT(),FC()},U$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],V$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class W$ extends j${constructor(){super(...arguments),this.type=W$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=U$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=V$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}W$.type="boxPlot";const G$=Object.assign(Object.assign({},aj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),Y$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},X$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},K$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),$$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=K$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=K$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=K$(t,"box").attribute.width,i=K$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=K$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=K$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=K$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=K$(t,"box").attribute.height,i=K$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},q$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=K$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=K$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=K$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=K$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=K$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=K$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=K$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=K$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=K$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class Z$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return Y$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class J$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return X$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class Q$ extends Z${computeAttribute(){return Y$(q$)(this.target,this.params,this.params.options)}}class tq extends J${computeAttribute(){return X$(q$)(this.target,this.params,this.params.options)}}class eq extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const iq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class sq extends Rj{constructor(){super(...arguments),this.type=PE.boxPlot,this.transformerConstructor=eq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),iq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(sq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(sq.mark.outlier,{key:GB,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}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=>XE(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XE(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XE(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XE(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XE(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"foldOutlierData",F$),YP(this._dataSet,"addVChartProperty",NH);const t=new za(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${NB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._outlierData=new Tz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=nB(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,nB(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,nB(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=nB(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Ow(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Pj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=vB.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(fj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(gj(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(gj(null===(a=vB.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new z$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}sq.type=PE.boxPlot,sq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},sq.mark=G$,sq.transformerConstructor=eq;const nq=()=>{N$(),iT(),OT(),vB.registerGraphicComponent("line",(t=>ag(t))),vB.registerGraphicComponent("rect",(t=>mg(t))),vB.registerMark(W$.type,W$),WN(),fH(),OV(),$V(),w_.registerBuiltInAnimate("boxplotScaleIn",Z$),w_.registerBuiltInAnimate("boxplotScaleOut",J$),w_.registerBuiltInAnimate("barBoxplotScaleIn",Q$),w_.registerBuiltInAnimate("barBoxplotScaleOut",tq),vB.registerSeries(sq.type,sq)};class rq extends qz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=rq.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?jg(t):Jg(t)}}rq.type="text";const aq=()=>{vB.registerMark(rq.type,rq),KT(),cM(),YT(),vB.registerGraphicComponent("text",Jg),vB.registerGraphicComponent("richtext",jg)};class oq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const lq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),hq={type:"fadeIn"},cq=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function dq(t,e){return"fadeIn"===e?hq:lq(t)}const uq=Object.assign(Object.assign({},xK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class pq extends kK{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 gq extends TK{constructor(){super(...arguments),this.type=PE.rangeColumn,this._barMarkType="rect",this._barName=PE.bar,this.transformerConstructor=pq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(gq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,gq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(gq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(gq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Pj(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(gj(null===(i=vB.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),fj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(gj(null===(n=vB.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),fj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new oq(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)}}gq.type=PE.rangeColumn,gq.mark=uq,gq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},gq.transformerConstructor=pq;const fq=()=>{bK(),aq(),vB.registerAnimation("rangeColumn",((t,e)=>({appear:dq(t,e),enter:lq(t),exit:cq(t),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(gq.type,gq)};var mq,vq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(mq||(mq={})),function(t){t.middle="middle",t.start="start",t.end="end"}(vq||(vq={}));class yq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const _q=Object.assign({},aG);class bq extends cK{constructor(){super(...arguments),this.type=PE.rangeArea}initMark(){this._areaMark=this._createMark(bq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new yq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}bq.type=PE.rangeArea,bq.mark=_q;class xq extends Ej{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=AU,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Ow(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:[]};Ow(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)&&Bj(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Sq(t){return kM(t)?Number.parseFloat(t):0}const Aq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&kq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[pU],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[pU]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},kq=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===Sq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Sq(i[e])),0)));function Cq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const Tq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Cq(t,!0,rR.appear)}),Mq={type:"fadeIn"},wq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Cq(t,!0,rR.enter)}),Eq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Cq(t,!0,rR.exit)});function Bq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Mq;case"growRadius":return Tq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Tq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Pq extends qz{constructor(t,e){super(t,e),this.type=Rq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[yU])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Rq extends Pq{constructor(){super(...arguments),this.type=Rq.type}}Rq.type="arc";const Oq=()=>{KT(),gC(),IN("arc",XG),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),vB.registerGraphicComponent("arc",Vp),vB.registerMark(Rq.type,Rq)},Iq=Object.assign(Object.assign({},aj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Lq extends Sj{_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=uB({},this._theme,i,t);const n=(t,e)=>uB({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Dq=`${NB}_LABEL_VISIBLE`,Fq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},zq={outerRadius:!0};class Hq extends xq{constructor(){super(...arguments),this.transformerConstructor=Lq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:QE(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:QE(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=xU,this._endAngle=SU,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[yU];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;YP(this._dataSet,"pie",Aq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:fU,asEndAngle:mU,asRatio:gU,asMiddleAngle:yU,asRadian:bU,asQuadrant:_U,asK:vU,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Hq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ew(fU)(t)}endAngleScale(t){return Ew(mU)(t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$E(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$E(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ew(Dq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),zq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Fq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[yU];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===rR.appear)return this._startAngle;if(i===rR.disappear)return this._endAngle;const r=[rR.disappear,rR.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[GB];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=gj(null===(i=vB.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Hq.transformerConstructor=Lq,Hq.mark=Iq,Hq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class jq extends Hq{constructor(){super(...arguments),this.type=PE.pie}}jq.type=PE.pie;const Nq=()=>{Oq(),vB.registerAnimation("pie",((t,e)=>({appear:Bq(t,e),enter:wq(t),exit:Eq(t),disappear:{duration:uH.disappear.duration}}))),vB.registerAnimation("emptyCircle",((t,e)=>({appear:Bq(t,e)}))),vB.registerSeries(jq.type,jq)};function Uq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const Vq=t=>({type:Uq(t.growField),options:{overall:!0}}),Wq={type:"fadeIn"},Gq=t=>({type:Uq(t.growField)}),Yq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function Xq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Wq;case"growAngle":return Vq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return Vq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const Kq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class $q extends xq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Kq)})}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(ZB),this.setInnerRadiusField(qB)}setValueFieldToPercent(){this.setRadiusField(QB),this.setInnerRadiusField(JB)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const qq=Object.assign(Object.assign({},aj),{rose:{name:"rose",type:"arc"}});class Zq extends Sj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class Jq extends HU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=vB.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=xU,this._endAngle=SU,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QE(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QE(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:aU(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Ow(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>cU(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=AU,e=0;const i=this.getChart().getSpec();return Tw(this.getRegions(),(s=>{const n=s;if(r=n.type,[PE.rose,PE.radar,PE.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(uB({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(uB({},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)}}Jq.type=r.polarAxis,Jq.specKey="axes";const Qq={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},tZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class eZ extends Jq{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}eZ.type=r.polarLinearAxis,eZ.specKey="axes",eZ.builtInTheme={axis:EV,axisLinear:XV,axisAngle:tZ,axisRadius:Qq},G(eZ,UV);const iZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(eZ.type,eZ)};class sZ extends Jq{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new iE}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,NG),t}transformScaleDomain(){}}sZ.type=r.polarBandAxis,sZ.specKey="axes",sZ.builtInTheme={axis:EV,axisBand:wV,axisAngle:tZ,axisRadius:Qq},G(sZ,VU);const nZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(sZ.type,sZ)};class rZ extends $q{constructor(){super(...arguments),this.type=PE.rose,this.transformerConstructor=Zq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(rZ.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,rZ.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XE(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XE(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(gj(null===(i=vB.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),fj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}rZ.type=PE.rose,rZ.mark=qq,rZ.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},rZ.transformerConstructor=Zq;const aZ=()=>{vB.registerSeries(rZ.type,rZ),Oq(),vB.registerAnimation("rose",((t,e)=>({appear:Xq(t,e),enter:Gq(t),exit:Yq(t),disappear:{duration:uH.disappear.duration}}))),nZ(),iZ()};class oZ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,vw(this._fromAngle,this._toAngle)&&vw(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lZ extends hH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!Cw(t)&&!Cw(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const hZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function cZ(t,e,i){return"fadeIn"===e?hZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function dZ(t,e,i){return"fadeIn"===e?hZ(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 uZ=(t,e)=>({custom:oH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),pZ=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}});class gZ extends $q{constructor(){super(...arguments),this.type=PE.radar,this.transformerConstructor=GN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(gZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:IH,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):xU},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(gj(null===(s=vB.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),fj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=vB.getAnimationInKey(e);t.setAnimationConfig(gj(null==i?void 0:i(n,r),fj(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}}}gZ.type=PE.radar,gZ.mark=pZ,gZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},gZ.transformerConstructor=GN,G(gZ,Zj);const fZ=()=>{vB.registerSeries(gZ.type,gZ),nG(),UN(),WN(),vB.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:cZ(t,e,"in"),enter:cZ(t,e,"in"),exit:cZ(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{channel:["points","center"],custom:lZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),vB.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:oZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing}]}))),vB.registerAnimation("radarGroup",((t,e)=>({appear:uZ(t,"in"),disappear:{duration:uH.disappear.duration}}))),gC(),nZ(),iZ()};class mZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const vZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(NB)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[GB]:r,[YB]:`${s}_${e}`})),r++}))})),n},yZ={fill:"#bbb",fillOpacity:.2},_Z=Object.assign(Object.assign({},aj),{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"}}),bZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},xZ={grid:{background:!0}};class SZ extends Rj{constructor(){super(...arguments),this.type=PE.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)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),bZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),xZ)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),YP(this._option.dataSet,"objFlat",vZ),YP(this._option.dataSet,"copyDataView",tR),XP(this._option.dataSet,"dataview",Ia),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(uB(yZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(SZ.mark.group),this._containerMark=this._createMark(SZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(SZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(SZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(SZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(SZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(SZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(SZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}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 WE).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:XB}}initTooltip(){this._tooltipHelper=new mZ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}SZ.type=PE.dot,SZ.mark=_Z,SZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class AZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const kZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),CZ=(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 TZ extends Rj{constructor(){super(...arguments),this.type=PE.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),YP(this._option.dataSet,"linkDotInfo",CZ),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(TZ.mark.group),this._containerMark=this._createMark(TZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(TZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(TZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new AZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}TZ.type=PE.link,TZ.mark=kZ,TZ.builtInTheme={link:{arrow:{style:{size:10}}}};const MZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"}}),wZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class EZ extends xq{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()?qB:cP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?ZB:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),wZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):xU;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):SU,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=XE(this.angleAxisHelper.dataToPosition([t[qB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XE(this.angleAxisHelper.dataToPosition([t[ZB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?XE(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(EZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[mg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const OZ=()=>{vB.registerAnimation("circularProgress",((t,e)=>({appear:RZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:uH.disappear.duration}})))};class IZ extends Sj{constructor(){super(...arguments),this._supportStack=!0}}const LZ={cornerRadius:!0,roundCap:!0};class DZ extends EZ{constructor(){super(...arguments),this.type=PE.circularProgress,this.transformerConstructor=IZ,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()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),LZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(DZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:yj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(DZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?qB:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?ZB: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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}DZ.type=PE.circularProgress,DZ.mark=BZ,DZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},DZ.transformerConstructor=IZ;const FZ=()=>{vB.registerSeries(DZ.type,DZ),Oq(),OZ(),mH(),nZ(),iZ()};function zZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const HZ={type:"fadeIn"};function jZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?HZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:zZ(t)}))(t)}class NZ extends KH{enableByType(t){return"dimension"!==t}}const UZ=Object.assign(Object.assign({},aj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),VZ={bandWidth:!0,cornerRadius:!0,clamp:!0},WZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class GZ extends Rj{constructor(){super(...arguments),this.type=PE.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),VZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),WZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(GZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return XE(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(GZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new NZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}GZ.type=PE.linearProgress,GZ.mark=UZ,GZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const YZ=()=>{bK(),vB.registerAnimation("linearProgress",((t,e)=>({appear:jZ(t,e),enter:jZ(t),disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(GZ.type,GZ)},XZ=[0],KZ=[20,40],$Z=[200,500],qZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},ZZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class JZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const QZ=`${NB}_WORD_CLOUD_TEXT`,tJ=Object.assign(Object.assign({},aj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),eJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class iJ extends Ej{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=KZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:$Z,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:XZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?QZ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:qZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||_M(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:XZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!ZZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new JZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(iJ.mark.word,{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(iJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(gj(vB.getAnimationInKey("wordCloud")(n,s),fj("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 WE).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:XB])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new AE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new AE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[GB])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:YB,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:b_.createCanvas.bind(b_),getTextBounds:gv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:sg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}iJ.mark=tJ,iJ.builtInTheme={wordCloud:eJ};function sJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||uH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=nJ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},rJ=(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=rJ(t.children,e,t,n))})),s},aJ=(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=aJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},oJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):oJ(t.children,e,i)))})),e};function lJ(t,e){let i,s;if(dJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function dJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function fJ(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 mJ(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 vJ(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 yJ(t){return{_:t,next:null,prev:null}}function _J(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];fJ(n,s,r);let a,o,l,h,c,d,u,p=yJ(s),g=yJ(n),f=yJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=nJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:AJ.defaultOpionts.nodeSort;rJ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)rJ([o],bJ(h)),aJ([o],xJ(this._getPadding,.5,a)),rJ([o],SJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);rJ([o],bJ(AJ.defaultOpionts.setRadius)),aJ([o],xJ(Ot,1,a)),c&&aJ([o],xJ(this._getPadding,o.radius/t,a)),rJ([o],SJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}AJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const kJ=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=kJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function CJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){kJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function TJ(t){return t.depth}function MJ(t,e){return e-1-t.endDepth}const wJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),EJ=(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},BJ={left:TJ,right:MJ,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:TJ,end:MJ},PJ=bt(0,1);class RJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>wJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>wJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},RJ.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):BJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return CJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[EJ(s[t.source]),EJ(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*PJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(wJ),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(wJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];OJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),IJ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},LJ.defaultOpionts,t):Object.assign({},LJ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(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]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(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-(_(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=nJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function DJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:OJ,slice:DJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?DJ:OJ)(t,e,i,s,n)}};class HJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},HJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?FJ(this.options.aspectRatio):null!==(e=zJ[this.options.splitType])&&void 0!==e?e:zJ.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=nJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function jJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=jJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=NJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function KJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*$J({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},ZJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||VJ,s=e.lossFunction||UJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:qJ(f),arcs:f})}))},JJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:QJ,triangle:QJ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function QJ(){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 tQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const eQ=t=>JJ[t]?JJ[t]():JJ.circle(),iQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function sQ(t){return d(t)?t:function(){return t}}class nQ{constructor(t){var e,i;switch(this.options=H({},nQ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=eQ(this.options.shape),this.getText=null!==(e=sQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=sQ(this.options.fontWeight),this.getTextFontSize=sQ(this.options.fontSize),this.getTextFontStyle=sQ(this.options.fontStyle),this.getTextFontFamily=sQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>iQ(10,50);break;case"random-light":this.getTextColor=()=>iQ(50,90);break;default:this.getTextColor=sQ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class aQ extends nQ{constructor(t){var e;super(H({},aQ.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<=aQ.defaultOptions.minFontSize&&(this.options.minFontSize=aQ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=rQ[this.options.spiral])&&void 0!==e?e:rQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=sQ(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}=tQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(hQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}cQ(p,this._size)&&(p=dQ(p,this._size))}else if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||lQ(p,i))&&(!i||!oQ(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 oQ(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 lQ(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,cQ=(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 dQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},pQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},gQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},fQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=tQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=eQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)gQ(n,pQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)gQ(n,pQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=pQ({x:l,y:h},o,-Math.PI/2,5),e=pQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);gQ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let mQ=class t extends nQ{constructor(e){super(H({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),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 C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[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(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?uQ(t,o,l.width,l.height,h):"geometric"===t.type&&fQ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=tQ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};mQ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vQ extends nQ{constructor(t){super(H({},vQ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vQ.defaultOptions={enlarge:!1};const _Q={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bQ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xQ(t.fontFamily):"sans-serif",d=t.fontStyle?xQ(t.fontStyle):"normal",u=t.fontWeight?xQ(t.fontWeight):"normal",p=t.rotate?xQ(t.rotate):0,g=xQ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?xQ(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},_Q),t.as):_Q,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?xQ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=AQ(kQ(t,l),w);M=i=>e(t(i))}let E=aQ;"fast"===t.layoutType?E=vQ:"grid"===t.layoutType&&(E=mQ);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},xQ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],SQ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),AQ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SQ(t[0]),n=SQ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SQ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},kQ=(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 CQ(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{vB.registerGrammarTransform("wordcloud",{transform:bQ}),aq(),vB.registerAnimation("wordCloud",((t,e)=>({appear:sJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:uH.disappear.duration}}))),vB.registerSeries(TQ.type,TQ)},wQ=t=>d(t)?t():t,EQ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=wQ(e.valueField),v=null!==(i=wQ(e.heightVisual))&&void 0!==i&&i,y=null===(s=wQ(e.isCone))||void 0===s||s,_=wQ(e.range),b=a.reduce(((t,e)=>{const i=Number.parseFloat(e[m]);return k(i)?Math.max(t,i):t}),-1/0),x=null!==(n=null==_?void 0:_.min)&&void 0!==n?n:0,S=null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b,A=t=>k(t)&&k(x)&&k(S)?x===S?t{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0,S=A(n);p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=S),d&&(t[d]=e===a.length-1?y?0:t[c]:A(_)),u&&(t[u]=0===e?1:A(r)),g&&(t[g]=n)})),a},BQ=(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},PQ=`${NB}_FUNNEL_TRANSFORM_RATIO`,RQ=`${NB}_FUNNEL_REACH_RATIO`,OQ=`${NB}_FUNNEL_HEIGHT_RATIO`,IQ=`${NB}_FUNNEL_VALUE_RATIO`,LQ=`${NB}_FUNNEL_LAST_VALUE_RATIO`,DQ=`${NB}_FUNNEL_NEXT_VALUE_RATIO`,FQ=`${NB}_FUNNEL_LAST_VALUE`,zQ=`${NB}_FUNNEL_CURRENT_VALUE`,HQ=`${NB}_FUNNEL_NEXT_VALUE`,jQ=`${NB}_FUNNEL_TRANSFORM_LEVEL`;class NQ extends KH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[RQ])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class UQ extends qz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VQ extends UQ{constructor(){super(...arguments),this.type=VQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VQ.type="polygon";const WQ=()=>{vB.registerMark(VQ.type,VQ),KT(),yT(),w_.registerBuiltInAnimate("growPointsOut",VL),vB.registerGraphicComponent("polygon",ug)},GQ=Object.assign(Object.assign({},aj),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YQ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class XQ extends Ej{constructor(){super(...arguments),this.type=PE.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"funnel",EQ),YP(this._dataSet,"funnelTransform",BQ);const t=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new Tz(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:zQ,asTransformRatio:PQ,asReachRatio:RQ,asHeightRatio:OQ,asValueRatio:IQ,asNextValueRatio:DQ,asLastValueRatio:LQ,asLastValue:FQ,asNextValue:HQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:jQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},XQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:yj(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},XQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(XQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(XQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new NQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&uM(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&uM(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ew(RQ).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(gj(null===(s=vB.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),fj("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("fadeInOut")(),fj(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("funnel")({},o),fj(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(gj(null===(a=vB.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),fj("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[LQ])/2:this._getSecondaryAxisLength(t[IQ])/2,n=this._getSecondaryAxisLength(t[IQ])/2):(s=this._getSecondaryAxisLength(t[IQ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[DQ])/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[jQ])}_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[YB]===t[YB]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{WQ(),aq(),g$(),vB.registerSeries(XQ.type,XQ),vB.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},gH))),vB.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:lH,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),mH()},$Q=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},qQ=t=>{const e=t.filter((t=>t.context.diffState===tz.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},ZQ=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},JQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),QQ=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},t0=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),e0=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},i0=(t,e={})=>{if(!t)return[];const i=[];return oJ(t,i,e),i},s0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new LJ(i).layout(t,{width:s,height:n})};class n0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var r0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(r0||(r0={}));const a0=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===r0.DrillDown){return Y(AP(t,n,s,"children"))}if(i.type===r0.DrillUp){const e=kP(t,n,s,"children");if(e)return Y(e)}return t};class o0{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=JK(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;YP(t,"drillFilter",a0),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:r0.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:r0.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:r0.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:r0.DrillUp},model:this}),r}}const l0=Object.assign(Object.assign({},aj),{sunburst:{name:"sunburst",type:"arc"}}),h0=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:QH,operations:["max","min","values"]}),t.push({key:tj,operations:["values"]}),t),c0={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class d0 extends xq{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),YP(this._dataSet,"sunburstLayout",s0),YP(this._dataSet,"flatten",i0),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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(d0.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(d0.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new n0(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(gj(null===(e=vB.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}d0.type=PE.sunburst,d0.mark=l0,d0.builtInTheme={sunburst:c0},G(d0,o0);const u0=()=>{vB.registerSeries(d0.type,d0),Oq(),aq(),mH(),vB.registerAnimation("sunburst",((t,e)=>({appear:e0(0,e),enter:JQ(t),exit:t0(t),disappear:{duration:uH.disappear.duration}})))},p0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new AJ(i).layout(t,{width:s,height:n})};class g0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const f0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},m0=Object.assign(Object.assign({},aj),{circlePacking:{name:"circlePacking",type:"arc"}});class v0 extends Rj{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},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),YP(this._dataSet,"circlePackingLayout",p0),YP(this._dataSet,"flatten",i0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return h0(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new g0(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}v0.type=PE.circlePacking,v0.mark=m0,v0.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(v0,o0);const y0=()=>{vB.registerSeries(v0.type,v0),Oq(),aq(),fH(),vB.registerAnimation("circlePacking",((t,e)=>({appear:f0(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:uH.disappear.duration}})))},_0=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&_0(t,e.children,i)}))},b0=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},x0=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=S0(n,i),a=new RJ(i),o=[];return o.push(a.layout(r,s)),o},S0=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},A0=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:[]},k0=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 C0 extends KH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const T0=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),M0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:T0(t),w0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class E0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class B0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const P0=(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`},R0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class O0 extends j${constructor(){super(...arguments),this.type=O0.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?R0:P0,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}O0.type="linkPath";const I0=Object.assign(Object.assign({},aj),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class L0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const D0=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&Kz(t,e),Xz(t,e,s,n)};class F0 extends Rj{constructor(){super(...arguments),this.type=PE.sankey,this.transformerConstructor=L0,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=IP(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=IP(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):r.target===i.key?(s.includes(r.source)||s.push(r.source),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=IP(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),D0(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation())):(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=IP(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=IP(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=IP(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=IP(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=IP(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s},!0,this._hasLinkStateAnimation())}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value},!0,this._hasLinkStateAnimation());Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(IP(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=IP(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=IP(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation());const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a},!0,this._hasLinkStateAnimation())}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value},!0,this._hasLinkStateAnimation());Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}_hasStateAnimation(t){var e;return xj(this)&&!!(null===(e=null==t?void 0:t.hasAnimationByState)||void 0===e?void 0:e.call(t,"state"))}_hasLinkStateAnimation(){return this._hasStateAnimation(this._linkMark)}_hasNodeStateAnimation(){return this._hasStateAnimation(this._nodeMark)}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){YP(this._dataSet,"sankeyLayout",x0),YP(this._dataSet,"sankeyFormat",b0),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;YP(s,"sankeyNodes",A0),YP(s,"flatten",i0);const n=new za(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.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),n.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._nodesSeriesData=n,YP(s,"sankeyLinks",k0);const r=new za(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(F0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(F0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=zH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),fj("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),fj("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:NP.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(IP(e).key)?Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasNodeStateAnimation()):Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasNodeStateAnimation())}))}initTooltip(){this._tooltipHelper=new C0(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new WE;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return _0(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}F0.type=PE.sankey,F0.transformerConstructor=L0,F0.mark=I0,F0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const z0=()=>{bK(),N$(),cT(),vB.registerGraphicComponent("path",(t=>hg(t))),vB.registerMark(O0.type,O0),aq(),vB.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:M0(t,e)},gH))),vB.registerAnimation("sankeyLinkPath",((t,e)=>({appear:w0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:uH.disappear.duration}}))),w_.registerBuiltInAnimate("linkPathGrowOut",B0),w_.registerBuiltInAnimate("linkPathGrowIn",E0),mH(),vB.registerSeries(F0.type,F0)},H0=(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=i0(n);return i=qH([{latestData:r}],e),i};class j0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const N0=Object.assign(Object.assign({},aj),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),U0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class V0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const W0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new HJ(i).layout(t,s),n=[];return oJ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[tj,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class G0 extends Rj{constructor(){super(...arguments),this.type=PE.treemap,this.transformerConstructor=V0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,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:tj),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),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:YB},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),YP(this._dataSet,"treemap",W0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=H0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){YP(this._dataSet,"hierarchyDimensionStatistics",H0),YP(this._dataSet,"flatten",i0);const i=new za(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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(G0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(G0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("treemap"))||void 0===e?void 0:e(),fj(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 j0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(FP.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(FP.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}G0.type=PE.treemap,G0.mark=N0,G0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},G0.transformerConstructor=V0,G(G0,o0),G(G0,t$);const Y0=()=>{vB.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),vB.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),bK(),aq(),vB.registerAnimation("treemap",((t,e)=>({appear:U0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(G0.type,G0)},X0=Object.assign(Object.assign({},MZ),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),K0=Object.assign(Object.assign({},aj),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),$0={type:"fadeIn"};function q0(t,e){return"fadeIn"===e?$0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class Z0 extends Sj{constructor(){super(...arguments),this._supportStack=!1}}class J0 extends KH{enableByType(t){return"dimension"!==t}}const Q0="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",t1={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:Q0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Q0,fill:"#ddd"}}};class e1 extends EZ{constructor(){super(...arguments),this.type=PE.gaugePointer,this.transformerConstructor=Z0,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(e1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},e1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(e1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new J0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}e1.type=PE.gaugePointer,e1.mark=K0,e1.builtInTheme={gaugePointer:t1},e1.transformerConstructor=Z0;const i1=()=>{vB.registerSeries(e1.type,e1),XK(),bK(),vB.registerAnimation("gaugePointer",((t,e)=>{const i=q0(t,e);return{appear:i,enter:i,disappear:{duration:uH.disappear.duration}}})),nZ(),iZ()};class s1 extends Sj{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class n1 extends EZ{constructor(){super(...arguments),this.type=PE.gauge,this.transformerConstructor=s1,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();YP(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[dP]=t[this._angleField[0]],t[cP]=e>0?i[e-1][dP]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(n1.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(n1.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[cP])?this.angleAxisHelper.dataToPosition([t[cP]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[dP]])}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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}n1.type=PE.gauge,n1.mark=X0,n1.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},n1.transformerConstructor=s1;class r1 extends qz{constructor(){super(...arguments),this.type=r1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Gg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}r1.type="cell";function a1(t){return!1===t?{}:{type:"fadeIn"}}class o1 extends KH{enableByType(t){return"dimension"!==t}}const l1=Object.assign(Object.assign({},aj),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class h1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const c1={valueField:!0};class d1 extends Rj{constructor(){super(...arguments),this.type=PE.heatmap,this.transformerConstructor=h1}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),c1)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(d1.mark.cell,{isSeriesMark:!0},{morph:yj(this._spec,d1.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(d1.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Pj(this);this._cellMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),fj("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 o1(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}d1.type=PE.heatmap,d1.mark=l1,d1.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},d1.transformerConstructor=h1;const u1=()=>{aq(),vB.registerMark(r1.type,r1),vB.registerGraphicComponent("symbol",Gg),KT(),iM(),jN(),vB.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},gH),{appear:a1(e)}))),OV(),$V(),vB.registerSeries(d1.type,d1)},p1=Object.assign(Object.assign({},aj),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),g1=`${NB}_CORRELATION_X`,f1=`${NB}_CORRELATION_Y`,m1=`${NB}_CORRELATION_SIZE`,v1=t=>d(t)?t():t,y1=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=v1(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=v1(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=v1(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(v1(e.outerRadius),f),y=v1(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(v1(e.field)),A=c.map(x),[k,C]=It(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=v1(e.radiusField),w=v1(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?It(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),O=Math.max(p,g),I=_1(R,O,c.length),L=[],D=(O-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),b1({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>O?a=R: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},b1=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,S1=(t,e)=>{if(!t||!_(t))return[];const i=x1(e.keyword),s=x1(e.categoryField),n=t[0].latestData[0];return{[s]:i,[GB]:null==n?void 0:n[GB],[XB]:null==n?void 0:n[XB]}};class A1 extends j${constructor(){super(...arguments),this.type=A1.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}A1.type="ripple";const k1=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class C1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class T1 extends xq{constructor(){super(...arguments),this.type=PE.correlation,this.transformerConstructor=C1,this._viewBox=new Ue}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(){if(super.initData(),!this._data)return;YP(this._dataSet,"correlation",y1);const t=new Fa;XP(t,"dataview",Ia),YP(t,"correlationCenter",S1);const e=new za(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return 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 Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(T1.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:GB});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(T1.mark.ripplePoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(T1.mark.centerPoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[g1],y:t=>t[f1],size:t=>t[m1],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),fj("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}T1.type=PE.correlation,T1.mark=p1,T1.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},T1.transformerConstructor=C1;const M1=()=>{WN(),N$(),iM(),vB.registerMark(A1.type,A1),vB.registerGraphicComponent("symbol",(t=>Gg(t))),vB.registerSeries(T1.type,T1),vB.registerAnimation("correlation",((t,e)=>Object.assign({appear:k1(0,e)},pH)))},w1=Object.assign(Object.assign({},aj),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class E1 extends j${constructor(){super(...arguments),this.type=E1.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}E1.type="liquid";const B1=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class P1 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class R1 extends Ej{constructor(){super(...arguments),this.type=PE.liquid,this.transformerConstructor=GN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=mg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Gg({x:s,y:n,size:r,symbolType:B1(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=iB(this._spec.outlineMargin),this._paddingSpec=iB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(R1.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(R1.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(R1.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(R1.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new P1(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),fj("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),fj("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=RM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}R1.type=PE.liquid,R1.mark=w1,R1.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},R1.transformerConstructor=GN;const O1=t=>Y(t).join(",");class I1 extends KH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]])}}const L1=Object.assign(Object.assign({},aj),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class D1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const F1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?ZJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class z1 extends Ej{constructor(){super(...arguments),this.type=PE.venn,this.transformerConstructor=D1,this._viewBox=new Ue}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:YB)}initData(){var t;super.initData(),YP(this._dataSet,"venn",F1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(z1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(z1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new I1(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:O1(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return O1(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[O1(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(O1(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}}z1.type=PE.venn,z1.mark=L1,z1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},z1.transformerConstructor=D1;class H1 extends TK{constructor(){super(...arguments),this.type=PE.mosaic,this.transformerConstructor=kK}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(oP),this.setFieldX2(aP)),this.setFieldY(hP),this.setFieldY2(lP)):(t&&(this.setFieldY(oP),this.setFieldY2(aP)),this.setFieldX(hP),this.setFieldX2(lP)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}H1.type=PE.mosaic,H1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},H1.transformerConstructor=kK;class j1 extends yW{_isValidSeries(t){return t===PE.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class N1 extends fW{constructor(){super(...arguments),this.transformerConstructor=j1,this.type="map",this.seriesType=PE.map}}N1.type="map",N1.seriesType=PE.map,N1.transformerConstructor=j1;class U1 extends yW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class V1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=oU(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,uB({},s,l)),n&&Object.assign(o,uB({},n,o))}}class W1 extends U1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class G1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class Y1 extends fW{constructor(){super(...arguments),this.transformerConstructor=G1}}Y1.transformerConstructor=G1;class X1 extends Y1{constructor(){super(...arguments),this.transformerConstructor=G1,this.type="pie",this.seriesType=PE.pie}}X1.type="pie",X1.seriesType=PE.pie,X1.transformerConstructor=G1;class K1 extends W1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:AU,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:AU,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>uB({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const $1=(t,e)=>{if(!t)return null;const i=Yj(t,(t=>"angle"===t.getOrient()),e),s=Yj(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Lw(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=Aw({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=kw(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=Wj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Lw(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=Aw({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=kw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=Wj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class q1 extends fW{constructor(){super(...arguments),this.transformerConstructor=K1,this.type="rose",this.seriesType=PE.rose}_setModelOption(){this._modelOption.getDimensionInfo=$1}}q1.type="rose",q1.seriesType=PE.rose,q1.transformerConstructor=K1,G(q1,AW);class Z1 extends W1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=uB({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}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=>uB({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class J1 extends fW{constructor(){super(...arguments),this.transformerConstructor=Z1,this.type="radar",this.seriesType=PE.radar}_setModelOption(){this._modelOption.getDimensionInfo=$1}}J1.type="radar",J1.seriesType=PE.radar,J1.transformerConstructor=Z1,G(J1,AW);class Q1 extends yW{_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")&&uB(e,qF(this.type,t))})),this._transformAxisSpec(t)}}class t2 extends fW{constructor(){super(...arguments),this.transformerConstructor=Q1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=OW(t,e,i))&&void 0!==s?s:[],...null!==(n=$1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}t2.type="common",t2.transformerConstructor=Q1,G(t2,AW);class e2 extends _W{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class i2 extends fW{constructor(){super(...arguments),this.transformerConstructor=e2}}i2.transformerConstructor=e2,G(i2,AW);class s2 extends e2{transformSpec(t){super.transformSpec(t),WF(t)}}class n2 extends i2{constructor(){super(...arguments),this.transformerConstructor=s2,this.type="histogram",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}n2.type="histogram",n2.seriesType=PE.bar,n2.transformerConstructor=s2;class r2 extends V1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class a2 extends fW{constructor(){super(...arguments),this.transformerConstructor=r2,this.type="circularProgress",this.seriesType=PE.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=$1}}a2.type="circularProgress",a2.seriesType=PE.circularProgress,a2.transformerConstructor=r2,G(a2,AW);class o2 extends V1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=PE.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===PE.gauge||t.type===PE.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===PE.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 l2 extends fW{constructor(){super(...arguments),this.transformerConstructor=o2,this.type="gauge",this.seriesType=PE.gaugePointer}}l2.type="gauge",l2.seriesType=PE.gaugePointer,l2.transformerConstructor=o2;class h2 extends yW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class c2 extends fW{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}c2.transformerConstructor=h2;class d2 extends c2{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}d2.type="wordCloud",d2.seriesType=PE.wordCloud,d2.transformerConstructor=h2;class u2 extends yW{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class p2 extends fW{constructor(){super(...arguments),this.transformerConstructor=u2,this.type="funnel",this.seriesType=PE.funnel}}p2.type="funnel",p2.seriesType=PE.funnel,p2.transformerConstructor=u2;class g2 extends _W{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=oU(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=oU(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class f2 extends fW{constructor(){super(...arguments),this.transformerConstructor=g2,this.type="linearProgress",this.seriesType=PE.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}f2.type="linearProgress",f2.seriesType=PE.linearProgress,f2.transformerConstructor=g2,G(f2,AW);class m2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),WF(t)}}class v2 extends fW{constructor(){super(...arguments),this.transformerConstructor=m2,this.type="rangeColumn",this.seriesType=PE.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}v2.type="rangeColumn",v2.seriesType=PE.rangeColumn,v2.transformerConstructor=m2;class y2 extends yW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _2 extends fW{constructor(){super(...arguments),this.transformerConstructor=y2,this.type="sunburst",this.seriesType=PE.sunburst}}_2.type="sunburst",_2.seriesType=PE.sunburst,_2.transformerConstructor=y2;class b2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class x2 extends fW{constructor(){super(...arguments),this.transformerConstructor=b2,this.type="circlePacking",this.seriesType=PE.circlePacking}}x2.type="circlePacking",x2.seriesType=PE.circlePacking,x2.transformerConstructor=b2;class S2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class A2 extends fW{constructor(){super(...arguments),this.transformerConstructor=S2,this.type="treemap",this.seriesType=PE.treemap}}A2.type="treemap",A2.seriesType=PE.treemap,A2.transformerConstructor=S2;class k2 extends wK{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),WF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class C2 extends EK{constructor(){super(...arguments),this.transformerConstructor=k2,this.type="waterfall",this.seriesType=PE.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}C2.type="waterfall",C2.seriesType=PE.waterfall,C2.transformerConstructor=k2;class T2 extends _W{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),WF(t)}}class M2 extends fW{constructor(){super(...arguments),this.transformerConstructor=T2,this.type="boxPlot",this.seriesType=PE.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}M2.type="boxPlot",M2.seriesType=PE.boxPlot,M2.transformerConstructor=T2;class w2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class E2 extends fW{constructor(){super(...arguments),this.transformerConstructor=w2,this.type="sankey",this.seriesType=PE.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=IP(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}E2.type="sankey",E2.seriesType=PE.sankey,E2.transformerConstructor=w2;class B2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),WF(t)}}class P2 extends fW{constructor(){super(...arguments),this.transformerConstructor=B2,this.type="rangeArea",this.seriesType=PE.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}P2.type="rangeArea",P2.seriesType=PE.rangeArea,P2.transformerConstructor=B2;class R2 extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class O2 extends fW{constructor(){super(...arguments),this.transformerConstructor=R2,this.type="heatmap",this.seriesType=PE.heatmap}}O2.type="heatmap",O2.seriesType=PE.heatmap,O2.transformerConstructor=R2;class I2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class L2 extends fW{constructor(){super(...arguments),this.transformerConstructor=I2,this.type="correlation",this.seriesType=PE.correlation}}L2.type="correlation",L2.seriesType=PE.correlation,L2.transformerConstructor=I2;function D2(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=PP(t.style)),P(t.textStyle)||uB(s.textStyle,PP(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&PP(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&PP(s.background.style),s}function F2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const z2=(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},H2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:XB;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},j2={position:!0,item:!0,title:!0,pager:!0,background:!0};class N2 extends EU{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:()=>{Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(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=qE(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||j2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Tz(this._option,e),this._initSelectedData(),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(Tw(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(uB({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}N2.specKey="legends";class U2 extends N2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){YP(this._option.dataSet,"discreteLegendFilter",H2),YP(this._option.dataSet,"discreteLegendDataMake",z2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return Tw(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(!CM(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=mP(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,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=qE(s)?s:qE(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=D2(A):M.title={visible:!1},P(k.focusIconStyle)||PP(k.focusIconStyle),k.shape&&(k.shape=F2(wP(k.shape))),k.label&&(k.label=wP(k.label)),k.value&&(k.value=wP(k.value)),k.background&&(k.background=wP(k.background)),ZE(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),ZE(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),ZE(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||PP(C.railStyle),P(C.sliderStyle)||PP(C.sliderStyle)):(P(C.textStyle)||PP(C.textStyle),C.handler&&wP(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(uB(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return kX}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(vX.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(vX.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(vX.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,datum:t.datum,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}=zH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=zH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}U2.specKey="legends",U2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},U2.type=r.discreteLegend;const V2=(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[]},W2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?CP(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function G2(t){const i=uB({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=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=D2(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=PP(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=PP(r.style)),P(a.style)||(w.trackStyle=PP(a.style)),w.startText=wP(o),w.endText=wP(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>PP(i(t,e,s)):P(i)||(e.style=PP(i)),e}(h),P(c)||(w.sizeBackground=PP(c)),u.visible&&!P(u.style)&&(uB(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const Y2={color:EX,size:PX},X2={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}},K2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},X2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},$2={horizontal:K2(!0),vertical:K2(!1)},q2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},X2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},Z2={horizontal:q2(!0),vertical:q2(!1)},J2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Q2=[2,10];class t5 extends N2{static getSpecInfo(t){const e=HH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){YP(this._option.dataSet,"continuousLegendFilter",W2),YP(this._option.dataSet,"continuousLegendDataMake",V2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>Mw(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=mP(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!CM(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=mP(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?J2:Q2);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},G2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return Y2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}t5.specKey="legends",t5.builtInTheme={colorLegend:$2,sizeLegend:Z2},t5.type=r.continuousLegend;const e5=(t,e)=>p(e)?t.map((t=>e[t])):void 0,i5=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),s5=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function n5(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=r5(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>i5(i,s)(t)&&i5(n,r)(t)&&(u(a)||i5([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:jP.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:jP.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(a.id),m}return"none"}const r5=(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=e5(c,t);let y=e5(d,t);const _=s5(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(i5(c,v));if(!_&&(y=e5(d,i),!s5(y)))return;const n=e.type===PE.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=Lw(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(i5(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=e5(d,o),!s5(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(i5(c,n));if(!_&&(y=e5(d,r),!s5(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===PE.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(i5(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=e5(d,i),!s5(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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(i5(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=e5(d,a),h=y,!s5(y)&&!a)return;s5(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},a5=t=>p(t)&&!_(t),o5=t=>p(t)&&_(t),l5=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class h5 extends wU{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=uB({},...l5.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=uB({},s);l5.forEach((t=>{delete r[t]})),delete r.style;const a=uB({},r,i);return a.style=uB({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:xM(this._option.mode)||!_M(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=b_.getElementById(t.parentElement)):_M(this._option.mode)&&(t.parentElement=null==yM?void 0:yM.body)}}const c5={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class d5 extends EU{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=h5,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=_M(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&a5(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&RH.globalConfig.uniqueTooltip&&l&&RH.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:jP.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:jP.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?GW.canvas:GW.dom,n=vB.getComponentPluginInType(t);n||fM("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=vB.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(bM(s)||xM(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=n5(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(o5(t)){if(a5(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>Uj(t,e[i])))}if(o5(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}d5.type=r.tooltip,d5.transformerConstructor=h5,d5.builtInTheme={tooltip:c5},d5.specKey="tooltip";var u5,p5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(u5||(u5={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(p5||(p5={}));const g5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},f5={labelZIndex:!0,gridZIndex:!0},m5={xField:!0,yField:!0,categoryField:!0,valueField:!0},v5={visible:!0,width:!0,style:!0};class y5 extends EU{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Lw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||f5[i]||m5[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||v5[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:NP.chart}:{source:jP.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:bM(e)||xM(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:jP.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:jP.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:jP.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)=>{g5[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}y5.specKey="crosshair";const _5={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class b5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=Oj(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){Oj(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Ij(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"cartesian");e&&(DW(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=HW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new EG(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new BG(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}b5.specKey="crosshair",b5.builtInTheme={crosshair:_5},b5.type=r.cartesianCrosshair;class x5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=aU(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=zH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new EG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new RG(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new OG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new PG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}x5.specKey="crosshair",x5.builtInTheme={crosshair:_5},x5.type=r.polarCrosshair;const S5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},A5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},k5=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},C5=(t,e,i)=>{const s=e.domain();if(Ow(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},T5=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Ow(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},M5=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},w5=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}},E5=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),B5=(t,e,i)=>{if(Ow(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class P5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===Fj(Dj(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(P5,t$);class R5 extends EU{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:T5(t,this._stateScale,this._isHorizontal),a="percent"===n?e:T5(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=M5(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=B5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&w5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=Dj(t),this._isHorizontal="horizontal"===Fj(this._orient),this._dataFilterEvent=new P5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Ow(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>Fj(t._orient)===Fj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Ow(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};Tw(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Ow(d.getScale(0).type),p=Ow(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else Tw(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;XP(r,"dataview",Ia),YP(r,"dataFilterComputeDomain",k5);const a=new za(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Tz(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(YP(this._option.dataSet,"dataFilterWithNewDomain",A5),YP(this._option.dataSet,"lockStatisticsFilter",S5),Tw(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Ow(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;E5("start",i,this._spec)&&E5("end",s,this._spec)&&(t="percent"===i?this._spec.start:T5(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:T5(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?T5(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?T5(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=C5(this._start,this._stateScale,M5(i,this._isHorizontal)),this._endValue=C5(this._end,this._stateScale,M5(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Ow(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=B5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&Tw(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new AE:new iE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=w5(h);if(!this._dataUpdating&&Lw(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,Lw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(R5,t$);class O5 extends wU{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=uB({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const I5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),L5={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:I5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:I5(!0)},D5={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class F5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=O5,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=C5(e,this._stateScale,M5(s,this._isHorizontal)),a=C5(i,this._stateScale,M5(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new AE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(M5(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=M5(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return D5}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new AE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(M5(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Ow(t.type)||e[0]!==X(e))&&(!Lw(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:M5(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new vY(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:PP(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:PP(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:PP(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:PP(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:PP(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:PP(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:PP(g.style)},selectedBackgroundStyle:PP(this._spec.selectedBackground.style),dragMaskStyle:PP(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:uB(PP(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:uB(PP(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(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}=zH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(M5(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}F5.type=r.dataZoom,F5.transformerConstructor=O5,F5.builtInTheme={dataZoom:L5},F5.specKey="dataZoom";const z5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},H5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class j5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=vw(this._start,e)&&vw(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=M5(n,this._isHorizontal),a=C5(e,this._stateScale,r),o=C5(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return H5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new uG(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=PP(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=PP(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}j5.type=r.scrollBar,j5.builtInTheme={scrollBar:z5},j5.specKey="scrollBar";const N5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():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},U5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),V5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:U5("l1FontSize","primaryFontColor")},content:{visible:!0,style:U5("l2FontSize","tertiaryFontColor")}};class W5 extends EU{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){YP(this._option.dataSet,"indicatorFilter",N5);const t=new za(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 Tz(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=uB({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},BP(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?nB(l,this._computeLayoutRadius()):0,dy:h?nB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},BP(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new IX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}W5.type=r.indicator,W5.builtInTheme={indicator:V5},W5.specKey="indicator";const G5=["sum","average","min","max","variance","standardDeviation","median"];function Y5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function X5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function K5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&Y5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,X5(a,"xAxis"),t.x)),c=ZE(t.x)?J5(t.x,n)+r.x:Q5(h.getXAxisHelper(),[t.x])+r.x,c}function $5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&Y5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(a,"yAxis"),t.y)),c=ZE(t.y)?J5(t.y,n)+r.y:Q5(h.getYAxisHelper(),[t.y])+r.y,c}function q5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&Y5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"angleAxis"),t.angle)),Q5(o.angleAxisHelper,[t.angle])}function Z5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&Y5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"radiusAxis"),t.radius)),Q5(o.radiusAxisHelper,[t.radius])}function J5(t,e){return Number(t.substring(0,t.length-1))*e/100}function Q5(t,e){const i=t.getScale(0);return Ow(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function t3(t){return G5.includes(t)}function e3(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=K5(t,_,n,g,d,l,a),r=$5(t,b,n,g,u,l,a),i3(s,x,A,f.length),i3(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=K5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);i3(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=$5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);i3(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function i3(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=q5(t,h,n,a,r),i=Z5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=q5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=Z5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function n3(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function r3(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&Y5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,X5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&Y5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,X5(s,"yAxis"),d[0]))}(t,n3(t,e),i,n)})),a.forEach(((t,i)=>{const n=n3(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=ZE(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=ZE(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:Q5(n.getXAxisHelper(),p)+l.x+d,y:Q5(n.getYAxisHelper(),g)+l.y+u})})),r}function a3(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&Y5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&Y5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(s,"radiusAxis"),p[0])),n.push({angle:Q5(h.angleAxisHelper,u),radius:Q5(h.radiusAxisHelper,p)})})),n}function o3(t,e,i){let{x:s,y:n}=t;return ZE(s)&&(s=J5(s,e)),ZE(n)&&(n=J5(n,i)),{x:s,y:n}}function l3(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=o3(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>o3(t,n,r)))}function h3(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 c3(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},PP(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},u3(PP(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=u3(PP(r),i,s)),t}return{visible:!1}}function d3(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function u3(t,e,i){return d(t)?t(e,i):t}function p3(t,e){return d(t)?t(e):t}function g3(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 f3(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function m3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=f3(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function v3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=f3(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function y3(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function _3(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&t3(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&t3(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&t3(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&t3(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>x3(i,t,e))):i.x=x3(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>x3(i,t,e))):i.y=x3(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>x3(i,t,e))):i.angle=x3(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>x3(i,t,e))):i.radius=x3(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=x3(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const b3={min:(t,e)=>yw(t[0].latestData,e.field),max:(t,e)=>_w(t[0].latestData,e.field),sum:function(t,e){return bw(t[0].latestData,e.field)},average:function(t,e){return xw(t[0].latestData,e.field)},variance:function(t,e){return Sw(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(Sw(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function x3(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 b3[i](e,{field:s})}return t}function S3(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}const A3=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},k3=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},C3=t=>{if(!t)return;A3(t).forEach((e=>{k3(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{k3(e,t)}))},T3=(t,e)=>{if(!t)return;const i=new Set(A3(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(C3),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},M3="__vchart_marker_coordinate__",w3=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],E3=["position","positions","coordinatesOffset","regionRelative"],B3=["offsetX","offsetY","confine"],P3=t=>Array.isArray(t)?t.map(P3):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,R3=t=>{if(Array.isArray(t))return t.map(R3);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=R3(e[t])})),e},O3=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&w3.forEach((t=>{i[t]=M3})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),E3.forEach((t=>{t in i&&(i[t]=M3)})),"label"in i&&(i.label=P3(i.label)),Object.keys(i).forEach((t=>{i[t]=R3(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),B3.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=M3)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},P3(t)),{text:"__vchart_marker_text__"}))}return i};class I3 extends EU{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&t3(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Fa;return e.registerParser("array",s),new za(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&T3(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}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._updateMarkerLayout()}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._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=ww(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=QE(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QE(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(O3(e,{normalizeDomainPosition:i}),O3(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(O3(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),O3(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerFilter",S3),this._releaseMarkerData();const i=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function L3(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=yw(t,e),r=_w(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class D3 extends I3{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}=m3(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:u3(PP(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{line:d3(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return d3(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return d3(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:u3(PP(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:u3(PP(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=h3([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=m3(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerRegression",L3),YP(this._option.dataSet,"markerFilter",S3);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new za(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()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}D3.specKey="markLine";const F3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),z3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},H3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:F3(!1),endSymbol:F3(!0),label:z3};class j3 extends D3{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new sX(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}=m3(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=e3(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=r3(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=l3(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(ZE(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.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));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=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}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_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}=m3(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 za(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}j3.type=r.markLine,j3.coordinateType="cartesian",j3.builtInTheme={markLine:H3};class N3 extends D3{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=m3(this._spec);return e||i?new aX(t):new sX(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}=m3(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=s3(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=a3(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=m3(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}}}N3.type=r.polarMarkLine,N3.coordinateType="polar",N3.builtInTheme={polarMarkLine:H3};class U3 extends EU{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=qE(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return HH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=QE(this._spec.width,a.width,null,a.width),l=QE(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new RX(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}}U3.type=r.title,U3.specKey=r.title,U3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class V3 extends I3{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=v3(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:u3(PP(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{area:d3(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>d3(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return d3(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=h3([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=v3(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}V3.specKey="markArea";const W3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class G3 extends V3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new rX(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=v3(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=r3(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=l3(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=v3(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}}}G3.type=r.markArea,G3.coordinateType="cartesian",G3.builtInTheme={markArea:W3};class Y3 extends V3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=v3(this._spec);return i||e||s?new oX(t):new rX(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}=v3(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=s3(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());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=a3(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=v3(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}}}Y3.type=r.polarMarkArea,Y3.coordinateType="polar",Y3.builtInTheme={polarMarkArea:W3};const X3=t=>PP(Object.assign({},t)),K3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},PP(t.style))}),$3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=X3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=X3(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:{},PP(Object.assign({},_)));var _;const b=K3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=K3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=K3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=K3(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},q3=t=>"left"===t||"right"===t,Z3=t=>"top"===t||"bottom"===t,J3={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Q3 extends EU{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({},$3(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({},$3(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?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new KX(t):this._playerComponent=new ZX(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=q3(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=q3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(UX.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(UX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(UX.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(UX.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(UX.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(UX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=q3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Z3(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):q3(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))):Z3(this._orient)?this._maxSize():t.height}_computeDx(t){return q3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Z3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){var i,s;const n=null===(i=this._specs)||void 0===i?void 0:i[e];n&&(null===(s=this._option)||void 0===s?void 0:s.globalInstance)&&(this._option.globalInstance.updateFullData(n.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:n,index:e,specs:this._specs}}))}release(){var e,i,s,n;null===(i=null===(e=this._playerComponent)||void 0===e?void 0:e.pause)||void 0===i||i.call(e),null===(n=null===(s=this._option)||void 0===s?void 0:s.globalInstance)||void 0===n||n.off(t.ChartEvent.rendered,this.autoPlayCallback),super.release(),this._playerComponent=null,this._cacheAttrs=null,this._specs=[]}}Q3.builtInTheme={player:J3},Q3.specKey="player",Q3.type=r.player;class t4 extends EU{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,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=HE({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==tz.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}t4.type=r.label;class e4 extends rq{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}e4.type="text",e4.constructorType="label";const i4=()=>{aq(),vB.registerMark(e4.constructorType,e4)};class s4 extends wU{_initTheme(t,e){return{spec:t,theme:this._theme}}}class n4 extends t4{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=s4,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(FP.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(FP.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Tw(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=uB({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},x$(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[rP])):t=>t.filter((t=>t.data[nP]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?S$(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}n4.type=r.label,n4.specKey="label",n4.transformerConstructor=s4;class r4 extends t4{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[iP]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return uB({textStyle:{pickable:!0===this._spec.interactive},position:a4(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[rP]:t.data[nP]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>S$({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function a4(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}r4.type=r.totalLabel,r4.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},r4.specKey="totalLabel";class o4 extends I3{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=y3(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,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,O,I,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=u3(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=c3(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=u3(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=PP(u3(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=u3(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=u3(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:p3(D.offsetX,j),offsetY:p3(D.offsetY,j)},et),{style:u3(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:u3(z.style,this._markerData,this._markAttributeContext)},state:{line:d3(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:d3(it,this._markerData,this._markAttributeContext),textBackground:d3(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:d3(null!==(I=null===(O=this._spec.targetSymbol)||void 0===O?void 0:O.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:PP(lt.style)}):{visible:!1};return new hX(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:PP(C.style)}):{visible:!1},w=c3(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=h3([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=p3(S.offsetX,A),f=p3(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:g3(y,s,A),offsetY:g3(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=y3(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}o4.specKey="markPoint";const l4={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class h4 extends o4{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=e3(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=r3(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=l3(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=y3(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}}}h4.type=r.markPoint,h4.coordinateType="cartesian",h4.builtInTheme={markPoint:l4};class c4 extends o4{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=s3(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}c4.type=r.polarMarkPoint,c4.coordinateType="polar",c4.builtInTheme={polarMarkPoint:l4};class d4 extends o4{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}])]}}}d4.type=r.geoMarkPoint,d4.coordinateType="geo",d4.builtInTheme={geoMarkPoint:l4};const u4="inBrush",p4="outOfBrush",g4={style:!0,inBrush:!0,outOfBrush:!0};class f4 extends EU{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),u4,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),p4,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||g4[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:PP(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new eK(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:PP(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener($X.brushActive,(s=>{this._initMarkBrushState(i,p4),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener($X.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener($X.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener($X.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},PP(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];Yz(t,[...s.filter((t=>t!==u4&&t!==p4)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,u4),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,p4),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,u4),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,p4),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;Kz(s,[u4,p4]),i&&Xz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}f4.type=r.brush,f4.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},f4.specKey="brush";const m4={style:!0,state:!0};class v4 extends EU{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${NB}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||m4[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_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 Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}v4.type=r.customMark,v4.specKey="customMark";class y4{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>_4(t))),a=n.filter((t=>!_4(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>_4(t))),h=o.filter((t=>!_4(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 _4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}y4.type="grid";const b4=t=>{t?function(t){if(!t)throw new Error("installPoptipToApp requires an app instance");WA(t),MG(NA()),UA(),GA(t)}(t):(MG(m_()),MG(NA()),UA())},x4="vchart-tooltip",S4=`${x4}-container`,A4=`${x4}-title`,k4=`${x4}-content-box`,C4={offsetX:10,offsetY:10},T4="99999999999999";function M4(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const w4=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,E4=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?M4(t):"",B4=(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},P4={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},R4=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=P4[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class O4 extends sU{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=VH(null==T?void 0:T.position,b,e),w=null!==(r=VH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:UB,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:VB;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=_M(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=w4(e,F),N=w4(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(R4(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=B4(t,y),W.top=B4(i,y),W.right=B4(e,y),W.bottom=B4(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=B4(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?O:I,n="x"===t?A:C,r=R4(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",L4=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=I4(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=I4(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},D4=(t={})=>{const{lineHeight:e}=t;return t.fontSize?QE(e,t.fontSize):0},F4=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=I4(o)),{panelStyle:a,panelPadding:o}};function z4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const H4=t=>!!t&&1===t.nodeType&&"function"==typeof t.appendChild&&!!t.children;class j4 extends O4{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(j4.type),this.type=GW.dom,this._tooltipContainer=null==yM?void 0:yM.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}_getTooltipParentElement(t){return H4(t.parentElement)?t.parentElement:H4(this._chartContainer)?this._chartContainer:H4(null==yM?void 0:yM.body)?yM.body:void 0}initEl(){const t=this._component.getSpec(),e=this._getTooltipParentElement(t);if(yM&&e){for(let t=0;t{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=F4(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:I4(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=L4(h),x=L4(d),S=L4(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=I4(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=I4(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=I4(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(D4(p),D4(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(A4))),l=a.find((t=>t.className.includes(k4)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(A4),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(z4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${x4}-column`),e.classList.add(`${x4}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(k4),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];z4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));z4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${x4}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=E4(e.key),e.keyStyle&&L4(e.keyStyle,l)):"value"===i?(o.innerHTML=E4(e.value),e.valueStyle&&L4(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?M4(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?M4(c):m,_=p,b=t=>new Wg({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=su.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?M4(u):"currentColor",`\n \n \n \n `;const M=T?su.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),z4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(k4))),h=[...o.children].find((t=>t.className.includes(A4)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(A4)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=QE(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,z4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=fv({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function V4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:N4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const W4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class G4 extends O4{constructor(){super(G4.type),this.type=GW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new aK({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=iB(d.padding),x=V4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=V4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=V4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:W4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.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:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=uB({},S,V4(b,void 0,{})),{width:s,height:n,text:r}=U4(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=uB({},A,V4(x,void 0,{})),{width:e,height:s,text:n}=U4(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};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=uB({},x,V4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=U4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}G4.type=GW.canvas;const Y4=/\{([^}]+)\}/,X4=/\{([^}]+)\}/g,K4=/:/;class $4 extends sU{constructor(){super($4.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.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[$4.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)),vB.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=Y4.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(X4,((t,i)=>{if(!K4.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 this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}$4.pluginType="chart",$4.specKey="formatter",$4.type="formatterPlugin";RH.useRegisters([()=>{qW(),JW(),tG(),MW(),TW(),lW(),QV(),UN(),WN(),yH(),fH(),OV(),$V(),vB.registerSeries(hW.type,hW),vB.registerChart(eG.type,eG)},()=>{qW(),JW(),tG(),TW(),lW(),QV(),UN(),nG(),WN(),oG(),OV(),$V(),vB.registerSeries(cK.type,cK),MW(),vB.registerChart(uK.type,uK)},()=>{qW(),JW(),tG(),TW(),MK(),MW(),vB.registerChart(EK.type,EK)},()=>{qW(),JW(),MW(),TW(),jK(),vB.registerChart(UK.type,UK)},()=>{JW(),Nq(),vB.registerChart(X1.type,X1)},()=>{qW(),JW(),MW(),TW(),aZ(),vB.registerChart(q1.type,q1)},()=>{qW(),JW(),tG(),MW(),TW(),fZ(),vB.registerChart(J1.type,J1)},()=>{qW(),JW(),tG(),MW(),TW(),MK(),vB.registerTransform("bin",Qr),vB.registerChart(n2.type,n2)},()=>{JW(),i$(),XK(),vB.registerSeries(n$.type,n$),vB.registerImplement("registerMap",ZP),vB.registerImplement("unregisterMap",JP),mH(),vB.registerChart(N1.type,N1)},()=>{JW(),i1(),vB.registerSeries(n1.type,n1),Oq(),OZ(),iZ(),FZ(),vB.registerChart(l2.type,l2)},()=>{JW(),MQ(),vB.registerChart(d2.type,d2)},()=>{JW(),KQ(),vB.registerChart(p2.type,p2)},()=>{qW(),JW(),tG(),MW(),TW(),I$(),vB.registerChart(C2.type,C2)},()=>{qW(),JW(),MW(),TW(),nq(),vB.registerTransform("boxplot",ta),vB.registerChart(M2.type,M2)},()=>{qW(),JW(),MW(),TW(),FZ(),vB.registerChart(a2.type,a2)},()=>{qW(),JW(),MW(),TW(),YZ(),vB.registerChart(f2.type,f2)},()=>{qW(),JW(),MW(),TW(),fq(),vB.registerChart(v2.type,v2)},()=>{qW(),JW(),tG(),MW(),TW(),nG(),OV(),$V(),vB.registerSeries(bq.type,bq),vB.registerChart(P2.type,P2)},()=>{JW(),u0(),vB.registerChart(_2.type,_2)},()=>{JW(),y0(),vB.registerChart(x2.type,x2)},()=>{JW(),Y0(),vB.registerChart(A2.type,A2)},()=>{JW(),gG(),z0(),vB.registerChart(E2.type,E2)},()=>{JW(),u1(),vB.registerChart(O2.type,O2)},()=>{JW(),M1(),vB.registerChart(L2.type,L2)},()=>{qW(),JW(),tG(),MW(),vB.registerChart(t2.type,t2),TW()},$V,OV,()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(oK.type,oK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(lK.type,lK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(hK.type,hK)},nZ,iZ,()=>{vB.registerComponent(U2.type,U2)},()=>{vB.registerComponent(t5.type,t5)},()=>{vB.registerComponent(d5.type,d5)},()=>{vB.registerComponent(b5.type,b5)},()=>{vB.registerComponent(x5.type,x5)},()=>{vB.registerComponent(F5.type,F5)},()=>{vB.registerComponent(j5.type,j5)},()=>{vB.registerComponent(W5.type,W5)},i$,()=>{vB.registerComponent(j3.type,j3),iX()},()=>{vB.registerComponent(G3.type,G3),nX()},()=>{vB.registerComponent(h4.type,h4),lX()},()=>{vB.registerComponent(N3.type,N3),aX._animate=FY,iX()},()=>{vB.registerComponent(Y3.type,Y3),oX._animate=HY,nX()},()=>{vB.registerComponent(c4.type,c4),lX()},()=>{vB.registerComponent(d4.type,d4),lX()},()=>{vB.registerComponent(U3.type,U3)},()=>{vB.registerComponent(Q3.type,Q3)},()=>{vB.registerGraphicComponent(n4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(n4.type,n4,!0,1/0)},()=>{vB.registerGraphicComponent(r4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(r4.type,r4,!0)},()=>{vB.registerComponent(f4.type,f4)},()=>{vB.registerComponent(v4.type,v4)},()=>{vB.registerRuntimePluginInstaller("poptipForText",b4),b4()},()=>{vB.registerLayout(y4.type,y4)},()=>{var t;t=G4,vB.registerComponentPlugin(t.type,t)},()=>{var t;t=$4,vB.registerChartPlugin(t.type,t)},kH,MH]),RH.useRegisters([()=>{BO(iA)}]),t.DEFAULT_CHART_HEIGHT=VB,t.DEFAULT_CHART_WIDTH=UB,t.DEFAULT_CLOSE_STROKE_JOIN=LH,t.DEFAULT_DATA_INDEX=GB,t.DEFAULT_DATA_KEY=YB,t.DEFAULT_DATA_SERIES_FIELD=XB,t.DEFAULT_KEY=uP,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=IH,t.DEFAULT_MAP_LOOK_UP_KEY=pP,t.DEFAULT_MEASURE_CANVAS_ID=WB,t.DEFAULT_SERIES_STYLE_NAME=KB,t.DEFAULT_SMOOTH_INTERPOLATE=OH,t.Factory=vB,t.MOSAIC_CAT_END_PERCENT=hP,t.MOSAIC_CAT_START_PERCENT=lP,t.MOSAIC_VALUE_END_PERCENT=oP,t.MOSAIC_VALUE_START_PERCENT=aP,t.ManualTicker=class extends pb{constructor(t){super(t),this.lastFrameTime=0,this.status=wl.RUNNING}setupTickHandler(){const t=new DH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,!0}},t.PREFIX=NB,t.SEGMENT_FIELD_END=dP,t.SEGMENT_FIELD_START=cP,t.STACK_FIELD_END=ZB,t.STACK_FIELD_END_OffsetSilhouette=eP,t.STACK_FIELD_END_PERCENT=QB,t.STACK_FIELD_KEY=$B,t.STACK_FIELD_START=qB,t.STACK_FIELD_START_OffsetSilhouette=tP,t.STACK_FIELD_START_PERCENT=JB,t.STACK_FIELD_TOTAL=iP,t.STACK_FIELD_TOTAL_BOTTOM=rP,t.STACK_FIELD_TOTAL_PERCENT=sP,t.STACK_FIELD_TOTAL_TOP=nP,t.StreamLight=eF,t.ThemeManager=OB,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=RH,t.boundsInRect=eB,t.builtinThemes=SB,t.calcLayoutNumber=QE,t.calcPadding=tB,t.computeActualDataScheme=FE,t.convertPoint=sB,t.createArc=Vp,t.createArea=Yp,t.createGroup=tg,t.createLine=ag,t.createRect=mg,t.createRichText=jg,t.createSymbol=Gg,t.createText=Jg,t.darkTheme=cB,t.dataScheme=rB,t.default=RH,t.defaultThemeName=AB,t.getActualColor=HE,t.getActualNumValue=nB,t.getColorSchemeBySeries=VE,t.getDataScheme=DE,t.getFunnelTheme=bB,t.getMergedTheme=PB,t.getSpecInfo=HH,t.getTheme=wB,t.hasThemeMerged=TB,t.isColorKey=jE,t.isPercent=ZE,t.isPercentOffset=JE,t.isProgressiveDataColorScheme=NE,t.isTokenKey=oB,t.isValidOrient=qE,t.lightTheme=hB,t.lookup=jH,t.measureText=jB,t.normalizeLayoutPaddingSpec=iB,t.queryColorFromColorScheme=zE,t.queryToken=aB,t.registerDataSetInstanceParser=XP,t.registerDataSetInstanceTransform=YP,t.registerTheme=MB,t.removeTheme=EB,t.themeExist=BB,t.themes=kB,t.token=lB,t.transformColorSchemeToStandardStruct=UE,t.transformToGraphic=PP,t.version="2.1.3",t.vglobal=b_,t.warn=gM,Object.defineProperty(t,"__esModule",{value:!0})})); +let mQ=class t extends nQ{constructor(e){super(H({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),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 C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[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(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?uQ(t,o,l.width,l.height,h):"geometric"===t.type&&fQ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=tQ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};mQ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vQ extends nQ{constructor(t){super(H({},vQ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vQ.defaultOptions={enlarge:!1};const _Q={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bQ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xQ(t.fontFamily):"sans-serif",d=t.fontStyle?xQ(t.fontStyle):"normal",u=t.fontWeight?xQ(t.fontWeight):"normal",p=t.rotate?xQ(t.rotate):0,g=xQ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?xQ(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},_Q),t.as):_Q,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?xQ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=AQ(kQ(t,l),w);M=i=>e(t(i))}let E=aQ;"fast"===t.layoutType?E=vQ:"grid"===t.layoutType&&(E=mQ);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},xQ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],SQ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),AQ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SQ(t[0]),n=SQ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SQ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},kQ=(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 CQ(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{vB.registerGrammarTransform("wordcloud",{transform:bQ}),aq(),vB.registerAnimation("wordCloud",((t,e)=>({appear:sJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:uH.disappear.duration}}))),vB.registerSeries(TQ.type,TQ)},wQ=t=>d(t)?t():t,EQ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=wQ(e.valueField),v=null!==(i=wQ(e.heightVisual))&&void 0!==i&&i,y=null===(s=wQ(e.isCone))||void 0===s||s,_=wQ(e.range),b=a.reduce(((t,e)=>{const i=Number.parseFloat(e[m]);return k(i)?Math.max(t,i):t}),-1/0),x=null!==(n=null==_?void 0:_.min)&&void 0!==n?n:0,S=null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b,A=t=>k(t)&&k(x)&&k(S)?x===S?t{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0,S=A(n);p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=S),d&&(t[d]=e===a.length-1?y?0:t[c]:A(_)),u&&(t[u]=0===e?1:A(r)),g&&(t[g]=n)})),a},BQ=(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},PQ=`${NB}_FUNNEL_TRANSFORM_RATIO`,RQ=`${NB}_FUNNEL_REACH_RATIO`,OQ=`${NB}_FUNNEL_HEIGHT_RATIO`,IQ=`${NB}_FUNNEL_VALUE_RATIO`,LQ=`${NB}_FUNNEL_LAST_VALUE_RATIO`,DQ=`${NB}_FUNNEL_NEXT_VALUE_RATIO`,FQ=`${NB}_FUNNEL_LAST_VALUE`,zQ=`${NB}_FUNNEL_CURRENT_VALUE`,HQ=`${NB}_FUNNEL_NEXT_VALUE`,jQ=`${NB}_FUNNEL_TRANSFORM_LEVEL`;class NQ extends KH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[RQ])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class UQ extends qz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VQ extends UQ{constructor(){super(...arguments),this.type=VQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VQ.type="polygon";const WQ=()=>{vB.registerMark(VQ.type,VQ),KT(),yT(),w_.registerBuiltInAnimate("growPointsOut",VL),vB.registerGraphicComponent("polygon",ug)},GQ=Object.assign(Object.assign({},aj),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YQ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class XQ extends Ej{constructor(){super(...arguments),this.type=PE.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"funnel",EQ),YP(this._dataSet,"funnelTransform",BQ);const t=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new Tz(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:zQ,asTransformRatio:PQ,asReachRatio:RQ,asHeightRatio:OQ,asValueRatio:IQ,asNextValueRatio:DQ,asLastValueRatio:LQ,asLastValue:FQ,asNextValue:HQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:jQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},XQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:yj(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},XQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(XQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(XQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new NQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&uM(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&uM(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ew(RQ).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(gj(null===(s=vB.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),fj("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("fadeInOut")(),fj(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("funnel")({},o),fj(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(gj(null===(a=vB.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),fj("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[LQ])/2:this._getSecondaryAxisLength(t[IQ])/2,n=this._getSecondaryAxisLength(t[IQ])/2):(s=this._getSecondaryAxisLength(t[IQ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[DQ])/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[jQ])}_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[YB]===t[YB]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{WQ(),aq(),g$(),vB.registerSeries(XQ.type,XQ),vB.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},gH))),vB.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:lH,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),mH()},$Q=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},qQ=t=>{const e=t.filter((t=>t.context.diffState===tz.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},ZQ=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},JQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),QQ=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},t0=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),e0=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},i0=(t,e={})=>{if(!t)return[];const i=[];return oJ(t,i,e),i},s0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new LJ(i).layout(t,{width:s,height:n})};class n0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var r0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(r0||(r0={}));const a0=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===r0.DrillDown){return Y(AP(t,n,s,"children"))}if(i.type===r0.DrillUp){const e=kP(t,n,s,"children");if(e)return Y(e)}return t};class o0{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=JK(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;YP(t,"drillFilter",a0),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:r0.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:r0.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:r0.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:r0.DrillUp},model:this}),r}}const l0=Object.assign(Object.assign({},aj),{sunburst:{name:"sunburst",type:"arc"}}),h0=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:QH,operations:["max","min","values"]}),t.push({key:tj,operations:["values"]}),t),c0={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class d0 extends xq{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),YP(this._dataSet,"sunburstLayout",s0),YP(this._dataSet,"flatten",i0),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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(d0.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(d0.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new n0(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(gj(null===(e=vB.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}d0.type=PE.sunburst,d0.mark=l0,d0.builtInTheme={sunburst:c0},G(d0,o0);const u0=()=>{vB.registerSeries(d0.type,d0),Oq(),aq(),mH(),vB.registerAnimation("sunburst",((t,e)=>({appear:e0(0,e),enter:JQ(t),exit:t0(t),disappear:{duration:uH.disappear.duration}})))},p0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new AJ(i).layout(t,{width:s,height:n})};class g0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const f0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},m0=Object.assign(Object.assign({},aj),{circlePacking:{name:"circlePacking",type:"arc"}});class v0 extends Rj{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},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),YP(this._dataSet,"circlePackingLayout",p0),YP(this._dataSet,"flatten",i0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return h0(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new g0(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}v0.type=PE.circlePacking,v0.mark=m0,v0.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(v0,o0);const y0=()=>{vB.registerSeries(v0.type,v0),Oq(),aq(),fH(),vB.registerAnimation("circlePacking",((t,e)=>({appear:f0(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:uH.disappear.duration}})))},_0=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&_0(t,e.children,i)}))},b0=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},x0=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=S0(n,i),a=new RJ(i),o=[];return o.push(a.layout(r,s)),o},S0=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},A0=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:[]},k0=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 C0 extends KH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const T0=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),M0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:T0(t),w0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class E0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class B0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const P0=(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`},R0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class O0 extends j${constructor(){super(...arguments),this.type=O0.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?R0:P0,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}O0.type="linkPath";const I0=Object.assign(Object.assign({},aj),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class L0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const D0=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&Kz(t,e),Xz(t,e,s,n)};class F0 extends Rj{constructor(){super(...arguments),this.type=PE.sankey,this.transformerConstructor=L0,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=IP(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=IP(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):r.target===i.key?(s.includes(r.source)||s.push(r.source),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=IP(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),D0(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation())):(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=IP(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=IP(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=IP(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=IP(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=IP(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s},!0,this._hasLinkStateAnimation())}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value},!0,this._hasLinkStateAnimation());Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(IP(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=IP(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=IP(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation());const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a},!0,this._hasLinkStateAnimation())}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value},!0,this._hasLinkStateAnimation());Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}_hasStateAnimation(t){var e;return xj(this)&&!!(null===(e=null==t?void 0:t.hasAnimationByState)||void 0===e?void 0:e.call(t,"state"))}_hasLinkStateAnimation(){return this._hasStateAnimation(this._linkMark)}_hasNodeStateAnimation(){return this._hasStateAnimation(this._nodeMark)}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){YP(this._dataSet,"sankeyLayout",x0),YP(this._dataSet,"sankeyFormat",b0),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;YP(s,"sankeyNodes",A0),YP(s,"flatten",i0);const n=new za(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.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),n.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._nodesSeriesData=n,YP(s,"sankeyLinks",k0);const r=new za(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(F0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(F0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=zH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),fj("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),fj("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:NP.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(IP(e).key)?Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasNodeStateAnimation()):Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasNodeStateAnimation())}))}initTooltip(){this._tooltipHelper=new C0(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new WE;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return _0(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}F0.type=PE.sankey,F0.transformerConstructor=L0,F0.mark=I0,F0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const z0=()=>{bK(),N$(),cT(),vB.registerGraphicComponent("path",(t=>hg(t))),vB.registerMark(O0.type,O0),aq(),vB.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:M0(t,e)},gH))),vB.registerAnimation("sankeyLinkPath",((t,e)=>({appear:w0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:uH.disappear.duration}}))),w_.registerBuiltInAnimate("linkPathGrowOut",B0),w_.registerBuiltInAnimate("linkPathGrowIn",E0),mH(),vB.registerSeries(F0.type,F0)},H0=(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=i0(n);return i=qH([{latestData:r}],e),i};class j0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const N0=Object.assign(Object.assign({},aj),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),U0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class V0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const W0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new HJ(i).layout(t,s),n=[];return oJ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[tj,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class G0 extends Rj{constructor(){super(...arguments),this.type=PE.treemap,this.transformerConstructor=V0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,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:tj),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),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:YB},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),YP(this._dataSet,"treemap",W0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=H0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){YP(this._dataSet,"hierarchyDimensionStatistics",H0),YP(this._dataSet,"flatten",i0);const i=new za(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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(G0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(G0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("treemap"))||void 0===e?void 0:e(),fj(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 j0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(FP.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(FP.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}G0.type=PE.treemap,G0.mark=N0,G0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},G0.transformerConstructor=V0,G(G0,o0),G(G0,t$);const Y0=()=>{vB.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),vB.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),bK(),aq(),vB.registerAnimation("treemap",((t,e)=>({appear:U0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(G0.type,G0)},X0=Object.assign(Object.assign({},MZ),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),K0=Object.assign(Object.assign({},aj),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),$0={type:"fadeIn"};function q0(t,e){return"fadeIn"===e?$0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class Z0 extends Sj{constructor(){super(...arguments),this._supportStack=!1}}class J0 extends KH{enableByType(t){return"dimension"!==t}}const Q0="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",t1={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:Q0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Q0,fill:"#ddd"}}};class e1 extends EZ{constructor(){super(...arguments),this.type=PE.gaugePointer,this.transformerConstructor=Z0,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(e1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},e1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(e1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new J0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}e1.type=PE.gaugePointer,e1.mark=K0,e1.builtInTheme={gaugePointer:t1},e1.transformerConstructor=Z0;const i1=()=>{vB.registerSeries(e1.type,e1),XK(),bK(),vB.registerAnimation("gaugePointer",((t,e)=>{const i=q0(t,e);return{appear:i,enter:i,disappear:{duration:uH.disappear.duration}}})),nZ(),iZ()};class s1 extends Sj{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class n1 extends EZ{constructor(){super(...arguments),this.type=PE.gauge,this.transformerConstructor=s1,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();YP(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[dP]=t[this._angleField[0]],t[cP]=e>0?i[e-1][dP]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(n1.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(n1.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[cP])?this.angleAxisHelper.dataToPosition([t[cP]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[dP]])}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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}n1.type=PE.gauge,n1.mark=X0,n1.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},n1.transformerConstructor=s1;class r1 extends qz{constructor(){super(...arguments),this.type=r1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Gg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}r1.type="cell";function a1(t){return!1===t?{}:{type:"fadeIn"}}class o1 extends KH{enableByType(t){return"dimension"!==t}}const l1=Object.assign(Object.assign({},aj),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class h1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const c1={valueField:!0};class d1 extends Rj{constructor(){super(...arguments),this.type=PE.heatmap,this.transformerConstructor=h1}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),c1)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(d1.mark.cell,{isSeriesMark:!0},{morph:yj(this._spec,d1.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(d1.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Pj(this);this._cellMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),fj("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 o1(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}d1.type=PE.heatmap,d1.mark=l1,d1.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},d1.transformerConstructor=h1;const u1=()=>{aq(),vB.registerMark(r1.type,r1),vB.registerGraphicComponent("symbol",Gg),KT(),iM(),jN(),vB.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},gH),{appear:a1(e)}))),OV(),$V(),vB.registerSeries(d1.type,d1)},p1=Object.assign(Object.assign({},aj),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),g1=`${NB}_CORRELATION_X`,f1=`${NB}_CORRELATION_Y`,m1=`${NB}_CORRELATION_SIZE`,v1=t=>d(t)?t():t,y1=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=v1(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=v1(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=v1(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(v1(e.outerRadius),f),y=v1(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(v1(e.field)),A=c.map(x),[k,C]=It(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=v1(e.radiusField),w=v1(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?It(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),O=Math.max(p,g),I=_1(R,O,c.length),L=[],D=(O-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),b1({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>O?a=R: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},b1=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,S1=(t,e)=>{if(!t||!_(t))return[];const i=x1(e.keyword),s=x1(e.categoryField),n=t[0].latestData[0];return{[s]:i,[GB]:null==n?void 0:n[GB],[XB]:null==n?void 0:n[XB]}};class A1 extends j${constructor(){super(...arguments),this.type=A1.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}A1.type="ripple";const k1=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class C1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class T1 extends xq{constructor(){super(...arguments),this.type=PE.correlation,this.transformerConstructor=C1,this._viewBox=new Ue}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(){if(super.initData(),!this._data)return;YP(this._dataSet,"correlation",y1);const t=new Fa;XP(t,"dataview",Ia),YP(t,"correlationCenter",S1);const e=new za(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return 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 Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(T1.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:GB});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(T1.mark.ripplePoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(T1.mark.centerPoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[g1],y:t=>t[f1],size:t=>t[m1],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),fj("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}T1.type=PE.correlation,T1.mark=p1,T1.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},T1.transformerConstructor=C1;const M1=()=>{WN(),N$(),iM(),vB.registerMark(A1.type,A1),vB.registerGraphicComponent("symbol",(t=>Gg(t))),vB.registerSeries(T1.type,T1),vB.registerAnimation("correlation",((t,e)=>Object.assign({appear:k1(0,e)},pH)))},w1=Object.assign(Object.assign({},aj),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class E1 extends j${constructor(){super(...arguments),this.type=E1.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}E1.type="liquid";const B1=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class P1 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class R1 extends Ej{constructor(){super(...arguments),this.type=PE.liquid,this.transformerConstructor=GN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=mg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Gg({x:s,y:n,size:r,symbolType:B1(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=iB(this._spec.outlineMargin),this._paddingSpec=iB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(R1.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(R1.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(R1.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(R1.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new P1(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),fj("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),fj("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=RM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}R1.type=PE.liquid,R1.mark=w1,R1.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},R1.transformerConstructor=GN;const O1=t=>Y(t).join(",");class I1 extends KH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]])}}const L1=Object.assign(Object.assign({},aj),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class D1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const F1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?ZJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class z1 extends Ej{constructor(){super(...arguments),this.type=PE.venn,this.transformerConstructor=D1,this._viewBox=new Ue}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:YB)}initData(){var t;super.initData(),YP(this._dataSet,"venn",F1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(z1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(z1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new I1(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:O1(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return O1(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[O1(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(O1(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}}z1.type=PE.venn,z1.mark=L1,z1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},z1.transformerConstructor=D1;class H1 extends TK{constructor(){super(...arguments),this.type=PE.mosaic,this.transformerConstructor=kK}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(oP),this.setFieldX2(aP)),this.setFieldY(hP),this.setFieldY2(lP)):(t&&(this.setFieldY(oP),this.setFieldY2(aP)),this.setFieldX(hP),this.setFieldX2(lP)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}H1.type=PE.mosaic,H1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},H1.transformerConstructor=kK;class j1 extends yW{_isValidSeries(t){return t===PE.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class N1 extends fW{constructor(){super(...arguments),this.transformerConstructor=j1,this.type="map",this.seriesType=PE.map}}N1.type="map",N1.seriesType=PE.map,N1.transformerConstructor=j1;class U1 extends yW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class V1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=oU(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,uB({},s,l)),n&&Object.assign(o,uB({},n,o))}}class W1 extends U1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class G1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class Y1 extends fW{constructor(){super(...arguments),this.transformerConstructor=G1}}Y1.transformerConstructor=G1;class X1 extends Y1{constructor(){super(...arguments),this.transformerConstructor=G1,this.type="pie",this.seriesType=PE.pie}}X1.type="pie",X1.seriesType=PE.pie,X1.transformerConstructor=G1;class K1 extends W1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:AU,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:AU,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>uB({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const $1=(t,e)=>{if(!t)return null;const i=Yj(t,(t=>"angle"===t.getOrient()),e),s=Yj(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Lw(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=Aw({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=kw(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=Wj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Lw(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=Aw({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=kw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=Wj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class q1 extends fW{constructor(){super(...arguments),this.transformerConstructor=K1,this.type="rose",this.seriesType=PE.rose}_setModelOption(){this._modelOption.getDimensionInfo=$1}}q1.type="rose",q1.seriesType=PE.rose,q1.transformerConstructor=K1,G(q1,AW);class Z1 extends W1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=uB({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}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=>uB({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class J1 extends fW{constructor(){super(...arguments),this.transformerConstructor=Z1,this.type="radar",this.seriesType=PE.radar}_setModelOption(){this._modelOption.getDimensionInfo=$1}}J1.type="radar",J1.seriesType=PE.radar,J1.transformerConstructor=Z1,G(J1,AW);class Q1 extends yW{_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")&&uB(e,qF(this.type,t))})),this._transformAxisSpec(t)}}class t2 extends fW{constructor(){super(...arguments),this.transformerConstructor=Q1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=OW(t,e,i))&&void 0!==s?s:[],...null!==(n=$1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}t2.type="common",t2.transformerConstructor=Q1,G(t2,AW);class e2 extends _W{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class i2 extends fW{constructor(){super(...arguments),this.transformerConstructor=e2}}i2.transformerConstructor=e2,G(i2,AW);class s2 extends e2{transformSpec(t){super.transformSpec(t),WF(t)}}class n2 extends i2{constructor(){super(...arguments),this.transformerConstructor=s2,this.type="histogram",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}n2.type="histogram",n2.seriesType=PE.bar,n2.transformerConstructor=s2;class r2 extends V1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class a2 extends fW{constructor(){super(...arguments),this.transformerConstructor=r2,this.type="circularProgress",this.seriesType=PE.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=$1}}a2.type="circularProgress",a2.seriesType=PE.circularProgress,a2.transformerConstructor=r2,G(a2,AW);class o2 extends V1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=PE.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===PE.gauge||t.type===PE.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===PE.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 l2 extends fW{constructor(){super(...arguments),this.transformerConstructor=o2,this.type="gauge",this.seriesType=PE.gaugePointer}}l2.type="gauge",l2.seriesType=PE.gaugePointer,l2.transformerConstructor=o2;class h2 extends yW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class c2 extends fW{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}c2.transformerConstructor=h2;class d2 extends c2{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}d2.type="wordCloud",d2.seriesType=PE.wordCloud,d2.transformerConstructor=h2;class u2 extends yW{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class p2 extends fW{constructor(){super(...arguments),this.transformerConstructor=u2,this.type="funnel",this.seriesType=PE.funnel}}p2.type="funnel",p2.seriesType=PE.funnel,p2.transformerConstructor=u2;class g2 extends _W{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=oU(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=oU(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class f2 extends fW{constructor(){super(...arguments),this.transformerConstructor=g2,this.type="linearProgress",this.seriesType=PE.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}f2.type="linearProgress",f2.seriesType=PE.linearProgress,f2.transformerConstructor=g2,G(f2,AW);class m2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),WF(t)}}class v2 extends fW{constructor(){super(...arguments),this.transformerConstructor=m2,this.type="rangeColumn",this.seriesType=PE.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}v2.type="rangeColumn",v2.seriesType=PE.rangeColumn,v2.transformerConstructor=m2;class y2 extends yW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _2 extends fW{constructor(){super(...arguments),this.transformerConstructor=y2,this.type="sunburst",this.seriesType=PE.sunburst}}_2.type="sunburst",_2.seriesType=PE.sunburst,_2.transformerConstructor=y2;class b2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class x2 extends fW{constructor(){super(...arguments),this.transformerConstructor=b2,this.type="circlePacking",this.seriesType=PE.circlePacking}}x2.type="circlePacking",x2.seriesType=PE.circlePacking,x2.transformerConstructor=b2;class S2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class A2 extends fW{constructor(){super(...arguments),this.transformerConstructor=S2,this.type="treemap",this.seriesType=PE.treemap}}A2.type="treemap",A2.seriesType=PE.treemap,A2.transformerConstructor=S2;class k2 extends wK{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),WF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class C2 extends EK{constructor(){super(...arguments),this.transformerConstructor=k2,this.type="waterfall",this.seriesType=PE.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}C2.type="waterfall",C2.seriesType=PE.waterfall,C2.transformerConstructor=k2;class T2 extends _W{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),WF(t)}}class M2 extends fW{constructor(){super(...arguments),this.transformerConstructor=T2,this.type="boxPlot",this.seriesType=PE.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}M2.type="boxPlot",M2.seriesType=PE.boxPlot,M2.transformerConstructor=T2;class w2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class E2 extends fW{constructor(){super(...arguments),this.transformerConstructor=w2,this.type="sankey",this.seriesType=PE.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=IP(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}E2.type="sankey",E2.seriesType=PE.sankey,E2.transformerConstructor=w2;class B2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),WF(t)}}class P2 extends fW{constructor(){super(...arguments),this.transformerConstructor=B2,this.type="rangeArea",this.seriesType=PE.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}P2.type="rangeArea",P2.seriesType=PE.rangeArea,P2.transformerConstructor=B2;class R2 extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class O2 extends fW{constructor(){super(...arguments),this.transformerConstructor=R2,this.type="heatmap",this.seriesType=PE.heatmap}}O2.type="heatmap",O2.seriesType=PE.heatmap,O2.transformerConstructor=R2;class I2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class L2 extends fW{constructor(){super(...arguments),this.transformerConstructor=I2,this.type="correlation",this.seriesType=PE.correlation}}L2.type="correlation",L2.seriesType=PE.correlation,L2.transformerConstructor=I2;function D2(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=PP(t.style)),P(t.textStyle)||uB(s.textStyle,PP(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&PP(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&PP(s.background.style),s}function F2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const z2=(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},H2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:XB;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},j2={position:!0,item:!0,title:!0,pager:!0,background:!0};class N2 extends EU{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:()=>{Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(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=qE(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||j2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Tz(this._option,e),this._initSelectedData(),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(Tw(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(uB({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}N2.specKey="legends";class U2 extends N2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){YP(this._option.dataSet,"discreteLegendFilter",H2),YP(this._option.dataSet,"discreteLegendDataMake",z2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return Tw(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(!CM(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=mP(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,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=qE(s)?s:qE(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=D2(A):M.title={visible:!1},P(k.focusIconStyle)||PP(k.focusIconStyle),k.shape&&(k.shape=F2(wP(k.shape))),k.label&&(k.label=wP(k.label)),k.value&&(k.value=wP(k.value)),k.background&&(k.background=wP(k.background)),ZE(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),ZE(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),ZE(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||PP(C.railStyle),P(C.sliderStyle)||PP(C.sliderStyle)):(P(C.textStyle)||PP(C.textStyle),C.handler&&wP(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(uB(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return kX}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(vX.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(vX.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(vX.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,datum:t.datum,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}=zH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=zH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}U2.specKey="legends",U2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},U2.type=r.discreteLegend;const V2=(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[]},W2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?CP(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function G2(t){const i=uB({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=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=D2(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=PP(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=PP(r.style)),P(a.style)||(w.trackStyle=PP(a.style)),w.startText=wP(o),w.endText=wP(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>PP(i(t,e,s)):P(i)||(e.style=PP(i)),e}(h),P(c)||(w.sizeBackground=PP(c)),u.visible&&!P(u.style)&&(uB(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const Y2={color:EX,size:PX},X2={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}},K2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},X2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},$2={horizontal:K2(!0),vertical:K2(!1)},q2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},X2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},Z2={horizontal:q2(!0),vertical:q2(!1)},J2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Q2=[2,10];class t5 extends N2{static getSpecInfo(t){const e=HH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){YP(this._option.dataSet,"continuousLegendFilter",W2),YP(this._option.dataSet,"continuousLegendDataMake",V2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>Mw(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=mP(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!CM(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=mP(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?J2:Q2);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},G2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return Y2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}t5.specKey="legends",t5.builtInTheme={colorLegend:$2,sizeLegend:Z2},t5.type=r.continuousLegend;const e5=(t,e)=>p(e)?t.map((t=>e[t])):void 0,i5=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),s5=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function n5(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=r5(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>i5(i,s)(t)&&i5(n,r)(t)&&(u(a)||i5([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:jP.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:jP.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(a.id),m}return"none"}const r5=(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=e5(c,t);let y=e5(d,t);const _=s5(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(i5(c,v));if(!_&&(y=e5(d,i),!s5(y)))return;const n=e.type===PE.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=Lw(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(i5(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=e5(d,o),!s5(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(i5(c,n));if(!_&&(y=e5(d,r),!s5(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===PE.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(i5(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=e5(d,i),!s5(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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(i5(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=e5(d,a),h=y,!s5(y)&&!a)return;s5(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},a5=t=>p(t)&&!_(t),o5=t=>p(t)&&_(t),l5=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class h5 extends wU{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=uB({},...l5.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=uB({},s);l5.forEach((t=>{delete r[t]})),delete r.style;const a=uB({},r,i);return a.style=uB({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:xM(this._option.mode)||!_M(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=b_.getElementById(t.parentElement)):_M(this._option.mode)&&(t.parentElement=null==yM?void 0:yM.body)}}const c5={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class d5 extends EU{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=h5,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=_M(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&a5(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&RH.globalConfig.uniqueTooltip&&l&&RH.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:jP.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:jP.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?GW.canvas:GW.dom,n=vB.getComponentPluginInType(t);n||fM("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=vB.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(bM(s)||xM(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=n5(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(o5(t)){if(a5(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>Uj(t,e[i])))}if(o5(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}d5.type=r.tooltip,d5.transformerConstructor=h5,d5.builtInTheme={tooltip:c5},d5.specKey="tooltip";var u5,p5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(u5||(u5={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(p5||(p5={}));const g5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},f5={labelZIndex:!0,gridZIndex:!0},m5={xField:!0,yField:!0,categoryField:!0,valueField:!0},v5={visible:!0,width:!0,style:!0};class y5 extends EU{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Lw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||f5[i]||m5[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||v5[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:NP.chart}:{source:jP.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:bM(e)||xM(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:jP.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:jP.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:jP.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)=>{g5[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}y5.specKey="crosshair";const _5={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class b5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=Oj(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){Oj(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Ij(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"cartesian");e&&(DW(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=HW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new EG(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new BG(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}b5.specKey="crosshair",b5.builtInTheme={crosshair:_5},b5.type=r.cartesianCrosshair;class x5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=aU(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=zH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new EG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new RG(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new OG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new PG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}x5.specKey="crosshair",x5.builtInTheme={crosshair:_5},x5.type=r.polarCrosshair;const S5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},A5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},k5=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},C5=(t,e,i)=>{const s=e.domain();if(Ow(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},T5=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Ow(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},M5=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},w5=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}},E5=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),B5=(t,e,i)=>{if(Ow(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class P5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===Fj(Dj(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(P5,t$);class R5 extends EU{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:T5(t,this._stateScale,this._isHorizontal),a="percent"===n?e:T5(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=M5(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=B5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&w5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=Dj(t),this._isHorizontal="horizontal"===Fj(this._orient),this._dataFilterEvent=new P5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Ow(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>Fj(t._orient)===Fj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Ow(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};Tw(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Ow(d.getScale(0).type),p=Ow(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else Tw(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;XP(r,"dataview",Ia),YP(r,"dataFilterComputeDomain",k5);const a=new za(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Tz(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(YP(this._option.dataSet,"dataFilterWithNewDomain",A5),YP(this._option.dataSet,"lockStatisticsFilter",S5),Tw(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Ow(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;E5("start",i,this._spec)&&E5("end",s,this._spec)&&(t="percent"===i?this._spec.start:T5(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:T5(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?T5(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?T5(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=C5(this._start,this._stateScale,M5(i,this._isHorizontal)),this._endValue=C5(this._end,this._stateScale,M5(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Ow(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=B5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&Tw(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new AE:new iE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=w5(h);if(!this._dataUpdating&&Lw(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,Lw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(R5,t$);class O5 extends wU{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=uB({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const I5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),L5={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:I5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:I5(!0)},D5={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class F5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=O5,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=C5(e,this._stateScale,M5(s,this._isHorizontal)),a=C5(i,this._stateScale,M5(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new AE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(M5(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=M5(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return D5}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new AE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(M5(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Ow(t.type)||e[0]!==X(e))&&(!Lw(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:M5(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new vY(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:PP(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:PP(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:PP(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:PP(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:PP(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:PP(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:PP(g.style)},selectedBackgroundStyle:PP(this._spec.selectedBackground.style),dragMaskStyle:PP(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:uB(PP(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:uB(PP(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(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}=zH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(M5(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}F5.type=r.dataZoom,F5.transformerConstructor=O5,F5.builtInTheme={dataZoom:L5},F5.specKey="dataZoom";const z5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},H5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class j5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=vw(this._start,e)&&vw(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=M5(n,this._isHorizontal),a=C5(e,this._stateScale,r),o=C5(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return H5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new uG(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=PP(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=PP(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}j5.type=r.scrollBar,j5.builtInTheme={scrollBar:z5},j5.specKey="scrollBar";const N5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():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},U5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),V5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:U5("l1FontSize","primaryFontColor")},content:{visible:!0,style:U5("l2FontSize","tertiaryFontColor")}};class W5 extends EU{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){YP(this._option.dataSet,"indicatorFilter",N5);const t=new za(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 Tz(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=uB({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},BP(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?nB(l,this._computeLayoutRadius()):0,dy:h?nB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},BP(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new IX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}W5.type=r.indicator,W5.builtInTheme={indicator:V5},W5.specKey="indicator";const G5=["sum","average","min","max","variance","standardDeviation","median"];function Y5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function X5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function K5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&Y5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,X5(a,"xAxis"),t.x)),c=ZE(t.x)?J5(t.x,n)+r.x:Q5(h.getXAxisHelper(),[t.x])+r.x,c}function $5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&Y5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(a,"yAxis"),t.y)),c=ZE(t.y)?J5(t.y,n)+r.y:Q5(h.getYAxisHelper(),[t.y])+r.y,c}function q5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&Y5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"angleAxis"),t.angle)),Q5(o.angleAxisHelper,[t.angle])}function Z5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&Y5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"radiusAxis"),t.radius)),Q5(o.radiusAxisHelper,[t.radius])}function J5(t,e){return Number(t.substring(0,t.length-1))*e/100}function Q5(t,e){const i=t.getScale(0);return Ow(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function t3(t){return G5.includes(t)}function e3(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=K5(t,_,n,g,d,l,a),r=$5(t,b,n,g,u,l,a),i3(s,x,A,f.length),i3(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=K5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);i3(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=$5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);i3(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function i3(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=q5(t,h,n,a,r),i=Z5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=q5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=Z5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function n3(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function r3(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&Y5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,X5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&Y5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,X5(s,"yAxis"),d[0]))}(t,n3(t,e),i,n)})),a.forEach(((t,i)=>{const n=n3(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=ZE(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=ZE(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:Q5(n.getXAxisHelper(),p)+l.x+d,y:Q5(n.getYAxisHelper(),g)+l.y+u})})),r}function a3(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&Y5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&Y5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(s,"radiusAxis"),p[0])),n.push({angle:Q5(h.angleAxisHelper,u),radius:Q5(h.radiusAxisHelper,p)})})),n}function o3(t,e,i){let{x:s,y:n}=t;return ZE(s)&&(s=J5(s,e)),ZE(n)&&(n=J5(n,i)),{x:s,y:n}}function l3(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=o3(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>o3(t,n,r)))}function h3(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 c3(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},PP(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},u3(PP(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=u3(PP(r),i,s)),t}return{visible:!1}}function d3(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function u3(t,e,i){return d(t)?t(e,i):t}function p3(t,e){return d(t)?t(e):t}function g3(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 f3(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function m3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=f3(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function v3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=f3(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function y3(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function _3(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&t3(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&t3(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&t3(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&t3(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>x3(i,t,e))):i.x=x3(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>x3(i,t,e))):i.y=x3(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>x3(i,t,e))):i.angle=x3(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>x3(i,t,e))):i.radius=x3(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=x3(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const b3={min:(t,e)=>yw(t[0].latestData,e.field),max:(t,e)=>_w(t[0].latestData,e.field),sum:function(t,e){return bw(t[0].latestData,e.field)},average:function(t,e){return xw(t[0].latestData,e.field)},variance:function(t,e){return Sw(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(Sw(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function x3(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 b3[i](e,{field:s})}return t}function S3(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}const A3=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},k3=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},C3=t=>{if(!t)return;A3(t).forEach((e=>{k3(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{k3(e,t)}))},T3=(t,e)=>{if(!t)return;const i=new Set(A3(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(C3),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},M3="__vchart_marker_coordinate__",w3=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],E3=["position","positions","coordinatesOffset","regionRelative"],B3=["offsetX","offsetY","confine"],P3=t=>Array.isArray(t)?t.map(P3):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,R3=t=>{if(Array.isArray(t))return t.map(R3);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=R3(e[t])})),e},O3=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&w3.forEach((t=>{i[t]=M3})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),E3.forEach((t=>{t in i&&(i[t]=M3)})),"label"in i&&(i.label=P3(i.label)),Object.keys(i).forEach((t=>{i[t]=R3(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),B3.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=M3)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},P3(t)),{text:"__vchart_marker_text__"}))}return i};class I3 extends EU{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&t3(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Fa;return e.registerParser("array",s),new za(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&T3(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}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._updateMarkerLayout()}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._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=ww(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=QE(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QE(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(O3(e,{normalizeDomainPosition:i}),O3(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(O3(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),O3(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerFilter",S3),this._releaseMarkerData();const i=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function L3(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=yw(t,e),r=_w(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class D3 extends I3{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}=m3(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:u3(PP(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{line:d3(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return d3(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return d3(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:u3(PP(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:u3(PP(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=h3([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=m3(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerRegression",L3),YP(this._option.dataSet,"markerFilter",S3);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new za(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()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}D3.specKey="markLine";const F3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),z3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},H3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:F3(!1),endSymbol:F3(!0),label:z3};class j3 extends D3{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new sX(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}=m3(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=e3(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=r3(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=l3(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(ZE(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.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));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=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}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_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}=m3(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 za(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}j3.type=r.markLine,j3.coordinateType="cartesian",j3.builtInTheme={markLine:H3};class N3 extends D3{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=m3(this._spec);return e||i?new aX(t):new sX(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}=m3(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=s3(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=a3(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=m3(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}}}N3.type=r.polarMarkLine,N3.coordinateType="polar",N3.builtInTheme={polarMarkLine:H3};class U3 extends EU{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=qE(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return HH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=QE(this._spec.width,a.width,null,a.width),l=QE(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new RX(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}}U3.type=r.title,U3.specKey=r.title,U3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class V3 extends I3{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=v3(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:u3(PP(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{area:d3(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>d3(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return d3(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=h3([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=v3(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}V3.specKey="markArea";const W3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class G3 extends V3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new rX(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=v3(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=r3(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=l3(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=v3(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}}}G3.type=r.markArea,G3.coordinateType="cartesian",G3.builtInTheme={markArea:W3};class Y3 extends V3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=v3(this._spec);return i||e||s?new oX(t):new rX(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}=v3(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=s3(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());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=a3(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=v3(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}}}Y3.type=r.polarMarkArea,Y3.coordinateType="polar",Y3.builtInTheme={polarMarkArea:W3};const X3=t=>PP(Object.assign({},t)),K3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},PP(t.style))}),$3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=X3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=X3(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:{},PP(Object.assign({},_)));var _;const b=K3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=K3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=K3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=K3(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},q3=t=>"left"===t||"right"===t,Z3=t=>"top"===t||"bottom"===t,J3={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Q3 extends EU{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({},$3(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({},$3(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?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new KX(t):this._playerComponent=new ZX(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=q3(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=q3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(UX.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(UX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(UX.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(UX.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(UX.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(UX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=q3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Z3(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):q3(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))):Z3(this._orient)?this._maxSize():t.height}_computeDx(t){return q3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Z3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){var i,s;const n=null===(i=this._specs)||void 0===i?void 0:i[e];n&&(null===(s=this._option)||void 0===s?void 0:s.globalInstance)&&(this._option.globalInstance.updateFullData(n.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:n,index:e,specs:this._specs}}))}release(){var e,i,s,n;null===(i=null===(e=this._playerComponent)||void 0===e?void 0:e.pause)||void 0===i||i.call(e),null===(n=null===(s=this._option)||void 0===s?void 0:s.globalInstance)||void 0===n||n.off(t.ChartEvent.rendered,this.autoPlayCallback),super.release(),this._playerComponent=null,this._cacheAttrs=null,this._specs=[]}}Q3.builtInTheme={player:J3},Q3.specKey="player",Q3.type=r.player;class t4 extends EU{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,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=HE({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==tz.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}t4.type=r.label;class e4 extends rq{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}e4.type="text",e4.constructorType="label";const i4=()=>{aq(),vB.registerMark(e4.constructorType,e4)};class s4 extends wU{_initTheme(t,e){return{spec:t,theme:this._theme}}}class n4 extends t4{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=s4,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(FP.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(FP.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Tw(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=uB({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},x$(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[rP])):t=>t.filter((t=>t.data[nP]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?S$(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}n4.type=r.label,n4.specKey="label",n4.transformerConstructor=s4;class r4 extends t4{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[iP]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return uB({textStyle:{pickable:!0===this._spec.interactive},position:a4(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[rP]:t.data[nP]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>S$({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function a4(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}r4.type=r.totalLabel,r4.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},r4.specKey="totalLabel";class o4 extends I3{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=y3(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,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,O,I,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=u3(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=c3(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=u3(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=PP(u3(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=u3(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=u3(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:p3(D.offsetX,j),offsetY:p3(D.offsetY,j)},et),{style:u3(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:u3(z.style,this._markerData,this._markAttributeContext)},state:{line:d3(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:d3(it,this._markerData,this._markAttributeContext),textBackground:d3(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:d3(null!==(I=null===(O=this._spec.targetSymbol)||void 0===O?void 0:O.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:PP(lt.style)}):{visible:!1};return new hX(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:PP(C.style)}):{visible:!1},w=c3(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=h3([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=p3(S.offsetX,A),f=p3(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:g3(y,s,A),offsetY:g3(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=y3(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}o4.specKey="markPoint";const l4={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class h4 extends o4{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=e3(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=r3(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=l3(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=y3(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}}}h4.type=r.markPoint,h4.coordinateType="cartesian",h4.builtInTheme={markPoint:l4};class c4 extends o4{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=s3(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}c4.type=r.polarMarkPoint,c4.coordinateType="polar",c4.builtInTheme={polarMarkPoint:l4};class d4 extends o4{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}])]}}}d4.type=r.geoMarkPoint,d4.coordinateType="geo",d4.builtInTheme={geoMarkPoint:l4};const u4="inBrush",p4="outOfBrush",g4={style:!0,inBrush:!0,outOfBrush:!0};class f4 extends EU{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),u4,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),p4,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||g4[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:PP(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new eK(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:PP(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener($X.brushActive,(s=>{this._initMarkBrushState(i,p4),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener($X.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener($X.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener($X.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},PP(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];Yz(t,[...s.filter((t=>t!==u4&&t!==p4)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,u4),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,p4),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,u4),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,p4),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;Kz(s,[u4,p4]),i&&Xz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}f4.type=r.brush,f4.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},f4.specKey="brush";const m4={style:!0,state:!0};class v4 extends EU{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${NB}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||m4[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_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 Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}v4.type=r.customMark,v4.specKey="customMark";class y4{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>_4(t))),a=n.filter((t=>!_4(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>_4(t))),h=o.filter((t=>!_4(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 _4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}y4.type="grid";const b4=t=>{t?function(t){if(!t)throw new Error("installPoptipToApp requires an app instance");WA(t),MG(NA()),UA(),GA(t)}(t):(MG(m_()),MG(NA()),UA())},x4="vchart-tooltip",S4=`${x4}-container`,A4=`${x4}-title`,k4=`${x4}-content-box`,C4={offsetX:10,offsetY:10},T4="99999999999999";function M4(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const w4=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,E4=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?M4(t):"",B4=(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},P4={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},R4=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=P4[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class O4 extends sU{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=VH(null==T?void 0:T.position,b,e),w=null!==(r=VH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:UB,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:VB;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=_M(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=w4(e,F),N=w4(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(R4(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=B4(t,y),W.top=B4(i,y),W.right=B4(e,y),W.bottom=B4(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=B4(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?O:I,n="x"===t?A:C,r=R4(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",L4=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=I4(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=I4(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},D4=(t={})=>{const{lineHeight:e}=t;return t.fontSize?QE(e,t.fontSize):0},F4=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=I4(o)),{panelStyle:a,panelPadding:o}};function z4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const H4=t=>!!t&&1===t.nodeType&&"function"==typeof t.appendChild&&!!t.children;class j4 extends O4{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(j4.type),this.type=GW.dom,this._tooltipContainer=null==yM?void 0:yM.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}_getTooltipParentElement(t){return H4(t.parentElement)?t.parentElement:H4(this._chartContainer)?this._chartContainer:H4(null==yM?void 0:yM.body)?yM.body:void 0}initEl(){const t=this._component.getSpec(),e=this._getTooltipParentElement(t);if(yM&&e){for(let t=0;t{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=F4(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:I4(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=L4(h),x=L4(d),S=L4(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=I4(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=I4(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=I4(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(D4(p),D4(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(A4))),l=a.find((t=>t.className.includes(k4)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(A4),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(z4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${x4}-column`),e.classList.add(`${x4}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(k4),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];z4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));z4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${x4}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=E4(e.key),e.keyStyle&&L4(e.keyStyle,l)):"value"===i?(o.innerHTML=E4(e.value),e.valueStyle&&L4(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?M4(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?M4(c):m,_=p,b=t=>new Wg({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=su.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?M4(u):"currentColor",`\n \n \n \n `;const M=T?su.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),z4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(k4))),h=[...o.children].find((t=>t.className.includes(A4)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(A4)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=QE(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,z4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=fv({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function V4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:N4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const W4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class G4 extends O4{constructor(){super(G4.type),this.type=GW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new aK({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=iB(d.padding),x=V4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=V4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=V4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:W4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.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:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=uB({},S,V4(b,void 0,{})),{width:s,height:n,text:r}=U4(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=uB({},A,V4(x,void 0,{})),{width:e,height:s,text:n}=U4(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};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=uB({},x,V4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=U4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}G4.type=GW.canvas;const Y4=/\{([^}]+)\}/,X4=/\{([^}]+)\}/g,K4=/:/;class $4 extends sU{constructor(){super($4.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.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[$4.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)),vB.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=Y4.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(X4,((t,i)=>{if(!K4.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 this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}$4.pluginType="chart",$4.specKey="formatter",$4.type="formatterPlugin";RH.useRegisters([()=>{qW(),JW(),tG(),MW(),TW(),lW(),QV(),UN(),WN(),yH(),fH(),OV(),$V(),vB.registerSeries(hW.type,hW),vB.registerChart(eG.type,eG)},()=>{qW(),JW(),tG(),TW(),lW(),QV(),UN(),nG(),WN(),oG(),OV(),$V(),vB.registerSeries(cK.type,cK),MW(),vB.registerChart(uK.type,uK)},()=>{qW(),JW(),tG(),TW(),MK(),MW(),vB.registerChart(EK.type,EK)},()=>{qW(),JW(),MW(),TW(),jK(),vB.registerChart(UK.type,UK)},()=>{JW(),Nq(),vB.registerChart(X1.type,X1)},()=>{qW(),JW(),MW(),TW(),aZ(),vB.registerChart(q1.type,q1)},()=>{qW(),JW(),tG(),MW(),TW(),fZ(),vB.registerChart(J1.type,J1)},()=>{qW(),JW(),tG(),MW(),TW(),MK(),vB.registerTransform("bin",Qr),vB.registerChart(n2.type,n2)},()=>{JW(),i$(),XK(),vB.registerSeries(n$.type,n$),vB.registerImplement("registerMap",ZP),vB.registerImplement("unregisterMap",JP),mH(),vB.registerChart(N1.type,N1)},()=>{JW(),i1(),vB.registerSeries(n1.type,n1),Oq(),OZ(),iZ(),FZ(),vB.registerChart(l2.type,l2)},()=>{JW(),MQ(),vB.registerChart(d2.type,d2)},()=>{JW(),KQ(),vB.registerChart(p2.type,p2)},()=>{qW(),JW(),tG(),MW(),TW(),I$(),vB.registerChart(C2.type,C2)},()=>{qW(),JW(),MW(),TW(),nq(),vB.registerTransform("boxplot",ta),vB.registerChart(M2.type,M2)},()=>{qW(),JW(),MW(),TW(),FZ(),vB.registerChart(a2.type,a2)},()=>{qW(),JW(),MW(),TW(),YZ(),vB.registerChart(f2.type,f2)},()=>{qW(),JW(),MW(),TW(),fq(),vB.registerChart(v2.type,v2)},()=>{qW(),JW(),tG(),MW(),TW(),nG(),OV(),$V(),vB.registerSeries(bq.type,bq),vB.registerChart(P2.type,P2)},()=>{JW(),u0(),vB.registerChart(_2.type,_2)},()=>{JW(),y0(),vB.registerChart(x2.type,x2)},()=>{JW(),Y0(),vB.registerChart(A2.type,A2)},()=>{JW(),gG(),z0(),vB.registerChart(E2.type,E2)},()=>{JW(),u1(),vB.registerChart(O2.type,O2)},()=>{JW(),M1(),vB.registerChart(L2.type,L2)},()=>{qW(),JW(),tG(),MW(),vB.registerChart(t2.type,t2),TW()},$V,OV,()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(oK.type,oK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(lK.type,lK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(hK.type,hK)},nZ,iZ,()=>{vB.registerComponent(U2.type,U2)},()=>{vB.registerComponent(t5.type,t5)},()=>{vB.registerComponent(d5.type,d5)},()=>{vB.registerComponent(b5.type,b5)},()=>{vB.registerComponent(x5.type,x5)},()=>{vB.registerComponent(F5.type,F5)},()=>{vB.registerComponent(j5.type,j5)},()=>{vB.registerComponent(W5.type,W5)},i$,()=>{vB.registerComponent(j3.type,j3),iX()},()=>{vB.registerComponent(G3.type,G3),nX()},()=>{vB.registerComponent(h4.type,h4),lX()},()=>{vB.registerComponent(N3.type,N3),aX._animate=FY,iX()},()=>{vB.registerComponent(Y3.type,Y3),oX._animate=HY,nX()},()=>{vB.registerComponent(c4.type,c4),lX()},()=>{vB.registerComponent(d4.type,d4),lX()},()=>{vB.registerComponent(U3.type,U3)},()=>{vB.registerComponent(Q3.type,Q3)},()=>{vB.registerGraphicComponent(n4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(n4.type,n4,!0,1/0)},()=>{vB.registerGraphicComponent(r4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(r4.type,r4,!0)},()=>{vB.registerComponent(f4.type,f4)},()=>{vB.registerComponent(v4.type,v4)},()=>{vB.registerRuntimePluginInstaller("poptipForText",b4),b4()},()=>{vB.registerLayout(y4.type,y4)},()=>{var t;t=G4,vB.registerComponentPlugin(t.type,t)},()=>{var t;t=$4,vB.registerChartPlugin(t.type,t)},kH,MH]),RH.useRegisters([()=>{BO(iA)}]),t.DEFAULT_CHART_HEIGHT=VB,t.DEFAULT_CHART_WIDTH=UB,t.DEFAULT_CLOSE_STROKE_JOIN=LH,t.DEFAULT_DATA_INDEX=GB,t.DEFAULT_DATA_KEY=YB,t.DEFAULT_DATA_SERIES_FIELD=XB,t.DEFAULT_KEY=uP,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=IH,t.DEFAULT_MAP_LOOK_UP_KEY=pP,t.DEFAULT_MEASURE_CANVAS_ID=WB,t.DEFAULT_SERIES_STYLE_NAME=KB,t.DEFAULT_SMOOTH_INTERPOLATE=OH,t.Factory=vB,t.MOSAIC_CAT_END_PERCENT=hP,t.MOSAIC_CAT_START_PERCENT=lP,t.MOSAIC_VALUE_END_PERCENT=oP,t.MOSAIC_VALUE_START_PERCENT=aP,t.ManualTicker=class extends pb{constructor(t){super(t),this.lastFrameTime=0,this.status=wl.RUNNING}setupTickHandler(){const t=new DH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,!0}},t.PREFIX=NB,t.SEGMENT_FIELD_END=dP,t.SEGMENT_FIELD_START=cP,t.STACK_FIELD_END=ZB,t.STACK_FIELD_END_OffsetSilhouette=eP,t.STACK_FIELD_END_PERCENT=QB,t.STACK_FIELD_KEY=$B,t.STACK_FIELD_START=qB,t.STACK_FIELD_START_OffsetSilhouette=tP,t.STACK_FIELD_START_PERCENT=JB,t.STACK_FIELD_TOTAL=iP,t.STACK_FIELD_TOTAL_BOTTOM=rP,t.STACK_FIELD_TOTAL_PERCENT=sP,t.STACK_FIELD_TOTAL_TOP=nP,t.StreamLight=eF,t.ThemeManager=OB,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=RH,t.boundsInRect=eB,t.builtinThemes=SB,t.calcLayoutNumber=QE,t.calcPadding=tB,t.computeActualDataScheme=FE,t.convertPoint=sB,t.createArc=Vp,t.createArea=Yp,t.createGroup=tg,t.createLine=ag,t.createRect=mg,t.createRichText=jg,t.createSymbol=Gg,t.createText=Jg,t.darkTheme=cB,t.dataScheme=rB,t.default=RH,t.defaultThemeName=AB,t.getActualColor=HE,t.getActualNumValue=nB,t.getColorSchemeBySeries=VE,t.getDataScheme=DE,t.getFunnelTheme=bB,t.getMergedTheme=PB,t.getSpecInfo=HH,t.getTheme=wB,t.hasThemeMerged=TB,t.isColorKey=jE,t.isPercent=ZE,t.isPercentOffset=JE,t.isProgressiveDataColorScheme=NE,t.isTokenKey=oB,t.isValidOrient=qE,t.lightTheme=hB,t.lookup=jH,t.measureText=jB,t.normalizeLayoutPaddingSpec=iB,t.queryColorFromColorScheme=zE,t.queryToken=aB,t.registerDataSetInstanceParser=XP,t.registerDataSetInstanceTransform=YP,t.registerTheme=MB,t.removeTheme=EB,t.themeExist=BB,t.themes=kB,t.token=lB,t.transformColorSchemeToStandardStruct=UE,t.transformToGraphic=PP,t.version="2.1.4",t.vglobal=b_,t.warn=gM,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/openinula-vchart/package.json b/packages/openinula-vchart/package.json index 1200b6ae21..c2e2152ec8 100644 --- a/packages/openinula-vchart/package.json +++ b/packages/openinula-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/openinula-vchart", - "version": "2.1.3", + "version": "2.1.4", "sideEffects": false, "description": "The openinula version of VChart 4.x", "keywords": [ @@ -28,7 +28,7 @@ "build": "bundle --clean" }, "dependencies": { - "@visactor/vchart": "workspace:2.1.3", + "@visactor/vchart": "workspace:2.1.4", "@visactor/vutils": "~1.0.23", "@visactor/vrender-core": "~1.1.4", "@visactor/vrender-kits": "~1.1.4", diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index f1e38f617f..e3e6bcd227 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vchart", - "version": "2.1.3", + "version": "2.1.4", "sideEffects": false, "description": "The react version of VChart 4.x", "keywords": [ @@ -33,8 +33,8 @@ "build": "bundle --clean" }, "dependencies": { - "@visactor/vchart": "workspace:2.1.3", - "@visactor/vchart-extension": "workspace:2.1.3", + "@visactor/vchart": "workspace:2.1.4", + "@visactor/vchart-extension": "workspace:2.1.4", "@visactor/vutils": "~1.0.23", "@visactor/vrender-core": "~1.1.4", "@visactor/vrender-kits": "~1.1.4", diff --git a/packages/taro-vchart/package.json b/packages/taro-vchart/package.json index da81cd8488..b628d8a82e 100644 --- a/packages/taro-vchart/package.json +++ b/packages/taro-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/taro-vchart", - "version": "2.1.3", + "version": "2.1.4", "description": "Taro VChart 图表组件", "sideEffects": false, "main": "esm/index.js", @@ -43,8 +43,8 @@ }, "license": "MIT", "dependencies": { - "@visactor/vchart": "workspace:2.1.3", - "@visactor/vchart-extension": "workspace:2.1.3" + "@visactor/vchart": "workspace:2.1.4", + "@visactor/vchart-extension": "workspace:2.1.4" }, "devDependencies": { "@internal/bundler": "workspace:*", diff --git a/packages/tt-vchart/src/vchart/index.js b/packages/tt-vchart/src/vchart/index.js index 2422440f2d..be26c32aea 100644 --- a/packages/tt-vchart/src/vchart/index.js +++ b/packages/tt-vchart/src/vchart/index.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=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 M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(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(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Ot=t=>0,It=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ie(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{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}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,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 Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{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 Xe(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 Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={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 Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(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=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(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=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(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 ni(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=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{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`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(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}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(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 ni(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:Ke});function oi(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 li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(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 di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(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 Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{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 Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal: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?Ci[8+bi/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 C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=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")+_i(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 wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Fi(){return new zi}function zi(){this.reset()}zi.prototype={constructor:zi,reset:function(){this.s=this.t=0},add:function(t){ji(Hi,t,this.t),ji(this,Hi.s,this.s),this.s?this.t+=Hi.t:this.s=Hi.t},valueOf:function(){return this.s}};var Hi=new zi;function ji(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Ni=1e-6,Ui=Math.PI,Vi=Ui/2,Wi=Ui/4,Gi=2*Ui,Yi=180/Ui,Xi=Ui/180,Ki=Math.abs,$i=Math.atan,qi=Math.atan2,Zi=Math.cos,Ji=Math.exp,Qi=Math.log,ts=Math.pow,es=Math.sin,is=Math.sign||function(t){return t>0?1:t<0?-1:0},ss=Math.sqrt,ns=Math.tan;function rs(t){return t>1?0:t<-1?Ui:Math.acos(t)}function as(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function os(){}function ls(t,e){t&&cs.hasOwnProperty(t.type)&&cs[t.type](t,e)}var hs={Feature:function(t,e){ls(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sUi?t+Math.round(-t/Gi)*Gi:t,e]}function As(t,e,i){return(t%=Gi)?e||i?xs(Cs(t),Ts(e,i)):Cs(t):e||i?Ts(e,i):Ss}function ks(t){return function(e,i){return[(e+=t)>Ui?e-Gi:e<-Ui?e+Gi:e,i]}}function Cs(t){var e=ks(t);return e.invert=ks(-t),e}function Ts(t,e){var i=Zi(t),s=es(t),n=Zi(e),r=es(e);function a(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*i+o*s;return[qi(l*n-c*r,o*i-h*s),as(c*n+l*r)]}return a.invert=function(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*n-l*r;return[qi(l*n+h*r,o*i+c*s),as(c*i-o*s)]},a}function Ms(t,e){(e=fs(e))[0]-=t,bs(e);var i=rs(-e[1]);return((-e[2]<0?-i:i)+Gi-Ni)%Gi}function ws(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:os,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Es(t,e){return Ki(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 Rs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function zs(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 Hs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ws(),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=zs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=es(s),r=[es(i),-Zi(i),0],a=0,o=0;Ls.reset(),1===n?s=Vi+Ni:-1===n&&(s=-Vi-Ni);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ui,M=f*x;if(Ls.add(qi(M*k*es(C),m*S+M*Zi(C))),a+=T?A+k*Gi:A,T^p>=i^_>=i){var w=vs(fs(u),fs(y));bs(w);var E=vs(r,w);bs(E);var B=(T^A>=0?-1:1)*as(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Ni||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(js))}return u}}function js(t){return t.length>1}function Ns(t,e){return((t=t.x)[0]<0?t[1]-Vi-Ni:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-Ni:Vi-e[1])}1===(Os=Fs).length&&(Is=Os,Os=function(t,e){return Fs(Is(t),e)});var Us=Hs((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?Ui:-Ui,l=Ki(r-i);Ki(l-Ui)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ui&&(Ki(i-n)Ni?$i((es(e)*(r=Zi(s))*es(i)-es(s)*(n=Zi(e))*es(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*Vi,s.point(-Ui,n),s.point(0,n),s.point(Ui,n),s.point(Ui,0),s.point(Ui,-n),s.point(0,-n),s.point(-Ui,-n),s.point(-Ui,0),s.point(-Ui,n);else if(Ki(t[0]-e[0])>Ni){var r=t[0]0,n=Ki(e)>Ni;function r(t,i){return Zi(t)*Zi(i)>e}function a(t,i,s){var n=[1,0,0],r=vs(fs(t),fs(i)),a=ms(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=vs(n,r),u=_s(n,h);ys(u,_s(r,c));var p=d,g=ms(u,p),f=ms(p,p),m=g*g-f*(ms(u,u)-1);if(!(m<0)){var v=ss(m),y=_s(p,(-g-v)/f);if(ys(y,u),y=gs(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Ki(y[0]-b)Ui^(b<=y[0]&&y[0]<=x)){var T=_s(p,(-g+v)/f);return ys(T,u),[y,gs(T)]}}}function o(e,i){var n=s?t:Ui-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Hs(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?Ui:-Ui),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Es(e,p)||Es(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&&Es(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=Zi(e),o=es(e),l=s*i;null==n?(n=e+s*Gi,r=e-l/2):(n=Ms(a,n),r=Ms(a,r),(s>0?nr)&&(n+=s*Gi));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 Ki(s[0]-t)0?0:3:Ki(s[0]-i)0?2:1:Ki(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=ws(),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=zs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ps(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(Gs,Math.min(Ws,g)),f=Math.max(Gs,Math.min(Ws,f))],b=[r=Math.max(Gs,Math.min(Ws,r)),a=Math.max(Gs,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&&(_.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 Xs(t){return t}var Ks,$s,qs,Zs,Js=Fi(),Qs=Fi(),tn={point:os,lineStart:os,lineEnd:os,polygonStart:function(){tn.lineStart=en,tn.lineEnd=rn},polygonEnd:function(){tn.lineStart=tn.lineEnd=tn.point=os,Js.add(Ki(Qs)),Qs.reset()},result:function(){var t=Js/2;return Js.reset(),t}};function en(){tn.point=sn}function sn(t,e){tn.point=nn,Ks=qs=t,$s=Zs=e}function nn(t,e){Qs.add(Zs*t-qs*e),qs=t,Zs=e}function rn(){nn(Ks,$s)}var an=tn,on=1/0,ln=on,hn=-on,cn=hn;var dn,un,pn,gn,fn={point:function(t,e){thn&&(hn=t);ecn&&(cn=e)},lineStart:os,lineEnd:os,polygonStart:os,polygonEnd:os,result:function(){var t=[[on,ln],[hn,cn]];return hn=cn=-(ln=on=1/0),t}},mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn=0,Cn={point:Tn,lineStart:Mn,lineEnd:Bn,polygonStart:function(){Cn.lineStart=Pn,Cn.lineEnd=Rn},polygonEnd:function(){Cn.point=Tn,Cn.lineStart=Mn,Cn.lineEnd=Bn},result:function(){var t=kn?[Sn/kn,An/kn]:xn?[_n/xn,bn/xn]:yn?[mn/yn,vn/yn]:[NaN,NaN];return mn=vn=yn=_n=bn=xn=Sn=An=kn=0,t}};function Tn(t,e){mn+=t,vn+=e,++yn}function Mn(){Cn.point=wn}function wn(t,e){Cn.point=En,Tn(pn=t,gn=e)}function En(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Tn(pn=t,gn=e)}function Bn(){Cn.point=Tn}function Pn(){Cn.point=On}function Rn(){In(dn,un)}function On(t,e){Cn.point=In,Tn(dn=pn=t,un=gn=e)}function In(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Sn+=(n=gn*t-pn*e)*(pn+t),An+=n*(gn+e),kn+=3*n,Tn(pn=t,gn=e)}var Ln=Cn;function Dn(t){this._context=t}Dn.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,Gi)}},result:os};var Fn,zn,Hn,jn,Nn,Un=Fi(),Vn={point:os,lineStart:function(){Vn.point=Wn},lineEnd:function(){Fn&&Gn(zn,Hn),Vn.point=os},polygonStart:function(){Fn=!0},polygonEnd:function(){Fn=null},result:function(){var t=+Un;return Un.reset(),t}};function Wn(t,e){Vn.point=Gn,zn=jn=t,Hn=Nn=e}function Gn(t,e){jn-=t,Nn-=e,Un.add(ss(jn*jn+Nn*Nn)),jn=t,Nn=e}var Yn=Vn;function Xn(){this._string=[]}function Kn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $n(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ps(t,i(s))),s.result()}return r.area=function(t){return ps(t,i(an)),an.result()},r.measure=function(t){return ps(t,i(Yn)),Yn.result()},r.bounds=function(t){return ps(t,i(fn)),fn.result()},r.centroid=function(t){return ps(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Xs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Xn):new Dn(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 qn(t){return function(e){var i=new Zn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Zn(){}function Jn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ps(i,t.stream(fn)),e(fn.result()),null!=s&&t.clipExtent(s),t}function Qn(t,e,i){return Jn(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 tr(t,e,i){return Qn(t,[[0,0],e],i)}function er(t,e,i){return Jn(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 ir(t,e,i){return Jn(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)}Xn.prototype={_radius:4.5,_circle:Kn(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=Kn(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}},Zn.prototype={constructor:Zn,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 sr=16,nr=Zi(30*Xi);function rr(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=ss(b*b+x*x+S*S),k=as(S/=A),C=Ki(Ki(S)-1)e||Ki((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Xi:0,E()):[m*Yi,v*Yi,y*Yi]},M.angle=function(t){return arguments.length?(_=t%360*Xi,E()):_*Yi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=rr(o,T=t*t),B()):ss(T)},M.fitExtent=function(t,e){return Qn(M,t,e)},M.fitSize=function(t,e){return tr(M,t,e)},M.fitWidth=function(t,e){return er(M,t,e)},M.fitHeight=function(t,e){return ir(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function dr(t){var e=0,i=Ui/3,s=cr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Xi,i=t[1]*Xi):[e*Yi,i*Yi]},n}function ur(t,e){var i=es(t),s=(i+es(e))/2;if(Ki(s)2?t[2]*Xi:0),e.invert=function(e){return(e=t.invert(e[0]*Xi,e[1]*Xi))[0]*=Yi,e[1]*=Yi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===_r?[[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 xr(t){return ns((Vi+t)/2)}function Sr(t,e){var i=Zi(t),s=t===e?es(t):Qi(i/Zi(e))/Qi(xr(e)/xr(t)),n=i*ts(xr(t),s)/s;if(!s)return _r;function r(t,e){n>0?e<-Vi+Ni&&(e=-Vi+Ni):e>Vi-Ni&&(e=Vi-Ni);var i=n/ts(xr(e),s);return[i*es(s*t),n-i*Zi(s*t)]}return r.invert=function(t,e){var i=n-e,r=is(s)*ss(t*t+i*i),a=qi(t,Ki(i))*is(i);return i*s<0&&(a-=Ui*is(t)*is(i)),[a/s,2*$i(ts(n/r,1/s))-Vi]},r}function Ar(t,e){return[t,e]}function kr(t,e){var i=Zi(t),s=t===e?es(t):(i-Zi(e))/(e-t),n=i/s+t;if(Ki(s)Ni&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Or.invert=mr(as),Ir.invert=mr((function(t){return 2*$i(t)})),Lr.invert=function(t,e){return[-e,2*$i(Ji(t))-Vi]};var zr={exports:{}},Hr=function(t,e){this.p1=t,this.p2=e};Hr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Hr.prototype.run=function(){return this.p2[0]-this.p1[0]},Hr.prototype.slope=function(){return this.rise()/this.run()},Hr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Hr.prototype.isVertical=function(){return!isFinite(this.slope())},Hr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Hr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Hr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Hr.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)},Hr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var jr=Hr,Nr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new jr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Nr(t.slice(0,s),e),o=Nr(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},Ur=Nr;!function(t){var e=Ur;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Xr,e),{tolerance:s}=i;return Vr(t,s)};var $r;!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"}($r||($r={}));const qr=(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a},Zr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return Jr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return Jr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},ta=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",O=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var ea={},ia={};function sa(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function na(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ra(t,e){var i=t+"",s=i.length;return s9999?"+"+ra(e,6):ra(e,4))+"-"+ra(t.getUTCMonth()+1,2)+"-"+ra(t.getUTCDate(),2)+(r?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"."+ra(r,3)+"Z":n?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"Z":s||i?"T"+ra(i,2)+":"+ra(s,2)+"Z":"")}function oa(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 ia;if(h)return h=!1,ea;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=$r.DSV;const s=Wr(ca,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return oa(n).parse(t)},ua=(t,e={},i)=>(i.type=$r.DSV,la(t)),pa=(t,e={},i)=>(i.type=$r.DSV,ha(t));function ga(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return fa(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 fa(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return va(t);default:throw new Error("unknown GeoJSON type")}}function fa(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=ma(t.properties),e.geometry=va(t.geometry),e}function ma(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]=ma(s):e[i]=s})),e):e}function va(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return va(t)})),e):(e.coordinates=ya(t.coordinates),e)}function ya(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return ya(t)}))}function _a(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 ba(t){for(var e,i,s=_a(t),n=0,r=1;r0}function xa(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=ga(t));var r=[];switch(t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,s)})),t;case"FeatureCollection":return xa(t,(function(t){xa(ka(t,s),(function(t){r.push(t)}))})),di(r)}return ka(t,s)}function ka(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,e)})),t;case"LineString":return Ca(_a(t),e),t;case"Polygon":return Ta(_a(t),e),t;case"MultiLineString":return _a(t).forEach((function(t){Ca(t,e)})),t;case"MultiPolygon":return _a(t).forEach((function(t){Ta(t,e)})),t;case"Point":case"MultiPoint":return t}}function Ca(t,e){ba(t)===e&&t.reverse()}function Ta(t,e){ba(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Pa=(t,e={},i)=>{i.type=$r.GEO;const s=Wr(Ea,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Aa(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=wa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=wa.bounds(t);t.bbox=e}})),t.features=l,t},Ra={},Oa=(t,e,i)=>{i.type=$r.GEO;const s=Wr(Ea,Ra,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 Fr(a,t)}))}:Fr(a,o));var a,o;return Pa(r,s,i)},Ia=(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 La=0;function Da(t="dataset"){return La>1e8&&(La=0),t+"_"+La++}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:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class za{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof za||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Zr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}$n();const Ha={},ja={albers:gr,albersusa:function(){var t,e,i,s,n,r,a=gr(),o=pr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=pr().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)}},Na=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ua(t,e){return function i(){const s=e();return s.type=t,s.path=$n().projection(s),s.copy=s.copy||function(){const t=i();return Na.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ga 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=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Za.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Ja(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(Ja(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,Ja(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Ja(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 $a))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Za.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Qa(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ka,this.rootWheelEvent=new $a,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const so=Nt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,fo;function mo(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;tfo){let t,e=uo;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 wo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Fo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Ho(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new jo(i,n),new jo(n,s)]}class jo extends Eo{constructor(t,e){super(),this.type=xo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p1.x):t===bo.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class No{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new jo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===bo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===bo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Uo extends No{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?bo.ROW:bo.COLUMN;return"monotoneY"===t?new Uo(t,s):new No(t,s)}class Go{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,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Xo(new Go(n,s),t),n}function Xo(t,e){return Vo(t,e,1)}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 $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&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 qo(t,e){return Vo(t,e,2)}function Zo(t,e={}){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 qo(new $o(n,s),t),n}function Jo(t){return t<0?-1:1}function Qo(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(Jo(r)+Jo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function tl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function el(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 il{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:el(this,this._t0,tl(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,el(this,tl(this,e=Qo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:el(this,this._t0,e=Qo(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 sl extends il{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function nl(t,e){return Vo(t,e,2)}function rl(t,e={}){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 nl(new il(n,s),t),n}function al(t,e){return Vo(t,e,2)}function ol(t,e={}){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 al(new sl(n,s),t),n}let ll=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class hl extends ll{lineEnd(){this.context.closePath()}}function cl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new ll(r,e,n),t),r}function dl(t,e){return Vo(t,e,1)}function ul(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new hl(r,e,n),t),r}class pl extends Go{lineEnd(){this.context.closePath()}}function gl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return fl(new pl(n,s),t),n}function fl(t,e){return Vo(t,e,1)}function ml(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function vl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Yo(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const yl=vl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const _l=vl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class bl extends Eo{constructor(t,e,i){super(),this.type=xo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Lo(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p2.x):t===bo.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Lo(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new bl(i,a,r),new bl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class xl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new jo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new bl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Sl(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return Zo(t,i);case"monotoneX":return rl(t,i);case"monotoneY":return ol(t,i);case"step":return cl(t,.5,i);case"stepClosed":return ul(t,.5,i);case"stepBefore":return cl(t,0,i);case"stepAfter":return cl(t,1,i);case"catmullRom":return yl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return _l(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return gl(t,i)}}class Al extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.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([lo.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([lo.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([lo.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([lo.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([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new xl(this);wo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];To(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.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=mo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Sl(e,i);"x"===s?this.direction=bo.ROW:"y"===s?this.direction=bo.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[lo.M]=this.moveToTransform,t[lo.L]=this.lineToTransform,t[lo.Q]=this.quadraticCurveToTransform,t[lo.C]=this.bezierCurveToTransform,t[lo.AT]=this.arcToTransform,t[lo.E]=this.ellipseTransform,t[lo.R]=this.rectTransform,t[lo.A]=this.arcTransform,t[lo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),wo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===bo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===bo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),$l=Object.assign(Object.assign({},Nl),{points:[],cornerRadius:0,closePath:!0}),ql=Object.assign(Object.assign({},Nl),{width:100,height:100,spikes:5,thickness:.5}),Zl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Ql=Object.assign(Object.assign({},Nl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),th=Object.assign(Object.assign(Object.assign({},Nl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),eh=Object.assign(Object.assign(Object.assign({},Nl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ih=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Nl),{fill:!0,cornerRadius:0,cornerType:"round"}),sh=Object.assign(Object.assign({},ih),{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});class nh{}const rh=Symbol.for("@visactor/vrender-core/application-state");function ah(){const t=globalThis;return t[rh]||(t[rh]={application:new nh}),t[rh]}const oh=ah().application;class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?oh.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):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?oh.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"},lh.cache.set(t,s),s.dataPromise=oh.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oh.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oh.global.loadBlob(t):"json"===e&&(i.dataPromise=oh.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=oh.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{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 Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Ph=new class extends Th{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Ih(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{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 Ih(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ih(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{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 Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Gh=new class extends Th{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(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 Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+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(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{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 Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{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 ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{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 sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{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 rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(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 dc=new class extends Th{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 cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(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 pc=new class extends Th{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 uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(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 fc=new class extends Th{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 gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(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 vc=new class extends Th{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 mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(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 Ac=new class extends Th{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 Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{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)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),wo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(wo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}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 Ec=[wh,Eh,Ph,Oh,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{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 Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ic(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ic(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ic(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 Rc(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 Rc(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 Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;eqc.set(t,!0)));const Zc=new Map;function Jc(t){if(qc.has(t))return!0;if(Zc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Qc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Zc.set(t,!0)));const td=Xc(),ed=Xc(),id=Xc(),sd=Xc(),nd=Xc(),rd=Xc(),ad=Xc(),od=Xc(),ld=Xc(),hd=Xc(),cd=Xc(),dd=Xc(),ud=Xc(),pd=Xc(),gd=Xc(),fd=Xc(),md=Xc(),vd=Symbol.for("GraphicService"),yd=Symbol.for("GraphicCreator"),_d={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},bd=Object.keys(_d),xd={"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"},Sd=Object.keys(xd),Ad={duration:200,easing:"cubicOut"},kd=Symbol.for("CanvasFactory"),Cd=Symbol.for("Context2dFactory");function Td(t){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.canvasFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Md=1e-4,wd=Math.sqrt(3),Ed=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Rd(t){return"number"==typeof t&&Number.isFinite(t)}const Od=[0,0],Id=[0,0],Ld=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Fd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function zd(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 Hd(t){return(t%=Ut)<0&&(t+=Ut),t}function jd(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+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Vd(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(Bd(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 Yd=[-1,-1,-1],Xd=[-1,-1];function Kd(){const t=Xd[0];Xd[0]=Xd[1],Xd[1]=t}function $d(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(Bd(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,Ed):Math.pow(i,Ed),s=s<0?-Math.pow(-s,Ed):Math.pow(s,Ed);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+wd*Math.sin(e)))/(3*a),h=(-o+i*(s-wd*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,Yd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Kd(),p=zd(e,s,r,o,Xd[0]),u>1&&(g=zd(e,s,r,o,Xd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Yd);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=Fd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Yd[0]=-l,Yd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Yd[0]+t&&a<=Yd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Yd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Jd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function Qd(t,e){let i=Jd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Jd(i-n)):e&&i1&&(i||(h+=Oe(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;tu[0]=S,tu[1]=A,Qd(tu,Boolean(a[6])),S=tu[0],A=tu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case lo.M:u=m,p=v,c=u,d=p;break;case lo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case lo.C:if(i){if(Nd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(jd(c,d,m,v,y,_,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case lo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Ud(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Zd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case lo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case lo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class su{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(su.IsGradientStr(t))try{const e=iu(t)[0];if(e){if("linear"===e.type)return su.ParseLinear(e);if("radial"===e.type)return su.ParseRadial(e);if("conic"===e.type)return su.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:su.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:su.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function au(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ou(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];return 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}function lu(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];return 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}function hu(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];return 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,t}function cu(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 du(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 uu(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function pu(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 gu(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];return Math.abs(g-b)0&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Cu),function(t,e,i){return eu(t,0,!1,e,i)}(this.path.commandList,Cu.x,Cu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Cu);const i=nu(this,this.lineWidth,this.dpr);return function(t,e,i,s){return eu(t,e,!0,i,s)}(this.path.commandList,i,Cu.x,Cu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ku,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}const Mu={WIDTH:500,HEIGHT:500,DPR:1};class wu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Mu.WIDTH,height:n=Mu.HEIGHT,dpr:r=Mu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Eu;wu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Eu||(Eu={}));class Bu{static Get(t,e=Eu.Color1,i=[0,0,0,1]){if(e===Eu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Eu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Pu(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ru(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ou(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ou(t,e,i,s,n)}function Ou(t,e,i,s,n){if(!t||!e)return t&&Pu(t)||e&&Pu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Eu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Eu.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:Pu(a)})))});return o?Ru(r,l,i,s,n):Ru(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 Iu(s,n,i);if("radial"===s.gradient)return Lu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Pu(Fu(r,a,i),s)}function Iu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(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]}function zu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const Hu=[0,0,0,0],ju=[0,0,0,0];function Nu(t,e,i){return Bu.Get(t,Eu.Color255,Hu),Bu.Get(e,Eu.Color255,ju),`rgba(${Math.round(Hu[0]+(ju[0]-Hu[0])*i)},${Math.round(Hu[1]+(ju[1]-Hu[1])*i)},${Math.round(Hu[2]+(ju[2]-Hu[2])*i)},${Hu[3]+(ju[3]-Hu[3])*i})`}class Uu{static GetCanvas(){try{return Uu.canvas||(Uu.canvas=oh.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 Vu extends Ye{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Gu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;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),Ru(o.color,l.color,h,!1)}function Yu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Uu.GetCanvas(),d=Uu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Ku(t){return null==t?void 0:t}class $u{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Ku(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Xu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Ku(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function qu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Zu(t){if(!qu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Zu(t[i])})),e}function Ju(t,e){var i;const s=null!==(i=Zu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];qu(n)&&qu(i)?s[t]=Ju(n,i):s[t]=Zu(i)})),s}class Qu{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Zu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];qu(r)&&qu(n)?t[i]=Ju(r,n):!qu(r)&&qu(a)&&qu(n)?t[i]=Ju(a,n):t[i]=Zu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?tp.PAINT|tp.BOUNDS|tp.PICK:tp.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?tp.PAINT|tp.BOUNDS:tp.PAINT}};class sp{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Ad;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:_o.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:_o.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:_o.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const np=new $u;function rp(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,ap(t),!0)}function ap(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=np.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function op(t){if(t)return t.parentScope&&op(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&ap(t),t}function lp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function hp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function cp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,hp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),lp(null!=e?e:t.ownerStage))}const dp=new Ve,up=new Ge,pp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],gp=["x","y"],fp=["scaleX","scaleY"],mp=["angle"],vp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),yp=new re,_p=[],bp=tp.PAINT|tp.SHAPE|tp.BOUNDS|tp.TRANSFORM|tp.LAYOUT;function xp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Sp(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Sp(s):s})),i}function Ap(t,e){return t===e||!!(xp(t)||xp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function kp(t,e){var i;const s=null!==(i=Sp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];xp(n)&&xp(i)?s[t]=kp(n,i):s[t]=Sp(i)})),s}const Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Tp extends Ga{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,hp(this.stage,this),lp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&op(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(op(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new $u).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Sp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&xp(n)&&xp(s)?e[t]=kp(n,s):e[t]=Sp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Sp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Ap(a,o)||(s.set(n,{prev:a,next:o}),t[n]=Sp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ip[t];return n?n(e,i):null!==(s=ep[t])&&void 0!==s?s:tp.PAINT}(e,i,s):null!==(n=ep[e])&&void 0!==n?n:tp.PAINT;return r&tp.PICK&&(r|=tp.BOUNDS),r===tp.PAINT&&this.needUpdateTag(e)&&(r=tp.SHAPE|tp.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&bp)!==bp?(t&tp.SHAPE?this.addUpdateShapeAndBoundsTag():t&tp.BOUNDS&&this.addUpdateBoundTag(),t&tp.PAINT&&this.addUpdatePaintTag(),t&tp.TRANSFORM&&this.addUpdatePositionTag(),t&tp.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=tp.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&vo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Ep.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];dp.clear();const n=[];s.forEach((t=>{const e=(new Al).fromString(t.d),i={};Sd.forEach((e=>{t[e]&&(i[xd[e]]=t[e])})),n.push({path:e,attribute:i}),dp.union(e.bounds)}));const r=dp.width(),a=dp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Ep.userSymbolMap[t]=l,l}const i=(new Al).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Ep.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return wo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&vo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&vo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&vo.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&vo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=vo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===yo.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===_o.STATE||null!=i&&i>=_o.ANIMATE_BIND&&i<=_o.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===_o.STATE||null!=o&&o>=_o.ANIMATE_BIND&&o<=_o.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Ap(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:_p,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ad}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:_p,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Sp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:_o.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:_p,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:_p,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,scaleX:i=Rl.scaleX,scaleY:s=Rl.scaleY,angle:n=Rl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(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,!0),oh.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Rl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=up.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=oh.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Al).fromString(t):this.pathProxy=new Al,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:oh.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new qa(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ga.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:_o.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:_o.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||oh.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Tu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Tp.userSymbolMap={};const Mp=Symbol.for("@visactor/vrender-core/graphic-class");function wp(){var t;const e=globalThis;return null!==(t=e[Mp])&&void 0!==t||(e[Mp]={Graphic:Tp}),e[Mp]}const Ep=wp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!vp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Lp=Op();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Rp.forEach((t=>{this._defaultTheme[t]=Object.create(Lp[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Rp.forEach((s=>{const n=Object.create(Lp[s]);t&&t[s]&&Ip(n,t[s]),i[s]&&Ip(n,i[s]),e[s]&&Ip(n,e[s]),this.combinedTheme[s]=n})),e.common&&Rp.forEach((t=>{Ip(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 Fp=new Dp;function zp(t,e){return t.glyphHost?zp(t.glyphHost):e?(t.isContainer,e):Hp(t)||t.attachedThemeGraphic&&zp(t.attachedThemeGraphic)||Fp.getTheme()}function Hp(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)):Fp.getTheme()}return null}const jp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Np=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...pp];class Up extends Ep{constructor(t){super(t),this.type="arc",this.numberType=td}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return zp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Np)}needUpdateTag(t){return super.needUpdateTag(t,Np)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const Wp=["segments","points","curveType","curveTension",...pp];class Gp extends Ep{constructor(t){super(t),this.type="area",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return zp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Al;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Gp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gp.NOWORK_ANIMATE_ATTR}}function Yp(t){return new Gp(t)}Gp.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Xp=["radius","startAngle","endAngle",...pp];class Kp extends Ep{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return zp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Xp)}needUpdateTag(t){return super.needUpdateTag(t,Xp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Al,s.arc(0,0,r,a,o),s}clone(){return new Kp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kp.NOWORK_ANIMATE_ATTR}}function $p(t){return new Kp(t)}Kp.NOWORK_ANIMATE_ATTR=Cp;class qp extends Ep{constructor(t){super(t),this.type="glyph",this.numberType=nd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return zp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new qp(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return qp.NOWORK_ANIMATE_ATTR}}function Zp(t){return new qp(t)}var Jp;qp.NOWORK_ANIMATE_ATTR=Cp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Jp||(Jp={}));let Qp=class t extends Ep{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rd,this._childUpdateTag=vo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(rp(this.sharedStateScope,t),cp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===yo.GLOBAL){const i=new re(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&vo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,dx:i=Rl.dx,dy:s=Rl.dy,scaleX:n=Rl.scaleX,scaleY:r=Rl.scaleY,angle:a=Rl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return zp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=vo.CLEAR_BOUNDS,this._childUpdateTag&=vo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&vo.UPDATE_BOUNDS||(this._childUpdateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&vo.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=oh.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&rp(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return ap({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Cp;const eg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...pp];class ig extends Ep{constructor(t){super(t),this.type="image",this.numberType=ad,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return zp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ih[t]}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}clone(){return new ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ig.NOWORK_ANIMATE_ATTR}}function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Cp);const ng=["segments","points","curveType","curveTension",...pp];let rg=class t extends Ep{constructor(t={}){super(t),this.type="line",this.numberType=od}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=bh(i,s,e))}getGraphicTheme(){return zp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,ng)}needUpdateTag(t){return super.needUpdateTag(t,ng)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Al;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ag(t){return new rg(t)}rg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const og=["path","customPath",...pp];class lg extends Ep{constructor(t){super(t),this.type="path",this.numberType=ld}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Al?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Al?this.cache:t.path)}getGraphicTheme(){return zp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Al).fromString(t.path):t.customPath&&(this.cache=new Al,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,og)}needUpdateTag(t){return super.needUpdateTag(t,og)}toCustomPath(){return(new Al).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new lg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lg.NOWORK_ANIMATE_ATTR}}function hg(t){return new lg(t)}lg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const cg=["points","cornerRadius",...pp];class dg extends Ep{constructor(t){super(t),this.type="polygon",this.numberType=hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return zp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,cg)}needUpdateTag(t){return super.needUpdateTag(t,cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Al,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Cp;const pg=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}},gg=["width","x1","y1","height","cornerRadius",...pp];class fg extends Ep{constructor(t){super(t),this.type="rect",this.numberType=dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return zp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,gg)}needUpdateTag(t){return super.needUpdateTag(t,gg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=pg(e);return t=new Al,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fg.NOWORK_ANIMATE_ATTR}}function mg(t){return new fg(t)}fg.NOWORK_ANIMATE_ATTR=Cp;const vg=Symbol.for("EnvContribution"),yg=Symbol.for("VGlobal"),_g="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",bg={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"}},xg=!0,Sg=!1,Ag=/\w|\(|\)|-/,kg=/[.?!,;:/,。?!、;:]/,Cg=/\S/,Tg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=oh.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=wg(t,a)),a}function wg(t,e,i=!1){let s=e;for(;Ag.test(t[s-1])&&Ag.test(t[s])||kg.test(t[s]);)if(s--,s<=0)return i?Eg(t,e):e;return s}function Eg(t,e){let i=e;for(;Ag.test(t[i+1])&&Ag.test(t[i])||kg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=oh.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Pg{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=bg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Rg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Og{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Rg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Mg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Ig extends ig{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(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=ih.width,height:e=ih.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 Lg{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 Ig?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Cg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Ig)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sg;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,Tg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ru(t,s,{AABBBounds:i}):s,Tg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Ig)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Ig?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=bg[this.direction]}store(t){if(t instanceof Ig){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 Lg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Ig?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character,t.ascentDescentMode),new Og(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Fg=!1;try{Fg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Fg=!1}const zg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...pp];class Hg extends Ep{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=pd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return zp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1)))}static splitText(t){if(Fg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Hg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),oh.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Hg.AllSingleCharacter(y)&&(y=Hg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Pg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Hg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Hg.NOWORK_ANIMATE_ATTR}}function jg(t){return new Hg(t)}Hg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);class Ng extends Qp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ug(t){return new Ng(t)}const Vg=["symbolType","size",...pp];let Wg=class t extends Ep{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=fd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return zp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Gc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Al).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Al).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Gg(t){return new Wg(t)}function Yg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Xg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Kg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);class $g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Tl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=md}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return zp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Zg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=oh.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Gc(n,o/Math.abs(r+a),!0,l),i.union(n)}return oh.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new $g(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new $g(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Yg(y,a),e=this.cache.verticalList.length*v,i=Xg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>$c(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Kc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Yg(y,a),A=x.verticalList.length*v,k=Xg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=qg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=qg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Zg.baselineMapAlign}getAlignMapBaseline(){return Zg.alignMapBaseline}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),Zg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Zg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Qg=["heightLimit","lineClamp"];class tf extends Zg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new $g(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 uf extends df{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let pf=0;class gf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=oh.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++pf,t),this.tryRunAnimationFrameNextFrame(),pf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class ff{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var mf=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 vf extends ff{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new uf(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return mf(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class yf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Td(Object.assign({nativeCanvas:oh.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Td(Object.assign({nativeCanvas:oh.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const _f=new yf,bf=Symbol.for("VWindow"),xf=Symbol.for("WindowHandlerContribution");function Sf(t){const e=oh.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Af extends ff{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(t=oh.global,e=Sf){super(),this.handlerFactory=e,this.hooks={onChange:new uf(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class kf{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=oh.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=_f.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=oh.windowFactory)||void 0===s?void 0:s.call(oh))&&void 0!==n?n:new Af(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var Cf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Cf||(Cf={}));const Tf=new Ge;class Mf{constructor(){this.matrix=new Ge}init(t){return this.mode=Cf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Cf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}scale(t,e,i){return this.mode===Cf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Cf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Tf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}translate(t,e){return this.mode===Cf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Cf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const wf=Symbol.for("@visactor/vrender-core/factory-state");function Ef(){const t=globalThis;return t[wf]||(t[wf]={pluginClasses:{}}),t[wf]}class Bf{constructor(){this.global=oh.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Pf=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 Rf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Of(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Ff{constructor(){this.time=So.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(jf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=zp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Kf(t,e,i,s)}}const zf=new Ff,Hf=new Set(["top","center","bottom"]);function jf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Nf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Uf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Uf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Nf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Gf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Hf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Yf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Xf(t){if(!t)return null;const e=Yf(t.naturalWidth,t.videoWidth,t.width),i=Yf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Kf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Xf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Gf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=_f.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),_f.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class $f{constructor(t){this.subRenderContribitions=t,this.time=So.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)}))}}class qf{constructor(){this.time=So.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Zf=new qf;class Jf{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Qf=new Jf,tm={getContributions:()=>[]};class em{constructor(t=[],e=tm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Of(e,Nl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:oh.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:tm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Su.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lf(e,i,Nl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Su.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),Su.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||function(){const t=oh.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class sm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class nm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class am{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const om={getContributions:()=>[]};class lm{constructor(t=om,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new rm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class hm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class cm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=oh.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=oh.global.getRequestAnimationFrame();this.rafId=t((()=>{oh.global.devicePixelRatio!==this.dpr&&(this.dpr=oh.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=oh.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class dm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oh.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const um=new Ve;class pm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&vo.UPDATE_PAINT)||s._updateTag&vo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(um.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(um,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let gm;function fm(){if(null==gm)try{const t=document.createElement("canvas"),e=t.getContext("2d");gm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),gm&&(gm=!!document.createElement)}catch(t){gm=!1}}function mm(){fm();const t=oh.global&&oh.global.env;return t?"browser"===t:gm}function vm(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(au(t),cu(t,t,[n+o,r+l,a+h]),cu(t,t,[y[0],y[1],y[2]]),ou(t,t,g),lu(t,t,p),cu(t,t,[-y[0],-y[1],y[2]]),uu(t,t,[c,d,u]),f){const i=Au.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]}cu(i,i,[s[0],s[1],0]),hu(i,i,f),cu(i,i,[-s[0],-s[1],0]),pu(t,t,i)}}function ym(t){const{alpha:e,beta:i}=t.attribute;return e||i}class _m{constructor(t=lf){this.creator=t,this.hooks={onAttributeUpdate:new uf(["graphic"]),onSetStage:new uf(["graphic","stage"]),onRemove:new uf(["graphic"]),onRelease:new uf(["graphic"]),onAddIncremental:new uf(["graphic","group","stage"]),onClearIncremental:new uf(["graphic","group","stage"]),beforeUpdateAABBBounds:new uf(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uf(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uf(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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=Xg(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=Yg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Gc(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;Gc(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&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const bm="white";class xm extends Qp{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:bm}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new uf(["stage"]),afterRender:new uf(["stage"]),afterClearScreen:new uf(["stage"]),afterClearRect:new uf(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:oh.global,!this.global.env&&mm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:oh.windowFactory)&&void 0!==n?n:()=>new Af(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=oh.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=oh.renderServiceFactory)||void 0===h?void 0:h.call(oh))&&void 0!==c?c:oh.renderService)&&void 0!==d?d:new im,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=oh.pluginServiceFactory)||void 0===p?void 0:p.call(oh))&&void 0!==g?g:oh.pluginService)&&void 0!==f?f:new lm,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:oh.layerService)&&void 0!==v?v:new Mm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:oh.graphicService)&&void 0!==b?b:new _m,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:bm,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,ap(s)),cp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new io(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=Cm.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=Cm.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Cm.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new hm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new cm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new dm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new pm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Cm.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Cm.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Cm.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return ap({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class Sm{constructor(t=xm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Am extends Qp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oh.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=>{oh.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)))}}class km{constructor(t=Am){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let Cm=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Tm(t){const e=oh.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}Cm._pluginClasses=Ef().pluginClasses;class Mm{static GenerateLayerId(){return`${Mm.idprefix}_${Mm.prefix_count++}`}constructor(t=oh.global,e=new km,i=Tm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Mm.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)}}Mm.idprefix="visactor_layer",Mm.prefix_count=0;const wm=Symbol.for("TransformUtil"),Em=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Pm=Symbol.for("StaticLayerHandlerContribution"),Rm=Symbol.for("DynamicLayerHandlerContribution"),Om=Symbol.for("VirtualLayerHandlerContribution"),Im=Symbol.for("@visactor/vrender-core/contribution-store-state");function Lm(){const t=globalThis;return t[Im]||(t[Im]={store:new Map}),t[Im]}const Dm=Symbol("ContributionProvider");class Fm{constructor(t,e){this.serviceIdentifier=t,this.container=e,Nm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function zm(t,e){return new Fm(t,e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).inSingletonScope().whenTargetNamed(e)}function jm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).whenTargetNamed(e)}class Nm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}Nm.store=Lm().store;class Um{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=th.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=wg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Um{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Gm({bind:t}){t(yg).toDynamicValue((({container:t})=>new vf(zm(vg,t)))).inSingletonScope(),t(bf).to(Af),t(Em).toDynamicValue((({container:t})=>new kf(zm(Vm,t)))).inSingletonScope(),t(wm).to(Mf).inSingletonScope(),t(Bm).to(Mm).inSingletonScope()}const Ym=Symbol.for("RenderService"),Xm=Symbol.for("BeforeRenderConstribution");function Km({bind:t}){t(Ym).to(im)}const $m=Symbol.for("GraphicPicker"),qm=Symbol.for("PickerService"),Zm=Symbol.for("BoundsPicker"),Jm=Symbol.for("GlobalPickerService"),Qm=Symbol.for("PickItemInterceptor"),tv=Symbol.for("PickServiceInterceptor"),ev=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ed,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},iv=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class sv extends fg{constructor(t){super(t),this.type="rect3d",this.numberType=ud}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return zp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,rv)}needUpdateTag(t){return super.needUpdateTag(t,rv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Al,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new av(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return av.NOWORK_ANIMATE_ATTR}}function ov(t){return new av(t)}av.NOWORK_ANIMATE_ATTR=Cp;class lv extends Up{constructor(t){super(t),this.type="arc3d",this.numberType=ed}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return lv.NOWORK_ANIMATE_ATTR}}function hv(t){return new lv(t)}lv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);class cv extends dg{constructor(t){super(t),this.type="pyramid3d",this.numberType=cd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return cv.NOWORK_ANIMATE_ATTR}}function dv(t){return new cv(t)}let uv,pv;function gv(t){return uv||(uv=cf("text",{})),uv.initAttributes(t),uv.AABBBounds}function fv(t){return pv||(pv=cf("richtext",{})),pv.setAttributes(t),pv.AABBBounds}cv.NOWORK_ANIMATE_ATTR=Cp;class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class vv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=zp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Su.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class _v{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=ev(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function bv({bind:t,isBound:e}){e(qm)||(t(Jm).toSelf(),t(qm).toService(Jm)),t(_v).toSelf().inSingletonScope(),t(Qm).toService(_v),t(vv).toSelf().inSingletonScope(),t(Qm).toService(vv),t(yv).toSelf().inSingletonScope(),t(Qm).toService(yv),Hm(t,Qm),t(mv).toSelf().inSingletonScope(),t(tv).toService(mv),Hm(t,tv)}function xv({bind:t}){t(vd).to(_m),t(yd).toConstantValue(lf)}const Sv=Symbol.for("AutoEnablePlugins"),Av=Symbol.for("PluginService");class kv{constructor(){this.type="static",this.offscreen=!1,this.global=oh.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Td({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()}}function Cv(t){(function({bind:t}){Hm(t,vg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),Hm(t,Vm)}({bind:t.bind}),function({bind:t}){t(kv).toSelf(),t(Pm).toService(kv)}({bind:t.bind})}const Tv=Ht/2;function Mv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Tv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Tv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Tv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Tv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function wv(t,e){return!(!t&&!e)}function Ev(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Pv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Rv(t,e){return t*e>0}function Ov(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Iv(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*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Fv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=Lv(g,f,u,p,n,t,Number(c)),l=Lv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=Lv(S,A,b,x,r,-n,Number(c)),l=Lv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const zv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Hv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=_f.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])),_f.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,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=_f.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Gg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:zv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=_f.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),_f.free(l),c}_f.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const jv=new Hv;class Nv{constructor(){this.time=So.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:nu(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Fv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Uv=new Nv,Vv=jv,Wv=zf;class Gv{constructor(){this.time=So.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Yv=new Gv,Xv=jv,Kv=zf;class $v extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(jf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const qv=new $v;function Zv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Jv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:nu(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Mv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class Qv{constructor(){this.time=So.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;Zv(p)&&(u.doStroke=!1)}}class ty{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Zv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Mv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ey=new Jv,iy=jv,sy=zf;class ny extends Jv{constructor(){super(...arguments),this.time=So.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)}}const ry=new ny,ay=zf;class oy{constructor(){this.time=So.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class ly{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const hy=new oy,cy=new ly,dy=jv,uy=zf,py=jv,gy=zf;class fy extends Hv{constructor(){super(...arguments),this.time=So.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:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class my{constructor(t){this.groupRenderContribitions=t,this.numberType=rd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:zp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Pv(p,m,g,f,c),w=Ov(p,v,g,f),E=wv(c,u),B=Ev(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Mv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===So.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===So.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=oh.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=zp(t,null==s?void 0:s.theme).group,i=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(i,p||i,n),a.modelMatrix=i,Au.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Au.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var vy,yy=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"}(vy||(vy={}));class _y extends em{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=vy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uf([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return yy(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:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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 yy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return yy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>yy(this,void 0,void 0,(function*(){if(2!==t.count)yield If(t,Nl.zIndex,((i,s)=>{if(this.status===vy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return yy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return yy(this,void 0,void 0,(function*(){this.rendering&&(this.status=vy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=vy.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 yy(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:()=>yy(this,void 0,void 0,(function*(){yield If(t,Nl.zIndex,(t=>yy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const by=Symbol.for("IncrementalDrawContribution"),xy=Symbol.for("ArcRender"),Sy=Symbol.for("Arc3dRender"),Ay=Symbol.for("AreaRender"),ky=Symbol.for("CircleRender"),Cy=Symbol.for("GraphicRender"),Ty=Symbol.for("GroupRender"),My=Symbol.for("LineRender"),wy=Symbol.for("PathRender"),Ey=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Py=Symbol.for("Rect3DRender"),Ry=Symbol.for("SymbolRender"),Oy=Symbol.for("TextRender"),Iy=Symbol.for("RichTextRender"),Ly=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Fy=Symbol.for("ImageRender"),zy=Symbol.for("RenderSelector"),Hy=Symbol.for("DrawContribution"),jy=Symbol.for("StarRender"),Ny=Symbol.for("DrawItemInterceptor"),Uy=new Ve,Vy=new Ve;class Wy{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){Uy.copy(s.dirtyBounds),Vy.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,Su.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Uy),s.backupDirtyBounds.copy(Vy)),!0}}class Gy{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}}class Yy{constructor(){this.order=1,this.interceptors=[new Wy,new Ky,new Xy,new Gy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Au.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const $y=Symbol.for("ArcRenderContribution"),qy=Symbol.for("AreaRenderContribution"),Zy=Symbol.for("CircleRenderContribution"),Jy=Symbol.for("GroupRenderContribution"),Qy=Symbol.for("ImageRenderContribution"),t_=Symbol.for("PathRenderContribution"),e_=Symbol.for("PolygonRenderContribution"),i_=Symbol.for("RectRenderContribution"),s_=Symbol.for("SymbolRenderContribution"),n_=Symbol.for("TextRenderContribution"),r_=Symbol.for("StarRenderContribution"),a_=Symbol.for("CommonRenderContribution"),o_=Symbol.for("InteractiveSubRenderContribution");function l_(t){!function({bind:t}){t(Ff).toSelf().inSingletonScope(),t(Hv).toSelf().inSingletonScope(),t(Hy).to(em),t(by).to(_y),t(Ty).toDynamicValue((({container:t})=>new my(zm(Jy,t)))).inSingletonScope(),t(Cy).toService(Ty),Hm(t,Jy),Hm(t,o_),t($f).toDynamicValue((({container:t})=>new $f(zm(o_,t)))).inSingletonScope(),Hm(t,Cy),t(Yy).toSelf().inSingletonScope(),t(Ny).toService(Yy),Hm(t,Ny)}({bind:t.bind})}class h_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class c_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new h_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function d_(){return new c_}const u_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const p_=function(){const t=globalThis;return t[u_]||(t[u_]={legacyBindingContext:d_(),preloaded:!1}),t[u_]}(),g_=p_.legacyBindingContext;function f_(){p_.preloaded||(p_.preloaded=!0,Gm({bind:g_.bind}),xv({bind:g_.bind}),Km({bind:g_.bind}),bv({bind:g_.bind,isBound:g_.isBound}),function({bind:t}){t(Av).to(lm),jm(t,Sv)}({bind:g_.bind}),Cv(g_),l_(g_))}function m_(){return g_}function v_(t){f_();const[e]=g_.getAll(t);return e}function y_(t,e){return f_(),g_.getNamed(t,e)}function __(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const b_=__((()=>v_(yg)));oh.global=b_;class x_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?oh.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:oh.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Kg("text"===t.type&&t.attribute?t.attribute:zp(t).text)}getTransformOfText(t){const e=zp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=oh.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));oh.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===oh.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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&&oh.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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"===oh.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 S_=()=>{Cm.registerPlugin("HtmlAttributePlugin",x_)};class A_ extends x_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?oh.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&oh.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const k_=()=>{Cm.registerPlugin("ReactAttributePlugin",A_)};class C_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return C_.instance||(C_.instance=new C_),C_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function T_(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function M_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:w_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=T_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:w_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=T_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const O=i*x+B;O>0&&E.wait(O);let I=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(E,e,p,L);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=T_(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:w_.builtInAnimateMap[r],m=t.custom?t.customType:T_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{M_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}w_.builtInAnimateMap={};const E_="appear",B_="disappear",P_="update",R_="highlight",O_="unhighlight";class I_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class L_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyHighlightState(t,e){this.applyState([R_],[{name:R_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([O_],[{name:O_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new L_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new I_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class F_{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-F_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*F_.bounceIn(2*t):.5*F_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){F_[t]=e}}function z_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}F_.quadIn=F_.getPowIn(2),F_.quadOut=F_.getPowOut(2),F_.quadInOut=F_.getPowInOut(2),F_.cubicIn=F_.getPowIn(3),F_.cubicOut=F_.getPowOut(3),F_.cubicInOut=F_.getPowInOut(3),F_.quartIn=F_.getPowIn(4),F_.quartOut=F_.getPowOut(4),F_.quartInOut=F_.getPowInOut(4),F_.quintIn=F_.getPowIn(5),F_.quintOut=F_.getPowOut(5),F_.quintInOut=F_.getPowInOut(5),F_.backIn=F_.getBackIn(1.7),F_.backOut=F_.getBackOut(1.7),F_.backInOut=F_.getBackInOut(1.7),F_.elasticIn=F_.getElasticIn(1,.3),F_.elasticOut=F_.getElasticOut(1,.3),F_.elasticInOut=F_.getElasticInOut(1,.3*1.5),F_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),F_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},F_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)F_[`flicker${t}`]=e=>z_(e,t);for(let t=2;t<10;t++)F_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function H_(t,e,i){return t+(e-t)*i}const j_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=H_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=H_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=H_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=H_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=H_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=H_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=H_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=H_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=H_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ru(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?zu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ru(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?zu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=H_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=H_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=H_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=H_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=H_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=H_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=H_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function N_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:_o.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=F_[s])&&void 0!==n?n:F_.linear:F_.linear,"wait"===t&&(this.onUpdate=Z_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=Z_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Bu.Get(i,Eu.Color255),r=Bu.Get(s,Eu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(j_["fill"===e?"fillPure":"strokePure"])}else j_[e]?t.push(j_[e]):t.push(N_)}else j_[e]?t.push(j_[e]):t.push(N_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tb extends Q_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();$_(this.target,t,_o.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class eb extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ib=new eb;ib.isGlobal=!0;class sb extends Q_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class nb extends sb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class rb extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class ab extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){$_(this.target,this.from,_o.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ob(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class cb{constructor(t=Va.GenAutoIncrementId(),e=ib,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(hb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new Q_(El.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tb(El.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new ab(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(hb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&$_(this.target,this._startProps,_o.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const db=new gf;class ub{constructor(){this.released=!1}tick(t,e){db.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class pb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===wl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=wl.INITIAL,oh.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),oh.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new ub;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==wl.INITIAL&&(this.status=wl.PAUSE,!0)}resume(){return this.status!==wl.INITIAL&&(this.status=wl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=wl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===wl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===wl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,oh.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function fb(){G(Ep,D_),G(Ep,gb)}function mb(){hf("arc",Vp)}function vb(){hf("arc3d",hv)}function yb(){hf("area",Yp)}function _b(){hf("circle",$p)}function bb(){hf("glyph",Zp)}function xb(){hf("group",tg)}function Sb(){hf("image",sg)}function Ab(){hf("line",ag)}function kb(){hf("path",hg)}function Cb(){hf("polygon",ug)}function Tb(){hf("pyramid3d",dv)}function Mb(){hf("rect",mg)}function wb(){hf("rect3d",nv)}function Eb(){hf("richtext",jg)}function Bb(){hf("shadowRoot",Ug)}function Pb(){hf("star",ov)}function Rb(){hf("symbol",Gg)}function Ob(){hf("text",Jg)}function Ib(){hf("wrapText",ef)}function Lb(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Fb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Zf),e(Qf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===So.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===So.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=zp(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=Bv(d,u,h),_=Rv(d,g),b=wv(h),x=Ev(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return wo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Rv(o,c),g=wv(n,r),f=Ev(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||ym(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Au.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Au.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class zb extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=td,this.builtinContributions=[Uv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=Lv(v,y,f,m,n,t,Number(u)),o=Lv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=Lv(C,T,A,k,r,-n,Number(u)),o=Lv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Gu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const Hb=new WeakSet;function jb({bind:t}){Lb(Hb,t)||(t(zb).toDynamicValue((({container:t})=>new zb(zm($y,t)))).inSingletonScope(),t(xy).toService(zb),t(Cy).toService(xy),t($y).toService($f),Hm(t,$y))}const Nb=jb;class Ub extends Fb{constructor(){super(...arguments),this.numberType=ed}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Eu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Lb(Vb,t)||(t(Ub).toDynamicValue((()=>new Ub)).inSingletonScope(),t(Sy).toService(Ub),t(Cy).toService(Sy))}const Gb=Wb;function Yb(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 Xb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?bo.ROW:bo.COLUMN,Number.isFinite(c)||(o=bo.COLUMN),Number.isFinite(d)||(o=bo.ROW);const u=i*(o===bo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Yb(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),Yb(t,l,1,s),o=!1):o=!0}t.closePath()}function $b(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function qb(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=$b(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Yb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=bo.ROW:"y"===s?u=bo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Jb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Qb=new fy,tx=zf;class ex extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Qb,tx],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=zp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,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=Sl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Sl(e,E,{curveTension:b}),n=Sl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=bo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?bo.ROW:null==y.y1?bo.COLUMN:Number.isFinite(S+A)?S>A?bo.ROW:bo.COLUMN:bo.ROW,Xb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),qb(t,i[0]?e.top:e.bottom,l,x===bo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ix=new WeakSet;function sx({bind:t}){Lb(ix,t)||(t(ex).toDynamicValue((({container:t})=>new ex(zm(qy,t)))).inSingletonScope(),t(Ay).toService(ex),t(Cy).toService(Ay),t(qy).toService($f),Hm(t,qy))}const nx=sx;class rx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[Yv,Kv,Xv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const ax=new WeakSet;function ox({bind:t}){Lb(ax,t)||(t(rx).toDynamicValue((({container:t})=>new rx(zm(Zy,t)))).inSingletonScope(),t(ky).toService(rx),t(Cy).toService(ky),t(Zy).toService($f),Hm(t,Zy))}const lx=ox;class hx{constructor(){this.numberType=nd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=zp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const cx=new WeakSet;function dx({bind:t}){Lb(cx,t)||(t(hx).toDynamicValue((()=>new hx)).inSingletonScope(),t(Dy).toService(hx),t(Cy).toService(Dy))}const ux=dx,px=["","repeat-x","repeat-y","repeat"];function gx(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?px[i]:"no-repeat"}function fx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=gx(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const mx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function vx(t){return{backgroundMode:mx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function yx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=fx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function _x(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=fx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?vx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Kf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class bx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ad,this.builtinContributions=[ry,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Mv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),_x(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=yx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,T,!1,k,!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&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=zp(t).image;this._draw(t,a,!1,i)}}const xx=new WeakSet;function Sx({bind:t}){Lb(xx,t)||(t(Fy).toDynamicValue((({container:t})=>new bx(zm(Qy,t)))).inSingletonScope(),t(Cy).toService(Fy),t(Qy).toService($f),Hm(t,Qy))}const Ax=Sx;class kx extends Fb{constructor(){super(...arguments),this.numberType=od}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();qb(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Sl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const Cx=new WeakSet;function Tx({bind:t}){Lb(Cx,t)||(t(kx).toDynamicValue((()=>new kx)).inSingletonScope(),t(My).toService(kx),t(Cy).toService(My))}const Mx=Tx,Ex=jv,Bx=zf;class Px extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ld,this.builtinContributions=[Bx,Ex],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:zp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)wo(t.pathShape.commandList,e,i,s,1,1,f);else{wo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Rx=new WeakSet;function Ox({bind:t}){Lb(Rx,t)||(t(Px).toDynamicValue((({container:t})=>new Px(zm(t_,t)))).inSingletonScope(),t(wy).toService(Px),t(Cy).toService(wy),t(t_).toService($f),Hm(t,t_))}const Ix=Ox;function Lx(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Lx(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lx(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Fx(h,y,_,d,u),A=Fx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=Dx(k,C),M=Fx(h,Dx(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const Nx=new WeakSet;function Ux({bind:t}){Lb(Nx,t)||(t(Ey).toDynamicValue((({container:t})=>new jx(zm(e_,t)))).inSingletonScope(),t(Cy).toService(Ey),t(e_).toService($f),Hm(t,e_))}const Vx=Ux;class Wx extends Fb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Eu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Gx extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=cd}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=zp(t).polygon;this._draw(t,s,!1,i)}}const Yx=new WeakSet;function Xx({bind:t}){Lb(Yx,t)||(t(Gx).toDynamicValue((()=>new Gx)).inSingletonScope(),t(Ly).toService(Gx),t(Cy).toService(Ly))}const Kx=Xx;class $x extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=dd,this.builtinContributions=[ey,sy,iy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Pv(g,f,T,M,h),E=Ov(g,v,T,M,C),B=wv(h,c),P=Ev(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Mv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const qx=new WeakSet;function Zx({bind:t}){Lb(qx,t)||(t($x).toDynamicValue((({container:t})=>new $x(zm(i_,t)))).inSingletonScope(),t(By).toService($x),t(Cy).toService(By),t(ty).toSelf(),t(Qv).toSelf(),t(i_).toService(ty),t(i_).toService(Qv),t(i_).toService($f),Hm(t,i_))}const Jx=Zx;class Qx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=ud}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=zp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Pv(v,y,A,k,d),M=Ov(v,b,A,k,S),w=wv(d),E=Ev(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=zp(t).rect;this._draw(t,s,!1,i)}}const tS=new WeakSet;function eS({bind:t}){Lb(tS,t)||(t(Qx).toDynamicValue((()=>new Qx)).inSingletonScope(),t(Py).toService(Qx),t(Cy).toService(Py))}const iS=eS;const sS=new class extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=gv(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 i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),O?Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,O?(Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),D()}};class nS extends Fb{constructor(){super(),this.numberType=pd,this.builtinContributions=[sS],this.init()}drawShape(t,e,i,s,n){const r=zp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=zp(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(),Mv(e,i-t,s-n,v,y,f,!0)),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=zp(t).richtext;this._draw(t,s,!1,i)}}const rS=new WeakSet;function aS({bind:t}){Lb(rS,t)||(t(nS).toDynamicValue((()=>new nS)).inSingletonScope(),t(Iy).toService(nS),t(Cy).toService(Iy))}const oS=aS;class lS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[gy,py],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const hS=new WeakSet;function cS({bind:t}){Lb(hS,t)||(t(lS).toDynamicValue((({container:t})=>new lS(zm(r_,t)))).inSingletonScope(),t(jy).toService(lS),t(Cy).toService(jy),Hm(t,r_))}const dS=cS;class uS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[hy,uy,dy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:zp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const pS=new WeakSet;function gS({bind:t}){Lb(pS,t)||(t(uS).toDynamicValue((({container:t})=>new uS(zm(s_,t)))).inSingletonScope(),t(Ry).toService(uS),t(Cy).toService(Ry),t(s_).toService($f),Hm(t,s_))}const fS=gS;class mS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[sS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=zp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Su.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Su.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Yg(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const vS=new WeakSet;function yS({bind:t}){Lb(vS,t)||(t(Oy).toDynamicValue((({container:t})=>new mS(zm(n_,t)))).inSingletonScope(),t(Cy).toService(Oy),t(n_).toService($f),Hm(t,n_))}const _S=yS,bS=mm();function xS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function SS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const AS=Symbol.for("MathPickerContribution"),kS=Symbol.for("MathArcPicker"),CS=Symbol.for("MathAreaPicker"),TS=Symbol.for("MathCirclePicker"),MS=Symbol.for("MathImagePicker"),wS=Symbol.for("MathLinePicker"),ES=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),PS=Symbol.for("MathSymbolPicker"),RS=Symbol.for("MathTextPicker"),OS=Symbol.for("MathPolygonPicker"),IS=Symbol.for("MathGlyphPicker"),LS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),FS=Symbol.for("CanvasArc3dPicker"),zS=Symbol.for("CanvasAreaPicker"),HS=Symbol.for("CanvasCirclePicker"),jS=Symbol.for("CanvasImagePicker"),NS=Symbol.for("CanvasGifImagePicker"),US=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),GS=Symbol.for("CanvasRectPicker"),YS=Symbol.for("CanvasRect3dPicker"),XS=Symbol.for("CanvasSymbolPicker"),KS=Symbol.for("CanvasTextPicker"),$S=Symbol.for("CanvasPolygonPicker"),qS=Symbol.for("CanvasPyramid3dPicker"),ZS=Symbol.for("CanvasRichTextPicker"),JS=Symbol.for("CanvasGlyphPicker"),QS=Symbol.for("CanvasGroupPicker"),tA=Symbol.for("CanvasStarPicker"),eA=Symbol.for("CanvasPickerContribution"),iA=m_(),sA=__((()=>v_(Em))),nA=__((()=>v_(wm))),rA=__((()=>v_(vd))),aA=__((()=>v_(Bm)));function oA(){oh.global=b_,oh.graphicUtil=sA,oh.transformUtil=nA,oh.graphicService=rA,oh.layerService=aA,oh.canvasFactory=t=>y_(kd,t),oh.context2dFactory=t=>y_(Cd,t),oh.windowFactory=()=>new Af(oh.global),oh.windowHandlerFactory=t=>function(t){const e=y_(xf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),oh.renderServiceFactory=()=>v_(Ym),oh.renderService=__((()=>v_(Ym))),oh.pluginServiceFactory=()=>v_(Av),oh.pluginService=__((()=>v_(Av))),oh.pickerServiceFactory=()=>v_(qm),oh.layerHandlerFactory=t=>v_("static"===t?Pm:"dynamic"===t?Rm:Om),oh.incrementalDrawContributionFactory=()=>v_(by)}oA();var lA=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 hA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return lA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class cA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class dA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Eu.Color1),this.ambient=i;const s=$t(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=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Bu.Get(e,Eu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const uA=()=>{Cm.registerPlugin("DirectionalLight",dA)};class pA{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=Au.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Au.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return gu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return fu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return mu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;mu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const gA=()=>{Cm.registerPlugin("OrthoCamera",pA)},fA={getContributions:()=>[]},mA={getContributions:()=>[]};class vA{constructor(t=fA,e=mA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:fA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:mA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=zp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=zp(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&&Au.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Su.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class yA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new sm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new nm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new am,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new rm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new Sm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new km,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new sf}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new im(new em([],(t=this.registry.contribution,e=Ny,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class _A{constructor(t={}){this.context=new yA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function bA(t={}){return new _A(t)}class xA extends _A{}class SA extends _A{}class AA extends ex{constructor(){super(...arguments),this.numberType=id}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=zp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=wv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=zp(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=Bv(u,p,c),y=Rv(u,g),_=wv(c),b=Ev(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{};function DA(){MA.preloaded||(MA.preloaded=!0,Gm({bind:wA.bind}),xv({bind:wA.bind}),Km({bind:wA.bind}),bv({bind:wA.bind,isBound:wA.isBound}),Cv(wA),l_(wA))}function FA(t,e){const i=NA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function zA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function HA(t,e){let i=PA.get(t);i||(i=new Map,PA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function jA(t,e,i){const s=HA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function NA(){return DA(),wA}function UA(){Nm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=MA.runtimeGlobal)&&void 0!==t||(MA.runtimeGlobal=new vf(zm(vg,wA))),MA.runtimeGlobal}function WA(t){const e=NA(),i=VA();oh.global=i,oh.canvasFactory=t=>e.getNamed(kd,t),oh.context2dFactory=t=>e.getNamed(Cd,t),oh.windowHandlerFactory=t=>FA(xf,t),oh.windowFactory=()=>new Af(i,(t=>FA(xf,t))),oh.pluginServiceFactory=()=>new lm(zm(Sv,e),{pluginRegistry:t.context.registry.plugin}),oh.incrementalDrawContributionFactory=()=>new _y([],new kA,new AA(zm(qy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,Ny))}function GA(t){var e;const i=NA();UA();const s=i.getAll(Cy),n=HA(t.registry.renderer,EA);jA(t.registry.renderer,EA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),zA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,EA)}function YA(t){var e;const i=NA();UA();const s=i.getAll(Ny),n=null!==(e=RA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,Ny,e)})),n.clear(),RA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(Ny));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(Ny,e),r.add(e)),n.add(e)}))}function XA(t,e){var i;const s=NA();UA();const n=s.getAll(e),r=HA(t.registry.picker,BA);jA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),zA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function KA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=OA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,LA,t.isBound,t.rebind),function(t,e){let i=OA.get(t);i||(i=new WeakSet,OA.set(t,i)),i.add(e)}(t,e))}function $A(t,{app:e,legacy:i=!0,targets:s}={}){KA(NA(),t),i&&(f_(),KA(m_(),t)),UA(),e&&function(t,e){const i=null!=e?e:IA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&YA(t),s&&GA(t),r.forEach((e=>{XA(t,e)}))}(e,s)}function qA(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function ZA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function JA(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 QA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ok(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=pg(t.attribute),n=hk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=hk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=hk(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{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(;n{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 _k(l,e,h),h},fk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return pk(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 pk(t,e)}return[]};const mk=t=>t.map((t=>({x:t.x,y:t.y}))),vk=(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]},yk=t=>{const e=new Ue;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 vk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return vk(t,{x:e.x1,y:n},{x:e.x2,y:n})},_k=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=yk(t);_k(n[0],s,i),_k(n[1],e-s,i)}},bk=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:mk(i)}];const s=[];return _k(i,e,s),s},xk=(t,e)=>{const i=ak(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;rObject.assign({},t))):[]}function Ak(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:Sk(t.touches),configurable:!0},changedTouches:{value:Sk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function kk(t,e){try{return t[e]}catch(t){return}}function Ck(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Ak(t),l=kk(t,"target"),h=kk(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Tk=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Ek(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:wk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Tk(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=wk(i,this.selectionStartCursorIdx),a=wk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=Mk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Ek(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),oh.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),oh.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Pk{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=wk(i,Math.ceil(t)),n=wk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=wk(i.attribute.textConfig,a),h=wk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Rk,[this.formatTextCommandCb]),this.commandCbs.set(Ok,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(oh.global.isMacOS()&&t.metaKey&&"c"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return oh.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(oh.global.isMacOS()&&t.metaKey&&"a"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},Mk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=jg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:fv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||mg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},Mk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=tg({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Ik.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=ag({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=tg({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=fv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=fv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(mg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:fv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Qk=new Jk;class tC{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const eC=()=>{Cm.registerPlugin("ViewTransform3dPlugin",tC)},iC=new Ve;class sC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=zp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nC=()=>{Cm.registerPlugin("FlexLayoutPlugin",sC)};var rC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:rh,ARC3D_NUMBER_TYPE:ed,ARC_NUMBER_TYPE:td,AREA_NUMBER_TYPE:id,AbstractGraphicRender:class{},get AnimateMode(){return Ml},get AnimateStatus(){return Bl},get AnimateStepType(){return El},AppContext:yA,Application:nh,Arc:Up,Arc3d:lv,Arc3dRender:Sy,ArcRender:xy,ArcRenderContribution:$y,Area:Gp,AreaRender:Ay,AreaRenderContribution:qy,get AttributeUpdateType(){return _o},AutoEnablePlugins:Sv,Base3dRender:Wx,BaseCanvas:wu,BaseEnvContribution:hA,BaseRender:Fb,get BaseRenderContributionTime(){return So},BaseWindowHandlerContribution:cA,Basis:$o,BeforeRenderConstribution:Xm,BoundsContext:no,BoundsPicker:Zm,BrowserEntry:_A,CIRCLE_NUMBER_TYPE:sd,CONTRIBUTION_STORE_STATE_SYMBOL:Im,Canvas3DDrawItemInterceptor:Ky,Canvas3DPickItemInterceptor:_v,CanvasFactory:kd,CanvasTextLayout:$g,Circle:Kp,CircleRender:ky,CircleRenderContribution:Zy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Eu},CommonDrawItemInterceptorContribution:Yy,CommonRenderContribution:a_,Context2dFactory:Cd,ContributionProvider:Dm,ContributionRegistry:am,ContributionStore:Nm,CubicBezierCurve:zo,CurveContext:xl,get CurveTypeEnum(){return xo},CustomEvent:qa,CustomPath2D:Al,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:_g,DebugDrawItemInterceptorContribution:Gy,DefaultArcAllocate:zk,DefaultArcAttribute:Ul,DefaultArcRenderContribution:Nv,DefaultAreaAllocate:jk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:fy,DefaultAttribute:Nl,DefaultBaseBackgroundRenderContribution:Ff,DefaultBaseClipRenderAfterContribution:Jf,DefaultBaseClipRenderBeforeContribution:qf,DefaultBaseInteractiveRenderContribution:$f,DefaultBaseTextureRenderContribution:Hv,DefaultCanvasAllocate:yf,DefaultCanvasArc3DRender:Ub,DefaultCanvasArcRender:zb,DefaultCanvasAreaRender:ex,DefaultCanvasCircleRender:rx,DefaultCanvasGroupRender:my,DefaultCanvasImageRender:bx,DefaultCanvasLineRender:kx,DefaultCanvasPathRender:Px,DefaultCanvasPolygonRender:jx,DefaultCanvasPyramid3dRender:Gx,DefaultCanvasRect3dRender:Qx,DefaultCanvasRectRender:$x,DefaultCanvasSymbolRender:uS,DefaultCanvasTextRender:mS,DefaultCircleAllocate:Uk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Gv,DefaultConnectAttribute:Hl,DefaultDebugAttribute:jl,DefaultFillStyle:Ol,DefaultGlobal:vf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Yl,DefaultGraphicAllocate:Lk,DefaultGraphicMemoryManager:Jk,DefaultGraphicService:_m,DefaultGraphicUtil:kf,DefaultGroupAttribute:Gl,DefaultGroupBackgroundRenderContribution:$v,DefaultImageAttribute:ih,DefaultImageRenderContribution:ny,DefaultLayerService:Mm,DefaultLayout:Pl,DefaultLineAllocate:Wk,DefaultLineAttribute:Xl,DefaultMat4Allocate:xu,DefaultMatrixAllocate:bu,DefaultPathAllocate:Yk,DefaultPathAttribute:Kl,DefaultPickService:vA,DefaultPickStyle:Fl,DefaultPolygonAttribute:$l,DefaultRect3dAttribute:Jl,DefaultRectAllocate:Dk,DefaultRectAttribute:Zl,DefaultRectRenderContribution:Jv,DefaultRenderService:im,DefaultRichTextAttribute:eh,DefaultRichTextIconAttribute:sh,DefaultStarAttribute:ql,DefaultStrokeStyle:Ll,DefaultStyle:zl,DefaultSymbolAllocate:Kk,DefaultSymbolAttribute:Ql,DefaultSymbolClipRangeStrokeRenderContribution:ly,DefaultSymbolRenderContribution:oy,DefaultTextAllocate:qk,DefaultTextAttribute:th,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Rl,DefaultTransformUtil:Mf,DefaultWindow:Af,get Direction(){return bo},DirectionalLight:dA,DrawContribution:Hy,DrawItemInterceptor:Ny,DynamicLayerHandlerContribution:Rm,get Edge(){return ch},EditModule:Bk,EmptyContext2d:Tu,EnvContribution:vg,EventManager:Qa,EventSystem:io,EventTarget:to,FACTORY_STATE_SYMBOL:wf,FORMAT_ALL_TEXT_COMMAND:Ok,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Rk,Factory:Cm,FederatedEvent:Ya,FederatedMouseEvent:Xa,FederatedPointerEvent:Ka,FederatedWheelEvent:$a,FlexLayoutPlugin:sC,GLYPH_NUMBER_TYPE:nd,GRAPHIC_CLASS_SYMBOL:Mp,GRAPHIC_REGISTRY_SYMBOL:rf,GRAPHIC_UPDATE_TAG_KEY:pp,GROUP_NUMBER_TYPE:rd,Generator:Va,GlobalPickerService:Jm,Glyph:qp,GlyphRender:Dy,GradientParser:su,Graphic:Ep,GraphicCreator:yd,GraphicFactory:sf,GraphicPicker:$m,GraphicRender:Cy,GraphicService:vd,GraphicUtil:Em,Group:Qp,GroupRender:Ty,GroupRenderContribution:Jy,get GroupUpdateAABBBoundsMode(){return Jp},HtmlAttributePlugin:x_,get IContainPointMode(){return yo},IMAGE_NUMBER_TYPE:ad,Image:ig,ImageRender:Fy,ImageRenderContribution:Qy,IncrementalDrawContribution:by,InteractiveDrawItemInterceptorContribution:Xy,InteractivePickItemInterceptorContribution:yv,InteractiveSubRenderContribution:o_,LINE_NUMBER_TYPE:od,Layer:Am,LayerFactory:km,LayerService:Bm,Line:rg,LineRender:My,Linear:Go,LinearClosed:pl,Mat4Allocate:yu,MatrixAllocate:vu,get MeasureModeEnum(){return Tl},MiniappEntry:SA,MonotoneX:il,MonotoneY:sl,NOWORK_ANIMATE_ATTR:Cp,Node:Ga,NodeEntry:xA,OrthoCamera:pA,PATH_NUMBER_TYPE:ld,POLYGON_NUMBER_TYPE:hd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:cd,Path:lg,PathRender:wy,PathRenderContribution:t_,PerformanceRAF:gf,PickItemInterceptor:Qm,PickServiceInterceptor:tv,PickerRegistry:nm,PickerService:qm,PluginRegistry:rm,PluginService:Av,Polygon:dg,PolygonRender:Ey,PolygonRenderContribution:e_,Pyramid3d:cv,Pyramid3dRender:Ly,RECT3D_NUMBER_TYPE:ud,RECT_NUMBER_TYPE:dd,RICHTEXT_NUMBER_TYPE:pd,RUNTIME_INSTALLER_STATE_SYMBOL:CA,RafBasedSTO:Sh,ReactAttributePlugin:A_,Rect:fg,Rect3DRender:Py,Rect3d:sv,RectRender:By,RectRenderContribution:i_,ReflectSegContext:Uo,RenderSelector:zy,RenderService:Ym,RendererRegistry:sm,ResourceLoader:lh,RichText:Hg,RichTextEditPlugin:Ik,RichTextRender:Iy,STAR_NUMBER_TYPE:gd,get STATUS(){return wl},SVG_ATTRIBUTE_MAP:_d,SVG_ATTRIBUTE_MAP_KEYS:bd,SVG_PARSE_ATTRIBUTE_MAP:xd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Sd,SYMBOL_NUMBER_TYPE:fd,SegContext:No,ShadowPickServiceInterceptorContribution:mv,ShadowRoot:Ng,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:vv,SplitRectAfterRenderContribution:ty,SplitRectBeforeRenderContribution:Qv,Stage:xm,StageFactory:Sm,Star:av,StarRender:jy,StarRenderContribution:r_,StateDefinitionCompiler:$u,StateEngine:Qu,StaticLayerHandlerContribution:Pm,Step:ll,StepClosed:hl,Symbol:Wg,SymbolRender:Ry,SymbolRenderContribution:s_,TEXT_NUMBER_TYPE:md,Text:Zg,get TextDirection(){return Kc},TextMeasureContribution:Vm,TextRender:Oy,TextRenderContribution:n_,Theme:Dp,TransformUtil:wm,get UpdateTag(){return vo},VGlobal:yg,VWindow:bf,ViewTransform3dPlugin:tC,VirtualLayerHandlerContribution:Om,WILDCARD:"*",WindowHandlerContribution:xf,WrapText:tf,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Ou,addArcToBezierPath:To,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:rk,alignSubpath:QA,application:oh,applyTransformOnBezierCurves:ok,arc3dModule:Gb,arcModule:Nb,areaModule:nx,bezier:ko,bezierCurversToPath:lk,binarySplitPolygon:yk,bindArc3dRenderModule:Wb,bindArcRenderModule:jb,bindAreaRenderModule:sx,bindCircleRenderModule:ox,bindContributionProvider:Hm,bindContributionProviderNoSingletonScope:jm,bindGlyphRenderModule:dx,bindImageRenderModule:Sx,bindLineRenderModule:Tx,bindPathRenderModule:Ox,bindPolygonRenderModule:Ux,bindPyramid3dRenderModule:Xx,bindRect3dRenderModule:eS,bindRectRenderModule:Zx,bindRichtextRenderModule:aS,bindStarRenderModule:cS,bindSymbolRenderModule:gS,bindTextRenderModule:yS,boundStroke:Gc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Sl,calculateArcCornerRadius:Dv,calculateLineHeight:Ch,canvasAllocate:_f,centroidOfSubpath:ik,circleBounds:vh,circleModule:lx,clock:Za,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Nu,configureRuntimeApplicationForApp:WA,container:iA,cornerTangents:Lv,createApp:bA,createArc:Vp,createArc3d:hv,createArea:Yp,createBrowserApp:bA,createCanvasEventTransformer:function(t,e,i,s){return Ck(t.parentElement,e,i,s)},createCircle:$p,createColor:ru,createConicalGradient:Yu,createContributionProvider:zm,createEventTransformer:Ck,createGlyph:Zp,createGraphic:cf,createGroup:tg,createImage:sg,createLine:ag,createMat4:_u,createMiniappApp:function(t={}){return new SA(t)},createNodeApp:function(t={}){return new xA(t)},createPath:hg,createPolygon:ug,createPyramid3d:dv,createRect:mg,createRect3d:nv,createRectPath:Mv,createRichText:jg,createShadowRoot:Ug,createStage:function(t){return oA(),(new Sm).create(t)},createStar:ov,createSymbol:Gg,createText:Jg,createWrapText:ef,cubicCalc:Ro,cubicLength:Po,cubicPointAt:Oo,cubicSubdivide:JA,defaultArcAllocate:Hk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Uv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:Nk,defaultBaseBackgroundRenderContribution:zf,defaultBaseClipRenderAfterContribution:Qf,defaultBaseClipRenderBeforeContribution:Zf,defaultBaseTextureRenderContribution:jv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Kv,defaultCircleRenderContribution:Yv,defaultCircleTextureRenderContribution:Xv,defaultGraphicMemoryManager:Qk,defaultGroupBackgroundRenderContribution:qv,defaultImageBackgroundRenderContribution:ay,defaultImageRenderContribution:ry,defaultLineAllocate:Gk,defaultPathAllocate:Xk,defaultRectAllocate:Fk,defaultRectBackgroundRenderContribution:sy,defaultRectRenderContribution:ey,defaultRectTextureRenderContribution:iy,defaultStarBackgroundRenderContribution:gy,defaultStarTextureRenderContribution:py,defaultSymbolAllocate:$k,defaultSymbolBackgroundRenderContribution:uy,defaultSymbolClipRangeStrokeRenderContribution:cy,defaultSymbolRenderContribution:hy,defaultSymbolTextureRenderContribution:dy,defaultTextAllocate:Zk,diff:ZA,divideCubic:Fo,drawArc:Co,drawArcPath:Fv,drawAreaSegments:Xb,drawBackgroundImage:Kf,drawImageWithLayout:_x,drawIncrementalAreaSegments:Jb,drawIncrementalSegments:Zb,drawSegments:qb,enumCommandMap:lo,fillVisible:Bv,findBestMorphingRotation:nk,findConfigIndexByCursorIdx:wk,findCursorIdxByConfigIndex:Ek,findNextGraphic:Lf,flatten_simplify:qA,foreach:Of,foreachAsync:If,genBasisSegments:Zo,genBasisTypeSegments:qo,genLinearClosedSegments:gl,genLinearClosedTypeSegments:fl,genLinearSegments:Yo,genLinearTypeSegments:Xo,genMonotoneXSegments:rl,genMonotoneXTypeSegments:nl,genMonotoneYSegments:ol,genMonotoneYTypeSegments:al,genNumberType:Xc,genStepClosedSegments:ul,genStepSegments:cl,genStepTypeSegments:dl,getApplicationState:ah,getAttributeFromDefaultAttrList:xh,getBackgroundImage:jf,getConicGradientAt:Gu,getContributionStoreState:Lm,getCurrentEnv:function(){return mm()?"browser":"node"},getDefaultCharacterConfig:Mk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Yg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Au.allocate();return cu(o,o,[a[0],a[1],0]),n&&ou(o,o,n),s&&lu(o,o,s),cu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Ef,getGraphicClassState:wp,getGraphicRegistryState:af,getLegacyBindingContext:m_,getModelMatrix:vm,getRichTextBounds:fv,getRuntimeInstallerBindingContext:NA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:TA,getScaledStroke:nu,getTextBounds:gv,getTheme:zp,getThemeFromGroup:Hp,globalTheme:Fp,glyphModule:ux,graphicCreator:lf,graphicService:rA,graphicUtil:sA,identityMat4:au,imageModule:Ax,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:$A,installRuntimeDrawContributionsToApp:YA,installRuntimeGraphicRenderersToApp:GA,installRuntimePickersToApp:XA,interpolateColor:Ru,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Iu,interpolateGradientRadialColor:Lu,interpolatePureColorArray:Fu,interpolatePureColorArrayToStr:zu,intersect:Iv,isBrowserEnv:mm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){fm();const t=oh.global&&oh.global.env;return t?"node"===t:!gm},isSvg:Nc,isXML:Uc,layerService:aA,lineModule:Mx,lookAt:gu,mapToCanvasPointForCanvas:function(t){var e;if(Rd(t._canvasX)&&Rd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:du,mat4Allocate:Au,matrixAllocate:Su,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:pu,newThemeObj:Op,ortho:fu,parsePadding:gh,parseStroke:uh,parseSvgPath:mo,pathModule:Ix,pathToBezierCurves:ak,point:Ko,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:Vx,preLoadAllModule:f_,pyramid3dModule:Kx,quadCalc:Io,quadLength:Do,quadPointAt:Lo,rafBasedSto:Ah,rect3dModule:iS,rectFillVisible:Pv,rectModule:Jx,rectStrokeVisible:Ov,recursiveCallBinarySplit:_k,refreshRuntimeInstallerContributions:UA,registerArc3dGraphic:vb,registerArcGraphic:mb,registerAreaGraphic:yb,registerCircleGraphic:_b,registerDirectionalLight:uA,registerFlexLayoutPlugin:nC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:bb,registerGraphic:hf,registerGroupGraphic:xb,registerHtmlAttributePlugin:S_,registerImageGraphic:Sb,registerLineGraphic:Ab,registerOrthoCamera:gA,registerPathGraphic:kb,registerPolygonGraphic:Cb,registerPyramid3dGraphic:Tb,registerReactAttributePlugin:k_,registerRect3dGraphic:wb,registerRectGraphic:Mb,registerRichtextGraphic:Eb,registerShadowRootGraphic:Bb,registerStarGraphic:Pb,registerSymbolGraphic:Rb,registerTextGraphic:Ob,registerViewTransform3dPlugin:eC,registerWindowEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Ib,renderCommandList:wo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:vx,resolveBackgroundPosition:Gf,resolveBackgroundSizing:Nf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:fx,resolveImageRepeatMode:gx,resolveRenderableImageSize:Xf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:oS,rotateX:ou,rotateY:lu,rotateZ:hu,runFill:wv,runStroke:Ev,scaleMat4:uu,segments:Ao,shouldClipImageByLayout:yx,shouldUseMat4:ym,snapLength:Bo,splitArc:dk,splitArea:gk,splitCircle:uk,splitLine:fk,splitPath:xk,splitPolygon:bk,splitRect:ck,splitToGrids:hk,starModule:dS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Rv,symbolModule:fS,textAttributesToStyle:Kg,textDrawOffsetX:Yg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Xg,textModule:_S,transformMat4:mu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:nA,translate:cu,verticalLayout:$c,vglobal:b_,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oh.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)}))},wrapCanvas:Td,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.context2dFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Qc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Qc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class aC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:nu(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class oC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let lC=!1;function hC(t){lC||(lC=!0,t.bind(DS).toDynamicValue((()=>new oC(xS(t,xy)))).inSingletonScope(),t.bind(eA).toService(DS))}class cC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let dC=!1;function uC(t){dC||(dC=!0,t.bind(kS).toDynamicValue((()=>new cC(xS(t,xy)))).inSingletonScope(),t.bind(AS).toService(kS))}function pC(){if(pC.__loaded)return;pC.__loaded=!0;const t=m_();mb(),Nb({bind:t.bind}),bS?hC(t):uC(t)}pC.__loaded=!1;const gC=pC;class fC extends Fb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class mC extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ed,this.themeType="arc"}}let vC=!1;function yC(t){var e;vC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Sy))&&(vC=!0,t.bind(FS).toDynamicValue((()=>new mC(xS(t,Sy)))).inSingletonScope(),t.bind(eA).toService(FS))}function _C(){if(_C.__loaded)return;_C.__loaded=!0;const t=m_();vb(),uA(),gA(),Gb({bind:t.bind}),yC(t)}_C.__loaded=!1;const bC=_C;class xC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let SC=!1;function AC(t){SC||(SC=!0,t.bind(zS).toDynamicValue((()=>new xC(xS(t,Ay)))).inSingletonScope(),t.bind(eA).toService(zS))}class kC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let CC=!1;function TC(t){CC||(CC=!0,t.bind(CS).toDynamicValue((()=>new kC(xS(t,Ay)))).inSingletonScope(),t.bind(AS).toService(CS))}function MC(){if(MC.__loaded)return;MC.__loaded=!0;const t=m_();yb(),nx({bind:t.bind}),bS?AC(t):TC(t)}MC.__loaded=!1;const wC=MC;class EC{constructor(){this.type="glyph",this.numberType=nd}contains(t,e,i){if(!t.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}}class BC extends EC{constructor(t){super(),this.canvasRenderer=t}}let PC=!1;function RC(t){PC||(PC=!0,t.bind(JS).toDynamicValue((()=>new BC(xS(t,Dy)))).inSingletonScope(),t.bind(eA).toService(JS))}class OC extends EC{constructor(t){super(),this.canvasRenderer=t}}let IC=!1;function LC(t){IC||(IC=!0,t.bind(IS).toDynamicValue((()=>new OC(xS(t,Dy)))).inSingletonScope(),t.bind(AS).toService(IS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=m_();bb(),ux({bind:t.bind}),bS?RC(t):LC(t)}DC.__loaded=!1;const FC=DC;function zC(){zC.__loaded||(zC.__loaded=!0,xb())}zC.__loaded=!1;const HC=zC;class jC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=ad}}let NC=!1;function UC(t){NC||(NC=!0,t.bind(jS).toDynamicValue((()=>new jC(xS(t,Fy)))).inSingletonScope(),t.bind(eA).toService(jS))}class VC{constructor(){this.type="image",this.numberType=ad}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function GC(t){WC||(WC=!0,t.bind(MS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(AS).toService(MS))}function YC(){if(YC.__loaded)return;YC.__loaded=!0;const t=m_();Sb(),Ax({bind:t.bind}),bS?UC(t):GC(t)}YC.__loaded=!1;const XC=YC;class KC extends Fb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class $C extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let qC=!1;function ZC(t){qC||(qC=!0,t.bind(US).toDynamicValue((()=>new $C(xS(t,My)))).inSingletonScope(),t.bind(eA).toService(US))}class JC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let QC=!1;function tT(t){QC||(QC=!0,t.bind(wS).toDynamicValue((()=>new JC(xS(t,My)))).inSingletonScope(),t.bind(AS).toService(wS))}function eT(){if(eT.__loaded)return;eT.__loaded=!0;const t=m_();Ab(),Mx({bind:t.bind}),bS?ZC(t):tT(t)}eT.__loaded=!1;const iT=eT;class sT extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let nT=!1;function rT(t){nT||(nT=!0,t.bind(WS).toDynamicValue((()=>new sT(xS(t,wy)))).inSingletonScope(),t.bind(eA).toService(WS))}class aT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let oT=!1;function lT(t){oT||(oT=!0,t.bind(ES).toDynamicValue((()=>new aT(xS(t,wy)))).inSingletonScope(),t.bind(AS).toService(ES))}function hT(){if(hT.__loaded)return;hT.__loaded=!0;const t=m_();kb(),Ix({bind:t.bind}),bS?rT(t):lT(t)}hT.__loaded=!1;const cT=hT;class dT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let uT=!1;function pT(t){uT||(uT=!0,t.bind($S).toDynamicValue((()=>new dT(xS(t,Ey)))).inSingletonScope(),t.bind(eA).toService($S))}class gT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let fT=!1;function mT(t){fT||(fT=!0,t.bind(OS).toDynamicValue((()=>new gT(xS(t,Ey)))).inSingletonScope(),t.bind(AS).toService(OS))}function vT(){if(vT.__loaded)return;vT.__loaded=!0;const t=m_();Cb(),Vx({bind:t.bind}),bS?pT(t):mT(t)}vT.__loaded=!1;const yT=vT;class _T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=cd,this.themeType="polygon"}}let bT=!1;function xT(t){var e;bT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ly))&&(bT=!0,t.bind(qS).toDynamicValue((()=>new _T(xS(t,Ly)))).inSingletonScope(),t.bind(eA).toService(qS))}function ST(){if(ST.__loaded)return;ST.__loaded=!0;const t=m_();Tb(),uA(),gA(),Kx({bind:t.bind}),xT(t)}ST.__loaded=!1;const AT=ST,kT=new Ve;class CT{constructor(){this.type="rect",this.numberType=dd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:nu(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;kT.setValue(i.x1,i.y1,i.x2,i.y2),kT.expand(-r/2),h=!kT.containsPoint(e)}}return s.highPerformanceRestore(),h}}class TT extends CT{constructor(t){super(),this.canvasRenderer=t}}let MT=!1;function wT(t){MT||(MT=!0,t.bind(GS).toDynamicValue((()=>new TT(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(GS))}class ET extends CT{constructor(t){super(),this.canvasRenderer=t}}let BT=!1;function PT(t){BT||(BT=!0,t.bind(BS).toDynamicValue((()=>new ET(xS(t,By)))).inSingletonScope(),t.bind(AS).toService(BS))}function RT(){if(RT.__loaded)return;RT.__loaded=!0;const t=m_();Mb(),Jx({bind:t.bind}),bS?wT(t):PT(t)}RT.__loaded=!1;const OT=RT;class IT extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=ud,this.themeType="rect"}}let LT=!1;function DT(t){var e;LT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Py))&&(LT=!0,t.bind(YS).toDynamicValue((()=>new IT(xS(t,Py)))).inSingletonScope(),t.bind(eA).toService(YS))}function FT(){if(FT.__loaded)return;FT.__loaded=!0;const t=m_();wb(),iS({bind:t.bind}),DT(t)}FT.__loaded=!1;const zT=FT;class HT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let jT=!1;function NT(t){jT||(jT=!0,t.bind(ZS).toDynamicValue((()=>new HT(xS(t,Iy)))).inSingletonScope(),t.bind(eA).toService(ZS))}class UT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let VT=!1;function WT(t){VT||(VT=!0,t.bind(LS).toDynamicValue((()=>new UT(xS(t,Iy)))).inSingletonScope(),t.bind(AS).toService(LS))}function GT(){if(GT.__loaded)return;GT.__loaded=!0;const t=m_();Eb(),oS({bind:t.bind}),bS?NT(t):WT(t)}GT.__loaded=!1;const YT=GT;function XT(){XT.__loaded||(XT.__loaded=!0,Bb())}XT.__loaded=!1;const KT=XT;class $T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Au.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let qT=!1;function ZT(t){qT||(qT=!0,t.bind(XS).toDynamicValue((()=>new $T(xS(t,Ry)))).inSingletonScope(),t.bind(eA).toService(XS))}class JT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}}let QT=!1;function tM(t){QT||(QT=!0,t.bind(PS).toDynamicValue((()=>new JT(xS(t,Ry)))).inSingletonScope(),t.bind(AS).toService(PS))}function eM(){if(eM.__loaded)return;eM.__loaded=!0;const t=m_();Rb(),fS({bind:t.bind}),bS?ZT(t):tM(t)}eM.__loaded=!1;const iM=eM;class sM extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Xg(a,u,n),v=Yg(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&&Au.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let nM=!1;function rM(t){nM||(nM=!0,t.bind(KS).toDynamicValue((()=>new sM(xS(t,Oy)))).inSingletonScope(),t.bind(eA).toService(KS))}class aM{constructor(){this.type="text",this.numberType=md}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let oM=!1;function lM(t){oM||(oM=!0,t.bind(RS).toDynamicValue((()=>new aM)).inSingletonScope(),t.bind(AS).toService(RS))}function hM(){if(hM.__loaded)return;hM.__loaded=!0;const t=m_();Ob(),_S({bind:t.bind}),bS?rM(t):lM(t)}hM.__loaded=!1;const cM=hM;function dM(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),gM=(t,e)=>(d(mM.warnHandler)&&mM.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),fM=(t,e,i)=>{if(!d(mM.errorHandler))throw new Error(t);mM.errorHandler.call(null,t,e)},mM={silent:!1,warnHandler:!1,errorHandler:!1},vM=mm(),yM=vM&&globalThis?globalThis.document:void 0;function _M(t){return("desktop-browser"===t||"mobile-browser"===t)&&vM}function bM(t){return xM(t)||"mobile-browser"===t}function xM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let SM=0;function AM(){return SM>=9999999&&(SM=0),SM++}function kM(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function CM(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function TM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&TM(t,e)}))}const MM=t=>!u(t)&&!1!==t.visible;function wM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function EM(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 PM=["#ffffff","#000000"];function RM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return OM(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(...PM);for(const n of a)if(t!==n&&OM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function OM(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?IM(t,e)>s:"largeText"===i?IM(t,e)>3:IM(t,e)>4.5}function IM(t,e){const i=LM(t),s=LM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function LM(t){const e=ri(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 DM(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 FM(t,e){return[t[0]*e,t[1]*e]}function zM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function HM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const jM=cf,NM={arc:t=>jM("arc",t),circle:t=>jM("circle",t),group:t=>jM("group",t),image:t=>jM("image",t),line:t=>jM("line",t),path:t=>jM("path",t),polygon:t=>jM("polygon",t),rect:t=>jM("rect",t),richtext:t=>jM("richtext",t),symbol:t=>jM("symbol",t),text:t=>jM("text",t)},UM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 GM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(GM||(GM={}));const YM={[GM.selectedReverse]:{},[GM.selected]:{},[GM.hover]:{},[GM.hoverReverse]:{}},XM={container:"",width:30,height:30,style:{}},KM="scrollDrag",$M=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:gv,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function qM(t,e,i={}){if(!t)return{width:0,height:0};const s=gv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 ZM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function JM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function QM(t,e="type"){const i=ZM(t,e);return"rich"===i?NM.richtext(JM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),NM.text(t))}function tw(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 ew=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function iw(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 sw(t,e){const{dx:i,dy:s}=iw(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const nw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},rw={size:8,stroke:"#000",lineWidth:1,zIndex:1};function aw(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Ae(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Ee(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const ow=Math.sin(Math.PI/10);function lw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function hw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function cw(t){const e={};return TM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return FM(r,(s?-1:1)*(n?-1:1)*t/zM(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function fw(t,e,i){var s;if(hw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function mw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function _w(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function bw(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function xw(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 Sw(t,e){const i=xw(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 Aw(t,e){const i=kw(t),s=kw(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 kw(t,e={x:0,y:0}){return ae.distancePP(t,e)}function Cw(t){return k(t.x)&&k(t.y)}function Tw(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 Mw(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const ww=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function Bw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&Bw(t[i],e)}}var Pw;!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"}(Pw||(Pw={}));const Rw={};function Ow(t){switch(t){case Pw.Linear:case Pw.Log:case Pw.Pow:case Pw.Sqrt:case Pw.Symlog:case Pw.Time:return!0;default:return!1}}function Iw(t){return!!Rw[t]}function Lw(t){switch(t){case Pw.Ordinal:case Pw.Point:case Pw.Band:return!0;default:return!1}}function Dw(t){return t}Object.values(Pw).forEach((t=>{Rw[t]=!0}));const Fw=t=>-Math.log(-t),zw=t=>-Math.exp(-t),Hw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,jw=t=>10===t?Hw:t===Math.E?Math.exp:e=>Math.pow(t,e),Nw=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)),Vw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Ww(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 Gw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Yw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Xw(t,e,i,s){return 1===i&&(i=0),Yw(t,i,s)*(e/(1-i))}function Kw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function $w(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Zw{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=Kw(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=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Jw=Symbol("implicit");class Qw extends Zw{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=Jw}clone(){const t=(new Qw).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!==Jw)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return tE(t,e,r,n)}class iE extends Qw{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=Xw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:eE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new iE(!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:sE}=ai;function nE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=sE(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?sE(t,e):e instanceof si?sE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class rE extends Zw{constructor(t=Dw,e=Dw){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Dw,this._piecewise=Gw,this._interpolate=nE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?$w:Gw,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:Dw),this.rescale(i)):this._clamp!==Dw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const aE=Math.sqrt(50),oE=Math.sqrt(10),lE=Math.sqrt(2),hE=[1,2,5,10],cE=(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=gE(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?uE(0,-(e-1)/s,s):uE((e-1)/s,0,s)},dE=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return cE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return cE(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=uE(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=uE(t,e,l);return n&&r.reverse(),r})),gE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=hE[0];return i>=aE?s=hE[3]:i>=oE?s=hE[2]:i>=lE&&(s=hE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function fE(t,e,i){const s=(e-t)/Math.max(0,i);return gE(s)}function mE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=fE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function yE(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 _E=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),bE=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),xE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=pE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?_E(t,e,n):_E(t,e,qw(n)),h=_E(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),SE=vt(((t,e,i,s,n)=>mE(s(t),s(e),i).map((t=>qw(n(t))))));class AE extends rE{constructor(){super(...arguments),this.type=Pw.Linear}clone(){var t;const e=new AE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return dE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=pE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function CE(t){return e=>-t(-e)}function TE(t=Number.EPSILON){return e=>Math.max(e,t)}class ME extends rE{constructor(){super(Nw(10),jw(10)),this.type=Pw.Log,this._limit=TE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new ME).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=Nw(this._base),s=jw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Fw,this.untransformer=zw):(this._logs=i,this._pows=s,this._limit=TE(),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 Dw}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return bE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(ME,kE);class wE extends AE{constructor(){super(Uw(1),Vw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new wE).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=Vw(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return bE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(wE,kE);class EE{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[lt(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new EE).domain(this._domain).range(this._range).unknown(this._unknown)}}var BE,PE,RE;function OE(t){var e,i;const{type:s}=t;return s===PE.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BE||(BE={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(PE||(PE={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(RE||(RE={}));const IE={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},LE={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DE(t,e){var i;if(!t)return[];const s=VE(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?NE(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>jE(i)?zE(t,i,e):i)).filter(p)}))):i.map((i=>jE(i)?zE(t,i,e):i)).filter(p):[]}return[]}function FE(t,e){var i,s;return NE(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 zE(t,e,i){var s;const n=VE(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=IE[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=LE[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 si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`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 HE=(t,e)=>{if(e&&jE(t)){const i=zE(e,t);if(i)return i}return t};function jE(t){return t&&"palette"===t.type&&!!t.key}function NE(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function UE(t){return _(t)?{dataScheme:t}:t}function VE(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=OE(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 WE extends Qw{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!NE(this._range))return void super.range(this._range);const t=FE(this._range,this._domain);super.range(t)}}const GE={linear:AE,band:iE,point:class extends iE{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:Qw,threshold:EE,colorOrdinal:WE};function YE(t){const e=GE[t];return e?new e:null}function XE(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function KE(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function $E(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qE(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZE(t){return!!y(t)&&(!!t.endsWith("%")&&kM(t.substring(0,t.length-1)))}function JE(t){return!!g(t)&&("percent"in t||"offset"in t)}function QE(t,e,i,s=0){var n,r;return S(t)?t:ZE(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 tB(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]=QE(t[s],e.size,i)}))})),o}function eB(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function iB(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)||ZE(t)||d(t)||JE(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function sB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const nB=(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},rB=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function aB(t,e){return t&&e.key in t?t[e.key]:e.default}function oB(t){return t&&"token"===t.type&&!!t.key}const lB={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},hB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:lB,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},cB={name:"dark",colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},dB=(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]={}),dB(t[s],e.slice(1),i))};function uB(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=UE(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}vB._charts=mB.charts,vB._series=mB.series,vB._components=mB.components,vB._graphicComponents=mB.graphicComponents,vB._marks=mB.marks,vB._regions=mB.regions,vB._animations=mB.animations,vB._implements=mB.implements,vB._chartPlugin=mB.chartPlugin,vB._vChartPlugin=mB.vChartPlugin,vB._componentPlugin=mB.componentPlugin,vB.transforms=mB.transforms,vB.dataParser=mB.dataParser,vB._layout=mB.layout,vB._grammarTransforms=mB.grammarTransforms,vB._stageEventPlugins=mB.stageEventPlugins,vB.registerStageEventPlugin=(t,e)=>{vB._stageEventPlugins[t]=e},vB.getStageEventPlugin=t=>vB._stageEventPlugins[t],vB._interactionTriggers=mB.interactionTriggers,vB.registerInteractionTrigger=(t,e)=>{vB._interactionTriggers[t]=e},vB._composedEventMap=mB.composedEventMap,vB.registerComposedEvent=(t,e)=>{vB._composedEventMap[t]=e},vB._tooltipProcessors=mB.tooltipProcessors,vB.registerTooltipProcessor=(t,e)=>{vB._tooltipProcessors[t]=e},vB.createTooltipProcessor=(t,e)=>{const i=vB._tooltipProcessors[t];return i?new i(e):null},vB._runtimePluginInstallers=mB.runtimePluginInstallers,vB.registerRuntimePluginInstaller=(t,e)=>{vB._runtimePluginInstallers[t]=e},vB.getRuntimePluginInstaller=t=>vB._runtimePluginInstallers[t];const bB=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},xB=bB(),SB={[hB.name]:hB},AB=hB.name,kB=new Map(Object.keys(SB).map((t=>[t,SB[t]]))),CB=new Map,TB=new Map(Object.keys(SB).map((t=>[t,t===AB]))),MB=(t,e)=>{if(!t)return;const i=PB(e);kB.set(t,i),TB.set(t,!0)},wB=(t=AB)=>(TB.has(t)&&!TB.get(t)&&MB(t,kB.get(t)),kB.get(t)),EB=t=>kB.delete(t)&&CB.delete(t)&&TB.delete(t),BB=t=>!!y(t)&&kB.has(t),PB=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:AB;return yB({},wB(i),t)};class RB{static registerInstance(t){RB.instances.set(t.id,t)}static unregisterInstance(t){RB.instances.delete(t.id)}static getInstance(t){return RB.instances.get(t)}static instanceExist(t){return RB.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return RB.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}RB.instances=new Map;class OB{static registerTheme(t,e){MB(t,e)}static getTheme(t,e=!1){return wB(t)}static removeTheme(t){return EB(t)}static themeExist(t){return BB(t)}static getDefaultTheme(){return OB.themes.get(AB)}static setCurrentTheme(t){OB.themeExist(t)&&(OB._currentThemeName=t,RB.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return OB.getTheme(OB._currentThemeName,t)}static getCurrentThemeName(){return OB._currentThemeName}}function IB(t){return y(t)?OB.themeExist(t)?OB.getTheme(t):{}:g(t)?t:{}}OB.themes=kB,OB._currentThemeName=AB;const LB=["animationThreshold","colorScheme","name","padding"];function DB(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];LB.includes(n)?s[n]=r:m(r)?jE(r)?s[n]=HE(r,e):oB(r)?s[n]=aB(i,r):s[n]=DB(r,e,i):s[n]=r})),s}function FB(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]=FB(t[s],e)}return i}return _(t)?t.map((t=>FB(t,e))):t}function zB(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]=zB(t[s],e)}return i}return _(t)?t.map((t=>zB(t,e))):t}function HB(t,...e){return d(t)?t(...e):t}const jB=(t,e,i,s)=>((t,e,i)=>$M(t,e,i,{fontFamily:lB.fontFamily,fontSize:lB.fontSize}))(e,i,s).measure(t),NB="__VCHART",UB=500,VB=500,WB=`${NB}_MEASURE_CANVAS_ID`,GB=`${NB}_DEFAULT_DATA_INDEX`,YB=`${NB}_DEFAULT_DATA_KEY`,XB=`${NB}_DEFAULT_DATA_SERIES_FIELD`,KB=`${NB}_DEFAULT_SERIES_STYLE_NAME`,$B=`${NB}_STACK_KEY`,qB=`${NB}_STACK_START`,ZB=`${NB}_STACK_END`,JB=`${NB}_STACK_START_PERCENT`,QB=`${NB}_STACK_END_PERCENT`,tP=`${NB}_STACK_START_OffsetSilhouette`,eP=`${NB}_STACK_END_OffsetSilhouette`,iP=`${NB}_STACK_TOTAL`,sP=`${NB}_STACK_TOTAL_PERCENT`,nP=`${NB}_STACK_TOTAL_TOP`,rP=`${NB}_STACK_TOTAL_BOTTOM`,aP=`${NB}_MOSAIC_VALUE_START_PERCENT`,oP=`${NB}_MOSAIC_VALUE_END_PERCENT`,lP=`${NB}_MOSAIC_CAT_START_PERCENT`,hP=`${NB}_MOSAIC_CAT_END_PERCENT`,cP=`${NB}_SEGMENT_START`,dP=`${NB}_SEGMENT_END`,uP=`${NB}_KEY`,pP=`${NB}_MAP_LOOK_UP_KEY`;function gP(t,e){for(let i=0;it.key===e))}function mP(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 vP(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},SP(t,a,n[o],l,e,r))})),s?yP(n):n}function yP(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))):yP(t[e].nodes);return t}function _P(t,e){if("values"in t&&t.values.length){const i=bw(t.values,e),s=_w(t.values,QB);t.values.forEach((t=>{t[iP]=i,t[sP]=s}))}else for(const i in t.nodes)_P(t.nodes[i],e)}function bP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][ZB]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)xP(t.nodes[r],e,i,s,n)}function SP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[ZB]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),SP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const AP=(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]=CP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function TP(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function MP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return PP(t(r,i,s,n));if(TP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),PP(e)}return PP(t)}function wP(t={}){const e=Object.assign({},t);if(d(t.style)||TP(t.style)?e.style=(e,i,s,n)=>MP(t.style,e,i,s,n):P(t.style)||(e.style=PP(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||TP(t.state[e])?i[e]=(i,s,n,r)=>MP(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=PP(t.state[e]))})),e.state=i}return e}function EP(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e,s,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}function BP(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),PP(i)}function PP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const RP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},OP=t=>"line"===t||"area"===t,IP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return OP(i)?e:null==e?void 0:e[0]},LP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let DP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=vB.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(vB.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var FP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(FP||(FP={}));const zP=["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 HP,jP,NP;t.ChartEvent=void 0,(HP=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",HP.rendered="rendered",HP.renderFinished="renderFinished",HP.animationFinished="animationFinished",HP.regionSeriesDataFilterOver="regionSeriesDataFilterOver",HP.afterInitData="afterInitData",HP.afterInitEvent="afterInitEvent",HP.afterInitMark="afterInitMark",HP.rawDataUpdate="rawDataUpdate",HP.viewDataFilterOver="viewDataFilterOver",HP.viewDataUpdate="viewDataUpdate",HP.viewDataStatisticsUpdate="viewDataStatisticsUpdate",HP.markDeltaYUpdate="markDeltaYUpdate",HP.viewDataLabelUpdate="viewDataLabelUpdate",HP.scaleDomainUpdate="scaleDomainUpdate",HP.scaleRawDomainUpdate="scaleRawDomainUpdate",HP.scaleUpdate="scaleUpdate",HP.dataZoomChange="dataZoomChange",HP.drill="drill",HP.layoutStart="layoutStart",HP.layoutEnd="layoutEnd",HP.layoutRectUpdate="layoutRectUpdate",HP.playerPlay="playerPlay",HP.playerPause="playerPause",HP.playerEnd="playerEnd",HP.playerChange="playerChange",HP.playerForward="playerForward",HP.playerBackward="playerBackward",HP.scrollBarChange="scrollBarChange",HP.brushStart="brushStart",HP.brushChange="brushChange",HP.brushEnd="brushEnd",HP.brushClear="brushClear",HP.brushActive="brushActive",HP.legendSelectedDataChange="legendSelectedDataChange",HP.legendFilter="legendFilter",HP.legendItemClick="legendItemClick",HP.legendItemHover="legendItemHover",HP.legendItemUnHover="legendItemUnHover",HP.tooltipShow="tooltipShow",HP.tooltipHide="tooltipHide",HP.tooltipRelease="tooltipRelease",HP.afterResize="afterResize",HP.afterRender="afterRender",HP.afterLayout="afterLayout",HP.afterMarkLayoutEnd="afterMarkLayoutEnd",HP.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(jP||(jP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(NP||(NP={}));const UP=[NP.mark,NP.model,NP.chart,NP.vchart];class VP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(NP.vchart,[]),this._levelNodes.set(NP.chart,[]),this._levelNodes.set(NP.model,[]),this._levelNodes.set(NP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const WP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class GP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>IP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||jP.chart);o.get(t)||o.set(t,new VP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||jP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||jP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||jP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?UP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[jP.chart,jP.window,jP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&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 WP[a]&&(a=WP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?NP.model:NP.vchart:NP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=jP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==NP.model&&s!==NP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=NP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case jP.chart:return this._viewBubbles;case jP.window:return this._windowBubbles;case jP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case jP.chart:return this._viewListeners;case jP.window:return this._windowListeners;case jP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return zP.includes(t)||Object.values(FP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&vB.hasInteractionTrigger(e)}}function YP(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function XP(t,e,i){t.getParser(e)||t.registerParser(e,i)}const KP=new Map;let $P;function qP(){$P||($P=new Fa,XP($P,"geojson",Pa),XP($P,"topojson",Oa),YP($P,"simplify",Kr))}function ZP(t,e,i={type:"geojson",centroid:!0}){KP.has(t)&&gM(`map type of '${t}' already exists, will be overwritten.`),qP();const s=new za($P),n=H({},{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}),KP.set(t,s)}function JP(t){KP.has(t)?KP.delete(t):gM(`map type of '${t}' does not exists.`)}function QP(t,e=!1){let i=e;return t.latestData instanceof za&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const tR=(t,e)=>0===t.length?[]:1===t.length?QP(t[0],null==e?void 0:e.deep):t.map((t=>QP(t,null==e?void 0:e.deep)));function eR(e,i,s){YP(i=i instanceof Fa?i:e.dataSet,"copyDataView",tR);const n=new za(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function iR(t,e,i=[]){var s;if(t instanceof za)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new za(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return gM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return gM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),gM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function sR(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var nR,rR,aR,oR;t.TransformLevel=void 0,(nR=t.TransformLevel||(t.TransformLevel={}))[nR.copyDataView=-10]="copyDataView",nR[nR.treemapFilter=-8]="treemapFilter",nR[nR.treemapFlatten=-7]="treemapFlatten",nR[nR.dotObjFlat=-7]="dotObjFlat",nR[nR.linkDotInfo=-7]="linkDotInfo",nR[nR.sankeyLayout=-7]="sankeyLayout",nR[nR.dataZoomFilter=-6]="dataZoomFilter",nR[nR.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(rR||(rR={})),function(t){t.data="data",t.mark="mark"}(aR||(aR={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(oR||(oR={}));const lR=["line","area","trail"];function hR(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(uP,i?t.slice().sort(i):t.slice()),{keys:[uP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const cR=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function dR(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{dR(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function pR(t,e,i,s){const n=hR(t,(t=>i(t))),r=hR(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const gR=`${NB}_BuiltIn_CallBack_Disappear`;var fR;!function(t){t.render="render",t.disappear="disappear"}(fR||(fR={}));const mR=[0,0,0];class vR{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ol),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Ll),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Su.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&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(mu(mR,[e,i,s],this.modelMatrix),e=mR[0],i=mR[1],s=mR[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=ru(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:nu(this,a,this.dpr),r.strokeStyle=ru(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}vR.env="browser";class yR extends wu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=oh.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new vR(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 _R(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,kd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Cd,e.env));r||i.bind(kd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Cd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}yR.env="browser";const bR=_R(yR,vR);class xR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}xR.env="feishu";class SR extends wu{constructor(t){super(t)}init(){this._context=new xR(this,this._dpr)}release(...t){}}SR.env="feishu";const AR=_R(SR,xR);class kR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}kR.env="harmony";class CR extends wu{constructor(t){super(t)}init(){this._context=new kR(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}CR.env="harmony";const TR=_R(CR,kR);class MR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}MR.env="lynx";class wR extends wu{constructor(t){super(t)}init(){this._context=new MR(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}wR.env="lynx";const ER=_R(wR,MR);class BR extends vR{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}BR.env="node";class PR extends wu{constructor(t){super(t)}init(){this._context=new BR(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}PR.env="node";const RR=_R(PR,BR);class OR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(ru(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:nu(this,l,this.dpr)),r.setStrokeStyle(ru(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}OR.env="taro";class IR extends wu{constructor(t){super(t)}init(){this._context=new OR(this,this._dpr)}release(...t){}}IR.env="taro";const LR=_R(IR,OR);class DR extends xR{}DR.env="tt";class FR extends wu{constructor(t){super(t)}init(){this._context=new DR(this,this._dpr)}release(...t){}}FR.env="tt";const zR=_R(FR,DR);class HR extends vR{draw(){}createPattern(t,e){return null}}HR.env="wx";class jR extends wu{constructor(t){super(t)}init(){this._context=new HR(this,this._dpr)}release(...t){}}jR.env="wx";const NR=_R(jR,HR);class UR extends vA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=_f.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;nnew GR(xS(t,ky)))).inSingletonScope(),t.bind(eA).toService(HS))}class KR extends CT{constructor(t){super(),this.canvasRenderer=t}}let $R=!1;class qR extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=gd}}let ZR=!1;function JR(t){var e;ZR||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,jy))&&(ZR=!0,t.bind(tA).toDynamicValue((()=>new qR(xS(t,jy)))).inSingletonScope(),t.bind(eA).toService(tA))}const QR=Xc();Xc();class tO{constructor(){this.type="gif-image",this.numberType=QR}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let eO=!1;function iO(t){eO||(eO=!0,t.bind(NS).toDynamicValue((()=>new tO)).inSingletonScope(),t.bind(eA).toService(NS))}function sO(t){t.isBound(UR)||t.bind(UR).toDynamicValue((()=>new UR(SS(eA,t),xS(t,Hy),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(UR):t.bind(qm).toService(UR)}function nO(t){(function(t){WR||(WR=!0,t.bind(QS).toDynamicValue((()=>new VR)).inSingletonScope(),t.bind(eA).toService(QS),Hm(t.bind.bind(t),eA))})(t),hC(t),yC(t),AC(t),XR(t),RC(t),UC(t),ZC(t),function(t){$R||($R=!0,t.bind(VS).toDynamicValue((()=>new KR(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(VS))}(t),rT(t),pT(t),xT(t),wT(t),DT(t),NT(t),JR(t),ZT(t),rM(t),iO(t),sO(t)}class rO extends cA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${rO.idprefix}_${rO.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=oh.global,this.viewBox=new Ve,this.modelMatrix=new Ge(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(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:rO.GenerateCanvasId(),canvasControled:!0};this.canvas=new yR(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new yR({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function aO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rO))||t.bind(rO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,rO.env))||t.bind(xf).toService(rO).whenTargetNamed(rO.env)}rO.env="browser",rO.idprefix="visactor_window",rO.prefix_count=0;var oO=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 lO{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 hO(t,e=!1){const i=document.createElement("img");if(oh.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class cO extends hA{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 lO(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return hO(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return hO(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return oO(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function dO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,cO))||(t.bind(cO).toSelf().inSingletonScope(),t.bind(vg).toService(cO))}function uO(t=m_(),e=!0){uO.__loaded||(uO.__loaded=!0,dO(t),bR(t),aO(t),e&&nO(t))}uO.__loaded=!1;class pO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new SR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 SR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function gO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,pO))||t.bind(pO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,pO.env))||t.bind(xf).toService(pO).whenTargetNamed(pO.env)}pO.env="feishu";class fO extends vA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Tu(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}}let mO=!1;class vO extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let yO=!1;function _O(t){yO||(yO=!0,t.bind(TS).toDynamicValue((()=>new vO(xS(t,ky)))).inSingletonScope(),t.bind(AS).toService(TS))}function bO(t){(function(t){mO||(mO=!0,Hm(t.bind.bind(t),AS))})(t),function(t){t.isBound(fO)||t.bind(fO).toDynamicValue((()=>new fO(SS(AS,t),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(fO):t.bind(qm).toService(fO)}(t),uC(t),TC(t),_O(t),LC(t),GC(t),tT(t),mT(t),lT(t),PT(t),WT(t),tM(t),lM(t)}class xO{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class SO{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function AO(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function kO(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new xO(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function CO(t,e,i,s){const n=AO(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new SO(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function TO(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function MO(t,e=TO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class wO extends hA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=TO(i),n=null!==(e=t.dpr)&&void 0!==e?e:MO(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return MO(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function EO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,wO))||(t.bind(wO).toSelf().inSingletonScope(),t.bind(vg).toService(wO))}function BO(t=m_(),e=!0){BO.__loaded||(BO.__loaded=!0,EO(t),AR(t),gO(t),e&&bO(t))}BO.__loaded=!1;function PO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function RO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new CR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 CR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return PO(t,"target",s),PO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=RO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=RO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&OO(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),OO(t,"x",_),OO(t,"y",b),OO(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),OO(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),OO(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),OO(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),OO(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),OO(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function LO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,IO))||t.bind(IO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,IO.env))||t.bind(xf).toService(IO).whenTargetNamed(IO.env)}IO.env="harmony";const DO="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function FO(t){return"number"==typeof t&&Number.isFinite(t)}function zO(...t){for(let e=0;e({width:i,height:s})),new SO(t,l,n,i,s,e)}function VO(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=NO(e*s,i*s);if(t)return t}throw new Error(DO)}class WO extends hA{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=HO(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=HO(s),r=null!==(i=t.dpr)&&void 0!==i?i:jO(s),a=function(t,e){if(!FO(t)||!FO(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=UO(VO(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=UO(VO(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return jO(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=zO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=zO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function GO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,WO))||(t.bind(WO).toSelf().inSingletonScope(),t.bind(vg).toService(WO))}function YO(t=m_(),e=!0){YO.__loaded||(YO.__loaded=!0,GO(t),TR(t),LO(t),e&&bO(t))}YO.__loaded=!1;function XO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function KO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new wR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 wR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return XO(t,"target",s),XO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=KO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=KO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&$O(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),$O(t,"x",_),$O(t,"y",b),$O(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),$O(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),$O(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),$O(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),$O(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),$O(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function ZO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qO))||t.bind(qO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,qO.env))||t.bind(xf).toService(qO).whenTargetNamed(qO.env)}qO.env="lynx";function JO(t){return"number"==typeof t&&Number.isFinite(t)}function QO(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=eI(r),o=null!==(i=t.dpr)&&void 0!==i?i:iI(r,a),l=nI(t.width,t.height),h=rI(aI(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=eI(a),l=null!==(n=t.dpr)&&void 0!==n?n:iI(a,o),h=nI(t.width,t.height),c=Math.random().toString(),d=rI(aI(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return iI(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=QO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=QO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function lI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,oI))||(t.bind(oI).toSelf().inSingletonScope(),t.bind(vg).toService(oI))}function hI(t=m_(),e=!0){hI.__loaded||(hI.__loaded=!0,lI(t),ER(t),ZO(t),e&&bO(t))}hI.__loaded=!1;class cI extends cA{get container(){return null}constructor(t=oh.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new PR(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new PR({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function dI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cI))||t.bind(cI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,cI.env))||t.bind(xf).toService(cI).whenTargetNamed(cI.env)}cI.env="node";class uI extends hA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function pI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uI))||(t.bind(uI).toSelf().inSingletonScope(),t.bind(vg).toService(uI))}function gI(t=m_(),e=!0){gI.__loaded||(gI.__loaded=!0,pI(t),RR(t),dI(t))}gI.__loaded=!1;class fI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new IR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 IR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fI))||t.bind(fI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,fI.env))||t.bind(xf).toService(fI).whenTargetNamed(fI.env)}fI.env="taro";class vI extends hA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=CO(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=kO(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function yI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,vI))||(t.bind(vI).toSelf().inSingletonScope(),t.bind(vg).toService(vI))}function _I(t=m_(),e=!0){_I.__loaded||(_I.__loaded=!0,yI(t),LR(t),mI(t),e&&bO(t))}_I.__loaded=!1;class bI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new FR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 FR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function xI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,bI))||t.bind(bI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,bI.env))||t.bind(xf).toService(bI).whenTargetNamed(bI.env)}bI.env="tt";function SI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function AI(t,e=SI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class kI extends hA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=SI(i),n=null!==(e=t.dpr)&&void 0!==e?e:AI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return AI(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function CI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,kI))||(t.bind(kI).toSelf().inSingletonScope(),t.bind(vg).toService(kI))}function TI(t=m_(),e=!0){TI.__loaded||(TI.__loaded=!0,CI(t),zR(t),xI(t),e&&bO(t))}TI.__loaded=!1;class MI{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={}}}function wI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class EI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="wx",this.eventManager=new MI}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new jR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 jR({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return wI(t,"target",o),wI(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function BI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,EI))||t.bind(EI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,EI.env))||t.bind(xf).toService(EI).whenTargetNamed(EI.env)}EI.env="wx";function PI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function RI(t,e=PI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class OI extends hA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=PI(i),n=null!==(e=t.dpr)&&void 0!==e?e:RI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return RI(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function II(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,OI))||(t.bind(OI).toSelf().inSingletonScope(),t.bind(vg).toService(OI))}function LI(t=m_(),e=!0){LI.__loaded||(LI.__loaded=!0,II(t),NR(t),BI(t),e&&bO(t))}LI.__loaded=!1;var DI={},FI={},zI={};Object.defineProperty(zI,"__esModule",{value:!0}),zI.loop=zI.conditional=zI.parse=void 0;zI.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};zI.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};zI.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var HI={};Object.defineProperty(HI,"__esModule",{value:!0}),HI.readBits=HI.readArray=HI.readUnsigned=HI.readString=HI.peekBytes=HI.readBytes=HI.peekByte=HI.readByte=HI.buildStream=void 0;HI.buildStream=function(t){return{data:t,pos:0}};var jI=function(){return function(t){return t.data[t.pos++]}};HI.readByte=jI;HI.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var NI=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};HI.readBytes=NI;HI.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};HI.readString=function(t){return function(e){return Array.from(NI(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};HI.readUnsigned=function(t){return function(e){var i=NI(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};HI.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=NI(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=ZI(t),i=GI(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=ZI(this.attribute.gifImage),e=GI(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=oh.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=oh.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function tL(t){return new QI(t)}class eL extends bx{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=QR,this._renderContribitions=void 0,this.builtinContributions=[iL],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=zp(t).image;this._draw(t,n,!1,i)}}const iL=new class extends Jv{constructor(){super(...arguments),this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let sL=!1;function nL(t){sL||(sL=!0,t.bind(eL).toDynamicValue((()=>new eL(SS(Qy,t)))).inSingletonScope(),t.bind(Cy).toService(eL))}function rL(){lf.RegisterGraphicCreator("gif",tL)}function aL(){if(aL.__loaded)return;aL.__loaded=!0;const t=m_();rL(),nL(t),iO(t)}aL.__loaded=!1;const oL=aL,lL=[{register:mb,bindModule:Nb},{register:vb,bindModule:Gb},{register:yb,bindModule:nx},{register:_b,bindModule:lx},{register:bb,bindModule:ux},{register:xb},{register:Sb,bindModule:Ax},{register:Ab,bindModule:Mx},{register:kb,bindModule:Ix},{register:Cb,bindModule:Vx},{register:Tb,bindModule:Kx},{register:Mb,bindModule:Jx},{register:wb,bindModule:iS},{register:Eb,bindModule:oS},{register:Bb},{register:Pb,bindModule:dS},{register:Rb,bindModule:fS},{register:Ob,bindModule:_S},{register:Ib},{register:rL}];let hL=!1;const cL=[hC,yC,AC,XR,RC,UC,ZC,rT,pT,xT,wT,DT,NT,JR,ZT,rM,iO];function dL(t){return{getContributions:t}}function uL(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function pL(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=NA();i(a),s(a),n(a),UA(),uL(e,{envParams:r,force:!0})}function gL(t,e){pL(t,"browser",{bindEnv:dO,bindCanvasModules:bR,bindWindowContribution:aO},e)}function fL(t,e){pL(t,"node",{bindEnv:pI,bindCanvasModules:RR,bindWindowContribution:dI},e)}function mL(t){WA(t),function(){if(hL)return;const t=NA();hL=!0,lL.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),nL(t),UA()}(),YA(t),GA(t)}function vL(t){WA(t);const e=NA();cL.forEach((t=>t(e))),sO(e),XA(t,eA),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[])),r=VA();oh.pickerServiceFactory=()=>new UR(i,{},s,n),oh.global=r}(t)}function yL(t){WA(t);bO(NA()),XA(t,AS),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[]));oh.pickerServiceFactory=()=>new fO(i,s,n)}(t)}function _L(){if(_L.__loaded)return;_L.__loaded=!0;const t=m_();_b(),lx({bind:t.bind}),bS?XR(t):_O(t)}_L.__loaded=!1;const bL=_L;function xL(){if(xL.__loaded)return;xL.__loaded=!0;const t=m_();Pb(),dS({bind:t.bind}),JR(t)}xL.__loaded=!1;const SL=xL;function AL(){AL.__loaded||(AL.__loaded=!0,Ib())}AL.__loaded=!1;const kL=AL;class CL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,$_(this.target,i,_o.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class wL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class EL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class BL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const PL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class RL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){X_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){X_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class OL extends RL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=PL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r),this.determineUpdateFunction()}}class IL extends RL{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class LL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class DL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const FL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class zL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=FL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class HL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const jL=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class NL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(X_(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class UL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:jL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class VL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:jL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const WL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class GL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:WL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class YL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:WL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const XL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class KL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:XL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class $L extends NL{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:XL(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const qL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class ZL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class JL extends ZL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=qL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}}class QL extends ZL{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const tD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class eD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nD extends sD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class rD extends sD{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class aD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,$_(this.target,{text:n})}}class oD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lD extends oD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class hD extends oD{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class cD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&q_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),X_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class dD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class uD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const pD={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function gD(t,e){for(let i=0;ipD[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&M_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(X_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class mD{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new w_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function vD(t){return new mD(t)}class yD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;$_(this.target,{text:o})}}class _D extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(q_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),q_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),q_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),q_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;q_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:yD});const i=s._titleBottom.attribute.text;q_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:yD})}else q_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),q_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;q_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());q_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class bD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class xD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(q_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:yD}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:yD}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class SD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class AD extends rb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==AD.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class kD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class CD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==CD.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CD.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TD{static createTempCanvas(t,e,i){return b_.createCanvas({width:t,height:e,dpr:i||b_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=TD.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(TD.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class ED extends CD{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class OD extends CD{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=TD.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class ID extends AD{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=b_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=b_.createCanvas({width:i,height:s,dpr:b_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class LD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}$_(this.target,{textConfig:o})}}class DD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class FD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function ND(t,e){X_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class UD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,q_(this.target,m)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class VD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,q_(this.target,d)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class WD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,q_(this.target,p)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class GD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class YD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}}class XD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:VD,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class KD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:WD,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class $D extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class qD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class ZD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class JD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:qD,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class QD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:ZD,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class tF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),X_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ru(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ru(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class eF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=oh.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Al,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=oh.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Fo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Fo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function lF(t){var e,i;const s=null!==(e=m_().getAll(Cy))&&void 0!==e?e:[],n=aF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;oF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=rF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function hF(t,e){var i,s;const n=null!==(i=m_().getAll(e))&&void 0!==i?i:[],r=aF(t.registry.picker,"vrender:legacy-picker"),a=new Set;oF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=rF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const cF=gL,dF=fL,uF={taro:{installEnv:function(t,e){pL(t,"taro",{bindEnv:yI,bindCanvasModules:LR,bindWindowContribution:mI},e)},loadEnv:_I},feishu:{installEnv:function(t,e){pL(t,"feishu",{bindEnv:EO,bindCanvasModules:AR,bindWindowContribution:gO},e)},loadEnv:BO},tt:{installEnv:function(t,e){pL(t,"tt",{bindEnv:CI,bindCanvasModules:zR,bindWindowContribution:xI},e)},loadEnv:TI},wx:{installEnv:function(t,e){pL(t,"wx",{bindEnv:II,bindCanvasModules:NR,bindWindowContribution:BI},e)},loadEnv:LI},lynx:{installEnv:function(t,e){pL(t,"lynx",{bindEnv:lI,bindCanvasModules:ER,bindWindowContribution:ZO},e)},loadEnv:hI},harmony:{installEnv:function(t,e){pL(t,"harmony",{bindEnv:GO,bindCanvasModules:TR,bindWindowContribution:LO},e)},loadEnv:YO}},pF=[nC,eC,S_,k_,uA,gA],gF=[()=>{w_.registerBuiltInAnimate("increaseCount",aD),w_.registerBuiltInAnimate("fromTo",ab),w_.registerBuiltInAnimate("scaleIn",cD),w_.registerBuiltInAnimate("scaleOut",dD),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL),w_.registerBuiltInAnimate("fadeIn",EL),w_.registerBuiltInAnimate("fadeOut",BL),w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("moveIn",nD),w_.registerBuiltInAnimate("moveOut",rD),w_.registerBuiltInAnimate("rotateIn",lD),w_.registerBuiltInAnimate("rotateOut",hD),w_.registerBuiltInAnimate("update",fD),w_.registerBuiltInAnimate("state",uD),w_.registerBuiltInAnimate("labelItemAppear",_D),w_.registerBuiltInAnimate("labelItemDisappear",bD),w_.registerBuiltInAnimate("poptipAppear",xD),w_.registerBuiltInAnimate("poptipDisappear",SD),w_.registerBuiltInAnimate("inputText",yD),w_.registerBuiltInAnimate("inputRichText",LD),w_.registerBuiltInAnimate("outputRichText",DD),w_.registerBuiltInAnimate("slideRichText",zD),w_.registerBuiltInAnimate("slideOutRichText",FD),w_.registerBuiltInAnimate("slideIn",UD),w_.registerBuiltInAnimate("growIn",VD),w_.registerBuiltInAnimate("spinIn",WD),w_.registerBuiltInAnimate("moveScaleIn",XD),w_.registerBuiltInAnimate("moveRotateIn",KD),w_.registerBuiltInAnimate("strokeIn",GD),w_.registerBuiltInAnimate("slideOut",$D),w_.registerBuiltInAnimate("growOut",qD),w_.registerBuiltInAnimate("spinOut",ZD),w_.registerBuiltInAnimate("moveScaleOut",JD),w_.registerBuiltInAnimate("moveRotateOut",QD),w_.registerBuiltInAnimate("strokeOut",YD),w_.registerBuiltInAnimate("pulse",tF),w_.registerBuiltInAnimate("MotionPath",HD),w_.registerBuiltInAnimate("streamLight",eF),w_.registerBuiltInAnimate("dissolve",wD),w_.registerBuiltInAnimate("grayscale",RD),w_.registerBuiltInAnimate("distortion",ED),w_.registerBuiltInAnimate("particle",OD),w_.registerBuiltInAnimate("glitch",PD),w_.registerBuiltInAnimate("gaussianBlur",BD),w_.registerBuiltInAnimate("pixelation",ID)},fb],fF=[gC,bC,wC,bL,FC,oL,HC,XC,iT,cT,yT,AT,OT,zT,YT,KT,iM,cM,kL,SL];function mF(){pF.forEach((t=>t())),gF.forEach((t=>t()))}function vF(t,e){if(!nF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==b_?void 0:b_.env)?b_.envParams:void 0}(e);return void 0===i?fL(t):dF(t,i),mL(t),yL(t),gI(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}function yF(t,e,i){if(!nF(t,e))return t;const s=uF[e];return s.installEnv(t,i),mL(t),function(t){yL(t)}(t),s.loadEnv(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}const _F=Symbol.for("visactor.vrender.sharedAppRegistry");function bF(){var t;const e=globalThis,i=null!==(t=e[_F])&&void 0!==t?t:new Map;return e[_F]=i,i}function xF(t,e){const i=bF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function SF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=bF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function AF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=xF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(SF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>SF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=xF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&SF(t,i,s))}}}(t,s,r,o)}const kF=$A,CF=[];function TF(t){CF.forEach((({module:e,options:i})=>{kF(e,Object.assign(Object.assign({},i),{app:t}))}))}var MF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),lF(t),hF(t,eA),mF(),t):t}(bA(MF(t,["envParams"])),e);return TF(i),i}var EF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},DF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},FF=(t,e)=>{const i=LF(t),s=DF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},zF=(t,e)=>{const i=AF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,IF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},HF="poptipForText";class jF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(HF))&&this._dedupeStagePlugin(HF)}initView(){var e,i,s,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:u,autoPreventDefault:f,background:m}=this._option,v=FF(l,h);b_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=LF(i.mode),n=FF(i.mode,i.modeParams);return zF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=t.releaseAppRef,null===(e=this._option.runtimePluginInstallers)||void 0===e||e.forEach((e=>e(t.app)));try{this._stage=(_=t.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:p(a)?a:!p(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=tg({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(p(c)?c:bM(l))&&!1!==d&&vB.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,g(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=oR.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!_M(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:b_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>dR(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>dR(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{dR(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===oR.before;(e||i)&&(pM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=oR.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=oR.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),pM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=uR(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=pR(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=pR(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=hR(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=hR(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:gR,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{dR(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===rR.appear))?rR.appear:e.every((t=>t===rR.disappear))?rR.disappear:rR.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===jP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=RP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=RP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:IP(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===jP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===jP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===jP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===jP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===jP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{dR(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=uR(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return _M(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{b_.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{dR(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function NF(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:fM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const UF={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}},VF={poptip:H({},UF)};function WF(t){t.crosshair=Y(t.crosshair||{}).map((e=>uB({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function GF(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}=li(l,i.width,i.height);a=t,o=e}else if(h&&_M(e.mode)){let t;t=y(h)?b_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(xM(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}}const YF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function XF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function KF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function $F(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;YF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function qF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var ZF,JF,QF,tz,ez,iz;t.LayoutZIndex=void 0,(ZF=t.LayoutZIndex||(t.LayoutZIndex={}))[ZF.SeriesGroup=0]="SeriesGroup",ZF[ZF.Axis_Grid=50]="Axis_Grid",ZF[ZF.CrossHair_Grid=100]="CrossHair_Grid",ZF[ZF.Region=450]="Region",ZF[ZF.Mark=300]="Mark",ZF[ZF.Node=400]="Node",ZF[ZF.Axis=100]="Axis",ZF[ZF.MarkLine=500]="MarkLine",ZF[ZF.MarkArea=100]="MarkArea",ZF[ZF.MarkPoint=500]="MarkPoint",ZF[ZF.DataZoom=500]="DataZoom",ZF[ZF.ScrollBar=500]="ScrollBar",ZF[ZF.Player=500]="Player",ZF[ZF.Legend=500]="Legend",ZF[ZF.CrossHair=500]="CrossHair",ZF[ZF.Indicator=500]="Indicator",ZF[ZF.Title=500]="Title",ZF[ZF.Label=500]="Label",ZF[ZF.Brush=500]="Brush",ZF[ZF.CustomMark=500]="CustomMark",ZF[ZF.Interaction=700]="Interaction",t.LayoutLevel=void 0,(JF=t.LayoutLevel||(t.LayoutLevel={}))[JF.Indicator=10]="Indicator",JF[JF.Region=20]="Region",JF[JF.Axis=30]="Axis",JF[JF.DataZoom=40]="DataZoom",JF[JF.Player=40]="Player",JF[JF.ScrollBar=40]="ScrollBar",JF[JF.Legend=50]="Legend",JF[JF.Title=70]="Title",JF[JF.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(QF=t.AttributeLevel||(t.AttributeLevel={}))[QF.Default=0]="Default",QF[QF.Theme=1]="Theme",QF[QF.Chart=2]="Chart",QF[QF.Base_Series=3]="Base_Series",QF[QF.Series=4]="Series",QF[QF.Mark=5]="Mark",QF[QF.User_Chart=6]="User_Chart",QF[QF.User_Series=7]="User_Series",QF[QF.User_Mark=8]="User_Mark",QF[QF.User_SeriesStyle=9]="User_SeriesStyle",QF[QF.Built_In=99]="Built_In";class sz{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,H({},sz.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]))))}}sz.defaultMarkInfo={};class nz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class rz{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=>uB({},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 az extends nz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=rz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new sz,this._lastLayoutRect=null,this.id=AM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new DP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${NB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=vB.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class oz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=tB(iB(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QE(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QE(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QE(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QE(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QE(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QE(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QE(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QE(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QE(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(eB(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class lz extends az{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new oz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(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 hz extends rz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class cz extends lz{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=hz,this.modelType="region",this.specKey="region",this.type=cz.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function dz(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 uz(t,e,i){e?t.forEach((t=>{const e=X(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=X(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 pz(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 gz(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),pz(d,!0,p,l),s&&uz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function fz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=yz(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),pz(d,!1,p,o),s&&uz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function vz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=yz(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=yz(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"left",s),r.length&&gz(r,e,i,!0,"left",s),a.length&&fz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"top",s),r.length&&mz(r,e,i,!0,"top",s),a.length&&vz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"right",s),r.length&&gz(r,e,i,!0,"right",s),a.length&&fz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"bottom",s),r.length&&mz(r,e,i,!0,"bottom",s),a.length&&vz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=yz(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=yz(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:fM)("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}}}_z.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(tz||(tz={})),t.STATE_VALUE_ENUM=void 0,(ez=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",ez.STATE_HOVER="hover",ez.STATE_HOVER_REVERSE="hover_reverse",ez.STATE_DIMENSION_HOVER="dimension_hover",ez.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",ez.STATE_SELECTED="selected",ez.STATE_SELECTED_REVERSE="selected_reverse",ez.STATE_SANKEY_EMPHASIS="selected",ez.STATE_SANKEY_EMPHASIS_REVERSE="blur",ez.STATE_HIGHLIGHT="highlight",ez.STATE_BLUR="blur",ez.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(iz||(iz={}));const bz=["linear","radial","conical"],xz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Sz={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{Sz[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class Az extends nz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class kz extends Az{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,lR.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Sz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(NB)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(NB))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Ow(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class Cz extends nz{constructor(){super(...arguments),this.id=AM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=vB.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Tz extends Cz{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Mz=1e3,wz="quadInOut",Ez=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Bz=(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=Ru(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Pz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ak(t):[],n=ak(e);i&&s&&(i.fromTransform&&ok(s,i.fromTransform.clone().getInverse()),ok(s,i.toTransfrom));const[r,a]=rk(s,n);return t?nk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Oz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Iz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Oz.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Eu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Lz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Pz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Bz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):$_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Dz=(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=Rz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Iz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Lz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wz);return c.play(d),c};class Fz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Pz(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&&Bz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const zz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Ez.includes(t))(i)||(e[i]=t[i])})),e},Hz=(t,e,i)=>{const s=zz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=oh.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},jz=(t,e,i)=>{const s=[],n=i?null:zz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:zz(t.attribute);if("rect"===t.type)ck(t,e).forEach((t=>{s.push(oh.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)dk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)uk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=fk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(oh.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?bk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?gk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&xk(t,e).forEach((t=>{"path"in t?s.push(oh.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Hz(t,s,e),s},Uz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Vz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Uz(l.delay,n,a,o),d=Uz(l.duration,n,a,o),u=Uz(l.oneByOne,n,a,o),p=Uz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(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);Dz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Rz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Iz(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:_o.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Lz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mz,null!==(l=i.easing)&&void 0!==l?l:wz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:_o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Fz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Dz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},Wz=(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))))},Gz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},Yz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},Xz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];Yz(t,a,s)},Kz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));Yz(t,r,i)},$z=Symbol("statesClearedBeforeReInit");class qz extends Cz{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Tz(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=tg("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Al)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===tz.enter||t.context.diffState===tz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&Yz(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new kz(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&uB(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Iw(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=YE(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):bz.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Iw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},xz[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)bz.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return hR(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return vB.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[YB],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=hR(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===rR.appear))?rR.appear:t.every((t=>t===rR.disappear))?rR.disappear:t[0];return null!=e?e:rR.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{Gz(t),s.push(...t.getGraphics())})),e.forEach((t=>{Gz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Vz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=Wz(e,n),r=Wz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===rR.exit?rR.exit:i===rR.update?rR.update:rR.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===tz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===tz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=tz.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=tz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=tz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=rR.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=rR.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return cR(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=cR(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!bz.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!Iw(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,LP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=vB.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=vB.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===oR.before||(this._product||this._initProduct(),pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[$z],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?Xz(i,t,!0,a):Kz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[$z]=e:delete s[$z]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===tz.exit&&!e.isExiting)if(e.context.animationState===tz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===tz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=tg({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[$z]=t.currentStates.slice())}))}}var Zz;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(Zz||(Zz={}));class Jz extends qz{constructor(){super(...arguments),this.type=Jz.type,this._marks=[],this._diffState=tz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(gM("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?(gM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return dR(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===tz.update){const t=this.hasAnimation(),e=LP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=tz.update}render(){this._isCommited&&(pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}Jz.type="group";const Qz={measureText:jB};class tH{static instance(){return tH.instance_||(tH.instance_=new tH),tH.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 eH{constructor(){this.id=AM(),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))?gM("不要重复添加相同的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 iH extends eH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const sH=(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"},nH=(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 rH extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=Za.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Za.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||sH(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=nH(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=Za.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=nH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=sH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Za.now()-i>this.config.press.time&&nH(s[0],t){oh.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class oH extends aH{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 C=oh.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 T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class lH extends aH{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=oh.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 hH extends sb{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&M_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(X_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));$_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const cH={type:"fadeIn"};function dH(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 cH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}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"},state:{duration:300,easing:"linear"}},pH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},gH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},fH=()=>{vB.registerAnimation("scaleInOut",(()=>pH))},mH=()=>{vB.registerAnimation("fadeInOut",(()=>gH))},vH=(t,e)=>({appear:dH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:hH,duration:uH.update.duration,easing:uH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),yH=()=>{vB.registerAnimation("line",vH)},_H=()=>{w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL)},bH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class xH{constructor(t){this._markSet=new sz,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const SH={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class AH extends xH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},SH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}AH.type="element-highlight",AH.defaultOptions=SH;const kH=()=>{vB.registerInteractionTrigger(AH.type,AH)},CH={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class TH extends xH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},CH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),Xz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}TH.type="element-select",TH.defaultOptions=CH;const MH=()=>{vB.registerInteractionTrigger(TH.type,TH)};class wH extends eH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const EH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},BH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...BH(t))})),s},PH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(EH(t,r),!1)};class RH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>vB.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>vB.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>vB.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return vB.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>vB.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){vB.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}static getFunction(t){return t?tH.instance().getFunction(t):null}static getFunctionList(){return tH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=vB.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=vB.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,KP.get(e);var e}static registerSVG(t,e,i){const s=vB.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=vB.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){RB.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=AM(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=fR.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=$F(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?vB.getSeriesBuiltInTheme(e):vB.getComponentBuiltInTheme(e);i=i?uB({},s,i[e]):s}s===t.length-1&&p(i)&&(i=DB({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},Bw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=_M(v);if(S?uO(iA):"node"===v&&gI(iA),S&&f&&(this._container=y(f)?b_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=OB.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=vB.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===i.type&&A.push("scrollbar");const C=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new jF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new GP(this,this._compiler),this._event=new DP(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),RB.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=uB({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=FB(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;RH.getFunctionList()&&RH.getFunctionList().length&&(t=zB(t,RH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=vB.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=vB.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=vB.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return GF(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:UB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:VB})}_initDataSet(t){this._dataSet=t instanceof Fa?t:new Fa,XP(this._dataSet,"dataview",Ia),XP(this._dataSet,"array",s),YP(this._dataSet,"copyDataView",tR);for(const t in vB.transforms)YP(this._dataSet,t,vB.transforms[t]);for(const t in vB.dataParser)XP(this._dataSet,t,vB.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),XF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?rR.none:rR.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,RB.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{EH(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof za?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=iR(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?uB({},t[n][e.index],i):i):t[n]=s?uB({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?uB({},t[n][r],i):i)}else t.id===e&&(t[n]=s?uB({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=uB({},t.getSpec(),e));const r=t.updateSpec(e),a=XF(r),o=KF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=yB({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=IB(this._currentThemeName),this._currentTheme=o(a,l);else{const t=yB({},IB(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),IB(n),IB(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(VF.poptip,UF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!_M(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return IB(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!OB.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield NF(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(!_M(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(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}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)?b_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?sB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 gM("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?sB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(gM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tH.instance().getFunction(t)}registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}getFunctionList(){return tH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=vB.getChartPlugins();t.length>0&&(this._chartPlugin=new iH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=vB.getVChartPlugins();e.length>0&&(this._vChartPlugin=new wH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=fR.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=fR.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}RH.InstanceManager=RB,RH.ThemeManager=OB,RH.globalConfig={uniqueTooltip:!0},RH.Utils=Qz,RH.vglobal=b_;vB.registerRegion("region",cz),vB.registerLayout("base",_z),KT(),HC(),vB.registerMark(Jz.type,Jz),vB.registerStageEventPlugin("gesture",rH),kH(),MH(),MB(cB.name,cB);const OH="monotone",IH="linear",LH="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class DH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function FH(t,e){return e("component",t)}function zH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=vB.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const HH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},jH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},NH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},UH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=zH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},VH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const WH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function GH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=XH(UH(h,r,a,c),d,g),o.value=XH(UH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=UH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function YH(t,e,i,s,n,r,a){if(d(e)){GH(t,e(n,a),i,s,r,a)}else e&&GH(t,e,i,s,r,a)}const XH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class KH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{YH(a,t,e,i,s,n,r)})):d(t)?YH(a,t,e,i,s,n,r):t&&GH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:UH(r.visible,t,n),value:XH(UH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:UH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=UH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&WH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const $H={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},qH=(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=gP([],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 ZH(a,n,o)},ZH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{kM(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=>{kM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=$H[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},JH=(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=>{kM(t[e])||(t[e]=0)}))})),t},QH=`${NB}_HIERARCHY_DEPTH`,tj=`${NB}_HIERARCHY_ROOT`,ej=`${NB}_HIERARCHY_ROOT_INDEX`;function ij(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function sj(t,e,i){t&&(i.needDefaultSeriesField&&(t[XB]=i.defaultSeriesField),t[GB]=e,t[YB]=i.getKey(t,e,i))}function nj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function rj(t,e,i,s=0,n,r){void 0===r&&(r=e),sj(t,e,i),t[QH]=s,t[tj]=n||t[i.categoryField],t[ej]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>rj(e,s,i,t[QH]+1,t[tj],r)))}const aj={label:{name:"label",type:"text"}},oj=`${NB}_rect_x`,lj=`${NB}_rect_x1`,hj=`${NB}_rect_y`,cj=`${NB}_rect_y1`,dj={data:!0},uj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},pj=[...Object.keys(uH),"normal"];function gj(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 _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=uB({},o[e],a);return _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function fj(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),bj(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function mj(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function vj(t,e){var i;return null!==(i=null==t?void 0:t[GB])&&void 0!==i?i:e.context.graphicIndex}function yj(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 _j(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function bj(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),bj(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),bj(t[s],e,i))}function xj(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Sj extends rz{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=OE(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=vB.getSeriesMarkMap(o)?function(t,e,i){const s=vB.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=uB({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return uB({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=uB({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>uB({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Aj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(uj[e]||(t[e]=!0),t)),{}),kj={compileOnlyKeys:uj,dataRelatedKeys:Aj,seriesOnlyKeys:{tooltip:!0}},Cj={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Tj=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,Mj=(t,e,i)=>{const s=Tj(t),n=Tj(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function wj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class Ej extends az{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${NB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Sj,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=xj(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"invalidTravel",JH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=iR(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=eR(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=eR(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Tz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=ZH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){YP(this._dataSet,"dimensionStatistics",qH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new za(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&&gP(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){YP(this._dataSet,"dimensionStatistics",qH);const s=new za(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=gP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&gP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new za(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)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!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,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:bM(s)||xM(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=uB(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=uB(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=bH(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=bH(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=bH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:XB;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:KB,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,KB,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(vB.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new KH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,wj(i))}_getSpecUpdatePolicy(){return kj}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},dj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Mj(t[i],e[i],Cj)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Mj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?wj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&wj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof za||sR(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();xj(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:XB,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WE).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DE(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:XB}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,uB({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:YB}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==ZB&&t!==QB&&t!==qB&&t!==JB||(t=this.getStackValueField()),null!==(e=mP(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>kM(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:XB]}}function Bj(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Ow(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 Pj(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}}}Ej.mark=aj,Ej.transformerConstructor=Sj;class Rj extends Ej{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);Ow(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:`${NB}_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(ZB),this.setFieldX2(qB)):(this.setFieldY(ZB),this.setFieldY2(qB))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(QB),this.setFieldX2(JB)):(this.setFieldY(QB),this.setFieldY2(JB))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(eP),this.setFieldX2(tP)):(this.setFieldY(eP),this.setFieldY2(tP))}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)&&(Bj("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Oj(t){return"bottom"===t||"top"===t}function Ij(t){return"left"===t||"right"===t}function Lj(t){return"z"===t}function Dj(t,e){return qE(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Fj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function zj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Oj(t)?"linear":"band":Oj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Hj=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):["linear","log","symlog"].includes(e)?FH("axisLinear",i):{})&&void 0!==s?s:{},r=Oj(t)?FH("axisX",i):Ij(t)?FH("axisY",i):FH("axisZ",i);return uB({},FH("axis",i),n,r)};class jj{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:fM)("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:fM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Lw(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Oj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Nj extends jj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Uj=(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))},Vj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},Wj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Lw(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:Gj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,Yj=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class Xj extends jj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Uj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:jP.canvas}),callback:this.onMouseOut}),bM(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),bM(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Kj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Kj||(Kj={}));const $j={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qj={sampling:!0,samplingFactor:!0};class Zj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark($j.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:LH,curveType:IH,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===OH?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark($j.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:yj(this._spec,$j.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new za(this._option.dataSet,{name:`${NB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[$j.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,uB({},this._spec[$j.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Jj=Object.assign(Object.assign({},aj),$j),Qj=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>Qj(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},tN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class eN extends qz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return tN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(Iw(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Qj(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[YB]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const iN=new Uint32Array(33),sN=new Uint32Array(33);sN[0]=0,iN[0]=~sN[0];for(let t=1;t<=32;++t)sN[t]=sN[t-1]<<1|1,iN[t]=~sN[t];function nN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&iN[31&o]&sN[1+(31&l)])return!0}else{if(i[h]&iN[31&o])return!0;if(i[c]&sN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,iN[31&o]&sN[1+(31&l)]);else for(s(h,iN[31&o]),s(c,sN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,sN[31&a]|iN[1+(31&o)]);else for(n(l,sN[31&a]),n(h,iN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function rN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function aN(t,e,i=!1){return i?rN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function oN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=aN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=rN(t,r)),e.getRange(r)))}function lN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return lN(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return lN(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 lN(t,e,n,s,h,c)}return!1}const cN=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],dN=["top","inside-top","inside"];function uN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const pN={mode:"same-time",duration:300,easing:"linear"};function gN(t){return 3===t||4===t}function fN(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 mN=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 vN(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)}}class yN extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class _N extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const bN=(t,e)=>Math.ceil(t)>Math.floor(e),xN=([t,e],[i,s])=>s>t&&e>i;function SN(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const AN=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class kN extends Qp{constructor(t,e){super(t),this._skipRenderAttributes=AN,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{MN(t,e,i)})),e}function wN(t,e){e&&(null==t||t.onComplete.push(e))}function EN(t){t.forEach((t=>{t()}))}function BN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var PN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(GM.hover,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(TM(this,(t=>{P(t.states)||(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void TM(this,(t=>{P(t.states)||(t.removeState(GM.selectedReverse),t.removeState(GM.selected))}));P(e.states)||(e.addState(GM.selected,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[vN(g,f,c,d,a,o),vN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=NM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Al)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),EN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(pN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=MN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=MN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}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):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return QM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&bN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&bN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(SN([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!xN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(aN(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;TN(i,null==n?void 0:n.attribute),TN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{ON[t]=e};var LN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};DN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const FN=()=>{IN("line",DN),IN("area",DN)};var zN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}HN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const jN=()=>{IN("symbol",HN),IN("line-data",HN)};class NN extends eN{constructor(){super(...arguments),this.type=NN.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)===PE.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}NN.type="line";const UN=()=>{vB.registerMark(NN.type,NN),KT(),iT(),FN(),jN(),_H(),vB.registerGraphicComponent("line",ag)};class VN extends qz{constructor(){super(...arguments),this.type=VN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}VN.type="symbol";const WN=()=>{vB.registerMark(VN.type,VN),KT(),iM(),jN(),vB.registerGraphicComponent("symbol",Gg)};class GN extends Sj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function YN(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function XN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function KN(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 $N(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 qN(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 ZN(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 JN=t=>t.map(((t,e)=>({index:e,value:t}))),QN=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},tU=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=$M(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return JN(v)};class sU{constructor(t){this.id=AM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class nU extends sU{constructor(){super(nU.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Ow(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&YN(c)&&YN(d)))return;const u=XN(t,c),p=XN(e,d);if(!0===u.break&&!0===p.break)return;const{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(!$N(u,p))return}else if(0===_&&0===b){if(!$N(p,u))return}else if(y||A)if(y&&!A){if(!KN(u,p))return}else if(A&&!y){if(!KN(p,u))return}else{if(f===b)return;if(f>b){if(!qN(u,p))return}else if(!qN(p,u))return}else{if(0===f&&0===_){if(!ZN(u,p))return}else if(0===b&&0===g&&!ZN(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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){YP(e.getOption().dataSet,"tickAlign",iU);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}nU.pluginType="component",nU.type="AxisSyncPlugin";const rU={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function aU(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 oU(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 lU(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const hU=t=>"band"===t||"ordinal"===t||"point"===t;function cU(t,e){return{id:t,label:t,value:e,rawValue:t}}function dU(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class uU extends eH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const pU=`${NB}_ARC_TRANSFORM_VALUE`,gU=`${NB}_ARC_RATIO`,fU=`${NB}_ARC_START_ANGLE`,mU=`${NB}_ARC_END_ANGLE`,vU=`${NB}_ARC_K`,yU=`${NB}_ARC_MIDDLE_ANGLE`,_U=`${NB}_ARC_QUADRANT`,bU=`${NB}_ARC_RADIAN`,xU=-Math.PI/2,SU=3*Math.PI/2,AU=.6,kU=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},CU=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):"linear"===e?FH("axisLinear",i):{})&&void 0!==s?s:{},r=FH("angle"===t?"axisAngle":"axisRadius",i);return uB({},FH("axis",i),n,r)};function TU(t,e,i,s){switch(t){case r.cartesianBandAxis:return Hj(Dj(i,["z"]),"band",e);case r.cartesianLinearAxis:return Hj(Dj(i,["z"]),"linear",e);case r.cartesianLogAxis:return Hj(Dj(i,["z"]),"log",e);case r.cartesianSymlogAxis:return Hj(Dj(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return Hj(Dj(i),void 0,e);case r.polarBandAxis:return CU(i.orient,"band",e);case r.polarLinearAxis:return CU(i.orient,"linear",e);case r.polarAxis:return CU(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>Oj(t.orient)));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>Ij(t.orient)));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return MU(i,FH(t,e));default:return FH(t,e)}}const MU=(t,e)=>{var i;const s=uB({},e,e[Fj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class wU extends rz{getTheme(t,e){return TU(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({},iB(e)),{[s]:0}))}}class EU extends lz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=wU,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof qa||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:jP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new uU(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;EH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=BH(t),s=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}EH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var BU,PU;EU.transformerConstructor=wU,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(BU||(BU={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(PU||(PU={}));class RU extends qz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?EH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(EH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=vB.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(FP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}RU.type="component";const OU=()=>{vB.registerMark(RU.type,RU)};var IU,LU;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(IU||(IU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(LU||(LU={}));const DU={[LU.selectedReverse]:{},[LU.selected]:{},[LU.hover]:{},[LU.hoverReverse]:{}},FU=t=>t,zU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class HU extends EU{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?BU.circleAxis:BU.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?PU.circleAxisGrid:PU.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=gj(null===(h=vB.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&Tw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Ow(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Ow(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return Tw(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=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=Mw(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()})),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(Tw(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||zU[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=wP(s=t.domainLine)).startSymbol=wP(s.startSymbol),s.endSymbol=wP(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(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 PP(uB({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:PP(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return PP(uB({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:PP(t.tick.style)),t.tick.state&&(i.tick.state=EP(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 PP(uB({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:PP(t.subTick.style)),t.subTick.state&&(i.subTick.state=EP(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=rU[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:uB({},d,PP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:PP(h.style)}),h.state&&(i.title.state.shape=EP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:PP(o.style)}),o.state&&(i.title.state.background=EP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=EP(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=PP(t.background.style)),t.background.state&&(i.panel.state=EP(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:HB(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 PP(uB({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:PP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:HB(t.subGrid.alternateColor),style:PP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=zH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){XP(this._option.dataSet,"scale",FU);const i=this.registerTicksTransform();return new za(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===IU.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}HU.specKey="axes";const jU=()=>{OU(),vB.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},NU=[nU];class UU extends HU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{const e=this.getOrient();Oj(e)?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Ij(e)?dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Lj(e)&&dU(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=uB({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(uB({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Oj(this.getOrient()),n=t=>{var e;return(s?!Oj(t.getOrient()):Oj(t.getOrient()))&&Ow(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&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Dj(i,["z"]),Lj(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(!lU(e))return null;const{axisType:t,componentName:s}=zj(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=>Ij(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(!lU(t))return;const{axisType:s,componentName:n}=zj(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=vB.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Oj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Lj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(NU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Oj(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&&!Oj(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Lj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Ij(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Oj(this.getOrient())?t.fieldX:Lj(this.getOrient())?t.fieldZ:t.fieldY,Ow(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(FP.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(Oj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Oj(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return Tw(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]:Oj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Lj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();Tw(this._regions,(e=>{Oj(t)?dU(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Ij(t)?dU(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Lj(t)&&dU(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Oj(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=Oj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=uB(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Oj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return cU(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Ow(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}UU.type=r.cartesianAxis,UU.specKey="axes";class VU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=cU(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=>cU(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const WU=(t,e,i,s)=>{const n=eU(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},GU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,YU=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?JN([s[s.length-1]]):JN([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=WU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=KU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=WU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!GU(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?YU(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function qU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=$U(e,t,!1,!!n),o=$U(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class ZU extends kN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${IU.grid}-sub`:`${IU.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=$U(t,o,!1,!!a)}const u=NM.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=gw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=NM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}ZU.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class JU{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=zM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return FM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class QU extends nb{onBind(){var t;const e=vD(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;TN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class tV extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;TN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function eV(){HC(),iT(),YT(),cM(),w_.registerBuiltInAnimate("axisEnter",QU),w_.registerBuiltInAnimate("axisUpdate",tV)}HC(),cT();class iV extends ZU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},ZU.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=UM,endAngle:r=VM}=this.attribute;i=pw(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function sV(){HC(),iT(),yT(),iM()}function nV(){HC(),iT(),gC(),iM()}G(iV,JU),sV();class rV extends kN{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=NM.line;Y(i)[0].cornerRadius&&(t=NM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=NM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}rV.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}}},nV();class aV extends rV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function oV(){HC(),OT(),iM(),YT(),cM()}var lV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:Y(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+E,i=1===j?(t-e)/2+E+I/2:b[0]+E-(T/2+e/2-E)+I/2;if(V(i,"center"),A){const t=i-I/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-I-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,G=lV(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Al)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},hV.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}hV.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const cV=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(GM.hover,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.hoverReverse,!0)})),s):i},dV=(t,e,i)=>i?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),null):i,uV=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(GM.selected)?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.selectedReverse),t.removeState(GM.selected))})),null):s.name&&!P(s.states)?(s.addState(GM.selected,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.selectedReverse,!0)})),s):i},pV={type:"default",duration:300,easing:"linear"};class gV extends CN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cV(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=NM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),EN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(TM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=MN(this),{delay:a=0,duration:o=pV.duration,easing:l=pV.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};TN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=MN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(pV)}_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=NM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=IU.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=NM.group({x:0,y:0,pickable:!1});t.name=IU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=NM.group({x:0,y:0,pickable:!1});i.name=IU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=NM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=IU.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=YM;else{const t=this.data[s],e=H({},YM,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=NM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=IU.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=YM;else{const i=H({},YM,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=NM.group({x:0,y:0,pickable:!1});return r.name=`${IU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=QM(this._getLabelAttribute(t,e,n,i));if(a.name=IU.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=YM;else{const s=H({},YM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new hV(Object.assign({},e));i.name=IU.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/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 f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},nw.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},TM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=ZA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},TN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const fV={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&&fw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function mV(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function vV(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fV[n]||fV.parity;if(s.length>=3&&mw(s,r)){do{s=a(s,r)}while(s.length>=3&&mw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);fw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),vV(l,s,n,(t=>fw(t,l,r))),vV(h,s,o,(t=>fw(t,h,r)||!(!n||t===l)&&fw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function _V(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},SV(t,e.attribute.angle)),{angle:xV(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({},AV(t,e.attribute.angle)),{angle:xV(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function xV(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function SV(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=xV(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 AV(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=xV(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 kV(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=hw(h),m=lw(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function CV(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var TV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=NM.group({zIndex:999});e.name=IU.axisBreak,e.id=this._getNodeId(`${IU.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},rw,s),a=null!==(e=r.size)&&void 0!==e?e:rw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=NM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=IU.axisBreakSymbol;const h=NM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=IU.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=NM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=IU.background,n.id=this._getNodeId("background"),n.states=H({},DU,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new hV(Object.assign({},t));e.name=IU.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=TV(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},DU,l),symbol:H({},DU,l)});const d=new rV(c);d.name=IU.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=TV(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=HM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},DU,c.text),shape:H({},DU,c.shape),panel:H({},DU,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=TV(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=HM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return SV(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return AV(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=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),bV(i,t),!_V(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=hw(a),l=lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=CV(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=CV(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);kV(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&yV(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(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=NM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=IU.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=qM(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=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}MV.defaultAttributes=nw,G(MV,JU);const wV={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},EV={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}}},BV={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}}},PV={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}}};class RV extends UU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new iE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,XU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Xw(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{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(RV.type,RV,!1)},IV=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function LV(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,FV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function zV(t,e,i="count"){const s=FV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const HV=Math.sqrt(50),jV=Math.sqrt(10),NV=Math.sqrt(2);class UV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=oU(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=Oj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(DV),e.sort(DV),{domain:LV(t,e),scope:zV(t,e,i)}}(r,dM(t),this._spec.breaks[0].scopeType);e=dM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=oU(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=HV?10:n>=jV?5:n>=NV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}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=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function VV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function WV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Ow(t.type))return JN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return JN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=VV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=VV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=VV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=eU(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=eU(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?YV.greedy:YV.parity;for(;l.length>=3&&mw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;fw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),WV(t,l,a,(e=>fw(e,t,i))),WV(n,l,o,(e=>fw(e,n,i)||!(!a||e===t)&&fw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return JN(m)},YV={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&fw(i,t,e)||(i=t,0))))}},XV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class KV extends UU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Lj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Oj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=ZE(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=dM(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}KV.type=r.cartesianLinearAxis,KV.specKey="axes",KV.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(KV,UV);const $V=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(KV.type,KV)},qV=`${NB}_hide_`;function ZV(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const JV=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[qV]&&(ZV(t,!0),t[qV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[qV]=!0,ZV(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},QV=()=>{vB.registerGrammarTransform("symbolOverlap",{transform:JV,runType:"afterEncode"})},tW={min:$,max:K,average:xw,sum:bw};function eW(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function iW(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 sW(t,e,i,s){return iW(t,e,i,"min",s)}function nW(t,e,i,s){return iW(t,e,i,"max",s)}function rW(t,e,i,s){return iW(t,e,i,"average",s)}function aW(t,e,i,s){return iW(t,e,i,"sum",s)}const oW=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=eW;if("min"===n?l=sW:"max"===n?l=nW:"average"===n?l=rW:"sum"===n&&(l=aW),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[]},lW=()=>{vB.registerGrammarTransform("dataSampling",{transform:oW})};class hW extends Rj{constructor(){super(...arguments),this.type=PE.line,this.transformerConstructor=GN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),fj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}hW.type=PE.line,hW.mark=Jj,hW.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},hW.transformerConstructor=GN,G(hW,Zj);class cW{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{sR(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof za)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];gM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];gM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class dW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{CM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{gP(e,[{key:t,operations:Ow(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&&gP(e,[{key:i.field,operations:Ow(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?YE("colorOrdinal"):YE(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(CM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),CM(s.domain)?e.reRender=!0:V(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(!CM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Ow(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Ow(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;Ow(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(Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Ow(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class uW{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&Xz(t,i,!0,l):a&&Xz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&Xz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Kz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Kz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const pW={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},gW={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class fW extends nz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=AM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:UB,height:VB},this._viewRect={width:UB,height:VB},this._viewBox={x1:0,y1:0,x2:UB,y2:VB},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._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(gW).some((t=>!u(e[t])))},this._paddingSpec=iB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new DP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new cW(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new uW;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=vB.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(gj({},fj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=vB.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=vB.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof az)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 qz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof qz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&sR(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=GF(this._spec,this._option,{width:UB,height:VB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DE(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new dW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){$F(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DE(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=iB(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{$F(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);KF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),$F(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);KF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),$F(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(pW[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return pW[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!pW[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;pW[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];$F(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=tB(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(FP.AFTER_MARK_RENDER_END,e)};this._event.on(FP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:IP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(OP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===Kj.dimensionHover||s===Kj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Lw(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Lw(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const mW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},vW={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class yW{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},vW),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):dB(t,a,c.spec),dB(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(vB.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(vB.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=vB.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=vB.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=vB.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):HH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=HH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class _W extends yW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&uB(i,qF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class bW extends _W{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),WF(t)}}const xW=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=vP(t,!0);for(const e in o)for(const i in o[e].nodes)xP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)bP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&_P(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class AW{_beforeInit(){this._dataSet&&YP(this._dataSet,"stackSplit",xW)}_initStack(){this._stack=new SW(this),this._stack.init()}}const kW={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:Kj.dimensionHover};class CW extends xH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},kW,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=IP(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}CW.type="dimension-hover",CW.defaultOptions=kW;const TW=()=>{vB.registerInteractionTrigger(CW.type,CW)},MW=()=>{vB.registerComposedEvent(Kj.dimensionHover,Xj),vB.registerComposedEvent(Kj.dimensionClick,Nj)},wW=t=>t.fieldX[0],EW=t=>t.fieldY[0],BW=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},PW=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},RW=(t,e)=>t?e?wW:BW:e?EW:PW,OW=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=Yj(t,(t=>Oj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=Yj(t,(t=>Ij(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Lw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=IW(t,i,RW(e,Lw(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=IW(t,i,RW(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},IW=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:LW(t,s,i)},LW=(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=Wj(e,t,"cartesian",null!=i?i:Oj(t.getOrient())?wW:EW);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},DW=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Lw(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Ow(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=aU(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};zW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&FW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),FW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=zH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},zW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},HW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=jW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},jW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},NW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return DW(c,r,e),c.xField.cacheInfo?HW(c.xField):c.yField.cacheInfo?HW(c.yField):void 0},UW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],VW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&UW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(WW(s).every((t=>{var e;return!WH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},WW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},GW={dom:`${NB}_TOOLTIP_HANDLER_DOM`,canvas:`${NB}_TOOLTIP_HANDLER_CANVAS`},YW={key:"其他",value:"..."};var XW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(XW||(XW={}));class KW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=VW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},YW),t):YW;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&WH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class $W extends KW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Lw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const qW=()=>{vB.registerTooltipProcessor("dimension",$W)};class ZW extends KW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,yo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(IP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const JW=()=>{vB.registerTooltipProcessor("mark",ZW)};class QW extends KW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const tG=()=>{vB.registerTooltipProcessor("group",QW)};class eG extends fW{constructor(){super(...arguments),this.transformerConstructor=bW,this.type="line",this.seriesType=PE.line}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}eG.type="line",eG.seriesType=PE.line,eG.transformerConstructor=bW,G(eG,AW);const iG=[...tN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class sG extends eN{constructor(){super(...arguments),this.type=sG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return iG}_getIgnoreAttributes(){return[]}}sG.type="area";const nG=()=>{vB.registerMark(sG.type,sG),KT(),wC(),FN(),jN(),_H(),vB.registerGraphicComponent("area",Yp)};class rG extends KH{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 aG=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}}),oG=()=>{vB.registerAnimation("area",vH),yH(),fH()};class lG extends GN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=uB({},f.style,g.style),l.state=uB({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function hG(){HC(),OT()}function cG(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const dG={debounce:St,throttle:At};hG();let uG=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=cG(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:dG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(KM,{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",dG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(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]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};uG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class pG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=pG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(KM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new uG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}SG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class AG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,SG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new SG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,VF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class kG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class CG extends kG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class TG extends kG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function MG(t){t.isBound(AG)||(t.bind(AG).toSelf().inSingletonScope(),t.bind(o_).toService(AG)),t.isBound(CG)||(t.bind(CG).toSelf(),t.bind(Sv).toService(CG)),t.isBound(TG)||(t.bind(TG).toSelf(),t.bind(Sv).toService(TG))}class wG extends kN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}HC(),iT();class EG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HC(),OT();class BG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},BG.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})}}BG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},HC(),gC();class PG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}PG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},HC(),gC();class RG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},RG.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=UM,endAngle:s=VM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}RG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},HC(),cT();class OG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},OG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}OG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class IG{isInValidValue(t){const{startAngle:e=UM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=UM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return uw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function LG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=LG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var zG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=NM.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=NM.circle(t)}h.name=IU.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},DU,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=zG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=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:y,textAlign:"center"},l),state:{text:H({},DU,d.text),shape:H({},DU,d.shape),panel:H({},DU,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=LG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&DG(e,c,i)}else e.AABBBounds.width()>r&&DG(e,r,i)}else o>a.x&&h.x2>n.x2?(DG(e,n.x2-o,i),r&&FG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}HG.defaultAttributes=nw,G(HG,IG);const jG=(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=$M(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=dw(r,uw(s,r,e,n));return o=a,l=uw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return JN(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=jG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=UG(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 JN(c)},UG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&QN(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var VG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new YG(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):gN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=gN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=gN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=gN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?gN(t.quadrant)?"left":"right":gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.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*(gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),EN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}$G.defaultAttributes={pickable:!1};var qG,ZG,JG,QG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(tY,IG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(qG||(qG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(ZG||(ZG={})),function(t){t.dataZoomChange="dataZoomChange"}(JG||(JG={}));const eY="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",iY={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:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},sY={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}},nY=0,rY=1,aY=2,oY=3,lY=4,hY=5,cY=5,dY=999,uY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var pY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:aY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:aY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:nY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:hY},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:hY},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},sY.horizontal),{zIndex:hY}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},sY.horizontal),{zIndex:hY}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:hY},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:hY},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},sY.vertical),{zIndex:hY}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:hY},sY.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:rY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:lY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return qA(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=pY(c,["formatMethod"]),{formatMethod:g}=d,f=pY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:uY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:uY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:uY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:uY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:cY}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:cY}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new hV(e),s.name=i,t.add(s)),s}}const fY={debounce:St,throttle:At};class mY extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=qG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=qG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=qG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=cG();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===qG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===qG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===qG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===qG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(ZG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===qG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:fY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=cG();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=qG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}oV(),OT(),iM(),wC(),iT();let vY=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new gY(this._getRendererAttrs()),this._interaction=new mY(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(ZG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(ZG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(JG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(ZG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(JG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var yY,_Y,bY,xY;function SY(){HC(),oV(),fb()}vY.defaultAttributes=iY,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"}(yY||(yY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(_Y||(_Y={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(bY||(bY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xY||(xY={}));class AY extends kN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cV(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(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:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},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=NM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=NM.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=NM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),EN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=MN(this);this.markerAnimate("exit");const n=MN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function kY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function CY(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;TN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function TY(t,e,i,s){t&&(CY(t.startSymbol,e,i,s),kY(t).forEach((t=>CY(t,e,i,s))),CY(t.endSymbol,e,i,s))}function MY(t,e,i,s){t&&(CY(t.getTextShape(),e,i,s),CY(t.getBgRect(),e,i,s))}function wY(t,e,i,s){var n,r,a,o;t&&(TN(t,{fillOpacity:0,strokeOpacity:0},{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 EY(t,e,i,s){t&&(wY(t.startSymbol,e,i,s),kY(t).forEach((t=>wY(t,e,i,s))),wY(t.endSymbol,e,i,s))}function BY(t,e,i,s){t&&(wY(t.getTextShape(),e,i,s),wY(t.getBgRect(),e,i,s))}function PY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;CY(t.startSymbol,s,r,n);const h=kY(t);h.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),CY(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;CY(t.getTextShape(),e,l,n),CY(t.getBgRect(),e,l,n)}))}function RY(t,e,i,s,n){TY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function OY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function IY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function LY(t,e,i,s,n,r){var a;TY(t,n,s,r),CY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?MY(i,n,s,r):CY(i,n,s,r)}function DY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;CY(t.startSymbol,n,o,r);const u=kY(t);u.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),CY(e,n+o+l,h,r),CY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(CY(i.getTextShape(),n+o+l+h+c,d,r),CY(i.getBgRect(),n+o+l+c,d,r)):CY(i,n+o+l+c,d,r)}function FY(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?PY(t,e,s,r,a):"fadeIn"===i&&RY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?PY(t,e,s,n,a):"fadeIn"===i&&RY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){EY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function zY(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&&OY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&OY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function HY(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&&IY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&IY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function jY(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?LY(n,r,e,i,s,o):"callIn"===t&&DY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?LY(n,r,e,i,s,a):"callIn"===t&&DY(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;EY(t,n,s,r),wY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?BY(i,n,s,r):wY(i,n,s,r)}(n,r,e,t,i,s)}}const NY={type:"clipIn",duration:500,easing:"linear",delay:0},UY={type:"fadeIn",duration:500,easing:"linear",delay:0},VY={type:"callIn",duration:500,easing:"linear",delay:0},WY={type:"fadeOut",duration:500,easing:"linear",delay:0};class GY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new hV(Object.assign(Object.assign({},h),{state:{panel:H({},YM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},YM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},YM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},YM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class YY extends AY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=NY,this.defaultExitAnimation=WY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;sw(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(YY,GY);const XY=.001,KY={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:yY.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]}},$Y={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"}}},qY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:bY.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]}},ZY={interactive:!0,label:{position:_Y.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}},JY={interactive:!0,label:{autoRotate:!0,position:bY.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}},QY={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"}},tX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},eX={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 iX(){sX._animate=FY}SY(),sV(),fb();class sX extends YY{markerAnimate(t){sX._animate&&this._animationConfig&&sX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},sX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(wM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return EM(Math.abs(e),Math.PI/2,XY)||EM(Math.abs(e),3*Math.PI/2,XY)?BM(i,e,t):wM(e)?$Y.postiveXAxis[t]:$Y.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new rV({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",sX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(sX.defaultAttributes.label)}}function nX(){rX._animate=zY}sX.defaultAttributes=KY,SY(),yT(),fb();class rX extends AY{markerAnimate(t){rX._animate&&this._animationConfig&&rX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},tX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=NM.polygon(Object.assign({points:e},i));n.states=H({},YM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",rX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},YM,null==i?void 0:i.area)),this._updateMarkLabels(rX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}rX.defaultAttributes=ZY,G(rX,GY),SY(),nV(),fb();class aX extends YY{markerAnimate(t){aX._animate&&this._animationConfig&&aX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},aX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case bY.arcInnerStart:l=n;case bY.arcOuterStart:l=n;break;case bY.arcInnerEnd:l=r;case bY.arcOuterEnd:l=r;break;case bY.center:case bY.arcInnerMiddle:case bY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return QY[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new aV({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",aX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(aX.defaultAttributes.label)}}aX.defaultAttributes=qY,SY(),gC(),fb();class oX extends AY{markerAnimate(t){oX._animate&&this._animationConfig&&oX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},oX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case bY.center:h=(s+n)/2,c=(r+a)/2;break;case bY.arcInnerStart:h=s,c=r;break;case bY.arcOuterStart:h=n,c=r;break;case bY.arcInnerEnd:h=s,c=a;break;case bY.arcOuterEnd:h=n,c=a;break;case bY.arcInnerMiddle:h=s,c=(r+a)/2;break;case bY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},QY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=NM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},YM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",oX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},YM,null==o?void 0:o.area)),this._updateMarkLabels(oX.defaultAttributes.label)}isValidPoints(){return!0}}function lX(){hX._animate=jY}oX.defaultAttributes=JY,G(oX,GY),SY(),sV(),nV(),iM(),XC(),iT(),fb();class hX extends AY{markerAnimate(t){hX._animate&&this._animationConfig&&hX._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},hX.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=VY,this.defaultExitAnimation=WY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return EM(Math.abs(s),Math.PI/2,XY)||EM(Math.abs(s),3*Math.PI/2,XY)?BM(t,s,n):wM(s)?eX.postiveXAxis[n]:eX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=xY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},YM,null==p?void 0:p.textBackground),text:H({},YM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},YM,null==p?void 0:p.itemContent));const v=wM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=NM.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"text"===n?o=new hV(Object.assign(Object.assign({},i),{state:{panel:H({},YM,null==s?void 0:s.textBackground),text:H({},YM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=NM.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"image"===n?(o=NM.image(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},YM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=EM(c,0,XY)||EM(d,0,XY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=ew(e-u,t-d),o=ew(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(yX.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(yX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===yX.focus||"focus"===o){const s=a.hasState(mX.focus);a.toggleState(mX.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover,mX.focus],t),this._setLegendItemState(e,mX.selected,t)})):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover,mX.focus],t),this._setLegendItemState(e,mX.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(mX.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(mX.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(vX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[mX.selected,mX.selectedHover],t),this._setLegendItemState(a,mX.unSelected,t)):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t))}else this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover],t),this._setLegendItemState(e,mX.unSelected,t))}))}this._dispatchLegendEvent(vX.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,mX.selected),this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover])):(this._removeLegendItemState(e,[mX.selected,mX.selectedHover]),this._setLegendItemState(e,mX.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=pX,spaceRow:l=gX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=NM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=NM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,yX.item,t,M)):(M=NM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,yX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?mX.selected:mX.unSelected);const w=NM.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=NM.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,yX.itemShape,t,M,S.state),s.addState(e?mX.selected:mX.unSelected),w.add(s)}let I=0;if(d){const e=R(g,"size",10);E=NM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,yX.focus,t,M),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=QM(Object.assign(Object.assign({x:P/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,yX.itemLabel,t,M,A.state),D.addState(e?mX.selected:mX.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=QM(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,yX.itemValue,t,M,k.state),r.addState(e?mX.selected:mX.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-O-I),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.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 j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new uX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new uX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new uG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new uG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=pX,spaceRow:o=gX}=n,l=this._itemsContainer,{space:h=fX,defaultCurrent:c=1}=r,d=SX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=NM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=pX,spaceRow:a=gX}=s,o=this._itemsContainer,{space:l=fX,defaultCurrent:h=1}=n,c=SX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=NM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=NM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(mX.selected)?this._setLegendItemState(t,mX.selectedHover,e):this._setLegendItemState(t,mX.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===yX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(vX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(mX.unSelectedHover)||t.hasState(mX.selectedHover))&&(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(mX.unSelectedHover)&&!t.hasState(mX.selectedHover)||(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===yX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(vX.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!==yX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(vX.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!==yX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(mX.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},AX,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(mX.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var CX;function TX(t){return _(t)?t:[t,t]}function MX(t){return t?"ew-resize":"ns-resize"}kX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:pX,spaceRow:gX,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:fX,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"}(CX||(CX={})),bX();class wX extends kN{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:H({},wX.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=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(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?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:TX(d)[0],endValue:TX(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=NM.group({x:0,y:0});f.name=CX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=NM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=CX.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=NM.group({x:g?v:0,y:g?0:v});f.add(y);const _=NM.group({x:0,y:0});let b;if(_.name=CX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=NM.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=CX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=NM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=CX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=TX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(v.name=CX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=CX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(i.name=CX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=CX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=NM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=CX.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":MX(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=NM.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=CX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return NM.symbol(t)}_renderHandlerText(t,e){return NM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":MX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=NM.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=NM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===CX.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===CX.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===CX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===CX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}wX.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}}},xX(),bX();class EX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 BX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}EX.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"}}},xX(),bX(),cT();class PX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PX.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=NM.group({x:0,y:0});this._innerView.add(x);const S=new wX({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:BX(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 C=NM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);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))}}PX.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)"}},HC(),cM(),YT();let RX=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},XM),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,O-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},XM),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GO&&(G=O),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(I)||p(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(I)||p(M.align)){const t=M.align?M.align:I,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};RX.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 OX={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"}}};HC(),cM(),YT();let IX=class extends kN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(OX,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=QM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=qM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&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 LX extends Wg{constructor(t){super(t)}}var DX,FX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(DX||(DX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(FX||(FX={}));class zX extends kN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},zX.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"},zX.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"},zX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.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 LX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new LX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new LX(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(DX.OnPlay)},this.pause=()=>{this._dispatchEvent(DX.OnPause)},this.forward=()=>{this._dispatchEvent(DX.OnForward)},this.backward=()=>{this._dispatchEvent(DX.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()}}zX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},zX.defaultAttributes={[FX.Start]:{},[FX.Pause]:{},[FX.Backward]:{},[FX.Forward]:{}};const HX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},jX=[200,10];var NX,UX;!function(t){t.Default="default",t.Reverse="reverse"}(NX||(NX={})),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"}(UX||(UX={}));const VX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),WX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),GX=t=>"top"===t||"bottom"===t;class YX extends kN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YX.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(GX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:jX[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:jX[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 wX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=GX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new zX(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=GX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:jX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(GX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(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:GX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:GX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function XX(){bX(),HC(),iM()}YX.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({},HX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},HX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},HX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},HX),{key:"backward",position:"start"})}},XX();class KX extends YX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},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:NX.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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(VX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||WX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===NX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(UX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(UX.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(UX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.change),this.dispatchCustomEvent(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var $X,qX=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())}))};XX();class ZX extends YX{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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change))},this.play=()=>qX(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(UX.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.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(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}($X||($X={}));const JX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},QX=5;const tK={debounce:St,throttle:At};HC(),yT();let eK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=JX.updateTrigger,endTrigger:i=JX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:tK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=JX.trigger,resetTrigger:i=JX.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent($X.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent($X.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=QX}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent($X.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent($X.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent($X.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=QX}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=JX.updateTrigger,endTrigger:s=JX.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=NM.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};eK.defaultAttributes=JX;const iK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},sK=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}},nK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},rK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];HC(),OT(),iM(),cM(),YT();let aK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},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=oi(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",H({symbolType:"circle"},u.shape,{visible:MM(u)&&MM(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:MM(u)&&MM(u.value)},sK(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:MM(u)&&MM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:MM(u)&&MM(u.value)},sK(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},XM),u.value),visible:MM(u)&&MM(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=MM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=MM(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]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!MM(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)+(MM(n.key)?r+n.key.spacing:0)+(MM(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&&(tw(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:MM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),tw(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(MM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(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(MM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},sK(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},sK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},XM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(MM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},sK(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},sK(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=>rK.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)&&MM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=MM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=$M(d),y=$M(u);let _=0;if(MM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(MM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return iK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return iK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};aK.defaultAttributes=nK;class oK extends KV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{Oj(this.getOrient())?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=uB({},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 za(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Tz(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.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=>cU(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=>cU(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}oK.type=r.cartesianTimeAxis,oK.specKey="axes",oK.builtInTheme={axis:EV,axisX:BV,axisY:PV};class lK extends KV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new ME}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}lK.type=r.cartesianLogAxis,lK.specKey="axes",lK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(lK,UV);class hK extends KV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new wE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}hK.type=r.cartesianSymlogAxis,hK.specKey="axes",hK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(hK,UV);class cK extends Rj{constructor(){super(...arguments),this.type=PE.area,this.transformerConstructor=lG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(cK.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===OH?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XE(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XE(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[ZB]},"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(gj(null===(e=vB.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),fj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),fj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new rG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}cK.type=PE.area,cK.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},cK.mark=aG,cK.transformerConstructor=lG,G(cK,Zj);class dK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(t)}}class uK extends fW{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="area",this.seriesType=PE.area}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}uK.type="area",uK.seriesType=PE.area,uK.transformerConstructor=dK,G(uK,AW);function pK(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 gK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:pK(t,e)}),fK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:pK(t,e)}),mK={type:"fadeIn"},vK={type:"growCenterIn"};function yK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mK;case"scaleIn":return vK;default:return gK(t)}}class _K extends qz{constructor(){super(...arguments),this.type=_K.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}_K.type="rect";const bK=()=>{KT(),OT(),IN("rect",WG),vB.registerMark(_K.type,_K),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),vB.registerGraphicComponent("rect",mg)},xK=Object.assign(Object.assign({},aj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function SK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=nB(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[oj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):XE(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[lj]):XE(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=XE(this._dataToPosX(t),e,i),n=XE(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[hj]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XE(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[cj]):XE(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=XE(this._dataToPosY(t),e,i),n=XE(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),CK)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},TK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:yj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(TK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}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(YP(this._option.dataSet,"addVChartProperty",NH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};YP(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new za(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new Tz(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_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=cj,s=hj,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=lj,s=oj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=vP(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)SK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=XE(this[r](t),l,i),u=XE(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!KE(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[qB],n=e[ZB],r=e[JB],d=e[QB];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?hj:oj],i=e[a?cj:lj];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[qB]:s,[ZB]:o}),c?{[JB]:u,[QB]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(mg(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>XE(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>XE(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Pj(this);this._barMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),fj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=nB(this._spec.barWidth,a)),l&&(c=Math.max(c,nB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,nB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=nB(null!==(l=i[r-1])&&void 0!==l?l:X(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 _=Ow(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}TK.type=PE.bar,TK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},TK.mark=xK,TK.transformerConstructor=kK;const MK=()=>{lW(),bK(),vB.registerAnimation("bar",((t,e)=>({appear:yK(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),OV(),$V(),vB.registerSeries(TK.type,TK)};class wK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(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 EK extends fW{constructor(){super(...arguments),this.transformerConstructor=wK,this.type="bar",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}EK.type="bar",EK.seriesType=PE.bar,EK.transformerConstructor=wK,G(EK,AW);const BK=[10,20],PK=Pw.Linear,RK="circle",OK=Pw.Ordinal,IK=["circle","square","triangle","diamond","star"],LK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},DK=Object.assign(Object.assign({},aj),{point:{name:"point",type:"symbol"}});class FK extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const zK={sizeField:!0};class HK extends Rj{constructor(){super(...arguments),this.type=PE.scatter,this.transformerConstructor=FK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),zK)})}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=`${NB}_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=`${NB}_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:PK,defaultRange:BK},"size")}getShapeAttribute(t,e){return u(e)?RK:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:OK,defaultRange:IK},"shape")}initMark(){this._symbolMark=this._createMark(HK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,HK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Pj(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(gj(null===(i=vB.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),fj("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:RK},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}HK.type=PE.scatter,HK.mark=DK,HK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},HK.transformerConstructor=FK;const jK=()=>{WN(),vB.registerAnimation("scatter",((t,e)=>Object.assign({appear:LK(0,e)},pH))),OV(),$V(),vB.registerSeries(HK.type,HK)};class NK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class UK extends fW{constructor(){super(...arguments),this.transformerConstructor=NK,this.type="scatter",this.seriesType=PE.scatter}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}UK.type="scatter",UK.seriesType=PE.scatter,UK.transformerConstructor=NK,G(UK,AW);class VK extends Ej{constructor(){super(...arguments),this.type=PE.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=`${NB}_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 WK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[GB]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[pP]=a||r})),s};class GK extends KH{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 YK extends qz{constructor(){super(...arguments),this.type=YK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}YK.type="path";const XK=()=>{vB.registerMark(YK.type,YK),KT(),cT(),vB.registerGraphicComponent("path",hg)},KK=Object.assign(Object.assign({},aj),{area:{name:"area",type:"path"}});class $K{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ua(i,e):ja[i]?(Ha[i]||(Ha[i]=Ua(i,ja[i])),Ha[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class qK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class ZK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function JK(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:qK}:bM(e)||xM(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:ZK}:null}const QK={debounce:St,throttle:At};class t${constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=bM(this._renderMode)||xM(this._renderMode),JK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return JK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,QK[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,QK[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){JK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:NP.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:NP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=QK[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=QK[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:NP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp)}))}}class e$ extends EU{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${NB}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=uB(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new $K(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===PE.map||e.type===PE.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),Tw(this._regions,(t=>{var e;if(t.type===PE.map||t.type===PE.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==PE.map&&e.type!==PE.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[pP],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}e$.type=r.geoCoordinate,G(e$,t$);const i$=()=>{vB.registerComponent(e$.type,e$)};class s$ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class n$ extends VK{constructor(){super(...arguments),this.type=PE.map,this.transformerConstructor=s$,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 !`),KP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),YP(this._dataSet,"copyDataView",tR),YP(this._dataSet,"map",WK),YP(this._dataSet,"lookup",jH);const s=KP.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new za(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:pP,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new Tz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(n$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:yj(this._spec,n$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:XB])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:XB]):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(gj(null===(t=vB.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),fj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new GK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[GB]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[GB],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return GB}getActiveMarks(){return[this._pathMark]}}n$.type=PE.map,n$.mark=KK,n$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},n$.transformerConstructor=s$;const r$=`${NB}_waterfall_default_seriesField`,a$=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[nP]=!0:delete t[nP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=o$([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}=l$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=o$(r,t,s,o,u,c,e,i),o.push(s)})),o};function o$(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}=l$(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===r$)&&(t[r$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function l$(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?gM("total.collectCountField error"):n=e[a].start;o<0?gM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const h$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},c$={type:"fadeIn"},d$={type:"growCenterIn"};function u$(t,e){switch(e){case"fadeIn":return c$;case"scaleIn":return d$;default:return gK(t,!1)}}class p$ extends qz{constructor(){super(...arguments),this.type=p$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return ag(t)}}p$.type="rule";const g$=()=>{vB.registerMark(p$.type,p$),KT(),iT(),vB.registerGraphicComponent("line",ag)},f$=Object.assign(Object.assign({},xK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),m$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:v$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function v$(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)=>v$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y${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 za(e instanceof Fa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),YP(e,"dimensionTree",m$),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 _$ extends kK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const b$={rect:T$,symbol:k$,arc:w$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=k$(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:E$,line:B$,area:B$,rect3d:T$,arc3d:w$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function x$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=b$[t])&&void 0!==i?i:b$.point;return e.series.type===PE.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=A$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:P$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function S$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==PE.sankey){const{formatFunc:t,args:n}=zH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function A$(t){return d(t)?e=>t(e.data):t}function k$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=A$(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:C$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function C$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function T$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=A$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:M$(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function M$(t){const e=[{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"]}}];return e}function w$(t){var e;const{labelSpec:i}=t,s=null!==(e=A$(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 E$(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=S$(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),Jg(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 B$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[XB]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function P$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const R$={calculationMode:!0};class O$ extends TK{constructor(){super(...arguments),this.type=PE.waterfall,this.transformerConstructor=_$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&_P(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),R$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y$(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=r$)}getSeriesKeys(){return this._seriesField===r$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),YP(this._dataSet,"waterfallFillTotal",h$),YP(this._dataSet,"waterfall",a$),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=eR(this.getViewData(),this._dataSet,{name:`${NB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Tz(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:qB,endAs:ZB,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Pj(this);this._barMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),fj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(O$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return E$(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?XE(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):XE(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&KE([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}O$.type=PE.waterfall,O$.mark=f$,O$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},O$.transformerConstructor=_$;const I$=()=>{g$(),bK(),vB.registerAnimation("waterfall",((t,e)=>({appear:u$(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(O$.type,O$)},L$=`${NB}_BOX_PLOT_OUTLIER_VALUE`;var D$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(D$||(D$={}));const F$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[L$]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class z$ extends KH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return this.series.getOutliersField();if(t===D$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case D$.MIN:return this.series.getMinField();case D$.MAX:return this.series.getMaxField();case D$.MEDIAN:return this.series.getMedianField();case D$.Q1:return this.series.getQ1Field();case D$.Q3:return this.series.getQ3Field();case D$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return e[L$];if(t===D$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case D$.MIN:return e[this.series.getMinField()];case D$.MAX:return e[this.series.getMaxField()];case D$.MEDIAN:return e[this.series.getMedianField()];case D$.Q1:return e[this.series.getQ1Field()];case D$.Q3:return e[this.series.getQ3Field()];case D$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[L$])}getDefaultContentList(t){return[{key:this.getContentKey(D$.OUTLIER),value:this.getContentValue(D$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(D$.MAX),value:this.getContentValue(D$.MAX)},{key:this.getContentKey(D$.Q3),value:this.getContentValue(D$.Q3)},{key:this.getContentKey(D$.MEDIAN),value:this.getContentValue(D$.MEDIAN)},{key:this.getContentKey(D$.Q1),value:this.getContentValue(D$.Q1)},{key:this.getContentKey(D$.MIN),value:this.getContentValue(D$.MIN)},{key:this.getContentKey(D$.SERIES_FIELD),value:this.getContentValue(D$.SERIES_FIELD)}]}}const H$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class j$ extends qz{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==tz.enter&&t.context.diffState!==tz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{H$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Zp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=vB.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const N$=()=>{vB.registerGraphicComponent("glyph",Zp),KT(),FC()},U$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],V$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class W$ extends j${constructor(){super(...arguments),this.type=W$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=U$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=V$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}W$.type="boxPlot";const G$=Object.assign(Object.assign({},aj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),Y$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},X$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},K$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),$$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=K$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=K$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=K$(t,"box").attribute.width,i=K$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=K$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=K$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=K$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=K$(t,"box").attribute.height,i=K$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},q$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=K$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=K$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=K$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=K$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=K$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=K$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=K$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=K$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=K$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class Z$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return Y$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class J$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return X$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class Q$ extends Z${computeAttribute(){return Y$(q$)(this.target,this.params,this.params.options)}}class tq extends J${computeAttribute(){return X$(q$)(this.target,this.params,this.params.options)}}class eq extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const iq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class sq extends Rj{constructor(){super(...arguments),this.type=PE.boxPlot,this.transformerConstructor=eq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),iq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(sq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(sq.mark.outlier,{key:GB,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}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=>XE(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XE(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XE(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XE(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XE(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"foldOutlierData",F$),YP(this._dataSet,"addVChartProperty",NH);const t=new za(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${NB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._outlierData=new Tz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=nB(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,nB(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,nB(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=nB(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Ow(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Pj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=vB.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(fj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(gj(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(gj(null===(a=vB.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new z$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}sq.type=PE.boxPlot,sq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},sq.mark=G$,sq.transformerConstructor=eq;const nq=()=>{N$(),iT(),OT(),vB.registerGraphicComponent("line",(t=>ag(t))),vB.registerGraphicComponent("rect",(t=>mg(t))),vB.registerMark(W$.type,W$),WN(),fH(),OV(),$V(),w_.registerBuiltInAnimate("boxplotScaleIn",Z$),w_.registerBuiltInAnimate("boxplotScaleOut",J$),w_.registerBuiltInAnimate("barBoxplotScaleIn",Q$),w_.registerBuiltInAnimate("barBoxplotScaleOut",tq),vB.registerSeries(sq.type,sq)};class rq extends qz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=rq.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?jg(t):Jg(t)}}rq.type="text";const aq=()=>{vB.registerMark(rq.type,rq),KT(),cM(),YT(),vB.registerGraphicComponent("text",Jg),vB.registerGraphicComponent("richtext",jg)};class oq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const lq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),hq={type:"fadeIn"},cq=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function dq(t,e){return"fadeIn"===e?hq:lq(t)}const uq=Object.assign(Object.assign({},xK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class pq extends kK{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 gq extends TK{constructor(){super(...arguments),this.type=PE.rangeColumn,this._barMarkType="rect",this._barName=PE.bar,this.transformerConstructor=pq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(gq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,gq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(gq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(gq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Pj(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(gj(null===(i=vB.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),fj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(gj(null===(n=vB.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),fj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new oq(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)}}gq.type=PE.rangeColumn,gq.mark=uq,gq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},gq.transformerConstructor=pq;const fq=()=>{bK(),aq(),vB.registerAnimation("rangeColumn",((t,e)=>({appear:dq(t,e),enter:lq(t),exit:cq(t),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(gq.type,gq)};var mq,vq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(mq||(mq={})),function(t){t.middle="middle",t.start="start",t.end="end"}(vq||(vq={}));class yq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const _q=Object.assign({},aG);class bq extends cK{constructor(){super(...arguments),this.type=PE.rangeArea}initMark(){this._areaMark=this._createMark(bq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new yq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}bq.type=PE.rangeArea,bq.mark=_q;class xq extends Ej{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=AU,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Ow(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:[]};Ow(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)&&Bj(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Sq(t){return kM(t)?Number.parseFloat(t):0}const Aq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&kq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[pU],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[pU]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},kq=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===Sq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Sq(i[e])),0)));function Cq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const Tq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Cq(t,!0,rR.appear)}),Mq={type:"fadeIn"},wq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Cq(t,!0,rR.enter)}),Eq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Cq(t,!0,rR.exit)});function Bq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Mq;case"growRadius":return Tq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Tq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Pq extends qz{constructor(t,e){super(t,e),this.type=Rq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[yU])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Rq extends Pq{constructor(){super(...arguments),this.type=Rq.type}}Rq.type="arc";const Oq=()=>{KT(),gC(),IN("arc",XG),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),vB.registerGraphicComponent("arc",Vp),vB.registerMark(Rq.type,Rq)},Iq=Object.assign(Object.assign({},aj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Lq extends Sj{_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=uB({},this._theme,i,t);const n=(t,e)=>uB({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Dq=`${NB}_LABEL_VISIBLE`,Fq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},zq={outerRadius:!0};class Hq extends xq{constructor(){super(...arguments),this.transformerConstructor=Lq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:QE(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:QE(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=xU,this._endAngle=SU,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[yU];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;YP(this._dataSet,"pie",Aq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:fU,asEndAngle:mU,asRatio:gU,asMiddleAngle:yU,asRadian:bU,asQuadrant:_U,asK:vU,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Hq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ew(fU)(t)}endAngleScale(t){return Ew(mU)(t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$E(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$E(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ew(Dq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),zq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Fq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[yU];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===rR.appear)return this._startAngle;if(i===rR.disappear)return this._endAngle;const r=[rR.disappear,rR.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[GB];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=gj(null===(i=vB.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Hq.transformerConstructor=Lq,Hq.mark=Iq,Hq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class jq extends Hq{constructor(){super(...arguments),this.type=PE.pie}}jq.type=PE.pie;const Nq=()=>{Oq(),vB.registerAnimation("pie",((t,e)=>({appear:Bq(t,e),enter:wq(t),exit:Eq(t),disappear:{duration:uH.disappear.duration}}))),vB.registerAnimation("emptyCircle",((t,e)=>({appear:Bq(t,e)}))),vB.registerSeries(jq.type,jq)};function Uq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const Vq=t=>({type:Uq(t.growField),options:{overall:!0}}),Wq={type:"fadeIn"},Gq=t=>({type:Uq(t.growField)}),Yq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function Xq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Wq;case"growAngle":return Vq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return Vq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const Kq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class $q extends xq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Kq)})}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(ZB),this.setInnerRadiusField(qB)}setValueFieldToPercent(){this.setRadiusField(QB),this.setInnerRadiusField(JB)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const qq=Object.assign(Object.assign({},aj),{rose:{name:"rose",type:"arc"}});class Zq extends Sj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class Jq extends HU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=vB.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=xU,this._endAngle=SU,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QE(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QE(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:aU(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Ow(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>cU(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=AU,e=0;const i=this.getChart().getSpec();return Tw(this.getRegions(),(s=>{const n=s;if(r=n.type,[PE.rose,PE.radar,PE.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(uB({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(uB({},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)}}Jq.type=r.polarAxis,Jq.specKey="axes";const Qq={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},tZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class eZ extends Jq{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}eZ.type=r.polarLinearAxis,eZ.specKey="axes",eZ.builtInTheme={axis:EV,axisLinear:XV,axisAngle:tZ,axisRadius:Qq},G(eZ,UV);const iZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(eZ.type,eZ)};class sZ extends Jq{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new iE}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,NG),t}transformScaleDomain(){}}sZ.type=r.polarBandAxis,sZ.specKey="axes",sZ.builtInTheme={axis:EV,axisBand:wV,axisAngle:tZ,axisRadius:Qq},G(sZ,VU);const nZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(sZ.type,sZ)};class rZ extends $q{constructor(){super(...arguments),this.type=PE.rose,this.transformerConstructor=Zq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(rZ.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,rZ.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XE(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XE(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(gj(null===(i=vB.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),fj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}rZ.type=PE.rose,rZ.mark=qq,rZ.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},rZ.transformerConstructor=Zq;const aZ=()=>{vB.registerSeries(rZ.type,rZ),Oq(),vB.registerAnimation("rose",((t,e)=>({appear:Xq(t,e),enter:Gq(t),exit:Yq(t),disappear:{duration:uH.disappear.duration}}))),nZ(),iZ()};class oZ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,vw(this._fromAngle,this._toAngle)&&vw(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lZ extends hH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!Cw(t)&&!Cw(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const hZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function cZ(t,e,i){return"fadeIn"===e?hZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function dZ(t,e,i){return"fadeIn"===e?hZ(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 uZ=(t,e)=>({custom:oH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),pZ=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}});class gZ extends $q{constructor(){super(...arguments),this.type=PE.radar,this.transformerConstructor=GN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(gZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:IH,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):xU},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(gj(null===(s=vB.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),fj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=vB.getAnimationInKey(e);t.setAnimationConfig(gj(null==i?void 0:i(n,r),fj(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}}}gZ.type=PE.radar,gZ.mark=pZ,gZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},gZ.transformerConstructor=GN,G(gZ,Zj);const fZ=()=>{vB.registerSeries(gZ.type,gZ),nG(),UN(),WN(),vB.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:cZ(t,e,"in"),enter:cZ(t,e,"in"),exit:cZ(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{channel:["points","center"],custom:lZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),vB.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:oZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing}]}))),vB.registerAnimation("radarGroup",((t,e)=>({appear:uZ(t,"in"),disappear:{duration:uH.disappear.duration}}))),gC(),nZ(),iZ()};class mZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const vZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(NB)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[GB]:r,[YB]:`${s}_${e}`})),r++}))})),n},yZ={fill:"#bbb",fillOpacity:.2},_Z=Object.assign(Object.assign({},aj),{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"}}),bZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},xZ={grid:{background:!0}};class SZ extends Rj{constructor(){super(...arguments),this.type=PE.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)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),bZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),xZ)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),YP(this._option.dataSet,"objFlat",vZ),YP(this._option.dataSet,"copyDataView",tR),XP(this._option.dataSet,"dataview",Ia),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(uB(yZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(SZ.mark.group),this._containerMark=this._createMark(SZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(SZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(SZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(SZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(SZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(SZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(SZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}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 WE).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:XB}}initTooltip(){this._tooltipHelper=new mZ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}SZ.type=PE.dot,SZ.mark=_Z,SZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class AZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const kZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),CZ=(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 TZ extends Rj{constructor(){super(...arguments),this.type=PE.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),YP(this._option.dataSet,"linkDotInfo",CZ),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(TZ.mark.group),this._containerMark=this._createMark(TZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(TZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(TZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new AZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}TZ.type=PE.link,TZ.mark=kZ,TZ.builtInTheme={link:{arrow:{style:{size:10}}}};const MZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"}}),wZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class EZ extends xq{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()?qB:cP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?ZB:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),wZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):xU;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):SU,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=XE(this.angleAxisHelper.dataToPosition([t[qB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XE(this.angleAxisHelper.dataToPosition([t[ZB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?XE(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(EZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[mg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const OZ=()=>{vB.registerAnimation("circularProgress",((t,e)=>({appear:RZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:uH.disappear.duration}})))};class IZ extends Sj{constructor(){super(...arguments),this._supportStack=!0}}const LZ={cornerRadius:!0,roundCap:!0};class DZ extends EZ{constructor(){super(...arguments),this.type=PE.circularProgress,this.transformerConstructor=IZ,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()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),LZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(DZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:yj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(DZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?qB:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?ZB: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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}DZ.type=PE.circularProgress,DZ.mark=BZ,DZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},DZ.transformerConstructor=IZ;const FZ=()=>{vB.registerSeries(DZ.type,DZ),Oq(),OZ(),mH(),nZ(),iZ()};function zZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const HZ={type:"fadeIn"};function jZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?HZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:zZ(t)}))(t)}class NZ extends KH{enableByType(t){return"dimension"!==t}}const UZ=Object.assign(Object.assign({},aj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),VZ={bandWidth:!0,cornerRadius:!0,clamp:!0},WZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class GZ extends Rj{constructor(){super(...arguments),this.type=PE.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),VZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),WZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(GZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return XE(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(GZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new NZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}GZ.type=PE.linearProgress,GZ.mark=UZ,GZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const YZ=()=>{bK(),vB.registerAnimation("linearProgress",((t,e)=>({appear:jZ(t,e),enter:jZ(t),disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(GZ.type,GZ)},XZ=[0],KZ=[20,40],$Z=[200,500],qZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},ZZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class JZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const QZ=`${NB}_WORD_CLOUD_TEXT`,tJ=Object.assign(Object.assign({},aj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),eJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class iJ extends Ej{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=KZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:$Z,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:XZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?QZ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:qZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||_M(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:XZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!ZZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new JZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(iJ.mark.word,{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(iJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(gj(vB.getAnimationInKey("wordCloud")(n,s),fj("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 WE).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:XB])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new AE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new AE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[GB])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:YB,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:b_.createCanvas.bind(b_),getTextBounds:gv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:sg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}iJ.mark=tJ,iJ.builtInTheme={wordCloud:eJ};function sJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||uH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=nJ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},rJ=(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=rJ(t.children,e,t,n))})),s},aJ=(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=aJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},oJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):oJ(t.children,e,i)))})),e};function lJ(t,e){let i,s;if(dJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function dJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function fJ(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 mJ(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 vJ(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 yJ(t){return{_:t,next:null,prev:null}}function _J(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];fJ(n,s,r);let a,o,l,h,c,d,u,p=yJ(s),g=yJ(n),f=yJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=nJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:AJ.defaultOpionts.nodeSort;rJ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)rJ([o],bJ(h)),aJ([o],xJ(this._getPadding,.5,a)),rJ([o],SJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);rJ([o],bJ(AJ.defaultOpionts.setRadius)),aJ([o],xJ(Ot,1,a)),c&&aJ([o],xJ(this._getPadding,o.radius/t,a)),rJ([o],SJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}AJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const kJ=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=kJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function CJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){kJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function TJ(t){return t.depth}function MJ(t,e){return e-1-t.endDepth}const wJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),EJ=(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},BJ={left:TJ,right:MJ,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:TJ,end:MJ},PJ=bt(0,1);class RJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>wJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>wJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},RJ.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):BJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return CJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[EJ(s[t.source]),EJ(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*PJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(wJ),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(wJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];OJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),IJ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},LJ.defaultOpionts,t):Object.assign({},LJ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(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]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(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-(_(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=nJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function DJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:OJ,slice:DJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?DJ:OJ)(t,e,i,s,n)}};class HJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},HJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?FJ(this.options.aspectRatio):null!==(e=zJ[this.options.splitType])&&void 0!==e?e:zJ.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=nJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function jJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=jJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=NJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function KJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*$J({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},ZJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||VJ,s=e.lossFunction||UJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:qJ(f),arcs:f})}))},JJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:QJ,triangle:QJ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function QJ(){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 tQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const eQ=t=>JJ[t]?JJ[t]():JJ.circle(),iQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function sQ(t){return d(t)?t:function(){return t}}class nQ{constructor(t){var e,i;switch(this.options=H({},nQ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=eQ(this.options.shape),this.getText=null!==(e=sQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=sQ(this.options.fontWeight),this.getTextFontSize=sQ(this.options.fontSize),this.getTextFontStyle=sQ(this.options.fontStyle),this.getTextFontFamily=sQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>iQ(10,50);break;case"random-light":this.getTextColor=()=>iQ(50,90);break;default:this.getTextColor=sQ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class aQ extends nQ{constructor(t){var e;super(H({},aQ.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<=aQ.defaultOptions.minFontSize&&(this.options.minFontSize=aQ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=rQ[this.options.spiral])&&void 0!==e?e:rQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=sQ(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}=tQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(hQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}cQ(p,this._size)&&(p=dQ(p,this._size))}else if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||lQ(p,i))&&(!i||!oQ(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 oQ(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 lQ(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,cQ=(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 dQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},pQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},gQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},fQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=tQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=eQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)gQ(n,pQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)gQ(n,pQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=pQ({x:l,y:h},o,-Math.PI/2,5),e=pQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);gQ(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=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 M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(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(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,Ot=t=>0,It=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ie(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{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}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,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 Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{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 Xe(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 Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={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 Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(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=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(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=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(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 ni(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=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{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`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(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}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(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 ni(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:Ke});function oi(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 li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(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 di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(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 Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{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 Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal: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?Ci[8+bi/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 C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=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")+_i(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 wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Fi(){return new zi}function zi(){this.reset()}zi.prototype={constructor:zi,reset:function(){this.s=this.t=0},add:function(t){ji(Hi,t,this.t),ji(this,Hi.s,this.s),this.s?this.t+=Hi.t:this.s=Hi.t},valueOf:function(){return this.s}};var Hi=new zi;function ji(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Ni=1e-6,Ui=Math.PI,Vi=Ui/2,Wi=Ui/4,Gi=2*Ui,Yi=180/Ui,Xi=Ui/180,Ki=Math.abs,$i=Math.atan,qi=Math.atan2,Zi=Math.cos,Ji=Math.exp,Qi=Math.log,ts=Math.pow,es=Math.sin,is=Math.sign||function(t){return t>0?1:t<0?-1:0},ss=Math.sqrt,ns=Math.tan;function rs(t){return t>1?0:t<-1?Ui:Math.acos(t)}function as(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function os(){}function ls(t,e){t&&cs.hasOwnProperty(t.type)&&cs[t.type](t,e)}var hs={Feature:function(t,e){ls(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sUi?t+Math.round(-t/Gi)*Gi:t,e]}function As(t,e,i){return(t%=Gi)?e||i?xs(Cs(t),Ts(e,i)):Cs(t):e||i?Ts(e,i):Ss}function ks(t){return function(e,i){return[(e+=t)>Ui?e-Gi:e<-Ui?e+Gi:e,i]}}function Cs(t){var e=ks(t);return e.invert=ks(-t),e}function Ts(t,e){var i=Zi(t),s=es(t),n=Zi(e),r=es(e);function a(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*i+o*s;return[qi(l*n-c*r,o*i-h*s),as(c*n+l*r)]}return a.invert=function(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*n-l*r;return[qi(l*n+h*r,o*i+c*s),as(c*i-o*s)]},a}function Ms(t,e){(e=fs(e))[0]-=t,bs(e);var i=rs(-e[1]);return((-e[2]<0?-i:i)+Gi-Ni)%Gi}function ws(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:os,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Es(t,e){return Ki(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 Rs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function zs(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 Hs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ws(),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=zs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=es(s),r=[es(i),-Zi(i),0],a=0,o=0;Ls.reset(),1===n?s=Vi+Ni:-1===n&&(s=-Vi-Ni);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ui,M=f*x;if(Ls.add(qi(M*k*es(C),m*S+M*Zi(C))),a+=T?A+k*Gi:A,T^p>=i^_>=i){var w=vs(fs(u),fs(y));bs(w);var E=vs(r,w);bs(E);var B=(T^A>=0?-1:1)*as(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Ni||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(js))}return u}}function js(t){return t.length>1}function Ns(t,e){return((t=t.x)[0]<0?t[1]-Vi-Ni:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-Ni:Vi-e[1])}1===(Os=Fs).length&&(Is=Os,Os=function(t,e){return Fs(Is(t),e)});var Us=Hs((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?Ui:-Ui,l=Ki(r-i);Ki(l-Ui)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ui&&(Ki(i-n)Ni?$i((es(e)*(r=Zi(s))*es(i)-es(s)*(n=Zi(e))*es(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*Vi,s.point(-Ui,n),s.point(0,n),s.point(Ui,n),s.point(Ui,0),s.point(Ui,-n),s.point(0,-n),s.point(-Ui,-n),s.point(-Ui,0),s.point(-Ui,n);else if(Ki(t[0]-e[0])>Ni){var r=t[0]0,n=Ki(e)>Ni;function r(t,i){return Zi(t)*Zi(i)>e}function a(t,i,s){var n=[1,0,0],r=vs(fs(t),fs(i)),a=ms(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=vs(n,r),u=_s(n,h);ys(u,_s(r,c));var p=d,g=ms(u,p),f=ms(p,p),m=g*g-f*(ms(u,u)-1);if(!(m<0)){var v=ss(m),y=_s(p,(-g-v)/f);if(ys(y,u),y=gs(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Ki(y[0]-b)Ui^(b<=y[0]&&y[0]<=x)){var T=_s(p,(-g+v)/f);return ys(T,u),[y,gs(T)]}}}function o(e,i){var n=s?t:Ui-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Hs(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?Ui:-Ui),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Es(e,p)||Es(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&&Es(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=Zi(e),o=es(e),l=s*i;null==n?(n=e+s*Gi,r=e-l/2):(n=Ms(a,n),r=Ms(a,r),(s>0?nr)&&(n+=s*Gi));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 Ki(s[0]-t)0?0:3:Ki(s[0]-i)0?2:1:Ki(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=ws(),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=zs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ps(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(Gs,Math.min(Ws,g)),f=Math.max(Gs,Math.min(Ws,f))],b=[r=Math.max(Gs,Math.min(Ws,r)),a=Math.max(Gs,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&&(_.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 Xs(t){return t}var Ks,$s,qs,Zs,Js=Fi(),Qs=Fi(),tn={point:os,lineStart:os,lineEnd:os,polygonStart:function(){tn.lineStart=en,tn.lineEnd=rn},polygonEnd:function(){tn.lineStart=tn.lineEnd=tn.point=os,Js.add(Ki(Qs)),Qs.reset()},result:function(){var t=Js/2;return Js.reset(),t}};function en(){tn.point=sn}function sn(t,e){tn.point=nn,Ks=qs=t,$s=Zs=e}function nn(t,e){Qs.add(Zs*t-qs*e),qs=t,Zs=e}function rn(){nn(Ks,$s)}var an=tn,on=1/0,ln=on,hn=-on,cn=hn;var dn,un,pn,gn,fn={point:function(t,e){thn&&(hn=t);ecn&&(cn=e)},lineStart:os,lineEnd:os,polygonStart:os,polygonEnd:os,result:function(){var t=[[on,ln],[hn,cn]];return hn=cn=-(ln=on=1/0),t}},mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn=0,Cn={point:Tn,lineStart:Mn,lineEnd:Bn,polygonStart:function(){Cn.lineStart=Pn,Cn.lineEnd=Rn},polygonEnd:function(){Cn.point=Tn,Cn.lineStart=Mn,Cn.lineEnd=Bn},result:function(){var t=kn?[Sn/kn,An/kn]:xn?[_n/xn,bn/xn]:yn?[mn/yn,vn/yn]:[NaN,NaN];return mn=vn=yn=_n=bn=xn=Sn=An=kn=0,t}};function Tn(t,e){mn+=t,vn+=e,++yn}function Mn(){Cn.point=wn}function wn(t,e){Cn.point=En,Tn(pn=t,gn=e)}function En(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Tn(pn=t,gn=e)}function Bn(){Cn.point=Tn}function Pn(){Cn.point=On}function Rn(){In(dn,un)}function On(t,e){Cn.point=In,Tn(dn=pn=t,un=gn=e)}function In(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Sn+=(n=gn*t-pn*e)*(pn+t),An+=n*(gn+e),kn+=3*n,Tn(pn=t,gn=e)}var Ln=Cn;function Dn(t){this._context=t}Dn.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,Gi)}},result:os};var Fn,zn,Hn,jn,Nn,Un=Fi(),Vn={point:os,lineStart:function(){Vn.point=Wn},lineEnd:function(){Fn&&Gn(zn,Hn),Vn.point=os},polygonStart:function(){Fn=!0},polygonEnd:function(){Fn=null},result:function(){var t=+Un;return Un.reset(),t}};function Wn(t,e){Vn.point=Gn,zn=jn=t,Hn=Nn=e}function Gn(t,e){jn-=t,Nn-=e,Un.add(ss(jn*jn+Nn*Nn)),jn=t,Nn=e}var Yn=Vn;function Xn(){this._string=[]}function Kn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $n(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ps(t,i(s))),s.result()}return r.area=function(t){return ps(t,i(an)),an.result()},r.measure=function(t){return ps(t,i(Yn)),Yn.result()},r.bounds=function(t){return ps(t,i(fn)),fn.result()},r.centroid=function(t){return ps(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Xs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Xn):new Dn(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 qn(t){return function(e){var i=new Zn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Zn(){}function Jn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ps(i,t.stream(fn)),e(fn.result()),null!=s&&t.clipExtent(s),t}function Qn(t,e,i){return Jn(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 tr(t,e,i){return Qn(t,[[0,0],e],i)}function er(t,e,i){return Jn(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 ir(t,e,i){return Jn(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)}Xn.prototype={_radius:4.5,_circle:Kn(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=Kn(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}},Zn.prototype={constructor:Zn,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 sr=16,nr=Zi(30*Xi);function rr(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=ss(b*b+x*x+S*S),k=as(S/=A),C=Ki(Ki(S)-1)e||Ki((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Xi:0,E()):[m*Yi,v*Yi,y*Yi]},M.angle=function(t){return arguments.length?(_=t%360*Xi,E()):_*Yi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=rr(o,T=t*t),B()):ss(T)},M.fitExtent=function(t,e){return Qn(M,t,e)},M.fitSize=function(t,e){return tr(M,t,e)},M.fitWidth=function(t,e){return er(M,t,e)},M.fitHeight=function(t,e){return ir(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function dr(t){var e=0,i=Ui/3,s=cr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Xi,i=t[1]*Xi):[e*Yi,i*Yi]},n}function ur(t,e){var i=es(t),s=(i+es(e))/2;if(Ki(s)2?t[2]*Xi:0),e.invert=function(e){return(e=t.invert(e[0]*Xi,e[1]*Xi))[0]*=Yi,e[1]*=Yi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===_r?[[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 xr(t){return ns((Vi+t)/2)}function Sr(t,e){var i=Zi(t),s=t===e?es(t):Qi(i/Zi(e))/Qi(xr(e)/xr(t)),n=i*ts(xr(t),s)/s;if(!s)return _r;function r(t,e){n>0?e<-Vi+Ni&&(e=-Vi+Ni):e>Vi-Ni&&(e=Vi-Ni);var i=n/ts(xr(e),s);return[i*es(s*t),n-i*Zi(s*t)]}return r.invert=function(t,e){var i=n-e,r=is(s)*ss(t*t+i*i),a=qi(t,Ki(i))*is(i);return i*s<0&&(a-=Ui*is(t)*is(i)),[a/s,2*$i(ts(n/r,1/s))-Vi]},r}function Ar(t,e){return[t,e]}function kr(t,e){var i=Zi(t),s=t===e?es(t):(i-Zi(e))/(e-t),n=i/s+t;if(Ki(s)Ni&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Or.invert=mr(as),Ir.invert=mr((function(t){return 2*$i(t)})),Lr.invert=function(t,e){return[-e,2*$i(Ji(t))-Vi]};var zr={exports:{}},Hr=function(t,e){this.p1=t,this.p2=e};Hr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Hr.prototype.run=function(){return this.p2[0]-this.p1[0]},Hr.prototype.slope=function(){return this.rise()/this.run()},Hr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Hr.prototype.isVertical=function(){return!isFinite(this.slope())},Hr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Hr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Hr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Hr.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)},Hr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var jr=Hr,Nr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new jr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Nr(t.slice(0,s),e),o=Nr(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},Ur=Nr;!function(t){var e=Ur;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Xr,e),{tolerance:s}=i;return Vr(t,s)};var $r;!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"}($r||($r={}));const qr=(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a},Zr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return Jr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return Jr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},ta=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",O=null!==(g=k.max)&&void 0!==g?g:"max",I=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var ea={},ia={};function sa(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function na(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ra(t,e){var i=t+"",s=i.length;return s9999?"+"+ra(e,6):ra(e,4))+"-"+ra(t.getUTCMonth()+1,2)+"-"+ra(t.getUTCDate(),2)+(r?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"."+ra(r,3)+"Z":n?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"Z":s||i?"T"+ra(i,2)+":"+ra(s,2)+"Z":"")}function oa(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 ia;if(h)return h=!1,ea;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=$r.DSV;const s=Wr(ca,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return oa(n).parse(t)},ua=(t,e={},i)=>(i.type=$r.DSV,la(t)),pa=(t,e={},i)=>(i.type=$r.DSV,ha(t));function ga(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return fa(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 fa(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return va(t);default:throw new Error("unknown GeoJSON type")}}function fa(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=ma(t.properties),e.geometry=va(t.geometry),e}function ma(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]=ma(s):e[i]=s})),e):e}function va(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return va(t)})),e):(e.coordinates=ya(t.coordinates),e)}function ya(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return ya(t)}))}function _a(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 ba(t){for(var e,i,s=_a(t),n=0,r=1;r0}function xa(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=ga(t));var r=[];switch(t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,s)})),t;case"FeatureCollection":return xa(t,(function(t){xa(ka(t,s),(function(t){r.push(t)}))})),di(r)}return ka(t,s)}function ka(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,e)})),t;case"LineString":return Ca(_a(t),e),t;case"Polygon":return Ta(_a(t),e),t;case"MultiLineString":return _a(t).forEach((function(t){Ca(t,e)})),t;case"MultiPolygon":return _a(t).forEach((function(t){Ta(t,e)})),t;case"Point":case"MultiPoint":return t}}function Ca(t,e){ba(t)===e&&t.reverse()}function Ta(t,e){ba(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Pa=(t,e={},i)=>{i.type=$r.GEO;const s=Wr(Ea,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Aa(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=wa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=wa.bounds(t);t.bbox=e}})),t.features=l,t},Ra={},Oa=(t,e,i)=>{i.type=$r.GEO;const s=Wr(Ea,Ra,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 Fr(a,t)}))}:Fr(a,o));var a,o;return Pa(r,s,i)},Ia=(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 La=0;function Da(t="dataset"){return La>1e8&&(La=0),t+"_"+La++}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:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class za{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof za||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Zr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}$n();const Ha={},ja={albers:gr,albersusa:function(){var t,e,i,s,n,r,a=gr(),o=pr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=pr().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)}},Na=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ua(t,e){return function i(){const s=e();return s.type=t,s.path=$n().projection(s),s.copy=s.copy||function(){const t=i();return Na.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ga 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=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Za.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Ja(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(Ja(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,Ja(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Ja(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 $a))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Za.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Qa(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ka,this.rootWheelEvent=new $a,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const so=Nt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,fo;function mo(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;tfo){let t,e=uo;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 wo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Fo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Ho(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new jo(i,n),new jo(n,s)]}class jo extends Eo{constructor(t,e){super(),this.type=xo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p1.x):t===bo.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class No{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new jo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===bo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===bo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Uo extends No{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?bo.ROW:bo.COLUMN;return"monotoneY"===t?new Uo(t,s):new No(t,s)}class Go{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,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Xo(new Go(n,s),t),n}function Xo(t,e){return Vo(t,e,1)}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 $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&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 qo(t,e){return Vo(t,e,2)}function Zo(t,e={}){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 qo(new $o(n,s),t),n}function Jo(t){return t<0?-1:1}function Qo(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(Jo(r)+Jo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function tl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function el(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 il{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:el(this,this._t0,tl(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,el(this,tl(this,e=Qo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:el(this,this._t0,e=Qo(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 sl extends il{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function nl(t,e){return Vo(t,e,2)}function rl(t,e={}){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 nl(new il(n,s),t),n}function al(t,e){return Vo(t,e,2)}function ol(t,e={}){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 al(new sl(n,s),t),n}let ll=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class hl extends ll{lineEnd(){this.context.closePath()}}function cl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new ll(r,e,n),t),r}function dl(t,e){return Vo(t,e,1)}function ul(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new hl(r,e,n),t),r}class pl extends Go{lineEnd(){this.context.closePath()}}function gl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return fl(new pl(n,s),t),n}function fl(t,e){return Vo(t,e,1)}function ml(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function vl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Yo(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const yl=vl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const _l=vl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class bl extends Eo{constructor(t,e,i){super(),this.type=xo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Lo(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p2.x):t===bo.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Lo(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new bl(i,a,r),new bl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class xl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new jo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new bl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Sl(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return Zo(t,i);case"monotoneX":return rl(t,i);case"monotoneY":return ol(t,i);case"step":return cl(t,.5,i);case"stepClosed":return ul(t,.5,i);case"stepBefore":return cl(t,0,i);case"stepAfter":return cl(t,1,i);case"catmullRom":return yl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return _l(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return gl(t,i)}}class Al extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.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([lo.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([lo.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([lo.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([lo.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([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new xl(this);wo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];To(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.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=mo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Sl(e,i);"x"===s?this.direction=bo.ROW:"y"===s?this.direction=bo.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[lo.M]=this.moveToTransform,t[lo.L]=this.lineToTransform,t[lo.Q]=this.quadraticCurveToTransform,t[lo.C]=this.bezierCurveToTransform,t[lo.AT]=this.arcToTransform,t[lo.E]=this.ellipseTransform,t[lo.R]=this.rectTransform,t[lo.A]=this.arcTransform,t[lo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),wo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===bo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===bo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),$l=Object.assign(Object.assign({},Nl),{points:[],cornerRadius:0,closePath:!0}),ql=Object.assign(Object.assign({},Nl),{width:100,height:100,spikes:5,thickness:.5}),Zl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Ql=Object.assign(Object.assign({},Nl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),th=Object.assign(Object.assign(Object.assign({},Nl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),eh=Object.assign(Object.assign(Object.assign({},Nl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ih=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Nl),{fill:!0,cornerRadius:0,cornerType:"round"}),sh=Object.assign(Object.assign({},ih),{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});class nh{}const rh=Symbol.for("@visactor/vrender-core/application-state");function ah(){const t=globalThis;return t[rh]||(t[rh]={application:new nh}),t[rh]}const oh=ah().application;class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?oh.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):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?oh.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"},lh.cache.set(t,s),s.dataPromise=oh.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oh.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oh.global.loadBlob(t):"json"===e&&(i.dataPromise=oh.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=oh.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{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 Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Ph=new class extends Th{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Oh=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Ih(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{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 Ih(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ih(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{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 Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Gh=new class extends Th{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(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 Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+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(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{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 Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{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 ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{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 sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{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 rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(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 dc=new class extends Th{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 cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(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 pc=new class extends Th{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 uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(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 fc=new class extends Th{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 gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(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 vc=new class extends Th{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 mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(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 Ac=new class extends Th{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 Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{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)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),wo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(wo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}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 Ec=[wh,Eh,Ph,Oh,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{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 Oc(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ic(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ic(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Oc(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ic(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 Rc(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 Rc(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 Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;eqc.set(t,!0)));const Zc=new Map;function Jc(t){if(qc.has(t))return!0;if(Zc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Qc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Zc.set(t,!0)));const td=Xc(),ed=Xc(),id=Xc(),sd=Xc(),nd=Xc(),rd=Xc(),ad=Xc(),od=Xc(),ld=Xc(),hd=Xc(),cd=Xc(),dd=Xc(),ud=Xc(),pd=Xc(),gd=Xc(),fd=Xc(),md=Xc(),vd=Symbol.for("GraphicService"),yd=Symbol.for("GraphicCreator"),_d={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},bd=Object.keys(_d),xd={"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"},Sd=Object.keys(xd),Ad={duration:200,easing:"cubicOut"},kd=Symbol.for("CanvasFactory"),Cd=Symbol.for("Context2dFactory");function Td(t){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.canvasFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Md=1e-4,wd=Math.sqrt(3),Ed=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Rd(t){return"number"==typeof t&&Number.isFinite(t)}const Od=[0,0],Id=[0,0],Ld=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Fd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function zd(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 Hd(t){return(t%=Ut)<0&&(t+=Ut),t}function jd(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+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Vd(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(Bd(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 Yd=[-1,-1,-1],Xd=[-1,-1];function Kd(){const t=Xd[0];Xd[0]=Xd[1],Xd[1]=t}function $d(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(Bd(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,Ed):Math.pow(i,Ed),s=s<0?-Math.pow(-s,Ed):Math.pow(s,Ed);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+wd*Math.sin(e)))/(3*a),h=(-o+i*(s-wd*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,Yd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Kd(),p=zd(e,s,r,o,Xd[0]),u>1&&(g=zd(e,s,r,o,Xd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Yd);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=Fd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Yd[0]=-l,Yd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Yd[0]+t&&a<=Yd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Yd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Jd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function Qd(t,e){let i=Jd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Jd(i-n)):e&&i1&&(i||(h+=Oe(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;tu[0]=S,tu[1]=A,Qd(tu,Boolean(a[6])),S=tu[0],A=tu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case lo.M:u=m,p=v,c=u,d=p;break;case lo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Oe(c,d,m,v,s,n)||0;c=m,d=v;break;case lo.C:if(i){if(Nd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(jd(c,d,m,v,y,_,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case lo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Oe(c,d,o,l,s,n),i){if(Ud(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Zd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case lo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Oe(o,p,o,l,s,n),h+=Oe(u,l,u,p,s,n);break;case lo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Oe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class su{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(su.IsGradientStr(t))try{const e=iu(t)[0];if(e){if("linear"===e.type)return su.ParseLinear(e);if("radial"===e.type)return su.ParseRadial(e);if("conic"===e.type)return su.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:su.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:su.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function au(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ou(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];return 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}function lu(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];return 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}function hu(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];return 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,t}function cu(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 du(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 uu(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function pu(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 gu(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];return Math.abs(g-b)0&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Cu),function(t,e,i){return eu(t,0,!1,e,i)}(this.path.commandList,Cu.x,Cu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Cu);const i=nu(this,this.lineWidth,this.dpr);return function(t,e,i,s){return eu(t,e,!0,i,s)}(this.path.commandList,i,Cu.x,Cu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ku,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}const Mu={WIDTH:500,HEIGHT:500,DPR:1};class wu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Mu.WIDTH,height:n=Mu.HEIGHT,dpr:r=Mu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Eu;wu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Eu||(Eu={}));class Bu{static Get(t,e=Eu.Color1,i=[0,0,0,1]){if(e===Eu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Eu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Pu(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ru(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Ou(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ou(t,e,i,s,n)}function Ou(t,e,i,s,n){if(!t||!e)return t&&Pu(t)||e&&Pu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Eu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Eu.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:Pu(a)})))});return o?Ru(r,l,i,s,n):Ru(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 Iu(s,n,i);if("radial"===s.gradient)return Lu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Pu(Fu(r,a,i),s)}function Iu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(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]}function zu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const Hu=[0,0,0,0],ju=[0,0,0,0];function Nu(t,e,i){return Bu.Get(t,Eu.Color255,Hu),Bu.Get(e,Eu.Color255,ju),`rgba(${Math.round(Hu[0]+(ju[0]-Hu[0])*i)},${Math.round(Hu[1]+(ju[1]-Hu[1])*i)},${Math.round(Hu[2]+(ju[2]-Hu[2])*i)},${Hu[3]+(ju[3]-Hu[3])*i})`}class Uu{static GetCanvas(){try{return Uu.canvas||(Uu.canvas=oh.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 Vu extends Ye{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Gu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;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),Ru(o.color,l.color,h,!1)}function Yu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Uu.GetCanvas(),d=Uu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Ku(t){return null==t?void 0:t}class $u{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Ku(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Xu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Ku(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function qu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Zu(t){if(!qu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Zu(t[i])})),e}function Ju(t,e){var i;const s=null!==(i=Zu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];qu(n)&&qu(i)?s[t]=Ju(n,i):s[t]=Zu(i)})),s}class Qu{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Zu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];qu(r)&&qu(n)?t[i]=Ju(r,n):!qu(r)&&qu(a)&&qu(n)?t[i]=Ju(a,n):t[i]=Zu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?tp.PAINT|tp.BOUNDS|tp.PICK:tp.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?tp.PAINT|tp.BOUNDS:tp.PAINT}};class sp{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Ad;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:_o.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:_o.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:_o.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const np=new $u;function rp(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,ap(t),!0)}function ap(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=np.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function op(t){if(t)return t.parentScope&&op(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&ap(t),t}function lp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function hp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function cp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,hp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),lp(null!=e?e:t.ownerStage))}const dp=new Ve,up=new Ge,pp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],gp=["x","y"],fp=["scaleX","scaleY"],mp=["angle"],vp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),yp=new re,_p=[],bp=tp.PAINT|tp.SHAPE|tp.BOUNDS|tp.TRANSFORM|tp.LAYOUT;function xp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Sp(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Sp(s):s})),i}function Ap(t,e){return t===e||!!(xp(t)||xp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function kp(t,e){var i;const s=null!==(i=Sp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];xp(n)&&xp(i)?s[t]=kp(n,i):s[t]=Sp(i)})),s}const Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Tp extends Ga{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,hp(this.stage,this),lp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&op(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(op(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new $u).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Sp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&xp(n)&&xp(s)?e[t]=kp(n,s):e[t]=Sp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Sp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Ap(a,o)||(s.set(n,{prev:a,next:o}),t[n]=Sp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ip[t];return n?n(e,i):null!==(s=ep[t])&&void 0!==s?s:tp.PAINT}(e,i,s):null!==(n=ep[e])&&void 0!==n?n:tp.PAINT;return r&tp.PICK&&(r|=tp.BOUNDS),r===tp.PAINT&&this.needUpdateTag(e)&&(r=tp.SHAPE|tp.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&bp)!==bp?(t&tp.SHAPE?this.addUpdateShapeAndBoundsTag():t&tp.BOUNDS&&this.addUpdateBoundTag(),t&tp.PAINT&&this.addUpdatePaintTag(),t&tp.TRANSFORM&&this.addUpdatePositionTag(),t&tp.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=tp.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&vo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Ep.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];dp.clear();const n=[];s.forEach((t=>{const e=(new Al).fromString(t.d),i={};Sd.forEach((e=>{t[e]&&(i[xd[e]]=t[e])})),n.push({path:e,attribute:i}),dp.union(e.bounds)}));const r=dp.width(),a=dp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Ep.userSymbolMap[t]=l,l}const i=(new Al).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Ep.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return wo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&vo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&vo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&vo.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&vo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=vo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===yo.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===_o.STATE||null!=i&&i>=_o.ANIMATE_BIND&&i<=_o.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===_o.STATE||null!=o&&o>=_o.ANIMATE_BIND&&o<=_o.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Ap(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:_p,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ad}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:_p,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Sp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:_o.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:_p,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:_p,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,scaleX:i=Rl.scaleX,scaleY:s=Rl.scaleY,angle:n=Rl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(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,!0),oh.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Rl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=up.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=oh.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Al).fromString(t):this.pathProxy=new Al,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:oh.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new qa(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ga.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:_o.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:_o.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||oh.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Tu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Tp.userSymbolMap={};const Mp=Symbol.for("@visactor/vrender-core/graphic-class");function wp(){var t;const e=globalThis;return null!==(t=e[Mp])&&void 0!==t||(e[Mp]={Graphic:Tp}),e[Mp]}const Ep=wp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!vp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Lp=Op();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Rp.forEach((t=>{this._defaultTheme[t]=Object.create(Lp[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Rp.forEach((s=>{const n=Object.create(Lp[s]);t&&t[s]&&Ip(n,t[s]),i[s]&&Ip(n,i[s]),e[s]&&Ip(n,e[s]),this.combinedTheme[s]=n})),e.common&&Rp.forEach((t=>{Ip(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 Fp=new Dp;function zp(t,e){return t.glyphHost?zp(t.glyphHost):e?(t.isContainer,e):Hp(t)||t.attachedThemeGraphic&&zp(t.attachedThemeGraphic)||Fp.getTheme()}function Hp(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)):Fp.getTheme()}return null}const jp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Np=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...pp];class Up extends Ep{constructor(t){super(t),this.type="arc",this.numberType=td}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return zp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Np)}needUpdateTag(t){return super.needUpdateTag(t,Np)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const Wp=["segments","points","curveType","curveTension",...pp];class Gp extends Ep{constructor(t){super(t),this.type="area",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return zp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Al;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Gp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gp.NOWORK_ANIMATE_ATTR}}function Yp(t){return new Gp(t)}Gp.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Xp=["radius","startAngle","endAngle",...pp];class Kp extends Ep{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return zp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Xp)}needUpdateTag(t){return super.needUpdateTag(t,Xp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Al,s.arc(0,0,r,a,o),s}clone(){return new Kp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kp.NOWORK_ANIMATE_ATTR}}function $p(t){return new Kp(t)}Kp.NOWORK_ANIMATE_ATTR=Cp;class qp extends Ep{constructor(t){super(t),this.type="glyph",this.numberType=nd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return zp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new qp(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return qp.NOWORK_ANIMATE_ATTR}}function Zp(t){return new qp(t)}var Jp;qp.NOWORK_ANIMATE_ATTR=Cp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Jp||(Jp={}));let Qp=class t extends Ep{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rd,this._childUpdateTag=vo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(rp(this.sharedStateScope,t),cp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===yo.GLOBAL){const i=new re(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&vo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,dx:i=Rl.dx,dy:s=Rl.dy,scaleX:n=Rl.scaleX,scaleY:r=Rl.scaleY,angle:a=Rl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return zp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=vo.CLEAR_BOUNDS,this._childUpdateTag&=vo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&vo.UPDATE_BOUNDS||(this._childUpdateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&vo.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=oh.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&rp(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return ap({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Cp;const eg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...pp];class ig extends Ep{constructor(t){super(t),this.type="image",this.numberType=ad,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return zp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ih[t]}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}clone(){return new ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ig.NOWORK_ANIMATE_ATTR}}function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Cp);const ng=["segments","points","curveType","curveTension",...pp];let rg=class t extends Ep{constructor(t={}){super(t),this.type="line",this.numberType=od}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=bh(i,s,e))}getGraphicTheme(){return zp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,ng)}needUpdateTag(t){return super.needUpdateTag(t,ng)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Al;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ag(t){return new rg(t)}rg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const og=["path","customPath",...pp];class lg extends Ep{constructor(t){super(t),this.type="path",this.numberType=ld}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Al?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Al?this.cache:t.path)}getGraphicTheme(){return zp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Al).fromString(t.path):t.customPath&&(this.cache=new Al,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,og)}needUpdateTag(t){return super.needUpdateTag(t,og)}toCustomPath(){return(new Al).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new lg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lg.NOWORK_ANIMATE_ATTR}}function hg(t){return new lg(t)}lg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const cg=["points","cornerRadius",...pp];class dg extends Ep{constructor(t){super(t),this.type="polygon",this.numberType=hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return zp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,cg)}needUpdateTag(t){return super.needUpdateTag(t,cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Al,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Cp;const pg=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}},gg=["width","x1","y1","height","cornerRadius",...pp];class fg extends Ep{constructor(t){super(t),this.type="rect",this.numberType=dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return zp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,gg)}needUpdateTag(t){return super.needUpdateTag(t,gg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=pg(e);return t=new Al,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fg.NOWORK_ANIMATE_ATTR}}function mg(t){return new fg(t)}fg.NOWORK_ANIMATE_ATTR=Cp;const vg=Symbol.for("EnvContribution"),yg=Symbol.for("VGlobal"),_g="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",bg={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"}},xg=!0,Sg=!1,Ag=/\w|\(|\)|-/,kg=/[.?!,;:/,。?!、;:]/,Cg=/\S/,Tg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=oh.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=wg(t,a)),a}function wg(t,e,i=!1){let s=e;for(;Ag.test(t[s-1])&&Ag.test(t[s])||kg.test(t[s]);)if(s--,s<=0)return i?Eg(t,e):e;return s}function Eg(t,e){let i=e;for(;Ag.test(t[i+1])&&Ag.test(t[i])||kg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=oh.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Pg{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=bg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Rg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Og{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Rg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Mg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Ig extends ig{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(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=ih.width,height:e=ih.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 Lg{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 Ig?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Og){const e=Cg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Ig)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Ig)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sg;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,Tg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ru(t,s,{AABBBounds:i}):s,Tg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Ig)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Ig?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=bg[this.direction]}store(t){if(t instanceof Ig){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 Lg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Ig?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Og(i,t.newLine,t.character,t.ascentDescentMode),new Og(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Fg=!1;try{Fg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Fg=!1}const zg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...pp];class Hg extends Ep{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=pd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return zp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1)))}static splitText(t){if(Fg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Hg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),oh.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Hg.AllSingleCharacter(y)&&(y=Hg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Pg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Hg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Hg.NOWORK_ANIMATE_ATTR}}function jg(t){return new Hg(t)}Hg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);class Ng extends Qp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ug(t){return new Ng(t)}const Vg=["symbolType","size",...pp];let Wg=class t extends Ep{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=fd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return zp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Gc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Al).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Al).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Gg(t){return new Wg(t)}function Yg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Xg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Kg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);class $g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Tl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=md}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return zp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Zg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=oh.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Gc(n,o/Math.abs(r+a),!0,l),i.union(n)}return oh.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new $g(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new $g(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Yg(y,a),e=this.cache.verticalList.length*v,i=Xg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>$c(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Kc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Yg(y,a),A=x.verticalList.length*v,k=Xg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=qg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=qg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Zg.baselineMapAlign}getAlignMapBaseline(){return Zg.alignMapBaseline}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),Zg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Zg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Qg=["heightLimit","lineClamp"];class tf extends Zg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new $g(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 uf extends df{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let pf=0;class gf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=oh.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++pf,t),this.tryRunAnimationFrameNextFrame(),pf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class ff{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var mf=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 vf extends ff{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new uf(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return mf(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class yf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Td(Object.assign({nativeCanvas:oh.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Td(Object.assign({nativeCanvas:oh.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const _f=new yf,bf=Symbol.for("VWindow"),xf=Symbol.for("WindowHandlerContribution");function Sf(t){const e=oh.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Af extends ff{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(t=oh.global,e=Sf){super(),this.handlerFactory=e,this.hooks={onChange:new uf(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class kf{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=oh.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=_f.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=oh.windowFactory)||void 0===s?void 0:s.call(oh))&&void 0!==n?n:new Af(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var Cf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Cf||(Cf={}));const Tf=new Ge;class Mf{constructor(){this.matrix=new Ge}init(t){return this.mode=Cf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Cf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}scale(t,e,i){return this.mode===Cf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Cf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Tf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}translate(t,e){return this.mode===Cf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Cf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const wf=Symbol.for("@visactor/vrender-core/factory-state");function Ef(){const t=globalThis;return t[wf]||(t[wf]={pluginClasses:{}}),t[wf]}class Bf{constructor(){this.global=oh.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Pf=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 Rf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Of(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Ff{constructor(){this.time=So.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(jf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=zp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Kf(t,e,i,s)}}const zf=new Ff,Hf=new Set(["top","center","bottom"]);function jf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Nf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Uf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Uf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Nf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Gf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Hf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Yf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Xf(t){if(!t)return null;const e=Yf(t.naturalWidth,t.videoWidth,t.width),i=Yf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Kf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Xf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Gf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=_f.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),_f.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class $f{constructor(t){this.subRenderContribitions=t,this.time=So.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)}))}}class qf{constructor(){this.time=So.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Zf=new qf;class Jf{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Qf=new Jf,tm={getContributions:()=>[]};class em{constructor(t=[],e=tm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Of(e,Nl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:oh.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:tm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Su.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lf(e,i,Nl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Su.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),Su.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||function(){const t=oh.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class sm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class nm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class am{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const om={getContributions:()=>[]};class lm{constructor(t=om,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new rm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class hm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class cm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=oh.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=oh.global.getRequestAnimationFrame();this.rafId=t((()=>{oh.global.devicePixelRatio!==this.dpr&&(this.dpr=oh.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=oh.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class dm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oh.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const um=new Ve;class pm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&vo.UPDATE_PAINT)||s._updateTag&vo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(um.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(um,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let gm;function fm(){if(null==gm)try{const t=document.createElement("canvas"),e=t.getContext("2d");gm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),gm&&(gm=!!document.createElement)}catch(t){gm=!1}}function mm(){fm();const t=oh.global&&oh.global.env;return t?"browser"===t:gm}function vm(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(au(t),cu(t,t,[n+o,r+l,a+h]),cu(t,t,[y[0],y[1],y[2]]),ou(t,t,g),lu(t,t,p),cu(t,t,[-y[0],-y[1],y[2]]),uu(t,t,[c,d,u]),f){const i=Au.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]}cu(i,i,[s[0],s[1],0]),hu(i,i,f),cu(i,i,[-s[0],-s[1],0]),pu(t,t,i)}}function ym(t){const{alpha:e,beta:i}=t.attribute;return e||i}class _m{constructor(t=lf){this.creator=t,this.hooks={onAttributeUpdate:new uf(["graphic"]),onSetStage:new uf(["graphic","stage"]),onRemove:new uf(["graphic"]),onRelease:new uf(["graphic"]),onAddIncremental:new uf(["graphic","group","stage"]),onClearIncremental:new uf(["graphic","group","stage"]),beforeUpdateAABBBounds:new uf(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uf(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uf(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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=Xg(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=Yg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Gc(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;Gc(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&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const bm="white";class xm extends Qp{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:bm}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new uf(["stage"]),afterRender:new uf(["stage"]),afterClearScreen:new uf(["stage"]),afterClearRect:new uf(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:oh.global,!this.global.env&&mm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:oh.windowFactory)&&void 0!==n?n:()=>new Af(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=oh.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=oh.renderServiceFactory)||void 0===h?void 0:h.call(oh))&&void 0!==c?c:oh.renderService)&&void 0!==d?d:new im,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=oh.pluginServiceFactory)||void 0===p?void 0:p.call(oh))&&void 0!==g?g:oh.pluginService)&&void 0!==f?f:new lm,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:oh.layerService)&&void 0!==v?v:new Mm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:oh.graphicService)&&void 0!==b?b:new _m,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:bm,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,ap(s)),cp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new io(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=Cm.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=Cm.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Cm.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new hm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new cm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new dm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new pm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Cm.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Cm.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Cm.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return ap({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class Sm{constructor(t=xm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Am extends Qp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oh.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=>{oh.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)))}}class km{constructor(t=Am){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let Cm=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Tm(t){const e=oh.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}Cm._pluginClasses=Ef().pluginClasses;class Mm{static GenerateLayerId(){return`${Mm.idprefix}_${Mm.prefix_count++}`}constructor(t=oh.global,e=new km,i=Tm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Mm.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)}}Mm.idprefix="visactor_layer",Mm.prefix_count=0;const wm=Symbol.for("TransformUtil"),Em=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Pm=Symbol.for("StaticLayerHandlerContribution"),Rm=Symbol.for("DynamicLayerHandlerContribution"),Om=Symbol.for("VirtualLayerHandlerContribution"),Im=Symbol.for("@visactor/vrender-core/contribution-store-state");function Lm(){const t=globalThis;return t[Im]||(t[Im]={store:new Map}),t[Im]}const Dm=Symbol("ContributionProvider");class Fm{constructor(t,e){this.serviceIdentifier=t,this.container=e,Nm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function zm(t,e){return new Fm(t,e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).inSingletonScope().whenTargetNamed(e)}function jm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).whenTargetNamed(e)}class Nm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}Nm.store=Lm().store;class Um{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=th.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=wg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Um{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Gm({bind:t}){t(yg).toDynamicValue((({container:t})=>new vf(zm(vg,t)))).inSingletonScope(),t(bf).to(Af),t(Em).toDynamicValue((({container:t})=>new kf(zm(Vm,t)))).inSingletonScope(),t(wm).to(Mf).inSingletonScope(),t(Bm).to(Mm).inSingletonScope()}const Ym=Symbol.for("RenderService"),Xm=Symbol.for("BeforeRenderConstribution");function Km({bind:t}){t(Ym).to(im)}const $m=Symbol.for("GraphicPicker"),qm=Symbol.for("PickerService"),Zm=Symbol.for("BoundsPicker"),Jm=Symbol.for("GlobalPickerService"),Qm=Symbol.for("PickItemInterceptor"),tv=Symbol.for("PickServiceInterceptor"),ev=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ed,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},iv=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class sv extends fg{constructor(t){super(t),this.type="rect3d",this.numberType=ud}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return zp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,rv)}needUpdateTag(t){return super.needUpdateTag(t,rv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Al,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new av(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return av.NOWORK_ANIMATE_ATTR}}function ov(t){return new av(t)}av.NOWORK_ANIMATE_ATTR=Cp;class lv extends Up{constructor(t){super(t),this.type="arc3d",this.numberType=ed}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return lv.NOWORK_ANIMATE_ATTR}}function hv(t){return new lv(t)}lv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);class cv extends dg{constructor(t){super(t),this.type="pyramid3d",this.numberType=cd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return cv.NOWORK_ANIMATE_ATTR}}function dv(t){return new cv(t)}let uv,pv;function gv(t){return uv||(uv=cf("text",{})),uv.initAttributes(t),uv.AABBBounds}function fv(t){return pv||(pv=cf("richtext",{})),pv.setAttributes(t),pv.AABBBounds}cv.NOWORK_ANIMATE_ATTR=Cp;class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class vv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=zp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Su.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class _v{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=ev(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function bv({bind:t,isBound:e}){e(qm)||(t(Jm).toSelf(),t(qm).toService(Jm)),t(_v).toSelf().inSingletonScope(),t(Qm).toService(_v),t(vv).toSelf().inSingletonScope(),t(Qm).toService(vv),t(yv).toSelf().inSingletonScope(),t(Qm).toService(yv),Hm(t,Qm),t(mv).toSelf().inSingletonScope(),t(tv).toService(mv),Hm(t,tv)}function xv({bind:t}){t(vd).to(_m),t(yd).toConstantValue(lf)}const Sv=Symbol.for("AutoEnablePlugins"),Av=Symbol.for("PluginService");class kv{constructor(){this.type="static",this.offscreen=!1,this.global=oh.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Td({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()}}function Cv(t){(function({bind:t}){Hm(t,vg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),Hm(t,Vm)}({bind:t.bind}),function({bind:t}){t(kv).toSelf(),t(Pm).toService(kv)}({bind:t.bind})}const Tv=Ht/2;function Mv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Tv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Tv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Tv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Tv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function wv(t,e){return!(!t&&!e)}function Ev(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Pv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Rv(t,e){return t*e>0}function Ov(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Iv(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*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Fv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=Lv(g,f,u,p,n,t,Number(c)),l=Lv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=Lv(S,A,b,x,r,-n,Number(c)),l=Lv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const zv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Hv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=_f.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])),_f.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,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=_f.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Gg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:zv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=_f.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),_f.free(l),c}_f.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const jv=new Hv;class Nv{constructor(){this.time=So.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:nu(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Fv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Uv=new Nv,Vv=jv,Wv=zf;class Gv{constructor(){this.time=So.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Yv=new Gv,Xv=jv,Kv=zf;class $v extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(jf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const qv=new $v;function Zv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Jv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:nu(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Mv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class Qv{constructor(){this.time=So.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;Zv(p)&&(u.doStroke=!1)}}class ty{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Zv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Mv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ey=new Jv,iy=jv,sy=zf;class ny extends Jv{constructor(){super(...arguments),this.time=So.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)}}const ry=new ny,ay=zf;class oy{constructor(){this.time=So.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class ly{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const hy=new oy,cy=new ly,dy=jv,uy=zf,py=jv,gy=zf;class fy extends Hv{constructor(){super(...arguments),this.time=So.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:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class my{constructor(t){this.groupRenderContribitions=t,this.numberType=rd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:zp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Pv(p,m,g,f,c),w=Ov(p,v,g,f),E=wv(c,u),B=Ev(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Mv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===So.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===So.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=oh.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=zp(t,null==s?void 0:s.theme).group,i=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(i,p||i,n),a.modelMatrix=i,Au.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Au.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var vy,yy=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"}(vy||(vy={}));class _y extends em{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=vy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uf([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return yy(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:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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 yy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return yy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>yy(this,void 0,void 0,(function*(){if(2!==t.count)yield If(t,Nl.zIndex,((i,s)=>{if(this.status===vy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return yy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return yy(this,void 0,void 0,(function*(){this.rendering&&(this.status=vy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=vy.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 yy(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:()=>yy(this,void 0,void 0,(function*(){yield If(t,Nl.zIndex,(t=>yy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const by=Symbol.for("IncrementalDrawContribution"),xy=Symbol.for("ArcRender"),Sy=Symbol.for("Arc3dRender"),Ay=Symbol.for("AreaRender"),ky=Symbol.for("CircleRender"),Cy=Symbol.for("GraphicRender"),Ty=Symbol.for("GroupRender"),My=Symbol.for("LineRender"),wy=Symbol.for("PathRender"),Ey=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Py=Symbol.for("Rect3DRender"),Ry=Symbol.for("SymbolRender"),Oy=Symbol.for("TextRender"),Iy=Symbol.for("RichTextRender"),Ly=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Fy=Symbol.for("ImageRender"),zy=Symbol.for("RenderSelector"),Hy=Symbol.for("DrawContribution"),jy=Symbol.for("StarRender"),Ny=Symbol.for("DrawItemInterceptor"),Uy=new Ve,Vy=new Ve;class Wy{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){Uy.copy(s.dirtyBounds),Vy.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,Su.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Uy),s.backupDirtyBounds.copy(Vy)),!0}}class Gy{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}}class Yy{constructor(){this.order=1,this.interceptors=[new Wy,new Ky,new Xy,new Gy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Au.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const $y=Symbol.for("ArcRenderContribution"),qy=Symbol.for("AreaRenderContribution"),Zy=Symbol.for("CircleRenderContribution"),Jy=Symbol.for("GroupRenderContribution"),Qy=Symbol.for("ImageRenderContribution"),t_=Symbol.for("PathRenderContribution"),e_=Symbol.for("PolygonRenderContribution"),i_=Symbol.for("RectRenderContribution"),s_=Symbol.for("SymbolRenderContribution"),n_=Symbol.for("TextRenderContribution"),r_=Symbol.for("StarRenderContribution"),a_=Symbol.for("CommonRenderContribution"),o_=Symbol.for("InteractiveSubRenderContribution");function l_(t){!function({bind:t}){t(Ff).toSelf().inSingletonScope(),t(Hv).toSelf().inSingletonScope(),t(Hy).to(em),t(by).to(_y),t(Ty).toDynamicValue((({container:t})=>new my(zm(Jy,t)))).inSingletonScope(),t(Cy).toService(Ty),Hm(t,Jy),Hm(t,o_),t($f).toDynamicValue((({container:t})=>new $f(zm(o_,t)))).inSingletonScope(),Hm(t,Cy),t(Yy).toSelf().inSingletonScope(),t(Ny).toService(Yy),Hm(t,Ny)}({bind:t.bind})}class h_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class c_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new h_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function d_(){return new c_}const u_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const p_=function(){const t=globalThis;return t[u_]||(t[u_]={legacyBindingContext:d_(),preloaded:!1}),t[u_]}(),g_=p_.legacyBindingContext;function f_(){p_.preloaded||(p_.preloaded=!0,Gm({bind:g_.bind}),xv({bind:g_.bind}),Km({bind:g_.bind}),bv({bind:g_.bind,isBound:g_.isBound}),function({bind:t}){t(Av).to(lm),jm(t,Sv)}({bind:g_.bind}),Cv(g_),l_(g_))}function m_(){return g_}function v_(t){f_();const[e]=g_.getAll(t);return e}function y_(t,e){return f_(),g_.getNamed(t,e)}function __(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const b_=__((()=>v_(yg)));oh.global=b_;class x_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?oh.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:oh.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Kg("text"===t.type&&t.attribute?t.attribute:zp(t).text)}getTransformOfText(t){const e=zp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=oh.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));oh.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===oh.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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&&oh.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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"===oh.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 S_=()=>{Cm.registerPlugin("HtmlAttributePlugin",x_)};class A_ extends x_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?oh.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&oh.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const k_=()=>{Cm.registerPlugin("ReactAttributePlugin",A_)};class C_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return C_.instance||(C_.instance=new C_),C_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function T_(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function M_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:w_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=T_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:w_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=T_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const O=i*x+B;O>0&&E.wait(O);let I=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(E,e,p,L);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=T_(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:w_.builtInAnimateMap[r],m=t.custom?t.customType:T_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{M_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}w_.builtInAnimateMap={};const E_="appear",B_="disappear",P_="update",R_="highlight",O_="unhighlight";class I_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class L_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyHighlightState(t,e){this.applyState([R_],[{name:R_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([O_],[{name:O_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new L_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new I_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class F_{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-F_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*F_.bounceIn(2*t):.5*F_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){F_[t]=e}}function z_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}F_.quadIn=F_.getPowIn(2),F_.quadOut=F_.getPowOut(2),F_.quadInOut=F_.getPowInOut(2),F_.cubicIn=F_.getPowIn(3),F_.cubicOut=F_.getPowOut(3),F_.cubicInOut=F_.getPowInOut(3),F_.quartIn=F_.getPowIn(4),F_.quartOut=F_.getPowOut(4),F_.quartInOut=F_.getPowInOut(4),F_.quintIn=F_.getPowIn(5),F_.quintOut=F_.getPowOut(5),F_.quintInOut=F_.getPowInOut(5),F_.backIn=F_.getBackIn(1.7),F_.backOut=F_.getBackOut(1.7),F_.backInOut=F_.getBackInOut(1.7),F_.elasticIn=F_.getElasticIn(1,.3),F_.elasticOut=F_.getElasticOut(1,.3),F_.elasticInOut=F_.getElasticInOut(1,.3*1.5),F_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),F_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},F_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)F_[`flicker${t}`]=e=>z_(e,t);for(let t=2;t<10;t++)F_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function H_(t,e,i){return t+(e-t)*i}const j_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=H_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=H_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=H_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=H_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=H_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=H_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=H_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=H_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=H_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ru(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?zu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ru(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?zu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=H_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=H_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=H_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=H_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=H_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=H_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=H_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function N_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:_o.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=F_[s])&&void 0!==n?n:F_.linear:F_.linear,"wait"===t&&(this.onUpdate=Z_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=Z_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Bu.Get(i,Eu.Color255),r=Bu.Get(s,Eu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(j_["fill"===e?"fillPure":"strokePure"])}else j_[e]?t.push(j_[e]):t.push(N_)}else j_[e]?t.push(j_[e]):t.push(N_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tb extends Q_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();$_(this.target,t,_o.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class eb extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ib=new eb;ib.isGlobal=!0;class sb extends Q_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class nb extends sb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class rb extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class ab extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){$_(this.target,this.from,_o.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ob(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class cb{constructor(t=Va.GenAutoIncrementId(),e=ib,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(hb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new Q_(El.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tb(El.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new ab(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(hb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&$_(this.target,this._startProps,_o.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const db=new gf;class ub{constructor(){this.released=!1}tick(t,e){db.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class pb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===wl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=wl.INITIAL,oh.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),oh.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new ub;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==wl.INITIAL&&(this.status=wl.PAUSE,!0)}resume(){return this.status!==wl.INITIAL&&(this.status=wl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=wl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===wl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===wl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,oh.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function fb(){G(Ep,D_),G(Ep,gb)}function mb(){hf("arc",Vp)}function vb(){hf("arc3d",hv)}function yb(){hf("area",Yp)}function _b(){hf("circle",$p)}function bb(){hf("glyph",Zp)}function xb(){hf("group",tg)}function Sb(){hf("image",sg)}function Ab(){hf("line",ag)}function kb(){hf("path",hg)}function Cb(){hf("polygon",ug)}function Tb(){hf("pyramid3d",dv)}function Mb(){hf("rect",mg)}function wb(){hf("rect3d",nv)}function Eb(){hf("richtext",jg)}function Bb(){hf("shadowRoot",Ug)}function Pb(){hf("star",ov)}function Rb(){hf("symbol",Gg)}function Ob(){hf("text",Jg)}function Ib(){hf("wrapText",ef)}function Lb(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Fb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Zf),e(Qf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===So.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===So.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=zp(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=Bv(d,u,h),_=Rv(d,g),b=wv(h),x=Ev(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return wo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Rv(o,c),g=wv(n,r),f=Ev(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||ym(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Au.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Au.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class zb extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=td,this.builtinContributions=[Uv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=Lv(v,y,f,m,n,t,Number(u)),o=Lv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=Lv(C,T,A,k,r,-n,Number(u)),o=Lv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Gu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const Hb=new WeakSet;function jb({bind:t}){Lb(Hb,t)||(t(zb).toDynamicValue((({container:t})=>new zb(zm($y,t)))).inSingletonScope(),t(xy).toService(zb),t(Cy).toService(xy),t($y).toService($f),Hm(t,$y))}const Nb=jb;class Ub extends Fb{constructor(){super(...arguments),this.numberType=ed}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Eu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Lb(Vb,t)||(t(Ub).toDynamicValue((()=>new Ub)).inSingletonScope(),t(Sy).toService(Ub),t(Cy).toService(Sy))}const Gb=Wb;function Yb(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 Xb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?bo.ROW:bo.COLUMN,Number.isFinite(c)||(o=bo.COLUMN),Number.isFinite(d)||(o=bo.ROW);const u=i*(o===bo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Yb(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),Yb(t,l,1,s),o=!1):o=!0}t.closePath()}function $b(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function qb(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=$b(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Yb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=bo.ROW:"y"===s?u=bo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Jb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Qb=new fy,tx=zf;class ex extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Qb,tx],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=zp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,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=Sl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Sl(e,E,{curveTension:b}),n=Sl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=bo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?bo.ROW:null==y.y1?bo.COLUMN:Number.isFinite(S+A)?S>A?bo.ROW:bo.COLUMN:bo.ROW,Xb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),qb(t,i[0]?e.top:e.bottom,l,x===bo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ix=new WeakSet;function sx({bind:t}){Lb(ix,t)||(t(ex).toDynamicValue((({container:t})=>new ex(zm(qy,t)))).inSingletonScope(),t(Ay).toService(ex),t(Cy).toService(Ay),t(qy).toService($f),Hm(t,qy))}const nx=sx;class rx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[Yv,Kv,Xv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const ax=new WeakSet;function ox({bind:t}){Lb(ax,t)||(t(rx).toDynamicValue((({container:t})=>new rx(zm(Zy,t)))).inSingletonScope(),t(ky).toService(rx),t(Cy).toService(ky),t(Zy).toService($f),Hm(t,Zy))}const lx=ox;class hx{constructor(){this.numberType=nd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=zp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const cx=new WeakSet;function dx({bind:t}){Lb(cx,t)||(t(hx).toDynamicValue((()=>new hx)).inSingletonScope(),t(Dy).toService(hx),t(Cy).toService(Dy))}const ux=dx,px=["","repeat-x","repeat-y","repeat"];function gx(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?px[i]:"no-repeat"}function fx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=gx(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const mx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function vx(t){return{backgroundMode:mx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function yx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=fx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function _x(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=fx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?vx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Kf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class bx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ad,this.builtinContributions=[ry,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Mv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),_x(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},O=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},I=yx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||I;g?(O(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),O()),this.afterRenderStep(t,e,i,s,T,!1,k,!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&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=zp(t).image;this._draw(t,a,!1,i)}}const xx=new WeakSet;function Sx({bind:t}){Lb(xx,t)||(t(Fy).toDynamicValue((({container:t})=>new bx(zm(Qy,t)))).inSingletonScope(),t(Cy).toService(Fy),t(Qy).toService($f),Hm(t,Qy))}const Ax=Sx;class kx extends Fb{constructor(){super(...arguments),this.numberType=od}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();qb(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Sl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const Cx=new WeakSet;function Tx({bind:t}){Lb(Cx,t)||(t(kx).toDynamicValue((()=>new kx)).inSingletonScope(),t(My).toService(kx),t(Cy).toService(My))}const Mx=Tx,Ex=jv,Bx=zf;class Px extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ld,this.builtinContributions=[Bx,Ex],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:zp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)wo(t.pathShape.commandList,e,i,s,1,1,f);else{wo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Rx=new WeakSet;function Ox({bind:t}){Lb(Rx,t)||(t(Px).toDynamicValue((({container:t})=>new Px(zm(t_,t)))).inSingletonScope(),t(wy).toService(Px),t(Cy).toService(wy),t(t_).toService($f),Hm(t,t_))}const Ix=Ox;function Lx(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Lx(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lx(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Fx(h,y,_,d,u),A=Fx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=Dx(k,C),M=Fx(h,Dx(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const Nx=new WeakSet;function Ux({bind:t}){Lb(Nx,t)||(t(Ey).toDynamicValue((({container:t})=>new jx(zm(e_,t)))).inSingletonScope(),t(Cy).toService(Ey),t(e_).toService($f),Hm(t,e_))}const Vx=Ux;class Wx extends Fb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Eu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Gx extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=cd}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=zp(t).polygon;this._draw(t,s,!1,i)}}const Yx=new WeakSet;function Xx({bind:t}){Lb(Yx,t)||(t(Gx).toDynamicValue((()=>new Gx)).inSingletonScope(),t(Ly).toService(Gx),t(Cy).toService(Ly))}const Kx=Xx;class $x extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=dd,this.builtinContributions=[ey,sy,iy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Pv(g,f,T,M,h),E=Ov(g,v,T,M,C),B=wv(h,c),P=Ev(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Mv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const qx=new WeakSet;function Zx({bind:t}){Lb(qx,t)||(t($x).toDynamicValue((({container:t})=>new $x(zm(i_,t)))).inSingletonScope(),t(By).toService($x),t(Cy).toService(By),t(ty).toSelf(),t(Qv).toSelf(),t(i_).toService(ty),t(i_).toService(Qv),t(i_).toService($f),Hm(t,i_))}const Jx=Zx;class Qx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=ud}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=zp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Pv(v,y,A,k,d),M=Ov(v,b,A,k,S),w=wv(d),E=Ev(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=zp(t).rect;this._draw(t,s,!1,i)}}const tS=new WeakSet;function eS({bind:t}){Lb(tS,t)||(t(Qx).toDynamicValue((()=>new Qx)).inSingletonScope(),t(Py).toService(Qx),t(Cy).toService(Py))}const iS=eS;const sS=new class extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:O=l.backgroundCornerRadius}=t.attribute;let I,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=gv(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 i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),O?Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,O?(Mv(e,F.x1,F.y1,F.width(),F.height(),O,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),D()}};class nS extends Fb{constructor(){super(),this.numberType=pd,this.builtinContributions=[sS],this.init()}drawShape(t,e,i,s,n){const r=zp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=zp(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(),Mv(e,i-t,s-n,v,y,f,!0)),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=zp(t).richtext;this._draw(t,s,!1,i)}}const rS=new WeakSet;function aS({bind:t}){Lb(rS,t)||(t(nS).toDynamicValue((()=>new nS)).inSingletonScope(),t(Iy).toService(nS),t(Cy).toService(Iy))}const oS=aS;class lS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[gy,py],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const hS=new WeakSet;function cS({bind:t}){Lb(hS,t)||(t(lS).toDynamicValue((({container:t})=>new lS(zm(r_,t)))).inSingletonScope(),t(jy).toService(lS),t(Cy).toService(jy),Hm(t,r_))}const dS=cS;class uS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[hy,uy,dy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:zp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const pS=new WeakSet;function gS({bind:t}){Lb(pS,t)||(t(uS).toDynamicValue((({container:t})=>new uS(zm(s_,t)))).inSingletonScope(),t(Ry).toService(uS),t(Cy).toService(Ry),t(s_).toService($f),Hm(t,s_))}const fS=gS;class mS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[sS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=zp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Su.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Su.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Yg(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const vS=new WeakSet;function yS({bind:t}){Lb(vS,t)||(t(Oy).toDynamicValue((({container:t})=>new mS(zm(n_,t)))).inSingletonScope(),t(Cy).toService(Oy),t(n_).toService($f),Hm(t,n_))}const _S=yS,bS=mm();function xS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function SS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const AS=Symbol.for("MathPickerContribution"),kS=Symbol.for("MathArcPicker"),CS=Symbol.for("MathAreaPicker"),TS=Symbol.for("MathCirclePicker"),MS=Symbol.for("MathImagePicker"),wS=Symbol.for("MathLinePicker"),ES=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),PS=Symbol.for("MathSymbolPicker"),RS=Symbol.for("MathTextPicker"),OS=Symbol.for("MathPolygonPicker"),IS=Symbol.for("MathGlyphPicker"),LS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),FS=Symbol.for("CanvasArc3dPicker"),zS=Symbol.for("CanvasAreaPicker"),HS=Symbol.for("CanvasCirclePicker"),jS=Symbol.for("CanvasImagePicker"),NS=Symbol.for("CanvasGifImagePicker"),US=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),GS=Symbol.for("CanvasRectPicker"),YS=Symbol.for("CanvasRect3dPicker"),XS=Symbol.for("CanvasSymbolPicker"),KS=Symbol.for("CanvasTextPicker"),$S=Symbol.for("CanvasPolygonPicker"),qS=Symbol.for("CanvasPyramid3dPicker"),ZS=Symbol.for("CanvasRichTextPicker"),JS=Symbol.for("CanvasGlyphPicker"),QS=Symbol.for("CanvasGroupPicker"),tA=Symbol.for("CanvasStarPicker"),eA=Symbol.for("CanvasPickerContribution"),iA=m_(),sA=__((()=>v_(Em))),nA=__((()=>v_(wm))),rA=__((()=>v_(vd))),aA=__((()=>v_(Bm)));function oA(){oh.global=b_,oh.graphicUtil=sA,oh.transformUtil=nA,oh.graphicService=rA,oh.layerService=aA,oh.canvasFactory=t=>y_(kd,t),oh.context2dFactory=t=>y_(Cd,t),oh.windowFactory=()=>new Af(oh.global),oh.windowHandlerFactory=t=>function(t){const e=y_(xf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),oh.renderServiceFactory=()=>v_(Ym),oh.renderService=__((()=>v_(Ym))),oh.pluginServiceFactory=()=>v_(Av),oh.pluginService=__((()=>v_(Av))),oh.pickerServiceFactory=()=>v_(qm),oh.layerHandlerFactory=t=>v_("static"===t?Pm:"dynamic"===t?Rm:Om),oh.incrementalDrawContributionFactory=()=>v_(by)}oA();var lA=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 hA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return lA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class cA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class dA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Eu.Color1),this.ambient=i;const s=$t(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=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Bu.Get(e,Eu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const uA=()=>{Cm.registerPlugin("DirectionalLight",dA)};class pA{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=Au.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Au.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return gu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return fu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return mu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;mu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const gA=()=>{Cm.registerPlugin("OrthoCamera",pA)},fA={getContributions:()=>[]},mA={getContributions:()=>[]};class vA{constructor(t=fA,e=mA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:fA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:mA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=zp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=zp(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&&Au.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Su.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class yA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new sm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new nm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new am,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new rm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new Sm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new km,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new sf}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new im(new em([],(t=this.registry.contribution,e=Ny,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class _A{constructor(t={}){this.context=new yA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function bA(t={}){return new _A(t)}class xA extends _A{}class SA extends _A{}class AA extends ex{constructor(){super(...arguments),this.numberType=id}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=zp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=wv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=zp(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=Bv(u,p,c),y=Rv(u,g),_=wv(c),b=Ev(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{};function DA(){MA.preloaded||(MA.preloaded=!0,Gm({bind:wA.bind}),xv({bind:wA.bind}),Km({bind:wA.bind}),bv({bind:wA.bind,isBound:wA.isBound}),Cv(wA),l_(wA))}function FA(t,e){const i=NA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function zA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function HA(t,e){let i=PA.get(t);i||(i=new Map,PA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function jA(t,e,i){const s=HA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function NA(){return DA(),wA}function UA(){Nm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=MA.runtimeGlobal)&&void 0!==t||(MA.runtimeGlobal=new vf(zm(vg,wA))),MA.runtimeGlobal}function WA(t){const e=NA(),i=VA();oh.global=i,oh.canvasFactory=t=>e.getNamed(kd,t),oh.context2dFactory=t=>e.getNamed(Cd,t),oh.windowHandlerFactory=t=>FA(xf,t),oh.windowFactory=()=>new Af(i,(t=>FA(xf,t))),oh.pluginServiceFactory=()=>new lm(zm(Sv,e),{pluginRegistry:t.context.registry.plugin}),oh.incrementalDrawContributionFactory=()=>new _y([],new kA,new AA(zm(qy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,Ny))}function GA(t){var e;const i=NA();UA();const s=i.getAll(Cy),n=HA(t.registry.renderer,EA);jA(t.registry.renderer,EA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),zA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,EA)}function YA(t){var e;const i=NA();UA();const s=i.getAll(Ny),n=null!==(e=RA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,Ny,e)})),n.clear(),RA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(Ny));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(Ny,e),r.add(e)),n.add(e)}))}function XA(t,e){var i;const s=NA();UA();const n=s.getAll(e),r=HA(t.registry.picker,BA);jA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),zA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function KA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=OA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,LA,t.isBound,t.rebind),function(t,e){let i=OA.get(t);i||(i=new WeakSet,OA.set(t,i)),i.add(e)}(t,e))}function $A(t,{app:e,legacy:i=!0,targets:s}={}){KA(NA(),t),i&&(f_(),KA(m_(),t)),UA(),e&&function(t,e){const i=null!=e?e:IA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&YA(t),s&&GA(t),r.forEach((e=>{XA(t,e)}))}(e,s)}function qA(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function ZA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function JA(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 QA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ok(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=pg(t.attribute),n=hk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=hk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=hk(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{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(;n{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 _k(l,e,h),h},fk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return pk(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 pk(t,e)}return[]};const mk=t=>t.map((t=>({x:t.x,y:t.y}))),vk=(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]},yk=t=>{const e=new Ue;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 vk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return vk(t,{x:e.x1,y:n},{x:e.x2,y:n})},_k=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=yk(t);_k(n[0],s,i),_k(n[1],e-s,i)}},bk=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:mk(i)}];const s=[];return _k(i,e,s),s},xk=(t,e)=>{const i=ak(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;rObject.assign({},t))):[]}function Ak(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:Sk(t.touches),configurable:!0},changedTouches:{value:Sk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function kk(t,e){try{return t[e]}catch(t){return}}function Ck(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Ak(t),l=kk(t,"target"),h=kk(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Tk=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Ek(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:wk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Tk(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=wk(i,this.selectionStartCursorIdx),a=wk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=Mk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Ek(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),oh.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),oh.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Pk{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=wk(i,Math.ceil(t)),n=wk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=wk(i.attribute.textConfig,a),h=wk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Rk,[this.formatTextCommandCb]),this.commandCbs.set(Ok,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(oh.global.isMacOS()&&t.metaKey&&"c"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return oh.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(oh.global.isMacOS()&&t.metaKey&&"a"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},Mk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=jg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:fv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||mg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},Mk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=tg({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Ik.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=ag({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=tg({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=fv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=fv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(mg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:fv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Qk=new Jk;class tC{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const eC=()=>{Cm.registerPlugin("ViewTransform3dPlugin",tC)},iC=new Ve;class sC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=zp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nC=()=>{Cm.registerPlugin("FlexLayoutPlugin",sC)};var rC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:rh,ARC3D_NUMBER_TYPE:ed,ARC_NUMBER_TYPE:td,AREA_NUMBER_TYPE:id,AbstractGraphicRender:class{},get AnimateMode(){return Ml},get AnimateStatus(){return Bl},get AnimateStepType(){return El},AppContext:yA,Application:nh,Arc:Up,Arc3d:lv,Arc3dRender:Sy,ArcRender:xy,ArcRenderContribution:$y,Area:Gp,AreaRender:Ay,AreaRenderContribution:qy,get AttributeUpdateType(){return _o},AutoEnablePlugins:Sv,Base3dRender:Wx,BaseCanvas:wu,BaseEnvContribution:hA,BaseRender:Fb,get BaseRenderContributionTime(){return So},BaseWindowHandlerContribution:cA,Basis:$o,BeforeRenderConstribution:Xm,BoundsContext:no,BoundsPicker:Zm,BrowserEntry:_A,CIRCLE_NUMBER_TYPE:sd,CONTRIBUTION_STORE_STATE_SYMBOL:Im,Canvas3DDrawItemInterceptor:Ky,Canvas3DPickItemInterceptor:_v,CanvasFactory:kd,CanvasTextLayout:$g,Circle:Kp,CircleRender:ky,CircleRenderContribution:Zy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Eu},CommonDrawItemInterceptorContribution:Yy,CommonRenderContribution:a_,Context2dFactory:Cd,ContributionProvider:Dm,ContributionRegistry:am,ContributionStore:Nm,CubicBezierCurve:zo,CurveContext:xl,get CurveTypeEnum(){return xo},CustomEvent:qa,CustomPath2D:Al,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:_g,DebugDrawItemInterceptorContribution:Gy,DefaultArcAllocate:zk,DefaultArcAttribute:Ul,DefaultArcRenderContribution:Nv,DefaultAreaAllocate:jk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:fy,DefaultAttribute:Nl,DefaultBaseBackgroundRenderContribution:Ff,DefaultBaseClipRenderAfterContribution:Jf,DefaultBaseClipRenderBeforeContribution:qf,DefaultBaseInteractiveRenderContribution:$f,DefaultBaseTextureRenderContribution:Hv,DefaultCanvasAllocate:yf,DefaultCanvasArc3DRender:Ub,DefaultCanvasArcRender:zb,DefaultCanvasAreaRender:ex,DefaultCanvasCircleRender:rx,DefaultCanvasGroupRender:my,DefaultCanvasImageRender:bx,DefaultCanvasLineRender:kx,DefaultCanvasPathRender:Px,DefaultCanvasPolygonRender:jx,DefaultCanvasPyramid3dRender:Gx,DefaultCanvasRect3dRender:Qx,DefaultCanvasRectRender:$x,DefaultCanvasSymbolRender:uS,DefaultCanvasTextRender:mS,DefaultCircleAllocate:Uk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Gv,DefaultConnectAttribute:Hl,DefaultDebugAttribute:jl,DefaultFillStyle:Ol,DefaultGlobal:vf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Yl,DefaultGraphicAllocate:Lk,DefaultGraphicMemoryManager:Jk,DefaultGraphicService:_m,DefaultGraphicUtil:kf,DefaultGroupAttribute:Gl,DefaultGroupBackgroundRenderContribution:$v,DefaultImageAttribute:ih,DefaultImageRenderContribution:ny,DefaultLayerService:Mm,DefaultLayout:Pl,DefaultLineAllocate:Wk,DefaultLineAttribute:Xl,DefaultMat4Allocate:xu,DefaultMatrixAllocate:bu,DefaultPathAllocate:Yk,DefaultPathAttribute:Kl,DefaultPickService:vA,DefaultPickStyle:Fl,DefaultPolygonAttribute:$l,DefaultRect3dAttribute:Jl,DefaultRectAllocate:Dk,DefaultRectAttribute:Zl,DefaultRectRenderContribution:Jv,DefaultRenderService:im,DefaultRichTextAttribute:eh,DefaultRichTextIconAttribute:sh,DefaultStarAttribute:ql,DefaultStrokeStyle:Ll,DefaultStyle:zl,DefaultSymbolAllocate:Kk,DefaultSymbolAttribute:Ql,DefaultSymbolClipRangeStrokeRenderContribution:ly,DefaultSymbolRenderContribution:oy,DefaultTextAllocate:qk,DefaultTextAttribute:th,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Rl,DefaultTransformUtil:Mf,DefaultWindow:Af,get Direction(){return bo},DirectionalLight:dA,DrawContribution:Hy,DrawItemInterceptor:Ny,DynamicLayerHandlerContribution:Rm,get Edge(){return ch},EditModule:Bk,EmptyContext2d:Tu,EnvContribution:vg,EventManager:Qa,EventSystem:io,EventTarget:to,FACTORY_STATE_SYMBOL:wf,FORMAT_ALL_TEXT_COMMAND:Ok,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Rk,Factory:Cm,FederatedEvent:Ya,FederatedMouseEvent:Xa,FederatedPointerEvent:Ka,FederatedWheelEvent:$a,FlexLayoutPlugin:sC,GLYPH_NUMBER_TYPE:nd,GRAPHIC_CLASS_SYMBOL:Mp,GRAPHIC_REGISTRY_SYMBOL:rf,GRAPHIC_UPDATE_TAG_KEY:pp,GROUP_NUMBER_TYPE:rd,Generator:Va,GlobalPickerService:Jm,Glyph:qp,GlyphRender:Dy,GradientParser:su,Graphic:Ep,GraphicCreator:yd,GraphicFactory:sf,GraphicPicker:$m,GraphicRender:Cy,GraphicService:vd,GraphicUtil:Em,Group:Qp,GroupRender:Ty,GroupRenderContribution:Jy,get GroupUpdateAABBBoundsMode(){return Jp},HtmlAttributePlugin:x_,get IContainPointMode(){return yo},IMAGE_NUMBER_TYPE:ad,Image:ig,ImageRender:Fy,ImageRenderContribution:Qy,IncrementalDrawContribution:by,InteractiveDrawItemInterceptorContribution:Xy,InteractivePickItemInterceptorContribution:yv,InteractiveSubRenderContribution:o_,LINE_NUMBER_TYPE:od,Layer:Am,LayerFactory:km,LayerService:Bm,Line:rg,LineRender:My,Linear:Go,LinearClosed:pl,Mat4Allocate:yu,MatrixAllocate:vu,get MeasureModeEnum(){return Tl},MiniappEntry:SA,MonotoneX:il,MonotoneY:sl,NOWORK_ANIMATE_ATTR:Cp,Node:Ga,NodeEntry:xA,OrthoCamera:pA,PATH_NUMBER_TYPE:ld,POLYGON_NUMBER_TYPE:hd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:cd,Path:lg,PathRender:wy,PathRenderContribution:t_,PerformanceRAF:gf,PickItemInterceptor:Qm,PickServiceInterceptor:tv,PickerRegistry:nm,PickerService:qm,PluginRegistry:rm,PluginService:Av,Polygon:dg,PolygonRender:Ey,PolygonRenderContribution:e_,Pyramid3d:cv,Pyramid3dRender:Ly,RECT3D_NUMBER_TYPE:ud,RECT_NUMBER_TYPE:dd,RICHTEXT_NUMBER_TYPE:pd,RUNTIME_INSTALLER_STATE_SYMBOL:CA,RafBasedSTO:Sh,ReactAttributePlugin:A_,Rect:fg,Rect3DRender:Py,Rect3d:sv,RectRender:By,RectRenderContribution:i_,ReflectSegContext:Uo,RenderSelector:zy,RenderService:Ym,RendererRegistry:sm,ResourceLoader:lh,RichText:Hg,RichTextEditPlugin:Ik,RichTextRender:Iy,STAR_NUMBER_TYPE:gd,get STATUS(){return wl},SVG_ATTRIBUTE_MAP:_d,SVG_ATTRIBUTE_MAP_KEYS:bd,SVG_PARSE_ATTRIBUTE_MAP:xd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Sd,SYMBOL_NUMBER_TYPE:fd,SegContext:No,ShadowPickServiceInterceptorContribution:mv,ShadowRoot:Ng,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:vv,SplitRectAfterRenderContribution:ty,SplitRectBeforeRenderContribution:Qv,Stage:xm,StageFactory:Sm,Star:av,StarRender:jy,StarRenderContribution:r_,StateDefinitionCompiler:$u,StateEngine:Qu,StaticLayerHandlerContribution:Pm,Step:ll,StepClosed:hl,Symbol:Wg,SymbolRender:Ry,SymbolRenderContribution:s_,TEXT_NUMBER_TYPE:md,Text:Zg,get TextDirection(){return Kc},TextMeasureContribution:Vm,TextRender:Oy,TextRenderContribution:n_,Theme:Dp,TransformUtil:wm,get UpdateTag(){return vo},VGlobal:yg,VWindow:bf,ViewTransform3dPlugin:tC,VirtualLayerHandlerContribution:Om,WILDCARD:"*",WindowHandlerContribution:xf,WrapText:tf,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Ou,addArcToBezierPath:To,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:rk,alignSubpath:QA,application:oh,applyTransformOnBezierCurves:ok,arc3dModule:Gb,arcModule:Nb,areaModule:nx,bezier:ko,bezierCurversToPath:lk,binarySplitPolygon:yk,bindArc3dRenderModule:Wb,bindArcRenderModule:jb,bindAreaRenderModule:sx,bindCircleRenderModule:ox,bindContributionProvider:Hm,bindContributionProviderNoSingletonScope:jm,bindGlyphRenderModule:dx,bindImageRenderModule:Sx,bindLineRenderModule:Tx,bindPathRenderModule:Ox,bindPolygonRenderModule:Ux,bindPyramid3dRenderModule:Xx,bindRect3dRenderModule:eS,bindRectRenderModule:Zx,bindRichtextRenderModule:aS,bindStarRenderModule:cS,bindSymbolRenderModule:gS,bindTextRenderModule:yS,boundStroke:Gc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Sl,calculateArcCornerRadius:Dv,calculateLineHeight:Ch,canvasAllocate:_f,centroidOfSubpath:ik,circleBounds:vh,circleModule:lx,clock:Za,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Nu,configureRuntimeApplicationForApp:WA,container:iA,cornerTangents:Lv,createApp:bA,createArc:Vp,createArc3d:hv,createArea:Yp,createBrowserApp:bA,createCanvasEventTransformer:function(t,e,i,s){return Ck(t.parentElement,e,i,s)},createCircle:$p,createColor:ru,createConicalGradient:Yu,createContributionProvider:zm,createEventTransformer:Ck,createGlyph:Zp,createGraphic:cf,createGroup:tg,createImage:sg,createLine:ag,createMat4:_u,createMiniappApp:function(t={}){return new SA(t)},createNodeApp:function(t={}){return new xA(t)},createPath:hg,createPolygon:ug,createPyramid3d:dv,createRect:mg,createRect3d:nv,createRectPath:Mv,createRichText:jg,createShadowRoot:Ug,createStage:function(t){return oA(),(new Sm).create(t)},createStar:ov,createSymbol:Gg,createText:Jg,createWrapText:ef,cubicCalc:Ro,cubicLength:Po,cubicPointAt:Oo,cubicSubdivide:JA,defaultArcAllocate:Hk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Uv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:Nk,defaultBaseBackgroundRenderContribution:zf,defaultBaseClipRenderAfterContribution:Qf,defaultBaseClipRenderBeforeContribution:Zf,defaultBaseTextureRenderContribution:jv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Kv,defaultCircleRenderContribution:Yv,defaultCircleTextureRenderContribution:Xv,defaultGraphicMemoryManager:Qk,defaultGroupBackgroundRenderContribution:qv,defaultImageBackgroundRenderContribution:ay,defaultImageRenderContribution:ry,defaultLineAllocate:Gk,defaultPathAllocate:Xk,defaultRectAllocate:Fk,defaultRectBackgroundRenderContribution:sy,defaultRectRenderContribution:ey,defaultRectTextureRenderContribution:iy,defaultStarBackgroundRenderContribution:gy,defaultStarTextureRenderContribution:py,defaultSymbolAllocate:$k,defaultSymbolBackgroundRenderContribution:uy,defaultSymbolClipRangeStrokeRenderContribution:cy,defaultSymbolRenderContribution:hy,defaultSymbolTextureRenderContribution:dy,defaultTextAllocate:Zk,diff:ZA,divideCubic:Fo,drawArc:Co,drawArcPath:Fv,drawAreaSegments:Xb,drawBackgroundImage:Kf,drawImageWithLayout:_x,drawIncrementalAreaSegments:Jb,drawIncrementalSegments:Zb,drawSegments:qb,enumCommandMap:lo,fillVisible:Bv,findBestMorphingRotation:nk,findConfigIndexByCursorIdx:wk,findCursorIdxByConfigIndex:Ek,findNextGraphic:Lf,flatten_simplify:qA,foreach:Of,foreachAsync:If,genBasisSegments:Zo,genBasisTypeSegments:qo,genLinearClosedSegments:gl,genLinearClosedTypeSegments:fl,genLinearSegments:Yo,genLinearTypeSegments:Xo,genMonotoneXSegments:rl,genMonotoneXTypeSegments:nl,genMonotoneYSegments:ol,genMonotoneYTypeSegments:al,genNumberType:Xc,genStepClosedSegments:ul,genStepSegments:cl,genStepTypeSegments:dl,getApplicationState:ah,getAttributeFromDefaultAttrList:xh,getBackgroundImage:jf,getConicGradientAt:Gu,getContributionStoreState:Lm,getCurrentEnv:function(){return mm()?"browser":"node"},getDefaultCharacterConfig:Mk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Yg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Au.allocate();return cu(o,o,[a[0],a[1],0]),n&&ou(o,o,n),s&&lu(o,o,s),cu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Ef,getGraphicClassState:wp,getGraphicRegistryState:af,getLegacyBindingContext:m_,getModelMatrix:vm,getRichTextBounds:fv,getRuntimeInstallerBindingContext:NA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:TA,getScaledStroke:nu,getTextBounds:gv,getTheme:zp,getThemeFromGroup:Hp,globalTheme:Fp,glyphModule:ux,graphicCreator:lf,graphicService:rA,graphicUtil:sA,identityMat4:au,imageModule:Ax,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:$A,installRuntimeDrawContributionsToApp:YA,installRuntimeGraphicRenderersToApp:GA,installRuntimePickersToApp:XA,interpolateColor:Ru,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Iu,interpolateGradientRadialColor:Lu,interpolatePureColorArray:Fu,interpolatePureColorArrayToStr:zu,intersect:Iv,isBrowserEnv:mm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){fm();const t=oh.global&&oh.global.env;return t?"node"===t:!gm},isSvg:Nc,isXML:Uc,layerService:aA,lineModule:Mx,lookAt:gu,mapToCanvasPointForCanvas:function(t){var e;if(Rd(t._canvasX)&&Rd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:du,mat4Allocate:Au,matrixAllocate:Su,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:pu,newThemeObj:Op,ortho:fu,parsePadding:gh,parseStroke:uh,parseSvgPath:mo,pathModule:Ix,pathToBezierCurves:ak,point:Ko,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:Vx,preLoadAllModule:f_,pyramid3dModule:Kx,quadCalc:Io,quadLength:Do,quadPointAt:Lo,rafBasedSto:Ah,rect3dModule:iS,rectFillVisible:Pv,rectModule:Jx,rectStrokeVisible:Ov,recursiveCallBinarySplit:_k,refreshRuntimeInstallerContributions:UA,registerArc3dGraphic:vb,registerArcGraphic:mb,registerAreaGraphic:yb,registerCircleGraphic:_b,registerDirectionalLight:uA,registerFlexLayoutPlugin:nC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:bb,registerGraphic:hf,registerGroupGraphic:xb,registerHtmlAttributePlugin:S_,registerImageGraphic:Sb,registerLineGraphic:Ab,registerOrthoCamera:gA,registerPathGraphic:kb,registerPolygonGraphic:Cb,registerPyramid3dGraphic:Tb,registerReactAttributePlugin:k_,registerRect3dGraphic:wb,registerRectGraphic:Mb,registerRichtextGraphic:Eb,registerShadowRootGraphic:Bb,registerStarGraphic:Pb,registerSymbolGraphic:Rb,registerTextGraphic:Ob,registerViewTransform3dPlugin:eC,registerWindowEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Ib,renderCommandList:wo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:vx,resolveBackgroundPosition:Gf,resolveBackgroundSizing:Nf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:fx,resolveImageRepeatMode:gx,resolveRenderableImageSize:Xf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:oS,rotateX:ou,rotateY:lu,rotateZ:hu,runFill:wv,runStroke:Ev,scaleMat4:uu,segments:Ao,shouldClipImageByLayout:yx,shouldUseMat4:ym,snapLength:Bo,splitArc:dk,splitArea:gk,splitCircle:uk,splitLine:fk,splitPath:xk,splitPolygon:bk,splitRect:ck,splitToGrids:hk,starModule:dS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Rv,symbolModule:fS,textAttributesToStyle:Kg,textDrawOffsetX:Yg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Xg,textModule:_S,transformMat4:mu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:nA,translate:cu,verticalLayout:$c,vglobal:b_,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oh.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)}))},wrapCanvas:Td,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.context2dFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Qc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Qc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class aC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:nu(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class oC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let lC=!1;function hC(t){lC||(lC=!0,t.bind(DS).toDynamicValue((()=>new oC(xS(t,xy)))).inSingletonScope(),t.bind(eA).toService(DS))}class cC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let dC=!1;function uC(t){dC||(dC=!0,t.bind(kS).toDynamicValue((()=>new cC(xS(t,xy)))).inSingletonScope(),t.bind(AS).toService(kS))}function pC(){if(pC.__loaded)return;pC.__loaded=!0;const t=m_();mb(),Nb({bind:t.bind}),bS?hC(t):uC(t)}pC.__loaded=!1;const gC=pC;class fC extends Fb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class mC extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ed,this.themeType="arc"}}let vC=!1;function yC(t){var e;vC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Sy))&&(vC=!0,t.bind(FS).toDynamicValue((()=>new mC(xS(t,Sy)))).inSingletonScope(),t.bind(eA).toService(FS))}function _C(){if(_C.__loaded)return;_C.__loaded=!0;const t=m_();vb(),uA(),gA(),Gb({bind:t.bind}),yC(t)}_C.__loaded=!1;const bC=_C;class xC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let SC=!1;function AC(t){SC||(SC=!0,t.bind(zS).toDynamicValue((()=>new xC(xS(t,Ay)))).inSingletonScope(),t.bind(eA).toService(zS))}class kC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let CC=!1;function TC(t){CC||(CC=!0,t.bind(CS).toDynamicValue((()=>new kC(xS(t,Ay)))).inSingletonScope(),t.bind(AS).toService(CS))}function MC(){if(MC.__loaded)return;MC.__loaded=!0;const t=m_();yb(),nx({bind:t.bind}),bS?AC(t):TC(t)}MC.__loaded=!1;const wC=MC;class EC{constructor(){this.type="glyph",this.numberType=nd}contains(t,e,i){if(!t.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}}class BC extends EC{constructor(t){super(),this.canvasRenderer=t}}let PC=!1;function RC(t){PC||(PC=!0,t.bind(JS).toDynamicValue((()=>new BC(xS(t,Dy)))).inSingletonScope(),t.bind(eA).toService(JS))}class OC extends EC{constructor(t){super(),this.canvasRenderer=t}}let IC=!1;function LC(t){IC||(IC=!0,t.bind(IS).toDynamicValue((()=>new OC(xS(t,Dy)))).inSingletonScope(),t.bind(AS).toService(IS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=m_();bb(),ux({bind:t.bind}),bS?RC(t):LC(t)}DC.__loaded=!1;const FC=DC;function zC(){zC.__loaded||(zC.__loaded=!0,xb())}zC.__loaded=!1;const HC=zC;class jC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=ad}}let NC=!1;function UC(t){NC||(NC=!0,t.bind(jS).toDynamicValue((()=>new jC(xS(t,Fy)))).inSingletonScope(),t.bind(eA).toService(jS))}class VC{constructor(){this.type="image",this.numberType=ad}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function GC(t){WC||(WC=!0,t.bind(MS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(AS).toService(MS))}function YC(){if(YC.__loaded)return;YC.__loaded=!0;const t=m_();Sb(),Ax({bind:t.bind}),bS?UC(t):GC(t)}YC.__loaded=!1;const XC=YC;class KC extends Fb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class $C extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let qC=!1;function ZC(t){qC||(qC=!0,t.bind(US).toDynamicValue((()=>new $C(xS(t,My)))).inSingletonScope(),t.bind(eA).toService(US))}class JC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let QC=!1;function tT(t){QC||(QC=!0,t.bind(wS).toDynamicValue((()=>new JC(xS(t,My)))).inSingletonScope(),t.bind(AS).toService(wS))}function eT(){if(eT.__loaded)return;eT.__loaded=!0;const t=m_();Ab(),Mx({bind:t.bind}),bS?ZC(t):tT(t)}eT.__loaded=!1;const iT=eT;class sT extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let nT=!1;function rT(t){nT||(nT=!0,t.bind(WS).toDynamicValue((()=>new sT(xS(t,wy)))).inSingletonScope(),t.bind(eA).toService(WS))}class aT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let oT=!1;function lT(t){oT||(oT=!0,t.bind(ES).toDynamicValue((()=>new aT(xS(t,wy)))).inSingletonScope(),t.bind(AS).toService(ES))}function hT(){if(hT.__loaded)return;hT.__loaded=!0;const t=m_();kb(),Ix({bind:t.bind}),bS?rT(t):lT(t)}hT.__loaded=!1;const cT=hT;class dT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let uT=!1;function pT(t){uT||(uT=!0,t.bind($S).toDynamicValue((()=>new dT(xS(t,Ey)))).inSingletonScope(),t.bind(eA).toService($S))}class gT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let fT=!1;function mT(t){fT||(fT=!0,t.bind(OS).toDynamicValue((()=>new gT(xS(t,Ey)))).inSingletonScope(),t.bind(AS).toService(OS))}function vT(){if(vT.__loaded)return;vT.__loaded=!0;const t=m_();Cb(),Vx({bind:t.bind}),bS?pT(t):mT(t)}vT.__loaded=!1;const yT=vT;class _T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=cd,this.themeType="polygon"}}let bT=!1;function xT(t){var e;bT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ly))&&(bT=!0,t.bind(qS).toDynamicValue((()=>new _T(xS(t,Ly)))).inSingletonScope(),t.bind(eA).toService(qS))}function ST(){if(ST.__loaded)return;ST.__loaded=!0;const t=m_();Tb(),uA(),gA(),Kx({bind:t.bind}),xT(t)}ST.__loaded=!1;const AT=ST,kT=new Ve;class CT{constructor(){this.type="rect",this.numberType=dd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:nu(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;kT.setValue(i.x1,i.y1,i.x2,i.y2),kT.expand(-r/2),h=!kT.containsPoint(e)}}return s.highPerformanceRestore(),h}}class TT extends CT{constructor(t){super(),this.canvasRenderer=t}}let MT=!1;function wT(t){MT||(MT=!0,t.bind(GS).toDynamicValue((()=>new TT(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(GS))}class ET extends CT{constructor(t){super(),this.canvasRenderer=t}}let BT=!1;function PT(t){BT||(BT=!0,t.bind(BS).toDynamicValue((()=>new ET(xS(t,By)))).inSingletonScope(),t.bind(AS).toService(BS))}function RT(){if(RT.__loaded)return;RT.__loaded=!0;const t=m_();Mb(),Jx({bind:t.bind}),bS?wT(t):PT(t)}RT.__loaded=!1;const OT=RT;class IT extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=ud,this.themeType="rect"}}let LT=!1;function DT(t){var e;LT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Py))&&(LT=!0,t.bind(YS).toDynamicValue((()=>new IT(xS(t,Py)))).inSingletonScope(),t.bind(eA).toService(YS))}function FT(){if(FT.__loaded)return;FT.__loaded=!0;const t=m_();wb(),iS({bind:t.bind}),DT(t)}FT.__loaded=!1;const zT=FT;class HT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let jT=!1;function NT(t){jT||(jT=!0,t.bind(ZS).toDynamicValue((()=>new HT(xS(t,Iy)))).inSingletonScope(),t.bind(eA).toService(ZS))}class UT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let VT=!1;function WT(t){VT||(VT=!0,t.bind(LS).toDynamicValue((()=>new UT(xS(t,Iy)))).inSingletonScope(),t.bind(AS).toService(LS))}function GT(){if(GT.__loaded)return;GT.__loaded=!0;const t=m_();Eb(),oS({bind:t.bind}),bS?NT(t):WT(t)}GT.__loaded=!1;const YT=GT;function XT(){XT.__loaded||(XT.__loaded=!0,Bb())}XT.__loaded=!1;const KT=XT;class $T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Au.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let qT=!1;function ZT(t){qT||(qT=!0,t.bind(XS).toDynamicValue((()=>new $T(xS(t,Ry)))).inSingletonScope(),t.bind(eA).toService(XS))}class JT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}}let QT=!1;function tM(t){QT||(QT=!0,t.bind(PS).toDynamicValue((()=>new JT(xS(t,Ry)))).inSingletonScope(),t.bind(AS).toService(PS))}function eM(){if(eM.__loaded)return;eM.__loaded=!0;const t=m_();Rb(),fS({bind:t.bind}),bS?ZT(t):tM(t)}eM.__loaded=!1;const iM=eM;class sM extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Xg(a,u,n),v=Yg(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&&Au.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let nM=!1;function rM(t){nM||(nM=!0,t.bind(KS).toDynamicValue((()=>new sM(xS(t,Oy)))).inSingletonScope(),t.bind(eA).toService(KS))}class aM{constructor(){this.type="text",this.numberType=md}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let oM=!1;function lM(t){oM||(oM=!0,t.bind(RS).toDynamicValue((()=>new aM)).inSingletonScope(),t.bind(AS).toService(RS))}function hM(){if(hM.__loaded)return;hM.__loaded=!0;const t=m_();Ob(),_S({bind:t.bind}),bS?rM(t):lM(t)}hM.__loaded=!1;const cM=hM;function dM(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),gM=(t,e)=>(d(mM.warnHandler)&&mM.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),fM=(t,e,i)=>{if(!d(mM.errorHandler))throw new Error(t);mM.errorHandler.call(null,t,e)},mM={silent:!1,warnHandler:!1,errorHandler:!1},vM=mm(),yM=vM&&globalThis?globalThis.document:void 0;function _M(t){return("desktop-browser"===t||"mobile-browser"===t)&&vM}function bM(t){return xM(t)||"mobile-browser"===t}function xM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let SM=0;function AM(){return SM>=9999999&&(SM=0),SM++}function kM(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function CM(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function TM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&TM(t,e)}))}const MM=t=>!u(t)&&!1!==t.visible;function wM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function EM(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 PM=["#ffffff","#000000"];function RM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return OM(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(...PM);for(const n of a)if(t!==n&&OM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function OM(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?IM(t,e)>s:"largeText"===i?IM(t,e)>3:IM(t,e)>4.5}function IM(t,e){const i=LM(t),s=LM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function LM(t){const e=ri(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 DM(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 FM(t,e){return[t[0]*e,t[1]*e]}function zM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function HM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const jM=cf,NM={arc:t=>jM("arc",t),circle:t=>jM("circle",t),group:t=>jM("group",t),image:t=>jM("image",t),line:t=>jM("line",t),path:t=>jM("path",t),polygon:t=>jM("polygon",t),rect:t=>jM("rect",t),richtext:t=>jM("richtext",t),symbol:t=>jM("symbol",t),text:t=>jM("text",t)},UM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 GM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(GM||(GM={}));const YM={[GM.selectedReverse]:{},[GM.selected]:{},[GM.hover]:{},[GM.hoverReverse]:{}},XM={container:"",width:30,height:30,style:{}},KM="scrollDrag",$M=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:gv,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function qM(t,e,i={}){if(!t)return{width:0,height:0};const s=gv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 ZM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function JM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function QM(t,e="type"){const i=ZM(t,e);return"rich"===i?NM.richtext(JM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),NM.text(t))}function tw(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 ew=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function iw(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 sw(t,e){const{dx:i,dy:s}=iw(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const nw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},rw={size:8,stroke:"#000",lineWidth:1,zIndex:1};function aw(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Ae(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Ee(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const ow=Math.sin(Math.PI/10);function lw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function hw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function cw(t){const e={};return TM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return FM(r,(s?-1:1)*(n?-1:1)*t/zM(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function fw(t,e,i){var s;if(hw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function mw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function _w(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function bw(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function xw(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 Sw(t,e){const i=xw(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 Aw(t,e){const i=kw(t),s=kw(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 kw(t,e={x:0,y:0}){return ae.distancePP(t,e)}function Cw(t){return k(t.x)&&k(t.y)}function Tw(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 Mw(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const ww=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function Bw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&Bw(t[i],e)}}var Pw;!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"}(Pw||(Pw={}));const Rw={};function Ow(t){switch(t){case Pw.Linear:case Pw.Log:case Pw.Pow:case Pw.Sqrt:case Pw.Symlog:case Pw.Time:return!0;default:return!1}}function Iw(t){return!!Rw[t]}function Lw(t){switch(t){case Pw.Ordinal:case Pw.Point:case Pw.Band:return!0;default:return!1}}function Dw(t){return t}Object.values(Pw).forEach((t=>{Rw[t]=!0}));const Fw=t=>-Math.log(-t),zw=t=>-Math.exp(-t),Hw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,jw=t=>10===t?Hw:t===Math.E?Math.exp:e=>Math.pow(t,e),Nw=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)),Vw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Ww(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 Gw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Yw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Xw(t,e,i,s){return 1===i&&(i=0),Yw(t,i,s)*(e/(1-i))}function Kw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function $w(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Zw{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=Kw(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=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Jw=Symbol("implicit");class Qw extends Zw{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=Jw}clone(){const t=(new Qw).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!==Jw)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return tE(t,e,r,n)}class iE extends Qw{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=Xw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:eE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new iE(!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:sE}=ai;function nE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=sE(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?sE(t,e):e instanceof si?sE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class rE extends Zw{constructor(t=Dw,e=Dw){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Dw,this._piecewise=Gw,this._interpolate=nE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?$w:Gw,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:Dw),this.rescale(i)):this._clamp!==Dw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const aE=Math.sqrt(50),oE=Math.sqrt(10),lE=Math.sqrt(2),hE=[1,2,5,10],cE=(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=gE(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?uE(0,-(e-1)/s,s):uE((e-1)/s,0,s)},dE=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return cE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return cE(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=uE(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=uE(t,e,l);return n&&r.reverse(),r})),gE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=hE[0];return i>=aE?s=hE[3]:i>=oE?s=hE[2]:i>=lE&&(s=hE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function fE(t,e,i){const s=(e-t)/Math.max(0,i);return gE(s)}function mE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=fE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function yE(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 _E=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),bE=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),xE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=pE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?_E(t,e,n):_E(t,e,qw(n)),h=_E(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),SE=vt(((t,e,i,s,n)=>mE(s(t),s(e),i).map((t=>qw(n(t))))));class AE extends rE{constructor(){super(...arguments),this.type=Pw.Linear}clone(){var t;const e=new AE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return dE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=pE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function CE(t){return e=>-t(-e)}function TE(t=Number.EPSILON){return e=>Math.max(e,t)}class ME extends rE{constructor(){super(Nw(10),jw(10)),this.type=Pw.Log,this._limit=TE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new ME).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=Nw(this._base),s=jw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Fw,this.untransformer=zw):(this._logs=i,this._pows=s,this._limit=TE(),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 Dw}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return bE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(ME,kE);class wE extends AE{constructor(){super(Uw(1),Vw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new wE).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=Vw(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return bE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(wE,kE);class EE{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[lt(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new EE).domain(this._domain).range(this._range).unknown(this._unknown)}}var BE,PE,RE;function OE(t){var e,i;const{type:s}=t;return s===PE.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BE||(BE={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(PE||(PE={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(RE||(RE={}));const IE={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},LE={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DE(t,e){var i;if(!t)return[];const s=VE(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?NE(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>jE(i)?zE(t,i,e):i)).filter(p)}))):i.map((i=>jE(i)?zE(t,i,e):i)).filter(p):[]}return[]}function FE(t,e){var i,s;return NE(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 zE(t,e,i){var s;const n=VE(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=IE[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=LE[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 si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`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 HE=(t,e)=>{if(e&&jE(t)){const i=zE(e,t);if(i)return i}return t};function jE(t){return t&&"palette"===t.type&&!!t.key}function NE(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function UE(t){return _(t)?{dataScheme:t}:t}function VE(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=OE(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 WE extends Qw{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!NE(this._range))return void super.range(this._range);const t=FE(this._range,this._domain);super.range(t)}}const GE={linear:AE,band:iE,point:class extends iE{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:Qw,threshold:EE,colorOrdinal:WE};function YE(t){const e=GE[t];return e?new e:null}function XE(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function KE(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function $E(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qE(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZE(t){return!!y(t)&&(!!t.endsWith("%")&&kM(t.substring(0,t.length-1)))}function JE(t){return!!g(t)&&("percent"in t||"offset"in t)}function QE(t,e,i,s=0){var n,r;return S(t)?t:ZE(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 tB(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]=QE(t[s],e.size,i)}))})),o}function eB(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function iB(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)||ZE(t)||d(t)||JE(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function sB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const nB=(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},rB=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function aB(t,e){return t&&e.key in t?t[e.key]:e.default}function oB(t){return t&&"token"===t.type&&!!t.key}const lB={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},hB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:lB,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},cB={name:"dark",colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},dB=(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]={}),dB(t[s],e.slice(1),i))};function uB(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=UE(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}vB._charts=mB.charts,vB._series=mB.series,vB._components=mB.components,vB._graphicComponents=mB.graphicComponents,vB._marks=mB.marks,vB._regions=mB.regions,vB._animations=mB.animations,vB._implements=mB.implements,vB._chartPlugin=mB.chartPlugin,vB._vChartPlugin=mB.vChartPlugin,vB._componentPlugin=mB.componentPlugin,vB.transforms=mB.transforms,vB.dataParser=mB.dataParser,vB._layout=mB.layout,vB._grammarTransforms=mB.grammarTransforms,vB._stageEventPlugins=mB.stageEventPlugins,vB.registerStageEventPlugin=(t,e)=>{vB._stageEventPlugins[t]=e},vB.getStageEventPlugin=t=>vB._stageEventPlugins[t],vB._interactionTriggers=mB.interactionTriggers,vB.registerInteractionTrigger=(t,e)=>{vB._interactionTriggers[t]=e},vB._composedEventMap=mB.composedEventMap,vB.registerComposedEvent=(t,e)=>{vB._composedEventMap[t]=e},vB._tooltipProcessors=mB.tooltipProcessors,vB.registerTooltipProcessor=(t,e)=>{vB._tooltipProcessors[t]=e},vB.createTooltipProcessor=(t,e)=>{const i=vB._tooltipProcessors[t];return i?new i(e):null},vB._runtimePluginInstallers=mB.runtimePluginInstallers,vB.registerRuntimePluginInstaller=(t,e)=>{vB._runtimePluginInstallers[t]=e},vB.getRuntimePluginInstaller=t=>vB._runtimePluginInstallers[t];const bB=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}},conversionArrow:{line:{style:{stroke:"black"}},symbol:{style:{fill:"black"}},text:{style:{fontSize:12,fill:"#606773"}}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},xB=bB(),SB={[hB.name]:hB},AB=hB.name,kB=new Map(Object.keys(SB).map((t=>[t,SB[t]]))),CB=new Map,TB=new Map(Object.keys(SB).map((t=>[t,t===AB]))),MB=(t,e)=>{if(!t)return;const i=PB(e);kB.set(t,i),TB.set(t,!0)},wB=(t=AB)=>(TB.has(t)&&!TB.get(t)&&MB(t,kB.get(t)),kB.get(t)),EB=t=>kB.delete(t)&&CB.delete(t)&&TB.delete(t),BB=t=>!!y(t)&&kB.has(t),PB=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:AB;return yB({},wB(i),t)};class RB{static registerInstance(t){RB.instances.set(t.id,t)}static unregisterInstance(t){RB.instances.delete(t.id)}static getInstance(t){return RB.instances.get(t)}static instanceExist(t){return RB.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return RB.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}RB.instances=new Map;class OB{static registerTheme(t,e){MB(t,e)}static getTheme(t,e=!1){return wB(t)}static removeTheme(t){return EB(t)}static themeExist(t){return BB(t)}static getDefaultTheme(){return OB.themes.get(AB)}static setCurrentTheme(t){OB.themeExist(t)&&(OB._currentThemeName=t,RB.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return OB.getTheme(OB._currentThemeName,t)}static getCurrentThemeName(){return OB._currentThemeName}}function IB(t){return y(t)?OB.themeExist(t)?OB.getTheme(t):{}:g(t)?t:{}}OB.themes=kB,OB._currentThemeName=AB;const LB=["animationThreshold","colorScheme","name","padding"];function DB(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];LB.includes(n)?s[n]=r:m(r)?jE(r)?s[n]=HE(r,e):oB(r)?s[n]=aB(i,r):s[n]=DB(r,e,i):s[n]=r})),s}function FB(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]=FB(t[s],e)}return i}return _(t)?t.map((t=>FB(t,e))):t}function zB(t,e){var i;if(!t)return t;if(y(t))return null!==(i=e.getFunction(t))&&void 0!==i?i:t;if(m(t)){const i={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=zB(t[s],e));return i}return _(t)?t.map((t=>zB(t,e))):t}function HB(t,...e){return d(t)?t(...e):t}const jB=(t,e,i,s)=>((t,e,i)=>$M(t,e,i,{fontFamily:lB.fontFamily,fontSize:lB.fontSize}))(e,i,s).measure(t),NB="__VCHART",UB=500,VB=500,WB=`${NB}_MEASURE_CANVAS_ID`,GB=`${NB}_DEFAULT_DATA_INDEX`,YB=`${NB}_DEFAULT_DATA_KEY`,XB=`${NB}_DEFAULT_DATA_SERIES_FIELD`,KB=`${NB}_DEFAULT_SERIES_STYLE_NAME`,$B=`${NB}_STACK_KEY`,qB=`${NB}_STACK_START`,ZB=`${NB}_STACK_END`,JB=`${NB}_STACK_START_PERCENT`,QB=`${NB}_STACK_END_PERCENT`,tP=`${NB}_STACK_START_OffsetSilhouette`,eP=`${NB}_STACK_END_OffsetSilhouette`,iP=`${NB}_STACK_TOTAL`,sP=`${NB}_STACK_TOTAL_PERCENT`,nP=`${NB}_STACK_TOTAL_TOP`,rP=`${NB}_STACK_TOTAL_BOTTOM`,aP=`${NB}_MOSAIC_VALUE_START_PERCENT`,oP=`${NB}_MOSAIC_VALUE_END_PERCENT`,lP=`${NB}_MOSAIC_CAT_START_PERCENT`,hP=`${NB}_MOSAIC_CAT_END_PERCENT`,cP=`${NB}_SEGMENT_START`,dP=`${NB}_SEGMENT_END`,uP=`${NB}_KEY`,pP=`${NB}_MAP_LOOK_UP_KEY`;function gP(t,e){for(let i=0;it.key===e))}function mP(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 vP(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},SP(t,a,n[o],l,e,r))})),s?yP(n):n}function yP(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))):yP(t[e].nodes);return t}function _P(t,e){if("values"in t&&t.values.length){const i=bw(t.values,e),s=_w(t.values,QB);t.values.forEach((t=>{t[iP]=i,t[sP]=s}))}else for(const i in t.nodes)_P(t.nodes[i],e)}function bP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][ZB]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)xP(t.nodes[r],e,i,s,n)}function SP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[ZB]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),SP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const AP=(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]=CP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function TP(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function MP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return PP(t(r,i,s,n));if(TP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),PP(e)}return PP(t)}function wP(t={}){const e=Object.assign({},t);if(d(t.style)||TP(t.style)?e.style=(e,i,s,n)=>MP(t.style,e,i,s,n):P(t.style)||(e.style=PP(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||TP(t.state[e])?i[e]=(i,s,n,r)=>MP(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=PP(t.state[e]))})),e.state=i}return e}function EP(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e,s,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}function BP(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),PP(i)}function PP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const RP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},OP=t=>"line"===t||"area"===t,IP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return OP(i)?e:null==e?void 0:e[0]},LP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let DP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=vB.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(vB.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var FP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(FP||(FP={}));const zP=["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 HP,jP,NP;t.ChartEvent=void 0,(HP=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",HP.rendered="rendered",HP.renderFinished="renderFinished",HP.animationFinished="animationFinished",HP.regionSeriesDataFilterOver="regionSeriesDataFilterOver",HP.afterInitData="afterInitData",HP.afterInitEvent="afterInitEvent",HP.afterInitMark="afterInitMark",HP.rawDataUpdate="rawDataUpdate",HP.viewDataFilterOver="viewDataFilterOver",HP.viewDataUpdate="viewDataUpdate",HP.viewDataStatisticsUpdate="viewDataStatisticsUpdate",HP.markDeltaYUpdate="markDeltaYUpdate",HP.viewDataLabelUpdate="viewDataLabelUpdate",HP.scaleDomainUpdate="scaleDomainUpdate",HP.scaleRawDomainUpdate="scaleRawDomainUpdate",HP.scaleUpdate="scaleUpdate",HP.dataZoomChange="dataZoomChange",HP.drill="drill",HP.layoutStart="layoutStart",HP.layoutEnd="layoutEnd",HP.layoutRectUpdate="layoutRectUpdate",HP.playerPlay="playerPlay",HP.playerPause="playerPause",HP.playerEnd="playerEnd",HP.playerChange="playerChange",HP.playerForward="playerForward",HP.playerBackward="playerBackward",HP.scrollBarChange="scrollBarChange",HP.brushStart="brushStart",HP.brushChange="brushChange",HP.brushEnd="brushEnd",HP.brushClear="brushClear",HP.brushActive="brushActive",HP.legendSelectedDataChange="legendSelectedDataChange",HP.legendFilter="legendFilter",HP.legendItemClick="legendItemClick",HP.legendItemHover="legendItemHover",HP.legendItemUnHover="legendItemUnHover",HP.tooltipShow="tooltipShow",HP.tooltipHide="tooltipHide",HP.tooltipRelease="tooltipRelease",HP.afterResize="afterResize",HP.afterRender="afterRender",HP.afterLayout="afterLayout",HP.afterMarkLayoutEnd="afterMarkLayoutEnd",HP.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(jP||(jP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(NP||(NP={}));const UP=[NP.mark,NP.model,NP.chart,NP.vchart];class VP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(NP.vchart,[]),this._levelNodes.set(NP.chart,[]),this._levelNodes.set(NP.model,[]),this._levelNodes.set(NP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const WP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class GP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>IP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||jP.chart);o.get(t)||o.set(t,new VP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||jP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||jP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||jP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||jP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?UP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[jP.chart,jP.window,jP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&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 WP[a]&&(a=WP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?NP.model:NP.vchart:NP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=jP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==NP.model&&s!==NP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=NP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case jP.chart:return this._viewBubbles;case jP.window:return this._windowBubbles;case jP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case jP.chart:return this._viewListeners;case jP.window:return this._windowListeners;case jP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return zP.includes(t)||Object.values(FP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&vB.hasInteractionTrigger(e)}}function YP(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function XP(t,e,i){t.getParser(e)||t.registerParser(e,i)}const KP=new Map;let $P;function qP(){$P||($P=new Fa,XP($P,"geojson",Pa),XP($P,"topojson",Oa),YP($P,"simplify",Kr))}function ZP(t,e,i={type:"geojson",centroid:!0}){KP.has(t)&&gM(`map type of '${t}' already exists, will be overwritten.`),qP();const s=new za($P),n=H({},{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}),KP.set(t,s)}function JP(t){KP.has(t)?KP.delete(t):gM(`map type of '${t}' does not exists.`)}function QP(t,e=!1){let i=e;return t.latestData instanceof za&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const tR=(t,e)=>0===t.length?[]:1===t.length?QP(t[0],null==e?void 0:e.deep):t.map((t=>QP(t,null==e?void 0:e.deep)));function eR(e,i,s){YP(i=i instanceof Fa?i:e.dataSet,"copyDataView",tR);const n=new za(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function iR(t,e,i=[]){var s;if(t instanceof za)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new za(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return gM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return gM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),gM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function sR(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var nR,rR,aR,oR;t.TransformLevel=void 0,(nR=t.TransformLevel||(t.TransformLevel={}))[nR.copyDataView=-10]="copyDataView",nR[nR.treemapFilter=-8]="treemapFilter",nR[nR.treemapFlatten=-7]="treemapFlatten",nR[nR.dotObjFlat=-7]="dotObjFlat",nR[nR.linkDotInfo=-7]="linkDotInfo",nR[nR.sankeyLayout=-7]="sankeyLayout",nR[nR.dataZoomFilter=-6]="dataZoomFilter",nR[nR.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(rR||(rR={})),function(t){t.data="data",t.mark="mark"}(aR||(aR={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(oR||(oR={}));const lR=["line","area","trail"];function hR(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(uP,i?t.slice().sort(i):t.slice()),{keys:[uP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const cR=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function dR(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{dR(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function pR(t,e,i,s){const n=hR(t,(t=>i(t))),r=hR(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const gR=`${NB}_BuiltIn_CallBack_Disappear`;var fR;!function(t){t.render="render",t.disappear="disappear"}(fR||(fR={}));const mR=[0,0,0];class vR{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Ol),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Ll),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Su.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&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(mu(mR,[e,i,s],this.modelMatrix),e=mR[0],i=mR[1],s=mR[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=ru(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:nu(this,a,this.dpr),r.strokeStyle=ru(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}vR.env="browser";class yR extends wu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=oh.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new vR(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 _R(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,kd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Cd,e.env));r||i.bind(kd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Cd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}yR.env="browser";const bR=_R(yR,vR);class xR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}xR.env="feishu";class SR extends wu{constructor(t){super(t)}init(){this._context=new xR(this,this._dpr)}release(...t){}}SR.env="feishu";const AR=_R(SR,xR);class kR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}kR.env="harmony";class CR extends wu{constructor(t){super(t)}init(){this._context=new kR(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}CR.env="harmony";const TR=_R(CR,kR);class MR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}MR.env="lynx";class wR extends wu{constructor(t){super(t)}init(){this._context=new MR(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}wR.env="lynx";const ER=_R(wR,MR);class BR extends vR{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}BR.env="node";class PR extends wu{constructor(t){super(t)}init(){this._context=new BR(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}PR.env="node";const RR=_R(PR,BR);class OR extends vR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(ru(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:nu(this,l,this.dpr)),r.setStrokeStyle(ru(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}OR.env="taro";class IR extends wu{constructor(t){super(t)}init(){this._context=new OR(this,this._dpr)}release(...t){}}IR.env="taro";const LR=_R(IR,OR);class DR extends xR{}DR.env="tt";class FR extends wu{constructor(t){super(t)}init(){this._context=new DR(this,this._dpr)}release(...t){}}FR.env="tt";const zR=_R(FR,DR);class HR extends vR{draw(){}createPattern(t,e){return null}}HR.env="wx";class jR extends wu{constructor(t){super(t)}init(){this._context=new HR(this,this._dpr)}release(...t){}}jR.env="wx";const NR=_R(jR,HR);class UR extends vA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=_f.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;nnew GR(xS(t,ky)))).inSingletonScope(),t.bind(eA).toService(HS))}class KR extends CT{constructor(t){super(),this.canvasRenderer=t}}let $R=!1;class qR extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=gd}}let ZR=!1;function JR(t){var e;ZR||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,jy))&&(ZR=!0,t.bind(tA).toDynamicValue((()=>new qR(xS(t,jy)))).inSingletonScope(),t.bind(eA).toService(tA))}const QR=Xc();Xc();class tO{constructor(){this.type="gif-image",this.numberType=QR}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let eO=!1;function iO(t){eO||(eO=!0,t.bind(NS).toDynamicValue((()=>new tO)).inSingletonScope(),t.bind(eA).toService(NS))}function sO(t){t.isBound(UR)||t.bind(UR).toDynamicValue((()=>new UR(SS(eA,t),xS(t,Hy),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(UR):t.bind(qm).toService(UR)}function nO(t){(function(t){WR||(WR=!0,t.bind(QS).toDynamicValue((()=>new VR)).inSingletonScope(),t.bind(eA).toService(QS),Hm(t.bind.bind(t),eA))})(t),hC(t),yC(t),AC(t),XR(t),RC(t),UC(t),ZC(t),function(t){$R||($R=!0,t.bind(VS).toDynamicValue((()=>new KR(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(VS))}(t),rT(t),pT(t),xT(t),wT(t),DT(t),NT(t),JR(t),ZT(t),rM(t),iO(t),sO(t)}class rO extends cA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${rO.idprefix}_${rO.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=oh.global,this.viewBox=new Ve,this.modelMatrix=new Ge(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(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:rO.GenerateCanvasId(),canvasControled:!0};this.canvas=new yR(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new yR({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function aO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rO))||t.bind(rO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,rO.env))||t.bind(xf).toService(rO).whenTargetNamed(rO.env)}rO.env="browser",rO.idprefix="visactor_window",rO.prefix_count=0;var oO=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 lO{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 hO(t,e=!1){const i=document.createElement("img");if(oh.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class cO extends hA{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 lO(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return hO(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return hO(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return oO(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function dO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,cO))||(t.bind(cO).toSelf().inSingletonScope(),t.bind(vg).toService(cO))}function uO(t=m_(),e=!0){uO.__loaded||(uO.__loaded=!0,dO(t),bR(t),aO(t),e&&nO(t))}uO.__loaded=!1;class pO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new SR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 SR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function gO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,pO))||t.bind(pO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,pO.env))||t.bind(xf).toService(pO).whenTargetNamed(pO.env)}pO.env="feishu";class fO extends vA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Tu(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}}let mO=!1;class vO extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let yO=!1;function _O(t){yO||(yO=!0,t.bind(TS).toDynamicValue((()=>new vO(xS(t,ky)))).inSingletonScope(),t.bind(AS).toService(TS))}function bO(t){(function(t){mO||(mO=!0,Hm(t.bind.bind(t),AS))})(t),function(t){t.isBound(fO)||t.bind(fO).toDynamicValue((()=>new fO(SS(AS,t),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(fO):t.bind(qm).toService(fO)}(t),uC(t),TC(t),_O(t),LC(t),GC(t),tT(t),mT(t),lT(t),PT(t),WT(t),tM(t),lM(t)}class xO{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class SO{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function AO(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function kO(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new xO(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function CO(t,e,i,s){const n=AO(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new SO(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function TO(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function MO(t,e=TO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class wO extends hA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=TO(i),n=null!==(e=t.dpr)&&void 0!==e?e:MO(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return MO(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function EO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,wO))||(t.bind(wO).toSelf().inSingletonScope(),t.bind(vg).toService(wO))}function BO(t=m_(),e=!0){BO.__loaded||(BO.__loaded=!0,EO(t),AR(t),gO(t),e&&bO(t))}BO.__loaded=!1;function PO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function RO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new CR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 CR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return PO(t,"target",s),PO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=RO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=RO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&OO(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),OO(t,"x",_),OO(t,"y",b),OO(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),OO(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),OO(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),OO(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),OO(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),OO(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function LO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,IO))||t.bind(IO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,IO.env))||t.bind(xf).toService(IO).whenTargetNamed(IO.env)}IO.env="harmony";const DO="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function FO(t){return"number"==typeof t&&Number.isFinite(t)}function zO(...t){for(let e=0;e({width:i,height:s})),new SO(t,l,n,i,s,e)}function VO(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=NO(e*s,i*s);if(t)return t}throw new Error(DO)}class WO extends hA{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=HO(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=HO(s),r=null!==(i=t.dpr)&&void 0!==i?i:jO(s),a=function(t,e){if(!FO(t)||!FO(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=UO(VO(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=UO(VO(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return jO(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=zO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=zO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function GO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,WO))||(t.bind(WO).toSelf().inSingletonScope(),t.bind(vg).toService(WO))}function YO(t=m_(),e=!0){YO.__loaded||(YO.__loaded=!0,GO(t),TR(t),LO(t),e&&bO(t))}YO.__loaded=!1;function XO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function KO(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new wR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 wR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return XO(t,"target",s),XO(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=KO(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=KO(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&$O(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),$O(t,"x",_),$O(t,"y",b),$O(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),$O(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),$O(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),$O(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),$O(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),$O(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function ZO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,qO))||t.bind(qO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,qO.env))||t.bind(xf).toService(qO).whenTargetNamed(qO.env)}qO.env="lynx";function JO(t){return"number"==typeof t&&Number.isFinite(t)}function QO(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=eI(r),o=null!==(i=t.dpr)&&void 0!==i?i:iI(r,a),l=nI(t.width,t.height),h=rI(aI(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=eI(a),l=null!==(n=t.dpr)&&void 0!==n?n:iI(a,o),h=nI(t.width,t.height),c=Math.random().toString(),d=rI(aI(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return iI(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=QO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=QO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function lI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,oI))||(t.bind(oI).toSelf().inSingletonScope(),t.bind(vg).toService(oI))}function hI(t=m_(),e=!0){hI.__loaded||(hI.__loaded=!0,lI(t),ER(t),ZO(t),e&&bO(t))}hI.__loaded=!1;class cI extends cA{get container(){return null}constructor(t=oh.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new PR(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new PR({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function dI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cI))||t.bind(cI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,cI.env))||t.bind(xf).toService(cI).whenTargetNamed(cI.env)}cI.env="node";class uI extends hA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function pI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,uI))||(t.bind(uI).toSelf().inSingletonScope(),t.bind(vg).toService(uI))}function gI(t=m_(),e=!0){gI.__loaded||(gI.__loaded=!0,pI(t),RR(t),dI(t))}gI.__loaded=!1;class fI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new IR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 IR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fI))||t.bind(fI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,fI.env))||t.bind(xf).toService(fI).whenTargetNamed(fI.env)}fI.env="taro";class vI extends hA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=CO(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=kO(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function yI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,vI))||(t.bind(vI).toSelf().inSingletonScope(),t.bind(vg).toService(vI))}function _I(t=m_(),e=!0){_I.__loaded||(_I.__loaded=!0,yI(t),LR(t),mI(t),e&&bO(t))}_I.__loaded=!1;class bI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new FR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 FR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function xI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,bI))||t.bind(bI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,bI.env))||t.bind(xf).toService(bI).whenTargetNamed(bI.env)}bI.env="tt";function SI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function AI(t,e=SI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class kI extends hA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=SI(i),n=null!==(e=t.dpr)&&void 0!==e?e:AI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return AI(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function CI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,kI))||(t.bind(kI).toSelf().inSingletonScope(),t.bind(vg).toService(kI))}function TI(t=m_(),e=!0){TI.__loaded||(TI.__loaded=!0,CI(t),zR(t),xI(t),e&&bO(t))}TI.__loaded=!1;class MI{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={}}}function wI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class EI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="wx",this.eventManager=new MI}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new jR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 jR({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return wI(t,"target",o),wI(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function BI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,EI))||t.bind(EI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,EI.env))||t.bind(xf).toService(EI).whenTargetNamed(EI.env)}EI.env="wx";function PI(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function RI(t,e=PI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class OI extends hA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=PI(i),n=null!==(e=t.dpr)&&void 0!==e?e:RI(i,s),r=CO(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=AO(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=kO(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return RI(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function II(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,OI))||(t.bind(OI).toSelf().inSingletonScope(),t.bind(vg).toService(OI))}function LI(t=m_(),e=!0){LI.__loaded||(LI.__loaded=!0,II(t),NR(t),BI(t),e&&bO(t))}LI.__loaded=!1;var DI={},FI={},zI={};Object.defineProperty(zI,"__esModule",{value:!0}),zI.loop=zI.conditional=zI.parse=void 0;zI.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};zI.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};zI.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var HI={};Object.defineProperty(HI,"__esModule",{value:!0}),HI.readBits=HI.readArray=HI.readUnsigned=HI.readString=HI.peekBytes=HI.readBytes=HI.peekByte=HI.readByte=HI.buildStream=void 0;HI.buildStream=function(t){return{data:t,pos:0}};var jI=function(){return function(t){return t.data[t.pos++]}};HI.readByte=jI;HI.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var NI=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};HI.readBytes=NI;HI.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};HI.readString=function(t){return function(e){return Array.from(NI(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};HI.readUnsigned=function(t){return function(e){var i=NI(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};HI.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=NI(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=ZI(t),i=GI(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=ZI(this.attribute.gifImage),e=GI(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=oh.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=oh.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function tL(t){return new QI(t)}class eL extends bx{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=QR,this._renderContribitions=void 0,this.builtinContributions=[iL],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=zp(t).image;this._draw(t,n,!1,i)}}const iL=new class extends Jv{constructor(){super(...arguments),this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let sL=!1;function nL(t){sL||(sL=!0,t.bind(eL).toDynamicValue((()=>new eL(SS(Qy,t)))).inSingletonScope(),t.bind(Cy).toService(eL))}function rL(){lf.RegisterGraphicCreator("gif",tL)}function aL(){if(aL.__loaded)return;aL.__loaded=!0;const t=m_();rL(),nL(t),iO(t)}aL.__loaded=!1;const oL=aL,lL=[{register:mb,bindModule:Nb},{register:vb,bindModule:Gb},{register:yb,bindModule:nx},{register:_b,bindModule:lx},{register:bb,bindModule:ux},{register:xb},{register:Sb,bindModule:Ax},{register:Ab,bindModule:Mx},{register:kb,bindModule:Ix},{register:Cb,bindModule:Vx},{register:Tb,bindModule:Kx},{register:Mb,bindModule:Jx},{register:wb,bindModule:iS},{register:Eb,bindModule:oS},{register:Bb},{register:Pb,bindModule:dS},{register:Rb,bindModule:fS},{register:Ob,bindModule:_S},{register:Ib},{register:rL}];let hL=!1;const cL=[hC,yC,AC,XR,RC,UC,ZC,rT,pT,xT,wT,DT,NT,JR,ZT,rM,iO];function dL(t){return{getContributions:t}}function uL(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function pL(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=NA();i(a),s(a),n(a),UA(),uL(e,{envParams:r,force:!0})}function gL(t,e){pL(t,"browser",{bindEnv:dO,bindCanvasModules:bR,bindWindowContribution:aO},e)}function fL(t,e){pL(t,"node",{bindEnv:pI,bindCanvasModules:RR,bindWindowContribution:dI},e)}function mL(t){WA(t),function(){if(hL)return;const t=NA();hL=!0,lL.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),nL(t),UA()}(),YA(t),GA(t)}function vL(t){WA(t);const e=NA();cL.forEach((t=>t(e))),sO(e),XA(t,eA),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[])),r=VA();oh.pickerServiceFactory=()=>new UR(i,{},s,n),oh.global=r}(t)}function yL(t){WA(t);bO(NA()),XA(t,AS),function(t){const e=NA(),i=dL((()=>t.registry.picker.getAll())),s=dL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=dL((()=>e.isBound(tv)?e.getAll(tv):[]));oh.pickerServiceFactory=()=>new fO(i,s,n)}(t)}function _L(){if(_L.__loaded)return;_L.__loaded=!0;const t=m_();_b(),lx({bind:t.bind}),bS?XR(t):_O(t)}_L.__loaded=!1;const bL=_L;function xL(){if(xL.__loaded)return;xL.__loaded=!0;const t=m_();Pb(),dS({bind:t.bind}),JR(t)}xL.__loaded=!1;const SL=xL;function AL(){AL.__loaded||(AL.__loaded=!0,Ib())}AL.__loaded=!1;const kL=AL;class CL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class TL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,$_(this.target,i,_o.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ML extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class wL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class EL extends CL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class BL extends TL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const PL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class RL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){X_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){X_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class OL extends RL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=PL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r),this.determineUpdateFunction()}}class IL extends RL{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class LL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class DL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const FL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class zL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=FL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class HL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const jL=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class NL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(X_(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class UL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:jL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class VL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:jL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const WL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class GL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:WL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class YL extends NL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:WL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const XL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class KL extends NL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:XL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class $L extends NL{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:XL(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const qL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class ZL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class JL extends ZL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=qL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}}class QL extends ZL{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const tD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class eD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nD extends sD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class rD extends sD{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class aD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,$_(this.target,{text:n})}}class oD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lD extends oD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class hD extends oD{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class cD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&q_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),X_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class dD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class uD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const pD={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function gD(t,e){for(let i=0;ipD[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&M_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(X_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class mD{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new w_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function vD(t){return new mD(t)}class yD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;$_(this.target,{text:o})}}class _D extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(q_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),q_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),q_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),q_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;q_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:yD});const i=s._titleBottom.attribute.text;q_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:yD})}else q_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),q_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;q_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());q_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class bD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class xD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(q_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:yD}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:yD}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class SD extends nb{onBind(){super.onBind();const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class AD extends rb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==AD.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class kD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class CD extends AD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==CD.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==CD.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class TD{static createTempCanvas(t,e,i){return b_.createCanvas({width:t,height:e,dpr:i||b_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=TD.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(TD.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(TD.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(TD.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(TD.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class ED extends CD{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class OD extends CD{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=TD.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class ID extends AD{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=b_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=b_.createCanvas({width:i,height:s,dpr:b_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class LD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}$_(this.target,{textConfig:o})}}class DD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class FD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function ND(t,e){X_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class UD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,q_(this.target,m)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class VD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,q_(this.target,d)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class WD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,q_(this.target,p)}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class GD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class YD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}}class XD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:VD,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class KD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:UD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:WD,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class $D extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class qD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class ZD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){ND(this.target,jD(this.propKeys,this.from,this.to,e))}}class JD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:qD,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class QD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:ZD,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:$D,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class tF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),X_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ru(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ru(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class eF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=oh.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Al,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=oh.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Fo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Fo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function lF(t){var e,i;const s=null!==(e=m_().getAll(Cy))&&void 0!==e?e:[],n=aF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;oF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=rF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function hF(t,e){var i,s;const n=null!==(i=m_().getAll(e))&&void 0!==i?i:[],r=aF(t.registry.picker,"vrender:legacy-picker"),a=new Set;oF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=rF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const cF=gL,dF=fL,uF={taro:{installEnv:function(t,e){pL(t,"taro",{bindEnv:yI,bindCanvasModules:LR,bindWindowContribution:mI},e)},loadEnv:_I},feishu:{installEnv:function(t,e){pL(t,"feishu",{bindEnv:EO,bindCanvasModules:AR,bindWindowContribution:gO},e)},loadEnv:BO},tt:{installEnv:function(t,e){pL(t,"tt",{bindEnv:CI,bindCanvasModules:zR,bindWindowContribution:xI},e)},loadEnv:TI},wx:{installEnv:function(t,e){pL(t,"wx",{bindEnv:II,bindCanvasModules:NR,bindWindowContribution:BI},e)},loadEnv:LI},lynx:{installEnv:function(t,e){pL(t,"lynx",{bindEnv:lI,bindCanvasModules:ER,bindWindowContribution:ZO},e)},loadEnv:hI},harmony:{installEnv:function(t,e){pL(t,"harmony",{bindEnv:GO,bindCanvasModules:TR,bindWindowContribution:LO},e)},loadEnv:YO}},pF=[nC,eC,S_,k_,uA,gA],gF=[()=>{w_.registerBuiltInAnimate("increaseCount",aD),w_.registerBuiltInAnimate("fromTo",ab),w_.registerBuiltInAnimate("scaleIn",cD),w_.registerBuiltInAnimate("scaleOut",dD),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL),w_.registerBuiltInAnimate("fadeIn",EL),w_.registerBuiltInAnimate("fadeOut",BL),w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("moveIn",nD),w_.registerBuiltInAnimate("moveOut",rD),w_.registerBuiltInAnimate("rotateIn",lD),w_.registerBuiltInAnimate("rotateOut",hD),w_.registerBuiltInAnimate("update",fD),w_.registerBuiltInAnimate("state",uD),w_.registerBuiltInAnimate("labelItemAppear",_D),w_.registerBuiltInAnimate("labelItemDisappear",bD),w_.registerBuiltInAnimate("poptipAppear",xD),w_.registerBuiltInAnimate("poptipDisappear",SD),w_.registerBuiltInAnimate("inputText",yD),w_.registerBuiltInAnimate("inputRichText",LD),w_.registerBuiltInAnimate("outputRichText",DD),w_.registerBuiltInAnimate("slideRichText",zD),w_.registerBuiltInAnimate("slideOutRichText",FD),w_.registerBuiltInAnimate("slideIn",UD),w_.registerBuiltInAnimate("growIn",VD),w_.registerBuiltInAnimate("spinIn",WD),w_.registerBuiltInAnimate("moveScaleIn",XD),w_.registerBuiltInAnimate("moveRotateIn",KD),w_.registerBuiltInAnimate("strokeIn",GD),w_.registerBuiltInAnimate("slideOut",$D),w_.registerBuiltInAnimate("growOut",qD),w_.registerBuiltInAnimate("spinOut",ZD),w_.registerBuiltInAnimate("moveScaleOut",JD),w_.registerBuiltInAnimate("moveRotateOut",QD),w_.registerBuiltInAnimate("strokeOut",YD),w_.registerBuiltInAnimate("pulse",tF),w_.registerBuiltInAnimate("MotionPath",HD),w_.registerBuiltInAnimate("streamLight",eF),w_.registerBuiltInAnimate("dissolve",wD),w_.registerBuiltInAnimate("grayscale",RD),w_.registerBuiltInAnimate("distortion",ED),w_.registerBuiltInAnimate("particle",OD),w_.registerBuiltInAnimate("glitch",PD),w_.registerBuiltInAnimate("gaussianBlur",BD),w_.registerBuiltInAnimate("pixelation",ID)},fb],fF=[gC,bC,wC,bL,FC,oL,HC,XC,iT,cT,yT,AT,OT,zT,YT,KT,iM,cM,kL,SL];function mF(){pF.forEach((t=>t())),gF.forEach((t=>t()))}function vF(t,e){if(!nF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==b_?void 0:b_.env)?b_.envParams:void 0}(e);return void 0===i?fL(t):dF(t,i),mL(t),yL(t),gI(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}function yF(t,e,i){if(!nF(t,e))return t;const s=uF[e];return s.installEnv(t,i),mL(t),function(t){yL(t)}(t),s.loadEnv(),fF.forEach((t=>t())),lF(t),hF(t,AS),mF(),t}const _F=Symbol.for("visactor.vrender.sharedAppRegistry");function bF(){var t;const e=globalThis,i=null!==(t=e[_F])&&void 0!==t?t:new Map;return e[_F]=i,i}function xF(t,e){const i=bF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function SF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=bF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function AF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=xF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(SF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>SF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=xF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&SF(t,i,s))}}}(t,s,r,o)}const kF=$A,CF=[];function TF(t){CF.forEach((({module:e,options:i})=>{kF(e,Object.assign(Object.assign({},i),{app:t}))}))}var MF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),lF(t),hF(t,eA),mF(),t):t}(bA(MF(t,["envParams"])),e);return TF(i),i}var EF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},DF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},FF=(t,e)=>{const i=LF(t),s=DF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},zF=(t,e)=>{const i=AF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,IF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},HF="poptipForText";class jF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(HF))&&this._dedupeStagePlugin(HF)}initView(){var e,i,s,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:u,autoPreventDefault:f,background:m}=this._option,v=FF(l,h);b_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=LF(i.mode),n=FF(i.mode,i.modeParams);return zF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=t.releaseAppRef,null===(e=this._option.runtimePluginInstallers)||void 0===e||e.forEach((e=>e(t.app)));try{this._stage=(_=t.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:p(a)?a:!p(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=tg({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(p(c)?c:bM(l))&&!1!==d&&vB.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,g(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=oR.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!_M(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:b_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>dR(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>dR(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{dR(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===oR.before;(e||i)&&(pM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=oR.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=oR.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),pM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=uR(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=pR(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=pR(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=hR(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=hR(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:gR,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{dR(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===rR.appear))?rR.appear:e.every((t=>t===rR.disappear))?rR.disappear:rR.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===jP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=RP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=RP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:IP(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===jP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===jP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===jP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===jP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===jP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{dR(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=uR(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return _M(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{b_.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{dR(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function NF(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:fM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const UF={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}},VF={poptip:H({},UF)};function WF(t){t.crosshair=Y(t.crosshair||{}).map((e=>uB({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function GF(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}=li(l,i.width,i.height);a=t,o=e}else if(h&&_M(e.mode)){let t;t=y(h)?b_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(xM(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}}const YF=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function XF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function KF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function $F(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;YF.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function qF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var ZF,JF,QF,tz,ez,iz;t.LayoutZIndex=void 0,(ZF=t.LayoutZIndex||(t.LayoutZIndex={}))[ZF.SeriesGroup=0]="SeriesGroup",ZF[ZF.Axis_Grid=50]="Axis_Grid",ZF[ZF.CrossHair_Grid=100]="CrossHair_Grid",ZF[ZF.Region=450]="Region",ZF[ZF.Mark=300]="Mark",ZF[ZF.Node=400]="Node",ZF[ZF.Axis=100]="Axis",ZF[ZF.MarkLine=500]="MarkLine",ZF[ZF.MarkArea=100]="MarkArea",ZF[ZF.MarkPoint=500]="MarkPoint",ZF[ZF.DataZoom=500]="DataZoom",ZF[ZF.ScrollBar=500]="ScrollBar",ZF[ZF.Player=500]="Player",ZF[ZF.Legend=500]="Legend",ZF[ZF.CrossHair=500]="CrossHair",ZF[ZF.Indicator=500]="Indicator",ZF[ZF.Title=500]="Title",ZF[ZF.Label=500]="Label",ZF[ZF.Brush=500]="Brush",ZF[ZF.CustomMark=500]="CustomMark",ZF[ZF.Interaction=700]="Interaction",t.LayoutLevel=void 0,(JF=t.LayoutLevel||(t.LayoutLevel={}))[JF.Indicator=10]="Indicator",JF[JF.Region=20]="Region",JF[JF.Axis=30]="Axis",JF[JF.DataZoom=40]="DataZoom",JF[JF.Player=40]="Player",JF[JF.ScrollBar=40]="ScrollBar",JF[JF.Legend=50]="Legend",JF[JF.Title=70]="Title",JF[JF.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(QF=t.AttributeLevel||(t.AttributeLevel={}))[QF.Default=0]="Default",QF[QF.Theme=1]="Theme",QF[QF.Chart=2]="Chart",QF[QF.Base_Series=3]="Base_Series",QF[QF.Series=4]="Series",QF[QF.Mark=5]="Mark",QF[QF.User_Chart=6]="User_Chart",QF[QF.User_Series=7]="User_Series",QF[QF.User_Mark=8]="User_Mark",QF[QF.User_SeriesStyle=9]="User_SeriesStyle",QF[QF.Built_In=99]="Built_In";class sz{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,H({},sz.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]))))}}sz.defaultMarkInfo={};class nz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class rz{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=>uB({},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 az extends nz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=rz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new sz,this._lastLayoutRect=null,this.id=AM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new DP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${NB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=vB.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class oz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=tB(iB(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QE(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QE(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QE(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QE(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QE(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QE(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QE(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QE(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QE(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(eB(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class lz extends az{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new oz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(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 hz extends rz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class cz extends lz{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=hz,this.modelType="region",this.specKey="region",this.type=cz.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function dz(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 uz(t,e,i){e?t.forEach((t=>{const e=X(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=X(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 pz(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 gz(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),pz(d,!0,p,l),s&&uz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function fz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=yz(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=yz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),pz(d,!1,p,o),s&&uz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function vz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=yz(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=yz(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"left",s),r.length&&gz(r,e,i,!0,"left",s),a.length&&fz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"top",s),r.length&&mz(r,e,i,!0,"top",s),a.length&&vz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&gz(n,e,i,!1,"right",s),r.length&&gz(r,e,i,!0,"right",s),a.length&&fz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dz(t);n.length&&mz(n,e,i,!1,"bottom",s),r.length&&mz(r,e,i,!0,"bottom",s),a.length&&vz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=yz(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=yz(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:fM)("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}}}_z.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(tz||(tz={})),t.STATE_VALUE_ENUM=void 0,(ez=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",ez.STATE_HOVER="hover",ez.STATE_HOVER_REVERSE="hover_reverse",ez.STATE_DIMENSION_HOVER="dimension_hover",ez.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",ez.STATE_SELECTED="selected",ez.STATE_SELECTED_REVERSE="selected_reverse",ez.STATE_SANKEY_EMPHASIS="selected",ez.STATE_SANKEY_EMPHASIS_REVERSE="blur",ez.STATE_HIGHLIGHT="highlight",ez.STATE_BLUR="blur",ez.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(iz||(iz={}));const bz=["linear","radial","conical"],xz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Sz={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{Sz[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class Az extends nz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class kz extends Az{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,lR.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Sz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(NB)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(NB))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Ow(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class Cz extends nz{constructor(){super(...arguments),this.id=AM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=vB.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Tz extends Cz{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Mz=1e3,wz="quadInOut",Ez=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Bz=(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=Ru(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Pz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ak(t):[],n=ak(e);i&&s&&(i.fromTransform&&ok(s,i.fromTransform.clone().getInverse()),ok(s,i.toTransfrom));const[r,a]=rk(s,n);return t?nk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Oz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Iz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Oz.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Eu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Lz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Pz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Bz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):$_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Dz=(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=Rz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Iz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Lz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:wz);return c.play(d),c};class Fz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Pz(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&&Bz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const zz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Ez.includes(t))(i)||(e[i]=t[i])})),e},Hz=(t,e,i)=>{const s=zz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=oh.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},jz=(t,e,i)=>{const s=[],n=i?null:zz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:zz(t.attribute);if("rect"===t.type)ck(t,e).forEach((t=>{s.push(oh.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)dk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)uk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=fk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(oh.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?bk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?gk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&xk(t,e).forEach((t=>{"path"in t?s.push(oh.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Hz(t,s,e),s},Uz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Vz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Uz(l.delay,n,a,o),d=Uz(l.duration,n,a,o),u=Uz(l.oneByOne,n,a,o),p=Uz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(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);Dz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?jz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Nz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Rz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Iz(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:_o.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Lz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mz,null!==(l=i.easing)&&void 0!==l?l:wz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:_o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Fz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:wz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Dz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},Wz=(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))))},Gz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},Yz=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},Xz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];Yz(t,a,s)},Kz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));Yz(t,r,i)},$z=Symbol("statesClearedBeforeReInit");class qz extends Cz{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Tz(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=tg("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Al)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===tz.enter||t.context.diffState===tz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&Yz(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new kz(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&uB(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Iw(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=YE(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):bz.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Iw(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},xz[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)bz.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return hR(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return vB.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[YB],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=hR(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===rR.appear))?rR.appear:t.every((t=>t===rR.disappear))?rR.disappear:t[0];return null!=e?e:rR.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{Gz(t),s.push(...t.getGraphics())})),e.forEach((t=>{Gz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Vz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=Wz(e,n),r=Wz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===rR.exit?rR.exit:i===rR.update?rR.update:rR.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===tz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===tz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=tz.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=tz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=tz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=rR.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=rR.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return cR(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=cR(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!bz.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!Iw(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,LP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=vB.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=vB.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===oR.before||(this._product||this._initProduct(),pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[$z],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?Xz(i,t,!0,a):Kz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[$z]=e:delete s[$z]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===tz.exit&&!e.isExiting)if(e.context.animationState===tz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===tz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=tg({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[$z]=t.currentStates.slice())}))}}var Zz;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(Zz||(Zz={}));class Jz extends qz{constructor(){super(...arguments),this.type=Jz.type,this._marks=[],this._diffState=tz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(gM("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?(gM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return dR(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===tz.update){const t=this.hasAnimation(),e=LP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=tz.update}render(){this._isCommited&&(pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}Jz.type="group";const Qz={measureText:jB};class tH{static instance(){return tH.instance_||(tH.instance_=new tH),tH.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 eH{constructor(){this.id=AM(),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))?gM("不要重复添加相同的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 iH extends eH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const sH=(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"},nH=(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 rH extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=Za.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Za.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||sH(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=nH(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=Za.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=nH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=sH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Za.now()-i>this.config.press.time&&nH(s[0],t){oh.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class oH extends aH{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 C=oh.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 T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class lH extends aH{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=oh.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 hH extends sb{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&M_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(X_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));$_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const cH={type:"fadeIn"};function dH(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 cH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}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"},state:{duration:300,easing:"linear"}},pH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},gH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},fH=()=>{vB.registerAnimation("scaleInOut",(()=>pH))},mH=()=>{vB.registerAnimation("fadeInOut",(()=>gH))},vH=(t,e)=>({appear:dH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:hH,duration:uH.update.duration,easing:uH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),yH=()=>{vB.registerAnimation("line",vH)},_H=()=>{w_.registerBuiltInAnimate("growPointsIn",UL),w_.registerBuiltInAnimate("growPointsOut",VL),w_.registerBuiltInAnimate("growPointsXIn",GL),w_.registerBuiltInAnimate("growPointsXOut",YL),w_.registerBuiltInAnimate("growPointsYIn",KL),w_.registerBuiltInAnimate("growPointsYOut",$L),w_.registerBuiltInAnimate("clipIn",ML),w_.registerBuiltInAnimate("clipOut",wL)},bH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class xH{constructor(t){this._markSet=new sz,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const SH={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class AH extends xH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},SH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}AH.type="element-highlight",AH.defaultOptions=SH;const kH=()=>{vB.registerInteractionTrigger(AH.type,AH)},CH={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class TH extends xH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},CH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),Xz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Kz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}TH.type="element-select",TH.defaultOptions=CH;const MH=()=>{vB.registerInteractionTrigger(TH.type,TH)};class wH extends eH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const EH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},BH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...BH(t))})),s},PH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(EH(t,r),!1)};class RH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>vB.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>vB.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>vB.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return vB.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>vB.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){vB.registerTransform(t,e)}static registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}static getFunction(t){return t?tH.instance().getFunction(t):null}static getFunctionList(){return tH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=vB.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=vB.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,KP.get(e);var e}static registerSVG(t,e,i){const s=vB.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=vB.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){RB.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=AM(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=fR.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=$F(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{var n;if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?vB.getSeriesBuiltInTheme(e):vB.getComponentBuiltInTheme(e);i=i?uB({},s,i[e]):s}s===t.length-1&&p(i)&&(i=DB({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e],(null===(n=this.getFunctionList())||void 0===n?void 0:n.length)&&(i=zB(i,this)))})),this._cachedProcessedTheme[e]=i,i},Bw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=_M(v);if(S?uO(iA):"node"===v&&gI(iA),S&&f&&(this._container=y(f)?b_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=OB.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=vB.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===i.type&&A.push("scrollbar");const C=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new jF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new GP(this,this._compiler),this._event=new DP(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),RB.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=uB({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=FB(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;RH.getFunctionList()&&RH.getFunctionList().length&&(t=zB(t,RH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=vB.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=vB.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=vB.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return GF(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:UB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:VB})}_initDataSet(t){this._dataSet=t instanceof Fa?t:new Fa,XP(this._dataSet,"dataview",Ia),XP(this._dataSet,"array",s),YP(this._dataSet,"copyDataView",tR);for(const t in vB.transforms)YP(this._dataSet,t,vB.transforms[t]);for(const t in vB.dataParser)XP(this._dataSet,t,vB.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),XF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?rR.none:rR.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,RB.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{EH(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof za?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=iR(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?uB({},t[n][e.index],i):i):t[n]=s?uB({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?uB({},t[n][r],i):i)}else t.id===e&&(t[n]=s?uB({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=uB({},t.getSpec(),e));const r=t.updateSpec(e),a=XF(r),o=KF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=yB({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=IB(this._currentThemeName),this._currentTheme=o(a,l);else{const t=yB({},IB(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),IB(n),IB(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(VF.poptip,UF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!_M(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return IB(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!OB.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield NF(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(!_M(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(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}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)?b_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?sB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 gM("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?sB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(gM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return tH.instance().getFunction(t)}registerFunction(t,e){t&&e&&tH.instance().registerFunction(t,e)}unregisterFunction(t){t&&tH.instance().unregisterFunction(t)}getFunctionList(){return tH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=vB.getChartPlugins();t.length>0&&(this._chartPlugin=new iH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=vB.getVChartPlugins();e.length>0&&(this._vChartPlugin=new wH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=fR.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=fR.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}RH.InstanceManager=RB,RH.ThemeManager=OB,RH.globalConfig={uniqueTooltip:!0},RH.Utils=Qz,RH.vglobal=b_;vB.registerRegion("region",cz),vB.registerLayout("base",_z),KT(),HC(),vB.registerMark(Jz.type,Jz),vB.registerStageEventPlugin("gesture",rH),kH(),MH(),MB(cB.name,cB);const OH="monotone",IH="linear",LH="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class DH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function FH(t,e){return e("component",t)}function zH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=vB.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const HH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},jH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},NH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},UH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=zH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},VH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const WH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function GH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=XH(UH(h,r,a,c),d,g),o.value=XH(UH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=UH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function YH(t,e,i,s,n,r,a){if(d(e)){GH(t,e(n,a),i,s,r,a)}else e&&GH(t,e,i,s,r,a)}const XH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class KH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{YH(a,t,e,i,s,n,r)})):d(t)?YH(a,t,e,i,s,n,r):t&&GH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:UH(r.visible,t,n),value:XH(UH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:UH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=UH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&WH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const $H={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},qH=(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=gP([],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 ZH(a,n,o)},ZH=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{kM(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=>{kM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=$H[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},JH=(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=>{kM(t[e])||(t[e]=0)}))})),t},QH=`${NB}_HIERARCHY_DEPTH`,tj=`${NB}_HIERARCHY_ROOT`,ej=`${NB}_HIERARCHY_ROOT_INDEX`;function ij(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function sj(t,e,i){t&&(i.needDefaultSeriesField&&(t[XB]=i.defaultSeriesField),t[GB]=e,t[YB]=i.getKey(t,e,i))}function nj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function rj(t,e,i,s=0,n,r){void 0===r&&(r=e),sj(t,e,i),t[QH]=s,t[tj]=n||t[i.categoryField],t[ej]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>rj(e,s,i,t[QH]+1,t[tj],r)))}const aj={label:{name:"label",type:"text"}},oj=`${NB}_rect_x`,lj=`${NB}_rect_x1`,hj=`${NB}_rect_y`,cj=`${NB}_rect_y1`,dj={data:!0},uj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},pj=[...Object.keys(uH),"normal"];function gj(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 _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=uB({},o[e],a);return _j(n)&&delete n.type,n.oneByOne&&(n=mj(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:vj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function fj(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),bj(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function mj(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function vj(t,e){var i;return null!==(i=null==t?void 0:t[GB])&&void 0!==i?i:e.context.graphicIndex}function yj(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 _j(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function bj(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),bj(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),bj(t[s],e,i))}function xj(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Sj extends rz{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=OE(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=vB.getSeriesMarkMap(o)?function(t,e,i){const s=vB.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=uB({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return uB({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=uB({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>uB({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Aj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(uj[e]||(t[e]=!0),t)),{}),kj={compileOnlyKeys:uj,dataRelatedKeys:Aj,seriesOnlyKeys:{tooltip:!0}},Cj={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Tj=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,Mj=(t,e,i)=>{const s=Tj(t),n=Tj(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function wj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class Ej extends az{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${NB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Sj,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=xj(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"invalidTravel",JH),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=iR(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=eR(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=eR(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Tz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=ZH(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){YP(this._dataSet,"dimensionStatistics",qH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new za(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&&gP(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){YP(this._dataSet,"dimensionStatistics",qH);const s=new za(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=gP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&gP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new za(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)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!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,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:bM(s)||xM(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=uB(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=uB(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=bH(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=bH(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=bH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:XB;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:KB,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,KB,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(vB.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new KH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,wj(i))}_getSpecUpdatePolicy(){return kj}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},dj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Mj(t[i],e[i],Cj)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Mj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?wj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&wj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof za||sR(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();xj(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:XB,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WE).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DE(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:XB}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,uB({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:YB}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==ZB&&t!==QB&&t!==qB&&t!==JB||(t=this.getStackValueField()),null!==(e=mP(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>kM(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:XB]}}function Bj(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Ow(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 Pj(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}}}Ej.mark=aj,Ej.transformerConstructor=Sj;class Rj extends Ej{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);Ow(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:`${NB}_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(ZB),this.setFieldX2(qB)):(this.setFieldY(ZB),this.setFieldY2(qB))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(QB),this.setFieldX2(JB)):(this.setFieldY(QB),this.setFieldY2(JB))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(eP),this.setFieldX2(tP)):(this.setFieldY(eP),this.setFieldY2(tP))}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)&&(Bj("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Oj(t){return"bottom"===t||"top"===t}function Ij(t){return"left"===t||"right"===t}function Lj(t){return"z"===t}function Dj(t,e){return qE(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Fj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function zj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Oj(t)?"linear":"band":Oj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Hj=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):["linear","log","symlog"].includes(e)?FH("axisLinear",i):{})&&void 0!==s?s:{},r=Oj(t)?FH("axisX",i):Ij(t)?FH("axisY",i):FH("axisZ",i);return uB({},FH("axis",i),n,r)};class jj{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:fM)("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:fM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Lw(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Oj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Nj extends jj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Uj=(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))},Vj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},Wj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Lw(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:Gj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,Yj=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class Xj extends jj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Uj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:jP.canvas}),callback:this.onMouseOut}),bM(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:jP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),bM(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Kj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Kj||(Kj={}));const $j={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},qj={sampling:!0,samplingFactor:!0};class Zj{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark($j.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:LH,curveType:IH,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===OH?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark($j.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:yj(this._spec,$j.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new za(this._option.dataSet,{name:`${NB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[$j.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(Kj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,uB({},this._spec[$j.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Jj=Object.assign(Object.assign({},aj),$j),Qj=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>Qj(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},tN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class eN extends qz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return tN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(Iw(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Qj(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[YB]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const iN=new Uint32Array(33),sN=new Uint32Array(33);sN[0]=0,iN[0]=~sN[0];for(let t=1;t<=32;++t)sN[t]=sN[t-1]<<1|1,iN[t]=~sN[t];function nN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&iN[31&o]&sN[1+(31&l)])return!0}else{if(i[h]&iN[31&o])return!0;if(i[c]&sN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,iN[31&o]&sN[1+(31&l)]);else for(s(h,iN[31&o]),s(c,sN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,sN[31&a]|iN[1+(31&o)]);else for(n(l,sN[31&a]),n(h,iN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function rN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function aN(t,e,i=!1){return i?rN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function oN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=aN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=rN(t,r)),e.getRange(r)))}function lN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return lN(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return lN(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 lN(t,e,n,s,h,c)}return!1}const cN=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],dN=["top","inside-top","inside"];function uN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const pN={mode:"same-time",duration:300,easing:"linear"};function gN(t){return 3===t||4===t}function fN(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 mN=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 vN(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)}}class yN extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class _N extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const bN=(t,e)=>Math.ceil(t)>Math.floor(e),xN=([t,e],[i,s])=>s>t&&e>i;function SN(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const AN=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class kN extends Qp{constructor(t,e){super(t),this._skipRenderAttributes=AN,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{MN(t,e,i)})),e}function wN(t,e){e&&(null==t||t.onComplete.push(e))}function EN(t){t.forEach((t=>{t()}))}function BN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var PN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(GM.hover,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(TM(this,(t=>{P(t.states)||(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void TM(this,(t=>{P(t.states)||(t.removeState(GM.selectedReverse),t.removeState(GM.selected))}));P(e.states)||(e.addState(GM.selected,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[vN(g,f,c,d,a,o),vN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=NM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Al)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),EN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(pN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=MN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=MN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}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):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return QM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&bN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&bN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(SN([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!xN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(aN(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(aN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;TN(i,null==n?void 0:n.attribute),TN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{ON[t]=e};var LN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};DN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const FN=()=>{IN("line",DN),IN("area",DN)};var zN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}HN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const jN=()=>{IN("symbol",HN),IN("line-data",HN)};class NN extends eN{constructor(){super(...arguments),this.type=NN.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)===PE.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}NN.type="line";const UN=()=>{vB.registerMark(NN.type,NN),KT(),iT(),FN(),jN(),_H(),vB.registerGraphicComponent("line",ag)};class VN extends qz{constructor(){super(...arguments),this.type=VN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}VN.type="symbol";const WN=()=>{vB.registerMark(VN.type,VN),KT(),iM(),jN(),vB.registerGraphicComponent("symbol",Gg)};class GN extends Sj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function YN(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function XN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function KN(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 $N(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 qN(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 ZN(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 JN=t=>t.map(((t,e)=>({index:e,value:t}))),QN=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},tU=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=$M(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return JN(v)};class sU{constructor(t){this.id=AM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class nU extends sU{constructor(){super(nU.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Ow(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&YN(c)&&YN(d)))return;const u=XN(t,c),p=XN(e,d);if(!0===u.break&&!0===p.break)return;const{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(!$N(u,p))return}else if(0===_&&0===b){if(!$N(p,u))return}else if(y||A)if(y&&!A){if(!KN(u,p))return}else if(A&&!y){if(!KN(p,u))return}else{if(f===b)return;if(f>b){if(!qN(u,p))return}else if(!qN(p,u))return}else{if(0===f&&0===_){if(!ZN(u,p))return}else if(0===b&&0===g&&!ZN(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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){YP(e.getOption().dataSet,"tickAlign",iU);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}nU.pluginType="component",nU.type="AxisSyncPlugin";const rU={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function aU(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 oU(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 lU(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const hU=t=>"band"===t||"ordinal"===t||"point"===t;function cU(t,e){return{id:t,label:t,value:e,rawValue:t}}function dU(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class uU extends eH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const pU=`${NB}_ARC_TRANSFORM_VALUE`,gU=`${NB}_ARC_RATIO`,fU=`${NB}_ARC_START_ANGLE`,mU=`${NB}_ARC_END_ANGLE`,vU=`${NB}_ARC_K`,yU=`${NB}_ARC_MIDDLE_ANGLE`,_U=`${NB}_ARC_QUADRANT`,bU=`${NB}_ARC_RADIAN`,xU=-Math.PI/2,SU=3*Math.PI/2,AU=.6,kU=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},CU=(t,e,i)=>{var s;const n=null!==(s="band"===e?FH("axisBand",i):"linear"===e?FH("axisLinear",i):{})&&void 0!==s?s:{},r=FH("angle"===t?"axisAngle":"axisRadius",i);return uB({},FH("axis",i),n,r)};function TU(t,e,i,s){switch(t){case r.cartesianBandAxis:return Hj(Dj(i,["z"]),"band",e);case r.cartesianLinearAxis:return Hj(Dj(i,["z"]),"linear",e);case r.cartesianLogAxis:return Hj(Dj(i,["z"]),"log",e);case r.cartesianSymlogAxis:return Hj(Dj(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return Hj(Dj(i),void 0,e);case r.polarBandAxis:return CU(i.orient,"band",e);case r.polarLinearAxis:return CU(i.orient,"linear",e);case r.polarAxis:return CU(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>Oj(t.orient)));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>Ij(t.orient)));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=FH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?uB({},hU(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?uB({},Lw(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return MU(i,FH(t,e));default:return FH(t,e)}}const MU=(t,e)=>{var i;const s=uB({},e,e[Fj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class wU extends rz{getTheme(t,e){return TU(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({},iB(e)),{[s]:0}))}}class EU extends lz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=wU,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof qa||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:jP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new uU(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;EH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=BH(t),s=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}EH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var BU,PU;EU.transformerConstructor=wU,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(BU||(BU={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(PU||(PU={}));class RU extends qz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=PH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?EH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(EH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?(this._component.setAttributes(i),this._product&&this._component.parent!==this._product&&this._product.appendChild(this._component)):(this._component=vB.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(FP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}RU.type="component";const OU=()=>{vB.registerMark(RU.type,RU)};var IU,LU;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(IU||(IU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(LU||(LU={}));const DU={[LU.selectedReverse]:{},[LU.selected]:{},[LU.hover]:{},[LU.hoverReverse]:{}},FU=t=>t,zU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class HU extends EU{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?BU.circleAxis:BU.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?PU.circleAxisGrid:PU.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=gj(null===(h=vB.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&Tw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Ow(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Ow(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return Tw(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=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=Mw(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()})),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(Tw(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||zU[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=wP(s=t.domainLine)).startSymbol=wP(s.startSymbol),s.endSymbol=wP(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(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 PP(uB({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:PP(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>PP(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=PP(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return PP(uB({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:PP(t.tick.style)),t.tick.state&&(i.tick.state=EP(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 PP(uB({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:PP(t.subTick.style)),t.subTick.state&&(i.subTick.state=EP(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=rU[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:uB({},d,PP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:PP(h.style)}),h.state&&(i.title.state.shape=EP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:PP(o.style)}),o.state&&(i.title.state.background=EP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=EP(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=PP(t.background.style)),t.background.state&&(i.panel.state=EP(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:HB(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 PP(uB({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:PP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:HB(t.subGrid.alternateColor),style:PP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=zH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){XP(this._option.dataSet,"scale",FU);const i=this.registerTicksTransform();return new za(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===IU.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}HU.specKey="axes";const jU=()=>{OU(),vB.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},NU=[nU];class UU extends HU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{const e=this.getOrient();Oj(e)?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Ij(e)?dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):Lj(e)&&dU(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._clearContinuousBarBandwidthCache=()=>{this._continuousBarBandwidthCache=void 0},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=uB({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(uB({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Oj(this.getOrient()),n=t=>{var e;return(s?!Oj(t.getOrient()):Oj(t.getOrient()))&&Ow(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&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Dj(i,["z"]),Lj(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(!lU(e))return null;const{axisType:t,componentName:s}=zj(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=>Ij(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(!lU(t))return;const{axisType:s,componentName:n}=zj(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=vB.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Oj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):Lj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(NU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Oj(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&&!Oj(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!Lj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Ij(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Oj(this.getOrient())?t.fieldX:Lj(this.getOrient())?t.fieldZ:t.fieldY,Ow(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getBandwidth:(t=0)=>this._getContinuousBarBandwidth(t),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}_getContinuousBarBandwidth(t=0){if(0!==t||!Ow(this._scale.type))return;const e=this._scales[0],i=e.domain(),s=e.range(),n=+(null==i?void 0:i[0]),r=+(null==i?void 0:i[i.length-1]),a=+(null==s?void 0:s[0]),o=+(null==s?void 0:s[s.length-1]);if(!(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(a)&&Number.isFinite(o)&&n!==r))return;const l=this._continuousBarBandwidthCache;if(l&&l.scale===e&&l.domainStart===n&&l.domainEnd===r&&l.rangeStart===a&&l.rangeEnd===o)return l.bandWidth;const h=new Set,c=this.getOrient();Tw(this._regions,(t=>{var e,i,s,n;if(t.type!==PE.bar)return;const r=t,a=Oj(c)&&"vertical"===r.direction?r.fieldX[0]:Ij(c)&&"horizontal"===r.direction?r.fieldY[0]:void 0,o=a?null===(n=null===(s=null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.latestData)||void 0===s?void 0:s[a])||void 0===n?void 0:n.values:void 0;null==o||o.forEach((t=>{const e=+t;Number.isFinite(e)&&h.add(e)}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const d=Array.from(h).sort(((t,e)=>t-e));if(d.length<2)return;let u=1/0,p=d[0];for(let t=1;t0&&i{if(t===this._axisMark&&!1===this._isLayout&&(Oj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Oj(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return Tw(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]:Oj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:Lj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();Tw(this._regions,(e=>{Oj(t)?dU(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Ij(t)?dU(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):Lj(t)&&dU(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Oj(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=Oj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=uB(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Oj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return cU(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Ow(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),Tw(this._regions,(t=>{var e,i;null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i||i.target.addListener("change",this._clearContinuousBarBandwidthCache)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}UU.type=r.cartesianAxis,UU.specKey="axes";class VU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Tz(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=cU(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=>cU(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const WU=(t,e,i,s)=>{const n=eU(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},GU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,YU=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?JN([s[s.length-1]]):JN([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=WU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=KU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=WU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!GU(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?YU(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function qU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=$U(e,t,!1,!!n),o=$U(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class ZU extends kN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${IU.grid}-sub`:`${IU.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=$U(t,o,!1,!!a)}const u=NM.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=gw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=NM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:ZU.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}ZU.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class JU{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=zM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return FM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class QU extends nb{onBind(){var t;const e=vD(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;TN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class tV extends nb{onBind(){const t=vD(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;TN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function eV(){HC(),iT(),YT(),cM(),w_.registerBuiltInAnimate("axisEnter",QU),w_.registerBuiltInAnimate("axisUpdate",tV)}HC(),cT();class iV extends ZU{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},ZU.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=UM,endAngle:r=VM}=this.attribute;i=pw(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function sV(){HC(),iT(),yT(),iM()}function nV(){HC(),iT(),gC(),iM()}G(iV,JU),sV();class rV extends kN{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=NM.line;Y(i)[0].cornerRadius&&(t=NM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=NM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}rV.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}}},nV();class aV extends rV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rV.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=NM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function oV(){HC(),OT(),iM(),YT(),cM()}var lV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:Y(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+E,i=1===j?(t-e)/2+E+I/2:b[0]+E-(T/2+e/2-E)+I/2;if(V(i,"center"),A){const t=i-I/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-I-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,G=lV(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Al)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},hV.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}hV.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const cV=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(GM.hover,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.hoverReverse,!0)})),s):i},dV=(t,e,i)=>i?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),null):i,uV=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(GM.selected)?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.selectedReverse),t.removeState(GM.selected))})),null):s.name&&!P(s.states)?(s.addState(GM.selected,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.selectedReverse,!0)})),s):i},pV={type:"default",duration:300,easing:"linear"};class gV extends CN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=cV(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=NM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),EN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(TM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=MN(this),{delay:a=0,duration:o=pV.duration,easing:l=pV.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};TN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=MN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(pV)}_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=NM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=IU.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=NM.group({x:0,y:0,pickable:!1});t.name=IU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=NM.group({x:0,y:0,pickable:!1});i.name=IU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=NM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=IU.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=YM;else{const t=this.data[s],e=H({},YM,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=NM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=IU.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=YM;else{const i=H({},YM,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=NM.group({x:0,y:0,pickable:!1});return r.name=`${IU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=QM(this._getLabelAttribute(t,e,n,i));if(a.name=IU.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=YM;else{const s=H({},YM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new hV(Object.assign({},e));i.name=IU.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/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 f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},nw.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},TM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=ZA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},TN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const fV={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&&fw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function mV(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function vV(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:fV[n]||fV.parity;if(s.length>=3&&mw(s,r)){do{s=a(s,r)}while(s.length>=3&&mw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);fw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),vV(l,s,n,(t=>fw(t,l,r))),vV(h,s,o,(t=>fw(t,h,r)||!(!n||t===l)&&fw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function _V(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},SV(t,e.attribute.angle)),{angle:xV(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({},AV(t,e.attribute.angle)),{angle:xV(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function xV(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function SV(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=xV(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 AV(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=xV(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 kV(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=hw(h),m=lw(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function CV(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var TV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=NM.group({zIndex:999});e.name=IU.axisBreak,e.id=this._getNodeId(`${IU.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},rw,s),a=null!==(e=r.size)&&void 0!==e?e:rw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=NM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=IU.axisBreakSymbol;const h=NM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=IU.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=NM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=IU.background,n.id=this._getNodeId("background"),n.states=H({},DU,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new hV(Object.assign({},t));e.name=IU.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=TV(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},DU,l),symbol:H({},DU,l)});const d=new rV(c);d.name=IU.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=TV(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=HM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},DU,c.text),shape:H({},DU,c.shape),panel:H({},DU,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=TV(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=HM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return SV(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return AV(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=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),bV(i,t),!_V(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=hw(a),l=lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=CV(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=CV(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);kV(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&yV(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(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=NM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=IU.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=qM(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=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}MV.defaultAttributes=nw,G(MV,JU);const wV={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},EV={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}}},BV={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}}},PV={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}}};class RV extends UU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new iE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,XU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Xw(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{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(RV.type,RV,!1)},IV=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function LV(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,FV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function zV(t,e,i="count"){const s=FV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const HV=Math.sqrt(50),jV=Math.sqrt(10),NV=Math.sqrt(2);class UV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=oU(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=Oj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(DV),e.sort(DV),{domain:LV(t,e),scope:zV(t,e,i)}}(r,dM(t),this._spec.breaks[0].scopeType);e=dM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=oU(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=HV?10:n>=jV?5:n>=NV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}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=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function VV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function WV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Ow(t.type))return JN(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return JN([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=VV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=VV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=VV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=eU(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=eU(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?YV.greedy:YV.parity;for(;l.length>=3&&mw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;fw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),WV(t,l,a,(e=>fw(e,t,i))),WV(n,l,o,(e=>fw(e,n,i)||!(!a||e===t)&&fw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return JN(m)},YV={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&fw(i,t,e)||(i=t,0))))}},XV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class KV extends UU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!Lj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Oj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=ZE(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=dM(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}KV.type=r.cartesianLinearAxis,KV.specKey="axes",KV.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(KV,UV);const $V=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(KV.type,KV)},qV=`${NB}_hide_`;function ZV(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const JV=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[qV]&&(ZV(t,!0),t[qV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[qV]=!0,ZV(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},QV=()=>{vB.registerGrammarTransform("symbolOverlap",{transform:JV,runType:"afterEncode"})},tW={min:$,max:K,average:xw,sum:bw};function eW(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function iW(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 sW(t,e,i,s){return iW(t,e,i,"min",s)}function nW(t,e,i,s){return iW(t,e,i,"max",s)}function rW(t,e,i,s){return iW(t,e,i,"average",s)}function aW(t,e,i,s){return iW(t,e,i,"sum",s)}const oW=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=eW;if("min"===n?l=sW:"max"===n?l=nW:"average"===n?l=rW:"sum"===n&&(l=aW),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[]},lW=()=>{vB.registerGrammarTransform("dataSampling",{transform:oW})};class hW extends Rj{constructor(){super(...arguments),this.type=PE.line,this.transformerConstructor=GN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),fj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}hW.type=PE.line,hW.mark=Jj,hW.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},hW.transformerConstructor=GN,G(hW,Zj);class cW{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{sR(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof za)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];gM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];gM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class dW{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{CM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{gP(e,[{key:t,operations:Ow(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&&gP(e,[{key:i.field,operations:Ow(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?YE("colorOrdinal"):YE(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(CM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),CM(s.domain)?e.reRender=!0:V(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(!CM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Ow(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Ow(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;Ow(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(Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Ow(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Ow(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class uW{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Kz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Xz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&Xz(t,i,!0,l):a&&Xz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&Xz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Kz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Kz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const pW={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},gW={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class fW extends nz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=AM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:UB,height:VB},this._viewRect={width:UB,height:VB},this._viewBox={x1:0,y1:0,x2:UB,y2:VB},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._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(gW).some((t=>!u(e[t])))},this._paddingSpec=iB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new DP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new cW(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new uW;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=vB.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(gj({},fj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=vB.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=vB.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof az)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 qz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof qz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&sR(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=GF(this._spec,this._option,{width:UB,height:VB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DE(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new dW(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){$F(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DE(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=iB(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{$F(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);KF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),$F(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);KF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),$F(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(pW[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return pW[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!pW[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;pW[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];$F(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=tB(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(FP.AFTER_MARK_RENDER_END,e)};this._event.on(FP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:IP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(OP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===Kj.dimensionHover||s===Kj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Lw(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Lw(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const mW=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},vW={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class yW{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},vW),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):dB(t,a,c.spec),dB(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=mW(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(vB.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(vB.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=vB.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=vB.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=vB.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):HH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=HH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class _W extends yW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&uB(i,qF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class bW extends _W{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),WF(t)}}const xW=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=vP(t,!0);for(const e in o)for(const i in o[e].nodes)xP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)bP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&_P(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class AW{_beforeInit(){this._dataSet&&YP(this._dataSet,"stackSplit",xW)}_initStack(){this._stack=new SW(this),this._stack.init()}}const kW={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:Kj.dimensionHover};class CW extends xH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},kW,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=IP(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}CW.type="dimension-hover",CW.defaultOptions=kW;const TW=()=>{vB.registerInteractionTrigger(CW.type,CW)},MW=()=>{vB.registerComposedEvent(Kj.dimensionHover,Xj),vB.registerComposedEvent(Kj.dimensionClick,Nj)},wW=t=>t.fieldX[0],EW=t=>t.fieldY[0],BW=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},PW=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},RW=(t,e)=>t?e?wW:BW:e?EW:PW,OW=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=Yj(t,(t=>Oj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=Yj(t,(t=>Ij(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Lw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=IW(t,i,RW(e,Lw(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=IW(t,i,RW(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},IW=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:LW(t,s,i)},LW=(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=Wj(e,t,"cartesian",null!=i?i:Oj(t.getOrient())?wW:EW);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},DW=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Lw(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Ow(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=aU(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};zW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&FW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),FW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=zH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},zW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},HW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=jW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},jW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},NW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return DW(c,r,e),c.xField.cacheInfo?HW(c.xField):c.yField.cacheInfo?HW(c.yField):void 0},UW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],VW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&UW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(WW(s).every((t=>{var e;return!WH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},WW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},GW={dom:`${NB}_TOOLTIP_HANDLER_DOM`,canvas:`${NB}_TOOLTIP_HANDLER_CANVAS`},YW={key:"其他",value:"..."};var XW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(XW||(XW={}));class KW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=VW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},YW),t):YW;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&WH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class $W extends KW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Lw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const qW=()=>{vB.registerTooltipProcessor("dimension",$W)};class ZW extends KW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,yo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(IP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const JW=()=>{vB.registerTooltipProcessor("mark",ZW)};class QW extends KW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const tG=()=>{vB.registerTooltipProcessor("group",QW)};class eG extends fW{constructor(){super(...arguments),this.transformerConstructor=bW,this.type="line",this.seriesType=PE.line}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}eG.type="line",eG.seriesType=PE.line,eG.transformerConstructor=bW,G(eG,AW);const iG=[...tN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class sG extends eN{constructor(){super(...arguments),this.type=sG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return iG}_getIgnoreAttributes(){return[]}}sG.type="area";const nG=()=>{vB.registerMark(sG.type,sG),KT(),wC(),FN(),jN(),_H(),vB.registerGraphicComponent("area",Yp)};class rG extends KH{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 aG=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}}),oG=()=>{vB.registerAnimation("area",vH),yH(),fH()};class lG extends GN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=uB({},f.style,g.style),l.state=uB({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function hG(){HC(),OT()}function cG(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const dG={debounce:St,throttle:At};hG();let uG=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=cG(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:dG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(KM,{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",dG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(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]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};uG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class pG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=pG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(KM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new uG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}SG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class AG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,SG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new SG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,VF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class kG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class CG extends kG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class TG extends kG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function MG(t){t.isBound(AG)||(t.bind(AG).toSelf().inSingletonScope(),t.bind(o_).toService(AG)),t.isBound(CG)||(t.bind(CG).toSelf(),t.bind(Sv).toService(CG)),t.isBound(TG)||(t.bind(TG).toSelf(),t.bind(Sv).toService(TG))}class wG extends kN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}HC(),iT();class EG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HC(),OT();class BG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},BG.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})}}BG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},HC(),gC();class PG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}PG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},HC(),gC();class RG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},RG.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=UM,endAngle:s=VM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}RG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},HC(),cT();class OG extends wG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},OG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}OG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class IG{isInValidValue(t){const{startAngle:e=UM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=UM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return uw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function LG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=LG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var zG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=NM.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=NM.circle(t)}h.name=IU.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},DU,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=zG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=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:y,textAlign:"center"},l),state:{text:H({},DU,d.text),shape:H({},DU,d.shape),panel:H({},DU,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=LG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&DG(e,c,i)}else e.AABBBounds.width()>r&&DG(e,r,i)}else o>a.x&&h.x2>n.x2?(DG(e,n.x2-o,i),r&&FG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}HG.defaultAttributes=nw,G(HG,IG);const jG=(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=$M(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=dw(r,uw(s,r,e,n));return o=a,l=uw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return JN(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=jG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=UG(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 JN(c)},UG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&QN(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var VG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new YG(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):gN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=gN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=gN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=gN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?gN(t.quadrant)?"left":"right":gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.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*(gN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),EN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}$G.defaultAttributes={pickable:!1};var qG,ZG,JG,QG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(tY,IG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(qG||(qG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(ZG||(ZG={})),function(t){t.dataZoomChange="dataZoomChange"}(JG||(JG={}));const eY="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",iY={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:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:eY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},sY={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}},nY=0,rY=1,aY=2,oY=3,lY=4,hY=5,cY=5,dY=999,uY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var pY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:aY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:aY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:nY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:hY},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:hY},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},sY.horizontal),{zIndex:hY}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},sY.horizontal),{zIndex:hY}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:dY},sY.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:hY},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:hY},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},sY.vertical),{zIndex:hY}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:hY},sY.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:dY},sY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:oY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:rY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:lY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return qA(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=pY(c,["formatMethod"]),{formatMethod:g}=d,f=pY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:uY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:uY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:uY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:uY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:cY}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:cY}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new hV(e),s.name=i,t.add(s)),s}}const fY={debounce:St,throttle:At};class mY extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=qG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=qG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=qG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=qG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=cG();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===qG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===qG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===qG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===qG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(ZG.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===qG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(ZG.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(ZG.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:fY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=cG();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=qG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}oV(),OT(),iM(),wC(),iT();let vY=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new gY(this._getRendererAttrs()),this._interaction=new mY(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(ZG.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(ZG.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(JG.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(ZG.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(JG.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var yY,_Y,bY,xY;function SY(){HC(),oV(),fb()}vY.defaultAttributes=iY,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"}(yY||(yY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(_Y||(_Y={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(bY||(bY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(xY||(xY={}));class AY extends kN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=cV(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=dV(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=uV(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:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},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=NM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=NM.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=NM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),EN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,wN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=MN(this);this.markerAnimate("exit");const n=MN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},BN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function kY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function CY(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;TN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function TY(t,e,i,s){t&&(CY(t.startSymbol,e,i,s),kY(t).forEach((t=>CY(t,e,i,s))),CY(t.endSymbol,e,i,s))}function MY(t,e,i,s){t&&(CY(t.getTextShape(),e,i,s),CY(t.getBgRect(),e,i,s))}function wY(t,e,i,s){var n,r,a,o;t&&(TN(t,{fillOpacity:0,strokeOpacity:0},{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 EY(t,e,i,s){t&&(wY(t.startSymbol,e,i,s),kY(t).forEach((t=>wY(t,e,i,s))),wY(t.endSymbol,e,i,s))}function BY(t,e,i,s){t&&(wY(t.getTextShape(),e,i,s),wY(t.getBgRect(),e,i,s))}function PY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;CY(t.startSymbol,s,r,n);const h=kY(t);h.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),CY(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;CY(t.getTextShape(),e,l,n),CY(t.getBgRect(),e,l,n)}))}function RY(t,e,i,s,n){TY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function OY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function IY(t,e,i,s,n){CY(t,s,i,n),Y(e).forEach((t=>{MY(t,s,i,n)}))}function LY(t,e,i,s,n,r){var a;TY(t,n,s,r),CY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?MY(i,n,s,r):CY(i,n,s,r)}function DY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;CY(t.startSymbol,n,o,r);const u=kY(t);u.forEach((t=>TN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),CY(e,n+o+l,h,r),CY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(CY(i.getTextShape(),n+o+l+h+c,d,r),CY(i.getBgRect(),n+o+l+c,d,r)):CY(i,n+o+l+c,d,r)}function FY(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?PY(t,e,s,r,a):"fadeIn"===i&&RY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?PY(t,e,s,n,a):"fadeIn"===i&&RY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){EY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function zY(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&&OY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&OY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function HY(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&&IY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&IY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}(t,e,i,s,n)}}function jY(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?LY(n,r,e,i,s,o):"callIn"===t&&DY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?LY(n,r,e,i,s,a):"callIn"===t&&DY(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;EY(t,n,s,r),wY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?BY(i,n,s,r):wY(i,n,s,r)}(n,r,e,t,i,s)}}const NY={type:"clipIn",duration:500,easing:"linear",delay:0},UY={type:"fadeIn",duration:500,easing:"linear",delay:0},VY={type:"callIn",duration:500,easing:"linear",delay:0},WY={type:"fadeOut",duration:500,easing:"linear",delay:0};class GY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new hV(Object.assign(Object.assign({},h),{state:{panel:H({},YM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},YM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},YM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},YM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class YY extends AY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=NY,this.defaultExitAnimation=WY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;sw(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(YY,GY);const XY=.001,KY={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:yY.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]}},$Y={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"}}},qY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:bY.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]}},ZY={interactive:!0,label:{position:_Y.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}},JY={interactive:!0,label:{autoRotate:!0,position:bY.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}},QY={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"}},tX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},eX={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 iX(){sX._animate=FY}SY(),sV(),fb();class sX extends YY{markerAnimate(t){sX._animate&&this._animationConfig&&sX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},sX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(wM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return EM(Math.abs(e),Math.PI/2,XY)||EM(Math.abs(e),3*Math.PI/2,XY)?BM(i,e,t):wM(e)?$Y.postiveXAxis[t]:$Y.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new rV({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",sX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(sX.defaultAttributes.label)}}function nX(){rX._animate=zY}sX.defaultAttributes=KY,SY(),yT(),fb();class rX extends AY{markerAnimate(t){rX._animate&&this._animationConfig&&rX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},rX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},tX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=NM.polygon(Object.assign({points:e},i));n.states=H({},YM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",rX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},YM,null==i?void 0:i.area)),this._updateMarkLabels(rX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}rX.defaultAttributes=ZY,G(rX,GY),SY(),nV(),fb();class aX extends YY{markerAnimate(t){aX._animate&&this._animationConfig&&aX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},aX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case bY.arcInnerStart:l=n;case bY.arcOuterStart:l=n;break;case bY.arcInnerEnd:l=r;case bY.arcOuterEnd:l=r;break;case bY.center:case bY.arcInnerMiddle:case bY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return QY[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new aV({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",aX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(aX.defaultAttributes.label)}}aX.defaultAttributes=qY,SY(),gC(),fb();class oX extends AY{markerAnimate(t){oX._animate&&this._animationConfig&&oX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},oX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=UY,this.defaultExitAnimation=WY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case bY.center:h=(s+n)/2,c=(r+a)/2;break;case bY.arcInnerStart:h=s,c=r;break;case bY.arcOuterStart:h=n,c=r;break;case bY.arcInnerEnd:h=s,c=a;break;case bY.arcOuterEnd:h=n,c=a;break;case bY.arcInnerMiddle:h=s,c=(r+a)/2;break;case bY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},QY[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=NM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},YM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",oX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},YM,null==o?void 0:o.area)),this._updateMarkLabels(oX.defaultAttributes.label)}isValidPoints(){return!0}}function lX(){hX._animate=jY}oX.defaultAttributes=JY,G(oX,GY),SY(),sV(),nV(),iM(),XC(),iT(),fb();class hX extends AY{markerAnimate(t){hX._animate&&this._animationConfig&&hX._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},hX.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=VY,this.defaultExitAnimation=WY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return EM(Math.abs(s),Math.PI/2,XY)||EM(Math.abs(s),3*Math.PI/2,XY)?BM(t,s,n):wM(s)?eX.postiveXAxis[n]:eX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=xY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},YM,null==p?void 0:p.textBackground),text:H({},YM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},YM,null==p?void 0:p.itemContent));const v=wM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=NM.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"text"===n?o=new hV(Object.assign(Object.assign({},i),{state:{panel:H({},YM,null==s?void 0:s.textBackground),text:H({},YM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=NM.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"image"===n?(o=NM.image(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},YM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=EM(c,0,XY)||EM(d,0,XY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=ew(e-u,t-d),o=ew(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(yX.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(yX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===yX.focus||"focus"===o){const s=a.hasState(mX.focus);a.toggleState(mX.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover,mX.focus],t),this._setLegendItemState(e,mX.selected,t)})):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover,mX.focus],t),this._setLegendItemState(e,mX.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(mX.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(mX.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(vX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[mX.selected,mX.selectedHover],t),this._setLegendItemState(a,mX.unSelected,t)):(this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t))}else this._setLegendItemState(a,mX.selected,t),this._removeLegendItemState(a,[mX.unSelected,mX.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[mX.selected,mX.selectedHover],t),this._setLegendItemState(e,mX.unSelected,t))}))}this._dispatchLegendEvent(vX.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,mX.selected),this._removeLegendItemState(e,[mX.unSelected,mX.unSelectedHover])):(this._removeLegendItemState(e,[mX.selected,mX.selectedHover]),this._setLegendItemState(e,mX.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=pX,spaceRow:l=gX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=NM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=NM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,yX.item,t,M)):(M=NM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,yX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?mX.selected:mX.unSelected);const w=NM.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=NM.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,yX.itemShape,t,M,S.state),s.addState(e?mX.selected:mX.unSelected),w.add(s)}let I=0;if(d){const e=R(g,"size",10);E=NM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,yX.focus,t,M),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=QM(Object.assign(Object.assign({x:P/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,yX.itemLabel,t,M,A.state),D.addState(e?mX.selected:mX.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=QM(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,yX.itemValue,t,M,k.state),r.addState(e?mX.selected:mX.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-O-I),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.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 j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new uX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new uX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new uG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new uG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=pX,spaceRow:o=gX}=n,l=this._itemsContainer,{space:h=fX,defaultCurrent:c=1}=r,d=SX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=NM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=pX,spaceRow:a=gX}=s,o=this._itemsContainer,{space:l=fX,defaultCurrent:h=1}=n,c=SX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=NM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=NM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(mX.selected)?this._setLegendItemState(t,mX.selectedHover,e):this._setLegendItemState(t,mX.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===yX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(vX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(mX.unSelectedHover)||t.hasState(mX.selectedHover))&&(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(mX.unSelectedHover)&&!t.hasState(mX.selectedHover)||(i=!0),t.removeState(mX.unSelectedHover),t.removeState(mX.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===yX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(vX.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!==yX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(vX.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!==yX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(vX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(mX.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},AX,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(mX.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var CX;function TX(t){return _(t)?t:[t,t]}function MX(t){return t?"ew-resize":"ns-resize"}kX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:pX,spaceRow:gX,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:fX,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"}(CX||(CX={})),bX();class wX extends kN{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:H({},wX.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=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=cG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(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?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:TX(d)[0],endValue:TX(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=NM.group({x:0,y:0});f.name=CX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=NM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=CX.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=NM.group({x:g?v:0,y:g?0:v});f.add(y);const _=NM.group({x:0,y:0});let b;if(_.name=CX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=NM.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=CX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=NM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=CX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=TX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(v.name=CX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=CX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":MX(p)},r));if(i.name=CX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=CX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=NM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=CX.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":MX(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=NM.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=CX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return NM.symbol(t)}_renderHandlerText(t,e){return NM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":MX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=NM.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=NM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=cG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===CX.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===CX.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===CX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===CX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}wX.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}}},xX(),bX();class EX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},EX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 BX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}EX.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"}}},xX(),bX(),cT();class PX extends _X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},PX.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=NM.group({x:0,y:0});this._innerView.add(x);const S=new wX({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:BX(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 C=NM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);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))}}PX.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)"}},HC(),cM(),YT();let RX=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},XM),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,O-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},XM),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GO&&(G=O),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(I)||p(C.align)){const t=C.align?C.align:I,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(I)||p(M.align)){const t=M.align?M.align:I,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};RX.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 OX={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"}}};HC(),cM(),YT();let IX=class extends kN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(OX,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=QM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=qM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&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 LX extends Wg{constructor(t){super(t)}}var DX,FX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(DX||(DX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(FX||(FX={}));class zX extends kN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},zX.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"},zX.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"},zX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},zX.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 LX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new LX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new LX(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(DX.OnPlay)},this.pause=()=>{this._dispatchEvent(DX.OnPause)},this.forward=()=>{this._dispatchEvent(DX.OnForward)},this.backward=()=>{this._dispatchEvent(DX.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()}}zX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},zX.defaultAttributes={[FX.Start]:{},[FX.Pause]:{},[FX.Backward]:{},[FX.Forward]:{}};const HX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},jX=[200,10];var NX,UX;!function(t){t.Default="default",t.Reverse="reverse"}(NX||(NX={})),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"}(UX||(UX={}));const VX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),WX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===NX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===NX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),GX=t=>"top"===t||"bottom"===t;class YX extends kN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},YX.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(GX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:jX[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:jX[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 wX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=GX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new zX(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=GX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:jX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(GX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(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:GX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:GX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:GX(this._orient)?t+s:(this._size.width-r)/2,y:GX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function XX(){bX(),HC(),iM()}YX.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({},HX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},HX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},HX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},HX),{key:"backward",position:"start"})}},XX();class KX extends YX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},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:NX.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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(VX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||WX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===NX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(UX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(UX.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(UX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.change),this.dispatchCustomEvent(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var $X,qX=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())}))};XX();class ZX extends YX{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(DX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(DX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(DX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(DX.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(UX.change))},this.play=()=>qX(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(UX.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UX.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(UX.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(UX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}($X||($X={}));const JX={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},QX=5;const tK={debounce:St,throttle:At};HC(),yT();let eK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=JX.updateTrigger,endTrigger:i=JX.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:tK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=JX.trigger,resetTrigger:i=JX.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent($X.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent($X.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=QX}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent($X.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent($X.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent($X.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=QX}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent($X.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=JX.updateTrigger,endTrigger:s=JX.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=NM.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};eK.defaultAttributes=JX;const iK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},sK=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}},nK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},rK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];HC(),OT(),iM(),cM(),YT();let aK=class t extends kN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},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=oi(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",H({symbolType:"circle"},u.shape,{visible:MM(u)&&MM(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:MM(u)&&MM(u.value)},sK(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:MM(u)&&MM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:MM(u)&&MM(u.value)},sK(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},XM),u.value),visible:MM(u)&&MM(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=MM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=MM(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]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!MM(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)+(MM(n.key)?r+n.key.spacing:0)+(MM(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&&(tw(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:MM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),tw(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(MM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(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(MM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},sK(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},sK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},XM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(MM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},sK(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},sK(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=>rK.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)&&MM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=MM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=$M(d),y=$M(u);let _=0;if(MM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(MM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return iK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return iK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};aK.defaultAttributes=nK;class oK extends KV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{Oj(this.getOrient())?dU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):dU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=uB({},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 za(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Tz(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.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=>cU(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=>cU(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}oK.type=r.cartesianTimeAxis,oK.specKey="axes",oK.builtInTheme={axis:EV,axisX:BV,axisY:PV};class lK extends KV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new ME}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}lK.type=r.cartesianLogAxis,lK.specKey="axes",lK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(lK,UV);class hK extends KV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new wE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}transformScaleDomain(){}}hK.type=r.cartesianSymlogAxis,hK.specKey="axes",hK.builtInTheme={axis:EV,axisLinear:XV,axisX:BV,axisY:PV},G(hK,UV);class cK extends Rj{constructor(){super(...arguments),this.type=PE.area,this.transformerConstructor=lG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(cK.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===OH?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XE(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XE(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[ZB]},"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(gj(null===(e=vB.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),fj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),fj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Pj(this);this._symbolMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),fj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new rG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}cK.type=PE.area,cK.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},cK.mark=aG,cK.transformerConstructor=lG,G(cK,Zj);class dK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(t)}}class uK extends fW{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="area",this.seriesType=PE.area}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}uK.type="area",uK.seriesType=PE.area,uK.transformerConstructor=dK,G(uK,AW);function pK(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 gK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:pK(t,e)}),fK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:pK(t,e)}),mK={type:"fadeIn"},vK={type:"growCenterIn"};function yK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mK;case"scaleIn":return vK;default:return gK(t)}}class _K extends qz{constructor(){super(...arguments),this.type=_K.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}_K.type="rect";const bK=()=>{KT(),OT(),IN("rect",WG),vB.registerMark(_K.type,_K),w_.registerBuiltInAnimate("growHeightIn",zL),w_.registerBuiltInAnimate("growHeightOut",HL),w_.registerBuiltInAnimate("growWidthIn",eD),w_.registerBuiltInAnimate("growWidthOut",iD),w_.registerBuiltInAnimate("growCenterIn",LL),w_.registerBuiltInAnimate("growCenterOut",DL),vB.registerGraphicComponent("rect",mg)},xK=Object.assign(Object.assign({},aj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function SK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=nB(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[oj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):XE(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[lj]):XE(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=XE(this._dataToPosX(t),e,i),n=XE(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[hj]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XE(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[cj]):XE(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=XE(this._dataToPosY(t),e,i),n=XE(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),CK)})}getStatisticFields(){var t;const e=super.getStatisticFields(),i="horizontal"===this.direction?this.getYAxisHelper():this.getXAxisHelper(),s="horizontal"===this.direction?this._fieldY:this._fieldX,n=null===(t=null==i?void 0:i.getScale)||void 0===t?void 0:t.call(i,0);return n&&Ow(n.type)&&s.forEach((t=>{const i=e.find((e=>e.key===t));i?i.operations.includes("values")||i.operations.push("values"):e.push({key:t,operations:["values"]})})),e}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},TK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:yj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(TK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}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(YP(this._option.dataSet,"addVChartProperty",NH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};YP(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new za(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new Tz(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_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=cj,s=hj,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=lj,s=oj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=vP(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)SK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=XE(this[r](t),l,i),u=XE(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!KE(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[qB],n=e[ZB],r=e[JB],d=e[QB];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?hj:oj],i=e[a?cj:lj];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[qB]:s,[ZB]:o}),c?{[JB]:u,[QB]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(mg(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>XE(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>XE(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Pj(this);this._barMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),fj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i;const s=this._groups?this._groups.fields.length:1,n=u(e)?s:Math.min(s,e),r=p(this._spec.barWidth)&&n===s,a=r&&"number"==typeof this._spec.barWidth&&"string"!=typeof this._spec.barMinWidth&&"string"!=typeof this._spec.barMaxWidth||null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,n-1),o=null!=a?a:6,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=!t.isContinuous||u(a)||r?o:.5*o;return r&&(c=nB(this._spec.barWidth,o)),l&&(c=Math.max(c,nB(this._spec.barMinWidth,o))),h&&(c=Math.min(c,nB(this._spec.barMaxWidth,o))),c}_getPosition(t,e,i,s){var n,r,a,o,l,h;let c,d,g;"horizontal"===t?(c=this.getYAxisHelper(),d="height",g="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(c=this.getXAxisHelper(),d="width",g="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const f=c.getScale(0),m=this._groups?this._groups.fields.length:1,v=u(i)?m:Math.min(m,i),y=null!==(r=null===(n=c.getBandwidth)||void 0===n?void 0:n.call(c,v-1))&&void 0!==r?r:6,_=v===m?this._barMark.getAttribute(d,e):y;if(v>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 h=t[r],d=null!==(o=null===(a=c.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=nB(null!==(l=i[r-1])&&void 0!==l?l:X(i),y),g=d.indexOf(e[h]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return f.scale(e[t[0]])+(null!==(h=c.getBandwidth(0))&&void 0!==h?h:y)/2-s/2+n}const b=Ow(f.type||"band");return g(e,v)+.5*(y-_)+(b?-y/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}TK.type=PE.bar,TK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},TK.mark=xK,TK.transformerConstructor=kK;const MK=()=>{lW(),bK(),vB.registerAnimation("bar",((t,e)=>({appear:yK(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),OV(),$V(),vB.registerSeries(TK.type,TK)};class wK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WF(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 EK extends fW{constructor(){super(...arguments),this.transformerConstructor=wK,this.type="bar",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}EK.type="bar",EK.seriesType=PE.bar,EK.transformerConstructor=wK,G(EK,AW);const BK=[10,20],PK=Pw.Linear,RK="circle",OK=Pw.Ordinal,IK=["circle","square","triangle","diamond","star"],LK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},DK=Object.assign(Object.assign({},aj),{point:{name:"point",type:"symbol"}});class FK extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const zK={sizeField:!0};class HK extends Rj{constructor(){super(...arguments),this.type=PE.scatter,this.transformerConstructor=FK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),zK)})}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=`${NB}_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=`${NB}_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:PK,defaultRange:BK},"size")}getShapeAttribute(t,e){return u(e)?RK:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:OK,defaultRange:IK},"shape")}initMark(){this._symbolMark=this._createMark(HK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,HK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Pj(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(gj(null===(i=vB.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),fj("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:RK},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}HK.type=PE.scatter,HK.mark=DK,HK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},HK.transformerConstructor=FK;const jK=()=>{WN(),vB.registerAnimation("scatter",((t,e)=>Object.assign({appear:LK(0,e)},pH))),OV(),$V(),vB.registerSeries(HK.type,HK)};class NK extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class UK extends fW{constructor(){super(...arguments),this.transformerConstructor=NK,this.type="scatter",this.seriesType=PE.scatter}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}UK.type="scatter",UK.seriesType=PE.scatter,UK.transformerConstructor=NK,G(UK,AW);class VK extends Ej{constructor(){super(...arguments),this.type=PE.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=`${NB}_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 WK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[GB]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[pP]=a||r})),s};class GK extends KH{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 YK extends qz{constructor(){super(...arguments),this.type=YK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}YK.type="path";const XK=()=>{vB.registerMark(YK.type,YK),KT(),cT(),vB.registerGraphicComponent("path",hg)},KK=Object.assign(Object.assign({},aj),{area:{name:"area",type:"path"}});class $K{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ua(i,e):ja[i]?(Ha[i]||(Ha[i]=Ua(i,ja[i])),Ha[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class qK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class ZK{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function JK(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:qK}:bM(e)||xM(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:ZK}:null}const QK={debounce:St,throttle:At};class t${constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=bM(this._renderMode)||xM(this._renderMode),JK(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return JK(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,QK[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:NP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:NP.chart,consume:!1}];l.on(...c,QK[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,QK[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){JK(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:NP.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:NP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||JK(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||JK(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:NP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=QK[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=QK[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:NP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:NP.chart,source:jP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:NP.chart,source:jP.chart},this._handleDragMouseUp)}))}}class e$ extends EU{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${NB}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=uB(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new $K(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===PE.map||e.type===PE.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),Tw(this._regions,(t=>{var e;if(t.type===PE.map||t.type===PE.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==PE.map&&e.type!==PE.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[pP],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}e$.type=r.geoCoordinate,G(e$,t$);const i$=()=>{vB.registerComponent(e$.type,e$)};class s$ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class n$ extends VK{constructor(){super(...arguments),this.type=PE.map,this.transformerConstructor=s$,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 !`),KP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),YP(this._dataSet,"copyDataView",tR),YP(this._dataSet,"map",WK),YP(this._dataSet,"lookup",jH);const s=KP.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new za(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:pP,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new Tz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(n$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:yj(this._spec,n$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:XB])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:XB]):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(gj(null===(t=vB.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),fj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new GK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[GB]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[GB],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return GB}getActiveMarks(){return[this._pathMark]}}n$.type=PE.map,n$.mark=KK,n$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},n$.transformerConstructor=s$;const r$=`${NB}_waterfall_default_seriesField`,a$=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[nP]=!0:delete t[nP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=o$([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}=l$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=o$(r,t,s,o,u,c,e,i),o.push(s)})),o};function o$(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}=l$(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===r$)&&(t[r$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function l$(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?gM("total.collectCountField error"):n=e[a].start;o<0?gM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const h$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},c$={type:"fadeIn"},d$={type:"growCenterIn"};function u$(t,e){switch(e){case"fadeIn":return c$;case"scaleIn":return d$;default:return gK(t,!1)}}class p$ extends qz{constructor(){super(...arguments),this.type=p$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return ag(t)}}p$.type="rule";const g$=()=>{vB.registerMark(p$.type,p$),KT(),iT(),vB.registerGraphicComponent("line",ag)},f$=Object.assign(Object.assign({},xK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),m$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:v$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function v$(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)=>v$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y${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 za(e instanceof Fa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),YP(e,"dimensionTree",m$),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 _$ extends kK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const b$={rect:T$,symbol:k$,arc:w$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=k$(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:E$,line:B$,area:B$,rect3d:T$,arc3d:w$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function x$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=b$[t])&&void 0!==i?i:b$.point;return e.series.type===PE.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=A$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:P$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function S$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==PE.sankey){const{formatFunc:t,args:n}=zH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function A$(t){return d(t)?e=>t(e.data):t}function k$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=A$(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:C$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function C$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function T$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=A$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:M$(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function M$(t){const e=[{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"]}}];return e}function w$(t){var e;const{labelSpec:i}=t,s=null!==(e=A$(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 E$(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=S$(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),Jg(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 B$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[XB]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function P$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const R$={calculationMode:!0};class O$ extends TK{constructor(){super(...arguments),this.type=PE.waterfall,this.transformerConstructor=_$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&_P(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),R$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y$(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=r$)}getSeriesKeys(){return this._seriesField===r$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),YP(this._dataSet,"waterfallFillTotal",h$),YP(this._dataSet,"waterfall",a$),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=eR(this.getViewData(),this._dataSet,{name:`${NB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Tz(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:qB,endAs:ZB,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Pj(this);this._barMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),fj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(O$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return E$(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?XE(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):XE(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&KE([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}O$.type=PE.waterfall,O$.mark=f$,O$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},O$.transformerConstructor=_$;const I$=()=>{g$(),bK(),vB.registerAnimation("waterfall",((t,e)=>({appear:u$(t,e),enter:gK(t,!1),exit:fK(t,!1),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(O$.type,O$)},L$=`${NB}_BOX_PLOT_OUTLIER_VALUE`;var D$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(D$||(D$={}));const F$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[L$]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class z$ extends KH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return this.series.getOutliersField();if(t===D$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case D$.MIN:return this.series.getMinField();case D$.MAX:return this.series.getMaxField();case D$.MEDIAN:return this.series.getMedianField();case D$.Q1:return this.series.getQ1Field();case D$.Q3:return this.series.getQ3Field();case D$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===D$.OUTLIER)return e[L$];if(t===D$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case D$.MIN:return e[this.series.getMinField()];case D$.MAX:return e[this.series.getMaxField()];case D$.MEDIAN:return e[this.series.getMedianField()];case D$.Q1:return e[this.series.getQ1Field()];case D$.Q3:return e[this.series.getQ3Field()];case D$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[L$])}getDefaultContentList(t){return[{key:this.getContentKey(D$.OUTLIER),value:this.getContentValue(D$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(D$.MAX),value:this.getContentValue(D$.MAX)},{key:this.getContentKey(D$.Q3),value:this.getContentValue(D$.Q3)},{key:this.getContentKey(D$.MEDIAN),value:this.getContentValue(D$.MEDIAN)},{key:this.getContentKey(D$.Q1),value:this.getContentValue(D$.Q1)},{key:this.getContentKey(D$.MIN),value:this.getContentValue(D$.MIN)},{key:this.getContentKey(D$.SERIES_FIELD),value:this.getContentValue(D$.SERIES_FIELD)}]}}const H$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class j$ extends qz{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==tz.enter&&t.context.diffState!==tz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{H$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Zp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=vB.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const N$=()=>{vB.registerGraphicComponent("glyph",Zp),KT(),FC()},U$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],V$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class W$ extends j${constructor(){super(...arguments),this.type=W$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=U$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=V$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}W$.type="boxPlot";const G$=Object.assign(Object.assign({},aj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),Y$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},X$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},K$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),$$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=K$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=K$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=K$(t,"box").attribute.width,i=K$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=K$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=K$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=K$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=K$(t,"box").attribute.height,i=K$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},q$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=K$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=K$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=K$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=K$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=K$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=K$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=K$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=K$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=K$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=K$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class Z$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return Y$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class J$ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return X$($$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class Q$ extends Z${computeAttribute(){return Y$(q$)(this.target,this.params,this.params.options)}}class tq extends J${computeAttribute(){return X$(q$)(this.target,this.params,this.params.options)}}class eq extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const iq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class sq extends Rj{constructor(){super(...arguments),this.type=PE.boxPlot,this.transformerConstructor=eq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),iq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(sq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(sq.mark.outlier,{key:GB,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}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=>XE(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XE(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XE(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XE(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XE(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>XE(e(this.getDatumPositionValues(t,L$),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"foldOutlierData",F$),YP(this._dataSet,"addVChartProperty",NH);const t=new za(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${NB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._outlierData=new Tz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=nB(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,nB(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,nB(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=nB(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Ow(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Pj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=vB.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(fj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(gj(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(gj(null===(a=vB.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new z$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}sq.type=PE.boxPlot,sq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},sq.mark=G$,sq.transformerConstructor=eq;const nq=()=>{N$(),iT(),OT(),vB.registerGraphicComponent("line",(t=>ag(t))),vB.registerGraphicComponent("rect",(t=>mg(t))),vB.registerMark(W$.type,W$),WN(),fH(),OV(),$V(),w_.registerBuiltInAnimate("boxplotScaleIn",Z$),w_.registerBuiltInAnimate("boxplotScaleOut",J$),w_.registerBuiltInAnimate("barBoxplotScaleIn",Q$),w_.registerBuiltInAnimate("barBoxplotScaleOut",tq),vB.registerSeries(sq.type,sq)};class rq extends qz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=rq.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?jg(t):Jg(t)}}rq.type="text";const aq=()=>{vB.registerMark(rq.type,rq),KT(),cM(),YT(),vB.registerGraphicComponent("text",Jg),vB.registerGraphicComponent("richtext",jg)};class oq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const lq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),hq={type:"fadeIn"},cq=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function dq(t,e){return"fadeIn"===e?hq:lq(t)}const uq=Object.assign(Object.assign({},xK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class pq extends kK{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 gq extends TK{constructor(){super(...arguments),this.type=PE.rangeColumn,this._barMarkType="rect",this._barName=PE.bar,this.transformerConstructor=pq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(gq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,gq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(gq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(gq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Pj(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(gj(null===(i=vB.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),fj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(gj(null===(n=vB.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),fj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new oq(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)}}gq.type=PE.rangeColumn,gq.mark=uq,gq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},gq.transformerConstructor=pq;const fq=()=>{bK(),aq(),vB.registerAnimation("rangeColumn",((t,e)=>({appear:dq(t,e),enter:lq(t),exit:cq(t),disappear:{duration:uH.disappear.duration}}))),mH(),OV(),$V(),vB.registerSeries(gq.type,gq)};var mq,vq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(mq||(mq={})),function(t){t.middle="middle",t.start="start",t.end="end"}(vq||(vq={}));class yq extends KH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const _q=Object.assign({},aG);class bq extends cK{constructor(){super(...arguments),this.type=PE.rangeArea}initMark(){this._areaMark=this._createMark(bq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new yq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}bq.type=PE.rangeArea,bq.mark=_q;class xq extends Ej{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=AU,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Ow(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:[]};Ow(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)&&Bj(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Sq(t){return kM(t)?Number.parseFloat(t):0}const Aq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&kq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[pU],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[pU]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},kq=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===Sq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Sq(i[e])),0)));function Cq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const Tq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Cq(t,!0,rR.appear)}),Mq={type:"fadeIn"},wq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Cq(t,!0,rR.enter)}),Eq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Cq(t,!0,rR.exit)});function Bq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Mq;case"growRadius":return Tq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Tq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Pq extends qz{constructor(t,e){super(t,e),this.type=Rq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[yU])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Rq extends Pq{constructor(){super(...arguments),this.type=Rq.type}}Rq.type="arc";const Oq=()=>{KT(),gC(),IN("arc",XG),w_.registerBuiltInAnimate("growRadiusIn",JL),w_.registerBuiltInAnimate("growRadiusOut",QL),w_.registerBuiltInAnimate("growAngleIn",OL),w_.registerBuiltInAnimate("growAngleOut",IL),vB.registerGraphicComponent("arc",Vp),vB.registerMark(Rq.type,Rq)},Iq=Object.assign(Object.assign({},aj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Lq extends Sj{_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=uB({},this._theme,i,t);const n=(t,e)=>uB({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Dq=`${NB}_LABEL_VISIBLE`,Fq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},zq={outerRadius:!0};class Hq extends xq{constructor(){super(...arguments),this.transformerConstructor=Lq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:QE(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:QE(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=xU,this._endAngle=SU,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[yU];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;YP(this._dataSet,"pie",Aq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:fU,asEndAngle:mU,asRatio:gU,asMiddleAngle:yU,asRadian:bU,asQuadrant:_U,asK:vU,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Hq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ew(fU)(t)}endAngleScale(t){return Ew(mU)(t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$E(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$E(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ew(Dq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),zq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Fq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[yU];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===rR.appear)return this._startAngle;if(i===rR.disappear)return this._endAngle;const r=[rR.disappear,rR.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[GB];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[GB])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[yU]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[yU]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=gj(null===(i=vB.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Hq.transformerConstructor=Lq,Hq.mark=Iq,Hq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class jq extends Hq{constructor(){super(...arguments),this.type=PE.pie}}jq.type=PE.pie;const Nq=()=>{Oq(),vB.registerAnimation("pie",((t,e)=>({appear:Bq(t,e),enter:wq(t),exit:Eq(t),disappear:{duration:uH.disappear.duration}}))),vB.registerAnimation("emptyCircle",((t,e)=>({appear:Bq(t,e)}))),vB.registerSeries(jq.type,jq)};function Uq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const Vq=t=>({type:Uq(t.growField),options:{overall:!0}}),Wq={type:"fadeIn"},Gq=t=>({type:Uq(t.growField)}),Yq=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function Xq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Wq;case"growAngle":return Vq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return Vq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const Kq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class $q extends xq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Kq)})}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(ZB),this.setInnerRadiusField(qB)}setValueFieldToPercent(){this.setRadiusField(QB),this.setInnerRadiusField(JB)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const qq=Object.assign(Object.assign({},aj),{rose:{name:"rose",type:"arc"}});class Zq extends Sj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class Jq extends HU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=vB.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=xU,this._endAngle=SU,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QE(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QE(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:aU(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){Tw(this._regions,(t=>{"radius"===this.getOrient()?dU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):dU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Ow(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Ow(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>cU(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return kU((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=AU,e=0;const i=this.getChart().getSpec();return Tw(this.getRegions(),(s=>{const n=s;if(r=n.type,[PE.rose,PE.radar,PE.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(uB({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(uB({},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)}}Jq.type=r.polarAxis,Jq.specKey="axes";const Qq={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},tZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class eZ extends Jq{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,GV),t}}eZ.type=r.polarLinearAxis,eZ.specKey="axes",eZ.builtInTheme={axis:EV,axisLinear:XV,axisAngle:tZ,axisRadius:Qq},G(eZ,UV);const iZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(eZ.type,eZ)};class sZ extends Jq{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new iE}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return YP(this._option.dataSet,t,NG),t}transformScaleDomain(){}}sZ.type=r.polarBandAxis,sZ.specKey="axes",sZ.builtInTheme={axis:EV,axisBand:wV,axisAngle:tZ,axisRadius:Qq},G(sZ,VU);const nZ=()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),vB.registerGraphicComponent(BU.circleAxis,((t,e)=>new HG(t,e))),vB.registerGraphicComponent(PU.circleAxisGrid,((t,e)=>new tY(t,e))),jU(),vB.registerComponent(sZ.type,sZ)};class rZ extends $q{constructor(){super(...arguments),this.type=PE.rose,this.transformerConstructor=Zq,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(rZ.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yj(this._spec,rZ.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XE(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XE(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(gj(null===(i=vB.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),fj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}rZ.type=PE.rose,rZ.mark=qq,rZ.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},rZ.transformerConstructor=Zq;const aZ=()=>{vB.registerSeries(rZ.type,rZ),Oq(),vB.registerAnimation("rose",((t,e)=>({appear:Xq(t,e),enter:Gq(t),exit:Yq(t),disappear:{duration:uH.disappear.duration}}))),nZ(),iZ()};class oZ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,vw(this._fromAngle,this._toAngle)&&vw(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lZ extends hH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!Cw(t)&&!Cw(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const hZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function cZ(t,e,i){return"fadeIn"===e?hZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function dZ(t,e,i){return"fadeIn"===e?hZ(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 uZ=(t,e)=>({custom:oH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),pZ=Object.assign(Object.assign(Object.assign({},aj),$j),{area:{name:"area",type:"area"}});class gZ extends $q{constructor(){super(...arguments),this.type=PE.radar,this.transformerConstructor=GN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(gZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:IH,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):xU},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(gj(null===(s=vB.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),fj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=vB.getAnimationInKey(e);t.setAnimationConfig(gj(null==i?void 0:i(n,r),fj(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}}}gZ.type=PE.radar,gZ.mark=pZ,gZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},gZ.transformerConstructor=GN,G(gZ,Zj);const fZ=()=>{vB.registerSeries(gZ.type,gZ),nG(),UN(),WN(),vB.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:cZ(t,e,"in"),enter:cZ(t,e,"in"),exit:cZ(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{channel:["points","center"],custom:lZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),vB.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:uH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:oZ,customParameters:t,duration:uH.update.duration,easing:uH.update.easing}]}))),vB.registerAnimation("radarGroup",((t,e)=>({appear:uZ(t,"in"),disappear:{duration:uH.disappear.duration}}))),gC(),nZ(),iZ()};class mZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const vZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(NB)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[GB]:r,[YB]:`${s}_${e}`})),r++}))})),n},yZ={fill:"#bbb",fillOpacity:.2},_Z=Object.assign(Object.assign({},aj),{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"}}),bZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},xZ={grid:{background:!0}};class SZ extends Rj{constructor(){super(...arguments),this.type=PE.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)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),bZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),xZ)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),YP(this._option.dataSet,"objFlat",vZ),YP(this._option.dataSet,"copyDataView",tR),XP(this._option.dataSet,"dataview",Ia),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(uB(yZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(SZ.mark.group),this._containerMark=this._createMark(SZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(SZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(SZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(SZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(SZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(SZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(SZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}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 WE).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:XB}}initTooltip(){this._tooltipHelper=new mZ(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}SZ.type=PE.dot,SZ.mark=_Z,SZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class AZ extends KH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const kZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),CZ=(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 TZ extends Rj{constructor(){super(...arguments),this.type=PE.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),YP(this._option.dataSet,"linkDotInfo",CZ),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(TZ.mark.group),this._containerMark=this._createMark(TZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(TZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(TZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:XB}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new AZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}TZ.type=PE.link,TZ.mark=kZ,TZ.builtInTheme={link:{arrow:{style:{size:10}}}};const MZ=Object.assign(Object.assign({},aj),{group:{name:"group",type:"group"}}),wZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class EZ extends xq{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()?qB:cP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?ZB:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),wZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):xU;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):SU,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=XE(this.angleAxisHelper.dataToPosition([t[qB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XE(this.angleAxisHelper.dataToPosition([t[ZB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?XE(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(EZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[mg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const OZ=()=>{vB.registerAnimation("circularProgress",((t,e)=>({appear:RZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:uH.disappear.duration}})))};class IZ extends Sj{constructor(){super(...arguments),this._supportStack=!0}}const LZ={cornerRadius:!0,roundCap:!0};class DZ extends EZ{constructor(){super(...arguments),this.type=PE.circularProgress,this.transformerConstructor=IZ,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()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),LZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(DZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:yj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(DZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?qB:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?ZB: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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}DZ.type=PE.circularProgress,DZ.mark=BZ,DZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},DZ.transformerConstructor=IZ;const FZ=()=>{vB.registerSeries(DZ.type,DZ),Oq(),OZ(),mH(),nZ(),iZ()};function zZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const HZ={type:"fadeIn"};function jZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?HZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:zZ(t)}))(t)}class NZ extends KH{enableByType(t){return"dimension"!==t}}const UZ=Object.assign(Object.assign({},aj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),VZ={bandWidth:!0,cornerRadius:!0,clamp:!0},WZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class GZ extends Rj{constructor(){super(...arguments),this.type=PE.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),VZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),WZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(GZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return XE(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(GZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),fj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),fj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new NZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}GZ.type=PE.linearProgress,GZ.mark=UZ,GZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const YZ=()=>{bK(),vB.registerAnimation("linearProgress",((t,e)=>({appear:jZ(t,e),enter:jZ(t),disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(GZ.type,GZ)},XZ=[0],KZ=[20,40],$Z=[200,500],qZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},ZZ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class JZ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const QZ=`${NB}_WORD_CLOUD_TEXT`,tJ=Object.assign(Object.assign({},aj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),eJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class iJ extends Ej{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=KZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:$Z,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:XZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?QZ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:qZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||_M(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:XZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!ZZ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new JZ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(iJ.mark.word,{key:YB,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(iJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(gj(vB.getAnimationInKey("wordCloud")(n,s),fj("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 WE).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:XB])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new AE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new AE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[GB])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:YB,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:b_.createCanvas.bind(b_),getTextBounds:gv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:sg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}iJ.mark=tJ,iJ.builtInTheme={wordCloud:eJ};function sJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||uH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=nJ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},rJ=(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=rJ(t.children,e,t,n))})),s},aJ=(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=aJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},oJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):oJ(t.children,e,i)))})),e};function lJ(t,e){let i,s;if(dJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function dJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function fJ(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 mJ(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 vJ(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 yJ(t){return{_:t,next:null,prev:null}}function _J(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];fJ(n,s,r);let a,o,l,h,c,d,u,p=yJ(s),g=yJ(n),f=yJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=nJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:AJ.defaultOpionts.nodeSort;rJ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)rJ([o],bJ(h)),aJ([o],xJ(this._getPadding,.5,a)),rJ([o],SJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);rJ([o],bJ(AJ.defaultOpionts.setRadius)),aJ([o],xJ(Ot,1,a)),c&&aJ([o],xJ(this._getPadding,o.radius/t,a)),rJ([o],SJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}AJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const kJ=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=kJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function CJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){kJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function TJ(t){return t.depth}function MJ(t,e){return e-1-t.endDepth}const wJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),EJ=(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},BJ={left:TJ,right:MJ,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:TJ,end:MJ},PJ=bt(0,1);class RJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>wJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>wJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},RJ.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):BJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return CJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[EJ(s[t.source]),EJ(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*PJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(wJ),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(wJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];OJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),IJ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},LJ.defaultOpionts,t):Object.assign({},LJ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(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]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(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-(_(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=nJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function DJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:OJ,slice:DJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?DJ:OJ)(t,e,i,s,n)}};class HJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},HJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?FJ(this.options.aspectRatio):null!==(e=zJ[this.options.splitType])&&void 0!==e?e:zJ.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=nJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function jJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=jJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=NJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function KJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Oi((function(i){return-1*$J({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},ZJ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||VJ,s=e.lossFunction||UJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:qJ(f),arcs:f})}))},JJ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:QJ,triangle:QJ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function QJ(){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 tQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const eQ=t=>JJ[t]?JJ[t]():JJ.circle(),iQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function sQ(t){return d(t)?t:function(){return t}}class nQ{constructor(t){var e,i;switch(this.options=H({},nQ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=eQ(this.options.shape),this.getText=null!==(e=sQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=sQ(this.options.fontWeight),this.getTextFontSize=sQ(this.options.fontSize),this.getTextFontStyle=sQ(this.options.fontStyle),this.getTextFontFamily=sQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>iQ(10,50);break;case"random-light":this.getTextColor=()=>iQ(50,90);break;default:this.getTextColor=sQ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class aQ extends nQ{constructor(t){var e;super(H({},aQ.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<=aQ.defaultOptions.minFontSize&&(this.options.minFontSize=aQ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=rQ[this.options.spiral])&&void 0!==e?e:rQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=sQ(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}=tQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(hQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}cQ(p,this._size)&&(p=dQ(p,this._size))}else if(cQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||lQ(p,i))&&(!i||!oQ(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 oQ(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 lQ(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,cQ=(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 dQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},pQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},gQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},fQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=tQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=eQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)gQ(n,pQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)gQ(n,pQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)gQ(n,pQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=pQ({x:l,y:h},o,-Math.PI/2,5),e=pQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);gQ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let mQ=class t extends nQ{constructor(e){super(H({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),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 C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[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(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?uQ(t,o,l.width,l.height,h):"geometric"===t.type&&fQ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=tQ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};mQ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vQ extends nQ{constructor(t){super(H({},vQ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vQ.defaultOptions={enlarge:!1};const _Q={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bQ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xQ(t.fontFamily):"sans-serif",d=t.fontStyle?xQ(t.fontStyle):"normal",u=t.fontWeight?xQ(t.fontWeight):"normal",p=t.rotate?xQ(t.rotate):0,g=xQ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?xQ(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},_Q),t.as):_Q,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?xQ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=AQ(kQ(t,l),w);M=i=>e(t(i))}let E=aQ;"fast"===t.layoutType?E=vQ:"grid"===t.layoutType&&(E=mQ);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},xQ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],SQ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),AQ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SQ(t[0]),n=SQ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SQ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},kQ=(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 CQ(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{vB.registerGrammarTransform("wordcloud",{transform:bQ}),aq(),vB.registerAnimation("wordCloud",((t,e)=>({appear:sJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:uH.disappear.duration}}))),vB.registerSeries(TQ.type,TQ)},wQ=t=>d(t)?t():t,EQ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=wQ(e.valueField),v=null!==(i=wQ(e.heightVisual))&&void 0!==i&&i,y=null===(s=wQ(e.isCone))||void 0===s||s,_=wQ(e.range),b=a.reduce(((t,e)=>{const i=Number.parseFloat(e[m]);return k(i)?Math.max(t,i):t}),-1/0),x=null!==(n=null==_?void 0:_.min)&&void 0!==n?n:0,S=null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b,A=t=>k(t)&&k(x)&&k(S)?x===S?t{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0,S=A(n);p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=S),d&&(t[d]=e===a.length-1?y?0:t[c]:A(_)),u&&(t[u]=0===e?1:A(r)),g&&(t[g]=n)})),a},BQ=(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},PQ=`${NB}_FUNNEL_TRANSFORM_RATIO`,RQ=`${NB}_FUNNEL_REACH_RATIO`,OQ=`${NB}_FUNNEL_HEIGHT_RATIO`,IQ=`${NB}_FUNNEL_VALUE_RATIO`,LQ=`${NB}_FUNNEL_LAST_VALUE_RATIO`,DQ=`${NB}_FUNNEL_NEXT_VALUE_RATIO`,FQ=`${NB}_FUNNEL_LAST_VALUE`,zQ=`${NB}_FUNNEL_CURRENT_VALUE`,HQ=`${NB}_FUNNEL_NEXT_VALUE`,jQ=`${NB}_FUNNEL_TRANSFORM_LEVEL`;class NQ extends KH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[RQ])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class UQ extends qz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VQ extends UQ{constructor(){super(...arguments),this.type=VQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VQ.type="polygon";const WQ=()=>{vB.registerMark(VQ.type,VQ),KT(),yT(),w_.registerBuiltInAnimate("growPointsOut",VL),vB.registerGraphicComponent("polygon",ug)},GQ=Object.assign(Object.assign({},aj),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YQ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class XQ extends Ej{constructor(){super(...arguments),this.type=PE.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"funnel",EQ),YP(this._dataSet,"funnelTransform",BQ);const t=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new Tz(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:zQ,asTransformRatio:PQ,asReachRatio:RQ,asHeightRatio:OQ,asValueRatio:IQ,asNextValueRatio:DQ,asLastValueRatio:LQ,asLastValue:FQ,asNextValue:HQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:jQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},XQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:yj(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},XQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(XQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(XQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new NQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&uM(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&uM(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ew(RQ).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(gj(null===(s=vB.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),fj("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("fadeInOut")(),fj(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("funnel")({},o),fj(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(gj(null===(a=vB.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),fj("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[LQ])/2:this._getSecondaryAxisLength(t[IQ])/2,n=this._getSecondaryAxisLength(t[IQ])/2):(s=this._getSecondaryAxisLength(t[IQ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[DQ])/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[jQ])}_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[YB]===t[YB]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{WQ(),aq(),g$(),vB.registerSeries(XQ.type,XQ),vB.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},gH))),vB.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:lH,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),mH()},$Q=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},qQ=t=>{const e=t.filter((t=>t.context.diffState===tz.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},ZQ=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},JQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),QQ=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},t0=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),e0=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},i0=(t,e={})=>{if(!t)return[];const i=[];return oJ(t,i,e),i},s0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new LJ(i).layout(t,{width:s,height:n})};class n0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var r0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(r0||(r0={}));const a0=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===r0.DrillDown){return Y(AP(t,n,s,"children"))}if(i.type===r0.DrillUp){const e=kP(t,n,s,"children");if(e)return Y(e)}return t};class o0{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=JK(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;YP(t,"drillFilter",a0),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:r0.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:r0.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:r0.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:r0.DrillUp},model:this}),r}}const l0=Object.assign(Object.assign({},aj),{sunburst:{name:"sunburst",type:"arc"}}),h0=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:QH,operations:["max","min","values"]}),t.push({key:tj,operations:["values"]}),t),c0={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class d0 extends xq{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),YP(this._dataSet,"sunburstLayout",s0),YP(this._dataSet,"flatten",i0),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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(d0.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(d0.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new n0(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(gj(null===(e=vB.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}d0.type=PE.sunburst,d0.mark=l0,d0.builtInTheme={sunburst:c0},G(d0,o0);const u0=()=>{vB.registerSeries(d0.type,d0),Oq(),aq(),mH(),vB.registerAnimation("sunburst",((t,e)=>({appear:e0(0,e),enter:JQ(t),exit:t0(t),disappear:{duration:uH.disappear.duration}})))},p0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new AJ(i).layout(t,{width:s,height:n})};class g0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const f0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},m0=Object.assign(Object.assign({},aj),{circlePacking:{name:"circlePacking",type:"arc"}});class v0 extends Rj{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},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),YP(this._dataSet,"circlePackingLayout",p0),YP(this._dataSet,"flatten",i0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return h0(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new g0(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}v0.type=PE.circlePacking,v0.mark=m0,v0.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(v0,o0);const y0=()=>{vB.registerSeries(v0.type,v0),Oq(),aq(),fH(),vB.registerAnimation("circlePacking",((t,e)=>({appear:f0(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:uH.disappear.duration}})))},_0=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&_0(t,e.children,i)}))},b0=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},x0=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=S0(n,i),a=new RJ(i),o=[];return o.push(a.layout(r,s)),o},S0=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},A0=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:[]},k0=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 C0 extends KH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const T0=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),M0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:T0(t),w0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class E0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class B0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const P0=(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`},R0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class O0 extends j${constructor(){super(...arguments),this.type=O0.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?R0:P0,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}O0.type="linkPath";const I0=Object.assign(Object.assign({},aj),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class L0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const D0=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&Kz(t,e),Xz(t,e,s,n)};class F0 extends Rj{constructor(){super(...arguments),this.type=PE.sankey,this.transformerConstructor=L0,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=IP(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=IP(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):r.target===i.key?(s.includes(r.source)||s.push(r.source),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=IP(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),D0(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation())):(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=IP(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=IP(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=IP(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=IP(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=IP(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s},!0,this._hasLinkStateAnimation())}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value},!0,this._hasLinkStateAnimation());Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(IP(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=IP(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=IP(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation());const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a},!0,this._hasLinkStateAnimation())}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value},!0,this._hasLinkStateAnimation());Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}_hasStateAnimation(t){var e;return xj(this)&&!!(null===(e=null==t?void 0:t.hasAnimationByState)||void 0===e?void 0:e.call(t,"state"))}_hasLinkStateAnimation(){return this._hasStateAnimation(this._linkMark)}_hasNodeStateAnimation(){return this._hasStateAnimation(this._nodeMark)}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){YP(this._dataSet,"sankeyLayout",x0),YP(this._dataSet,"sankeyFormat",b0),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;YP(s,"sankeyNodes",A0),YP(s,"flatten",i0);const n=new za(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.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),n.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._nodesSeriesData=n,YP(s,"sankeyLinks",k0);const r=new za(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(F0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(F0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=zH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),fj("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),fj("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:NP.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(IP(e).key)?Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasNodeStateAnimation()):Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasNodeStateAnimation())}))}initTooltip(){this._tooltipHelper=new C0(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new WE;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return _0(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}F0.type=PE.sankey,F0.transformerConstructor=L0,F0.mark=I0,F0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const z0=()=>{bK(),N$(),cT(),vB.registerGraphicComponent("path",(t=>hg(t))),vB.registerMark(O0.type,O0),aq(),vB.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:M0(t,e)},gH))),vB.registerAnimation("sankeyLinkPath",((t,e)=>({appear:w0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:uH.disappear.duration}}))),w_.registerBuiltInAnimate("linkPathGrowOut",B0),w_.registerBuiltInAnimate("linkPathGrowIn",E0),mH(),vB.registerSeries(F0.type,F0)},H0=(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=i0(n);return i=qH([{latestData:r}],e),i};class j0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const N0=Object.assign(Object.assign({},aj),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),U0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class V0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const W0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new HJ(i).layout(t,s),n=[];return oJ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[tj,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class G0 extends Rj{constructor(){super(...arguments),this.type=PE.treemap,this.transformerConstructor=V0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,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:tj),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),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:YB},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),YP(this._dataSet,"treemap",W0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=H0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){YP(this._dataSet,"hierarchyDimensionStatistics",H0),YP(this._dataSet,"flatten",i0);const i=new za(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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(G0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(G0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("treemap"))||void 0===e?void 0:e(),fj(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 j0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(FP.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(FP.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}G0.type=PE.treemap,G0.mark=N0,G0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},G0.transformerConstructor=V0,G(G0,o0),G(G0,t$);const Y0=()=>{vB.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),vB.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),bK(),aq(),vB.registerAnimation("treemap",((t,e)=>({appear:U0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(G0.type,G0)},X0=Object.assign(Object.assign({},MZ),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),K0=Object.assign(Object.assign({},aj),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),$0={type:"fadeIn"};function q0(t,e){return"fadeIn"===e?$0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class Z0 extends Sj{constructor(){super(...arguments),this._supportStack=!1}}class J0 extends KH{enableByType(t){return"dimension"!==t}}const Q0="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",t1={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:Q0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Q0,fill:"#ddd"}}};class e1 extends EZ{constructor(){super(...arguments),this.type=PE.gaugePointer,this.transformerConstructor=Z0,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(e1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},e1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(e1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new J0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}e1.type=PE.gaugePointer,e1.mark=K0,e1.builtInTheme={gaugePointer:t1},e1.transformerConstructor=Z0;const i1=()=>{vB.registerSeries(e1.type,e1),XK(),bK(),vB.registerAnimation("gaugePointer",((t,e)=>{const i=q0(t,e);return{appear:i,enter:i,disappear:{duration:uH.disappear.duration}}})),nZ(),iZ()};class s1 extends Sj{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class n1 extends EZ{constructor(){super(...arguments),this.type=PE.gauge,this.transformerConstructor=s1,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();YP(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[dP]=t[this._angleField[0]],t[cP]=e>0?i[e-1][dP]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(n1.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(n1.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[cP])?this.angleAxisHelper.dataToPosition([t[cP]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[dP]])}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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}n1.type=PE.gauge,n1.mark=X0,n1.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},n1.transformerConstructor=s1;class r1 extends qz{constructor(){super(...arguments),this.type=r1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Gg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}r1.type="cell";function a1(t){return!1===t?{}:{type:"fadeIn"}}class o1 extends KH{enableByType(t){return"dimension"!==t}}const l1=Object.assign(Object.assign({},aj),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class h1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const c1={valueField:!0};class d1 extends Rj{constructor(){super(...arguments),this.type=PE.heatmap,this.transformerConstructor=h1}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),c1)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(d1.mark.cell,{isSeriesMark:!0},{morph:yj(this._spec,d1.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(d1.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Pj(this);this._cellMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),fj("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 o1(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}d1.type=PE.heatmap,d1.mark=l1,d1.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},d1.transformerConstructor=h1;const u1=()=>{aq(),vB.registerMark(r1.type,r1),vB.registerGraphicComponent("symbol",Gg),KT(),iM(),jN(),vB.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},gH),{appear:a1(e)}))),OV(),$V(),vB.registerSeries(d1.type,d1)},p1=Object.assign(Object.assign({},aj),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),g1=`${NB}_CORRELATION_X`,f1=`${NB}_CORRELATION_Y`,m1=`${NB}_CORRELATION_SIZE`,v1=t=>d(t)?t():t,y1=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=v1(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=v1(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=v1(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(v1(e.outerRadius),f),y=v1(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(v1(e.field)),A=c.map(x),[k,C]=It(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=v1(e.radiusField),w=v1(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?It(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),O=Math.max(p,g),I=_1(R,O,c.length),L=[],D=(O-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),b1({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>O?a=R: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},b1=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,S1=(t,e)=>{if(!t||!_(t))return[];const i=x1(e.keyword),s=x1(e.categoryField),n=t[0].latestData[0];return{[s]:i,[GB]:null==n?void 0:n[GB],[XB]:null==n?void 0:n[XB]}};class A1 extends j${constructor(){super(...arguments),this.type=A1.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}A1.type="ripple";const k1=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class C1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class T1 extends xq{constructor(){super(...arguments),this.type=PE.correlation,this.transformerConstructor=C1,this._viewBox=new Ue}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(){if(super.initData(),!this._data)return;YP(this._dataSet,"correlation",y1);const t=new Fa;XP(t,"dataview",Ia),YP(t,"correlationCenter",S1);const e=new za(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return 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 Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(T1.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:GB});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(T1.mark.ripplePoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(T1.mark.centerPoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[g1],y:t=>t[f1],size:t=>t[m1],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),fj("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}T1.type=PE.correlation,T1.mark=p1,T1.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},T1.transformerConstructor=C1;const M1=()=>{WN(),N$(),iM(),vB.registerMark(A1.type,A1),vB.registerGraphicComponent("symbol",(t=>Gg(t))),vB.registerSeries(T1.type,T1),vB.registerAnimation("correlation",((t,e)=>Object.assign({appear:k1(0,e)},pH)))},w1=Object.assign(Object.assign({},aj),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class E1 extends j${constructor(){super(...arguments),this.type=E1.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}E1.type="liquid";const B1=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class P1 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class R1 extends Ej{constructor(){super(...arguments),this.type=PE.liquid,this.transformerConstructor=GN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=mg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Gg({x:s,y:n,size:r,symbolType:B1(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=iB(this._spec.outlineMargin),this._paddingSpec=iB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(R1.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(R1.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(R1.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(R1.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new P1(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),fj("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),fj("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=RM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}R1.type=PE.liquid,R1.mark=w1,R1.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},R1.transformerConstructor=GN;const O1=t=>Y(t).join(",");class I1 extends KH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]])}}const L1=Object.assign(Object.assign({},aj),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class D1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const F1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?ZJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class z1 extends Ej{constructor(){super(...arguments),this.type=PE.venn,this.transformerConstructor=D1,this._viewBox=new Ue}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:YB)}initData(){var t;super.initData(),YP(this._dataSet,"venn",F1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(z1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(z1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new I1(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:O1(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return O1(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[O1(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(O1(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}}z1.type=PE.venn,z1.mark=L1,z1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},z1.transformerConstructor=D1;class H1 extends TK{constructor(){super(...arguments),this.type=PE.mosaic,this.transformerConstructor=kK}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(oP),this.setFieldX2(aP)),this.setFieldY(hP),this.setFieldY2(lP)):(t&&(this.setFieldY(oP),this.setFieldY2(aP)),this.setFieldX(hP),this.setFieldX2(lP)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}H1.type=PE.mosaic,H1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},H1.transformerConstructor=kK;class j1 extends yW{_isValidSeries(t){return t===PE.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class N1 extends fW{constructor(){super(...arguments),this.transformerConstructor=j1,this.type="map",this.seriesType=PE.map}}N1.type="map",N1.seriesType=PE.map,N1.transformerConstructor=j1;class U1 extends yW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class V1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=oU(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,uB({},s,l)),n&&Object.assign(o,uB({},n,o))}}class W1 extends U1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class G1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class Y1 extends fW{constructor(){super(...arguments),this.transformerConstructor=G1}}Y1.transformerConstructor=G1;class X1 extends Y1{constructor(){super(...arguments),this.transformerConstructor=G1,this.type="pie",this.seriesType=PE.pie}}X1.type="pie",X1.seriesType=PE.pie,X1.transformerConstructor=G1;class K1 extends W1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:AU,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:AU,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>uB({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const $1=(t,e)=>{if(!t)return null;const i=Yj(t,(t=>"angle"===t.getOrient()),e),s=Yj(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Lw(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=Aw({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=kw(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=Wj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Lw(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=Aw({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=kw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=Wj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class q1 extends fW{constructor(){super(...arguments),this.transformerConstructor=K1,this.type="rose",this.seriesType=PE.rose}_setModelOption(){this._modelOption.getDimensionInfo=$1}}q1.type="rose",q1.seriesType=PE.rose,q1.transformerConstructor=K1,G(q1,AW);class Z1 extends W1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=uB({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}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=>uB({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class J1 extends fW{constructor(){super(...arguments),this.transformerConstructor=Z1,this.type="radar",this.seriesType=PE.radar}_setModelOption(){this._modelOption.getDimensionInfo=$1}}J1.type="radar",J1.seriesType=PE.radar,J1.transformerConstructor=Z1,G(J1,AW);class Q1 extends yW{_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")&&uB(e,qF(this.type,t))})),this._transformAxisSpec(t)}}class t2 extends fW{constructor(){super(...arguments),this.transformerConstructor=Q1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=OW(t,e,i))&&void 0!==s?s:[],...null!==(n=$1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}t2.type="common",t2.transformerConstructor=Q1,G(t2,AW);class e2 extends _W{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class i2 extends fW{constructor(){super(...arguments),this.transformerConstructor=e2}}i2.transformerConstructor=e2,G(i2,AW);class s2 extends e2{transformSpec(t){super.transformSpec(t),WF(t)}}class n2 extends i2{constructor(){super(...arguments),this.transformerConstructor=s2,this.type="histogram",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}n2.type="histogram",n2.seriesType=PE.bar,n2.transformerConstructor=s2;class r2 extends V1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class a2 extends fW{constructor(){super(...arguments),this.transformerConstructor=r2,this.type="circularProgress",this.seriesType=PE.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=$1}}a2.type="circularProgress",a2.seriesType=PE.circularProgress,a2.transformerConstructor=r2,G(a2,AW);class o2 extends V1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=PE.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===PE.gauge||t.type===PE.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===PE.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 l2 extends fW{constructor(){super(...arguments),this.transformerConstructor=o2,this.type="gauge",this.seriesType=PE.gaugePointer}}l2.type="gauge",l2.seriesType=PE.gaugePointer,l2.transformerConstructor=o2;class h2 extends yW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class c2 extends fW{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}c2.transformerConstructor=h2;class d2 extends c2{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}d2.type="wordCloud",d2.seriesType=PE.wordCloud,d2.transformerConstructor=h2;class u2 extends yW{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class p2 extends fW{constructor(){super(...arguments),this.transformerConstructor=u2,this.type="funnel",this.seriesType=PE.funnel}}p2.type="funnel",p2.seriesType=PE.funnel,p2.transformerConstructor=u2;class g2 extends _W{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=oU(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=oU(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class f2 extends fW{constructor(){super(...arguments),this.transformerConstructor=g2,this.type="linearProgress",this.seriesType=PE.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}f2.type="linearProgress",f2.seriesType=PE.linearProgress,f2.transformerConstructor=g2,G(f2,AW);class m2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),WF(t)}}class v2 extends fW{constructor(){super(...arguments),this.transformerConstructor=m2,this.type="rangeColumn",this.seriesType=PE.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}v2.type="rangeColumn",v2.seriesType=PE.rangeColumn,v2.transformerConstructor=m2;class y2 extends yW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _2 extends fW{constructor(){super(...arguments),this.transformerConstructor=y2,this.type="sunburst",this.seriesType=PE.sunburst}}_2.type="sunburst",_2.seriesType=PE.sunburst,_2.transformerConstructor=y2;class b2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class x2 extends fW{constructor(){super(...arguments),this.transformerConstructor=b2,this.type="circlePacking",this.seriesType=PE.circlePacking}}x2.type="circlePacking",x2.seriesType=PE.circlePacking,x2.transformerConstructor=b2;class S2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class A2 extends fW{constructor(){super(...arguments),this.transformerConstructor=S2,this.type="treemap",this.seriesType=PE.treemap}}A2.type="treemap",A2.seriesType=PE.treemap,A2.transformerConstructor=S2;class k2 extends wK{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),WF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class C2 extends EK{constructor(){super(...arguments),this.transformerConstructor=k2,this.type="waterfall",this.seriesType=PE.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}C2.type="waterfall",C2.seriesType=PE.waterfall,C2.transformerConstructor=k2;class T2 extends _W{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),WF(t)}}class M2 extends fW{constructor(){super(...arguments),this.transformerConstructor=T2,this.type="boxPlot",this.seriesType=PE.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}M2.type="boxPlot",M2.seriesType=PE.boxPlot,M2.transformerConstructor=T2;class w2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class E2 extends fW{constructor(){super(...arguments),this.transformerConstructor=w2,this.type="sankey",this.seriesType=PE.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=IP(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}E2.type="sankey",E2.seriesType=PE.sankey,E2.transformerConstructor=w2;class B2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),WF(t)}}class P2 extends fW{constructor(){super(...arguments),this.transformerConstructor=B2,this.type="rangeArea",this.seriesType=PE.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}P2.type="rangeArea",P2.seriesType=PE.rangeArea,P2.transformerConstructor=B2;class R2 extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class O2 extends fW{constructor(){super(...arguments),this.transformerConstructor=R2,this.type="heatmap",this.seriesType=PE.heatmap}}O2.type="heatmap",O2.seriesType=PE.heatmap,O2.transformerConstructor=R2;class I2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class L2 extends fW{constructor(){super(...arguments),this.transformerConstructor=I2,this.type="correlation",this.seriesType=PE.correlation}}L2.type="correlation",L2.seriesType=PE.correlation,L2.transformerConstructor=I2;function D2(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=PP(t.style)),P(t.textStyle)||uB(s.textStyle,PP(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&PP(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&PP(s.background.style),s}function F2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const z2=(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},H2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:XB;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},j2={position:!0,item:!0,title:!0,pager:!0,background:!0};class N2 extends EU{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:()=>{Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(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=qE(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||j2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Tz(this._option,e),this._initSelectedData(),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(Tw(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(uB({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}N2.specKey="legends";class U2 extends N2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){YP(this._option.dataSet,"discreteLegendFilter",H2),YP(this._option.dataSet,"discreteLegendDataMake",z2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return Tw(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(!CM(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=mP(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,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=qE(s)?s:qE(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=D2(A):M.title={visible:!1},P(k.focusIconStyle)||PP(k.focusIconStyle),k.shape&&(k.shape=F2(wP(k.shape))),k.label&&(k.label=wP(k.label)),k.value&&(k.value=wP(k.value)),k.background&&(k.background=wP(k.background)),ZE(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),ZE(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),ZE(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||PP(C.railStyle),P(C.sliderStyle)||PP(C.sliderStyle)):(P(C.textStyle)||PP(C.textStyle),C.handler&&wP(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(uB(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return kX}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(vX.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(vX.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(vX.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,datum:t.datum,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}=zH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=zH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}U2.specKey="legends",U2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},U2.type=r.discreteLegend;const V2=(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[]},W2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?CP(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function G2(t){const i=uB({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=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=D2(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=PP(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=PP(r.style)),P(a.style)||(w.trackStyle=PP(a.style)),w.startText=wP(o),w.endText=wP(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>PP(i(t,e,s)):P(i)||(e.style=PP(i)),e}(h),P(c)||(w.sizeBackground=PP(c)),u.visible&&!P(u.style)&&(uB(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const Y2={color:EX,size:PX},X2={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}},K2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},X2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},$2={horizontal:K2(!0),vertical:K2(!1)},q2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},X2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},Z2={horizontal:q2(!0),vertical:q2(!1)},J2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Q2=[2,10];class t5 extends N2{static getSpecInfo(t){const e=HH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){YP(this._option.dataSet,"continuousLegendFilter",W2),YP(this._option.dataSet,"continuousLegendDataMake",V2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>Mw(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=mP(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!CM(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=mP(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?J2:Q2);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},G2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return Y2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}t5.specKey="legends",t5.builtInTheme={colorLegend:$2,sizeLegend:Z2},t5.type=r.continuousLegend;const e5=(t,e)=>p(e)?t.map((t=>e[t])):void 0,i5=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),s5=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function n5(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=r5(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>i5(i,s)(t)&&i5(n,r)(t)&&(u(a)||i5([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:jP.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:jP.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(a.id),m}return"none"}const r5=(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=e5(c,t);let y=e5(d,t);const _=s5(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(i5(c,v));if(!_&&(y=e5(d,i),!s5(y)))return;const n=e.type===PE.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=Lw(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(i5(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=e5(d,o),!s5(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(i5(c,n));if(!_&&(y=e5(d,r),!s5(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===PE.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(i5(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=e5(d,i),!s5(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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(i5(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=e5(d,a),h=y,!s5(y)&&!a)return;s5(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},a5=t=>p(t)&&!_(t),o5=t=>p(t)&&_(t),l5=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class h5 extends wU{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=uB({},...l5.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=uB({},s);l5.forEach((t=>{delete r[t]})),delete r.style;const a=uB({},r,i);return a.style=uB({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:xM(this._option.mode)||!_M(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=b_.getElementById(t.parentElement)):_M(this._option.mode)&&(t.parentElement=null==yM?void 0:yM.body)}}const c5={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class d5 extends EU{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=h5,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=_M(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&a5(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&RH.globalConfig.uniqueTooltip&&l&&RH.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:jP.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:jP.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?GW.canvas:GW.dom,n=vB.getComponentPluginInType(t);n||fM("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=vB.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(bM(s)||xM(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=n5(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(o5(t)){if(a5(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>Uj(t,e[i])))}if(o5(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}d5.type=r.tooltip,d5.transformerConstructor=h5,d5.builtInTheme={tooltip:c5},d5.specKey="tooltip";var u5,p5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(u5||(u5={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(p5||(p5={}));const g5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},f5={labelZIndex:!0,gridZIndex:!0},m5={xField:!0,yField:!0,categoryField:!0,valueField:!0},v5={visible:!0,width:!0,style:!0};class y5 extends EU{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Lw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||f5[i]||m5[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||v5[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:NP.chart}:{source:jP.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:bM(e)||xM(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:jP.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:jP.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:jP.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)=>{g5[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}y5.specKey="crosshair";const _5={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class b5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=Oj(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){Oj(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Ij(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"cartesian");e&&(DW(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=HW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new EG(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new BG(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}b5.specKey="crosshair",b5.builtInTheme={crosshair:_5},b5.type=r.cartesianCrosshair;class x5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=aU(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=zH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new EG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new RG(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new OG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new PG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}x5.specKey="crosshair",x5.builtInTheme={crosshair:_5},x5.type=r.polarCrosshair;const S5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},A5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},k5=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},C5=(t,e,i)=>{const s=e.domain();if(Ow(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},T5=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Ow(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},M5=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},w5=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}},E5=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),B5=(t,e,i)=>{if(Ow(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class P5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===Fj(Dj(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(P5,t$);class R5 extends EU{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:T5(t,this._stateScale,this._isHorizontal),a="percent"===n?e:T5(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=M5(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=B5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&w5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=Dj(t),this._isHorizontal="horizontal"===Fj(this._orient),this._dataFilterEvent=new P5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Ow(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>Fj(t._orient)===Fj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Ow(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};Tw(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Ow(d.getScale(0).type),p=Ow(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else Tw(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;XP(r,"dataview",Ia),YP(r,"dataFilterComputeDomain",k5);const a=new za(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Tz(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(YP(this._option.dataSet,"dataFilterWithNewDomain",A5),YP(this._option.dataSet,"lockStatisticsFilter",S5),Tw(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Ow(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;E5("start",i,this._spec)&&E5("end",s,this._spec)&&(t="percent"===i?this._spec.start:T5(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:T5(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?T5(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?T5(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=C5(this._start,this._stateScale,M5(i,this._isHorizontal)),this._endValue=C5(this._end,this._stateScale,M5(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Ow(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=B5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&Tw(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new AE:new iE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=w5(h);if(!this._dataUpdating&&Lw(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,Lw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(R5,t$);class O5 extends wU{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=uB({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const I5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),L5={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:I5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:I5(!0)},D5={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class F5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=O5,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=C5(e,this._stateScale,M5(s,this._isHorizontal)),a=C5(i,this._stateScale,M5(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new AE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(M5(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=M5(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return D5}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new AE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(M5(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Ow(t.type)||e[0]!==X(e))&&(!Lw(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:M5(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new vY(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:PP(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:PP(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:PP(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:PP(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:PP(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:PP(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:PP(g.style)},selectedBackgroundStyle:PP(this._spec.selectedBackground.style),dragMaskStyle:PP(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:uB(PP(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:uB(PP(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(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}=zH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(M5(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}F5.type=r.dataZoom,F5.transformerConstructor=O5,F5.builtInTheme={dataZoom:L5},F5.specKey="dataZoom";const z5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},H5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class j5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=vw(this._start,e)&&vw(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=M5(n,this._isHorizontal),a=C5(e,this._stateScale,r),o=C5(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return H5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new uG(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=PP(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=PP(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}j5.type=r.scrollBar,j5.builtInTheme={scrollBar:z5},j5.specKey="scrollBar";const N5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():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},U5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),V5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:U5("l1FontSize","primaryFontColor")},content:{visible:!0,style:U5("l2FontSize","tertiaryFontColor")}};class W5 extends EU{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){YP(this._option.dataSet,"indicatorFilter",N5);const t=new za(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 Tz(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=uB({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},BP(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?nB(l,this._computeLayoutRadius()):0,dy:h?nB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},BP(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new IX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}W5.type=r.indicator,W5.builtInTheme={indicator:V5},W5.specKey="indicator";const G5=["sum","average","min","max","variance","standardDeviation","median"];function Y5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function X5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function K5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&Y5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,X5(a,"xAxis"),t.x)),c=ZE(t.x)?J5(t.x,n)+r.x:Q5(h.getXAxisHelper(),[t.x])+r.x,c}function $5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&Y5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(a,"yAxis"),t.y)),c=ZE(t.y)?J5(t.y,n)+r.y:Q5(h.getYAxisHelper(),[t.y])+r.y,c}function q5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&Y5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"angleAxis"),t.angle)),Q5(o.angleAxisHelper,[t.angle])}function Z5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&Y5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"radiusAxis"),t.radius)),Q5(o.radiusAxisHelper,[t.radius])}function J5(t,e){return Number(t.substring(0,t.length-1))*e/100}function Q5(t,e){const i=t.getScale(0);return Ow(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function t3(t){return G5.includes(t)}function e3(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=K5(t,_,n,g,d,l,a),r=$5(t,b,n,g,u,l,a),i3(s,x,A,f.length),i3(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=K5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);i3(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=$5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);i3(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function i3(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=q5(t,h,n,a,r),i=Z5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=q5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=Z5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function n3(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function r3(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&Y5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,X5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&Y5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,X5(s,"yAxis"),d[0]))}(t,n3(t,e),i,n)})),a.forEach(((t,i)=>{const n=n3(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=ZE(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=ZE(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:Q5(n.getXAxisHelper(),p)+l.x+d,y:Q5(n.getYAxisHelper(),g)+l.y+u})})),r}function a3(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&Y5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&Y5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(s,"radiusAxis"),p[0])),n.push({angle:Q5(h.angleAxisHelper,u),radius:Q5(h.radiusAxisHelper,p)})})),n}function o3(t,e,i){let{x:s,y:n}=t;return ZE(s)&&(s=J5(s,e)),ZE(n)&&(n=J5(n,i)),{x:s,y:n}}function l3(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=o3(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>o3(t,n,r)))}function h3(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 c3(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},PP(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},u3(PP(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=u3(PP(r),i,s)),t}return{visible:!1}}function d3(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function u3(t,e,i){return d(t)?t(e,i):t}function p3(t,e){return d(t)?t(e):t}function g3(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 f3(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function m3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=f3(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function v3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=f3(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function y3(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function _3(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&t3(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&t3(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&t3(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&t3(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>x3(i,t,e))):i.x=x3(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>x3(i,t,e))):i.y=x3(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>x3(i,t,e))):i.angle=x3(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>x3(i,t,e))):i.radius=x3(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=x3(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const b3={min:(t,e)=>yw(t[0].latestData,e.field),max:(t,e)=>_w(t[0].latestData,e.field),sum:function(t,e){return bw(t[0].latestData,e.field)},average:function(t,e){return xw(t[0].latestData,e.field)},variance:function(t,e){return Sw(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(Sw(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function x3(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 b3[i](e,{field:s})}return t}function S3(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}const A3=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},k3=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},C3=t=>{if(!t)return;A3(t).forEach((e=>{k3(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{k3(e,t)}))},T3=(t,e)=>{if(!t)return;const i=new Set(A3(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(C3),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},M3="__vchart_marker_coordinate__",w3=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],E3=["position","positions","coordinatesOffset","regionRelative"],B3=["offsetX","offsetY","confine"],P3=t=>Array.isArray(t)?t.map(P3):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,R3=t=>{if(Array.isArray(t))return t.map(R3);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=R3(e[t])})),e},O3=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&w3.forEach((t=>{i[t]=M3})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),E3.forEach((t=>{t in i&&(i[t]=M3)})),"label"in i&&(i.label=P3(i.label)),Object.keys(i).forEach((t=>{i[t]=R3(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),B3.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=M3)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},P3(t)),{text:"__vchart_marker_text__"}))}return i};class I3 extends EU{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&t3(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Fa;return e.registerParser("array",s),new za(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&T3(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}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._updateMarkerLayout()}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._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=ww(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=QE(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QE(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(O3(e,{normalizeDomainPosition:i}),O3(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(O3(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),O3(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerFilter",S3),this._releaseMarkerData();const i=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function L3(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=yw(t,e),r=_w(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class D3 extends I3{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}=m3(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:u3(PP(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{line:d3(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return d3(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return d3(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:u3(PP(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:u3(PP(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=h3([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=m3(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerRegression",L3),YP(this._option.dataSet,"markerFilter",S3);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new za(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()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}D3.specKey="markLine";const F3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),z3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},H3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:F3(!1),endSymbol:F3(!0),label:z3};class j3 extends D3{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new sX(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}=m3(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=e3(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=r3(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=l3(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(ZE(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.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));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=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}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_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}=m3(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 za(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}j3.type=r.markLine,j3.coordinateType="cartesian",j3.builtInTheme={markLine:H3};class N3 extends D3{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=m3(this._spec);return e||i?new aX(t):new sX(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}=m3(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=s3(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=a3(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=m3(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}}}N3.type=r.polarMarkLine,N3.coordinateType="polar",N3.builtInTheme={polarMarkLine:H3};class U3 extends EU{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=qE(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return HH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=QE(this._spec.width,a.width,null,a.width),l=QE(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new RX(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}}U3.type=r.title,U3.specKey=r.title,U3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class V3 extends I3{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=v3(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:u3(PP(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{area:d3(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>d3(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return d3(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=h3([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=v3(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}V3.specKey="markArea";const W3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class G3 extends V3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new rX(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=v3(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=r3(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=l3(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=v3(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}}}G3.type=r.markArea,G3.coordinateType="cartesian",G3.builtInTheme={markArea:W3};class Y3 extends V3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=v3(this._spec);return i||e||s?new oX(t):new rX(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}=v3(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=s3(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());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=a3(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=v3(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}}}Y3.type=r.polarMarkArea,Y3.coordinateType="polar",Y3.builtInTheme={polarMarkArea:W3};const X3=t=>PP(Object.assign({},t)),K3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},PP(t.style))}),$3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=X3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=X3(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:{},PP(Object.assign({},_)));var _;const b=K3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=K3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=K3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=K3(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},q3=t=>"left"===t||"right"===t,Z3=t=>"top"===t||"bottom"===t,J3={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Q3 extends EU{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({},$3(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({},$3(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?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new KX(t):this._playerComponent=new ZX(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=q3(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=q3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(UX.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(UX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(UX.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(UX.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(UX.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(UX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=q3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Z3(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):q3(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))):Z3(this._orient)?this._maxSize():t.height}_computeDx(t){return q3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Z3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){var i,s;const n=null===(i=this._specs)||void 0===i?void 0:i[e];n&&(null===(s=this._option)||void 0===s?void 0:s.globalInstance)&&(this._option.globalInstance.updateFullData(n.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:n,index:e,specs:this._specs}}))}release(){var e,i,s,n;null===(i=null===(e=this._playerComponent)||void 0===e?void 0:e.pause)||void 0===i||i.call(e),null===(n=null===(s=this._option)||void 0===s?void 0:s.globalInstance)||void 0===n||n.off(t.ChartEvent.rendered,this.autoPlayCallback),super.release(),this._playerComponent=null,this._cacheAttrs=null,this._specs=[]}}Q3.builtInTheme={player:J3},Q3.specKey="player",Q3.type=r.player;class t4 extends EU{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,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=HE({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==tz.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}t4.type=r.label;class e4 extends rq{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}e4.type="text",e4.constructorType="label";const i4=()=>{aq(),vB.registerMark(e4.constructorType,e4)};class s4 extends wU{_initTheme(t,e){return{spec:t,theme:this._theme}}}class n4 extends t4{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=s4,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(FP.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(FP.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Tw(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=uB({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},x$(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[rP])):t=>t.filter((t=>t.data[nP]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?S$(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}n4.type=r.label,n4.specKey="label",n4.transformerConstructor=s4;class r4 extends t4{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[iP]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return uB({textStyle:{pickable:!0===this._spec.interactive},position:a4(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[rP]:t.data[nP]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>S$({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function a4(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}r4.type=r.totalLabel,r4.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},r4.specKey="totalLabel";class o4 extends I3{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=y3(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,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,O,I,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=u3(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=c3(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=u3(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=PP(u3(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=u3(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=u3(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:p3(D.offsetX,j),offsetY:p3(D.offsetY,j)},et),{style:u3(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:u3(z.style,this._markerData,this._markAttributeContext)},state:{line:d3(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:d3(it,this._markerData,this._markAttributeContext),textBackground:d3(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:d3(null!==(I=null===(O=this._spec.targetSymbol)||void 0===O?void 0:O.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:PP(lt.style)}):{visible:!1};return new hX(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:PP(C.style)}):{visible:!1},w=c3(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=h3([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=p3(S.offsetX,A),f=p3(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:g3(y,s,A),offsetY:g3(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=y3(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}o4.specKey="markPoint";const l4={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class h4 extends o4{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=e3(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=r3(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=l3(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=y3(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}}}h4.type=r.markPoint,h4.coordinateType="cartesian",h4.builtInTheme={markPoint:l4};class c4 extends o4{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=s3(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}c4.type=r.polarMarkPoint,c4.coordinateType="polar",c4.builtInTheme={polarMarkPoint:l4};class d4 extends o4{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}])]}}}d4.type=r.geoMarkPoint,d4.coordinateType="geo",d4.builtInTheme={geoMarkPoint:l4};const u4="inBrush",p4="outOfBrush",g4={style:!0,inBrush:!0,outOfBrush:!0};class f4 extends EU{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),u4,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),p4,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||g4[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:PP(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new eK(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:PP(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener($X.brushActive,(s=>{this._initMarkBrushState(i,p4),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener($X.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener($X.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener($X.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},PP(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];Yz(t,[...s.filter((t=>t!==u4&&t!==p4)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,u4),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,p4),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,u4),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,p4),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;Kz(s,[u4,p4]),i&&Xz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}f4.type=r.brush,f4.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},f4.specKey="brush";const m4={style:!0,state:!0};class v4 extends EU{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${NB}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||m4[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_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 Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}v4.type=r.customMark,v4.specKey="customMark";class y4{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>_4(t))),a=n.filter((t=>!_4(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>_4(t))),h=o.filter((t=>!_4(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 _4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}y4.type="grid";const b4=t=>{t?function(t){if(!t)throw new Error("installPoptipToApp requires an app instance");WA(t),MG(NA()),UA(),GA(t)}(t):(MG(m_()),MG(NA()),UA())},x4="vchart-tooltip",S4=`${x4}-container`,A4=`${x4}-title`,k4=`${x4}-content-box`,C4={offsetX:10,offsetY:10},T4="99999999999999";function M4(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const w4=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,E4=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?M4(t):"",B4=(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},P4={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},R4=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=P4[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class O4 extends sU{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=VH(null==T?void 0:T.position,b,e),w=null!==(r=VH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:UB,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:VB;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=_M(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=w4(e,F),N=w4(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(R4(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=B4(t,y),W.top=B4(i,y),W.right=B4(e,y),W.bottom=B4(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=B4(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?O:I,n="x"===t?A:C,r=R4(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",L4=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=I4(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=I4(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},D4=(t={})=>{const{lineHeight:e}=t;return t.fontSize?QE(e,t.fontSize):0},F4=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=I4(o)),{panelStyle:a,panelPadding:o}};function z4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const H4=t=>!!t&&1===t.nodeType&&"function"==typeof t.appendChild&&!!t.children;class j4 extends O4{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(j4.type),this.type=GW.dom,this._tooltipContainer=null==yM?void 0:yM.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}_getTooltipParentElement(t){return H4(t.parentElement)?t.parentElement:H4(this._chartContainer)?this._chartContainer:H4(null==yM?void 0:yM.body)?yM.body:void 0}initEl(){const t=this._component.getSpec(),e=this._getTooltipParentElement(t);if(yM&&e){for(let t=0;t{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=F4(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:I4(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=L4(h),x=L4(d),S=L4(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=I4(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=I4(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=I4(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(D4(p),D4(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(A4))),l=a.find((t=>t.className.includes(k4)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(A4),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(z4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${x4}-column`),e.classList.add(`${x4}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(k4),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];z4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));z4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${x4}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=E4(e.key),e.keyStyle&&L4(e.keyStyle,l)):"value"===i?(o.innerHTML=E4(e.value),e.valueStyle&&L4(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?M4(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?M4(c):m,_=p,b=t=>new Wg({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=su.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?M4(u):"currentColor",`\n \n \n \n `;const M=T?su.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),z4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(k4))),h=[...o.children].find((t=>t.className.includes(A4)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(A4)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=QE(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,z4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=fv({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function V4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:N4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const W4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class G4 extends O4{constructor(){super(G4.type),this.type=GW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new aK({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=iB(d.padding),x=V4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=V4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=V4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:W4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.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:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=uB({},S,V4(b,void 0,{})),{width:s,height:n,text:r}=U4(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=uB({},A,V4(x,void 0,{})),{width:e,height:s,text:n}=U4(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};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=uB({},x,V4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=U4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}G4.type=GW.canvas;const Y4=/\{([^}]+)\}/,X4=/\{([^}]+)\}/g,K4=/:/;class $4 extends sU{constructor(){super($4.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.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[$4.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)),vB.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=Y4.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(X4,((t,i)=>{if(!K4.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 this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}$4.pluginType="chart",$4.specKey="formatter",$4.type="formatterPlugin";RH.useRegisters([()=>{qW(),JW(),tG(),MW(),TW(),lW(),QV(),UN(),WN(),yH(),fH(),OV(),$V(),vB.registerSeries(hW.type,hW),vB.registerChart(eG.type,eG)},()=>{qW(),JW(),tG(),TW(),lW(),QV(),UN(),nG(),WN(),oG(),OV(),$V(),vB.registerSeries(cK.type,cK),MW(),vB.registerChart(uK.type,uK)},()=>{qW(),JW(),tG(),TW(),MK(),MW(),vB.registerChart(EK.type,EK)},()=>{qW(),JW(),MW(),TW(),jK(),vB.registerChart(UK.type,UK)},()=>{JW(),Nq(),vB.registerChart(X1.type,X1)},()=>{qW(),JW(),MW(),TW(),aZ(),vB.registerChart(q1.type,q1)},()=>{qW(),JW(),tG(),MW(),TW(),fZ(),vB.registerChart(J1.type,J1)},()=>{qW(),JW(),tG(),MW(),TW(),MK(),vB.registerTransform("bin",Qr),vB.registerChart(n2.type,n2)},()=>{JW(),i$(),XK(),vB.registerSeries(n$.type,n$),vB.registerImplement("registerMap",ZP),vB.registerImplement("unregisterMap",JP),mH(),vB.registerChart(N1.type,N1)},()=>{JW(),i1(),vB.registerSeries(n1.type,n1),Oq(),OZ(),iZ(),FZ(),vB.registerChart(l2.type,l2)},()=>{JW(),MQ(),vB.registerChart(d2.type,d2)},()=>{JW(),KQ(),vB.registerChart(p2.type,p2)},()=>{qW(),JW(),tG(),MW(),TW(),I$(),vB.registerChart(C2.type,C2)},()=>{qW(),JW(),MW(),TW(),nq(),vB.registerTransform("boxplot",ta),vB.registerChart(M2.type,M2)},()=>{qW(),JW(),MW(),TW(),FZ(),vB.registerChart(a2.type,a2)},()=>{qW(),JW(),MW(),TW(),YZ(),vB.registerChart(f2.type,f2)},()=>{qW(),JW(),MW(),TW(),fq(),vB.registerChart(v2.type,v2)},()=>{qW(),JW(),tG(),MW(),TW(),nG(),OV(),$V(),vB.registerSeries(bq.type,bq),vB.registerChart(P2.type,P2)},()=>{JW(),u0(),vB.registerChart(_2.type,_2)},()=>{JW(),y0(),vB.registerChart(x2.type,x2)},()=>{JW(),Y0(),vB.registerChart(A2.type,A2)},()=>{JW(),gG(),z0(),vB.registerChart(E2.type,E2)},()=>{JW(),u1(),vB.registerChart(O2.type,O2)},()=>{JW(),M1(),vB.registerChart(L2.type,L2)},()=>{qW(),JW(),tG(),MW(),vB.registerChart(t2.type,t2),TW()},$V,OV,()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(oK.type,oK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(lK.type,lK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(hK.type,hK)},nZ,iZ,()=>{vB.registerComponent(U2.type,U2)},()=>{vB.registerComponent(t5.type,t5)},()=>{vB.registerComponent(d5.type,d5)},()=>{vB.registerComponent(b5.type,b5)},()=>{vB.registerComponent(x5.type,x5)},()=>{vB.registerComponent(F5.type,F5)},()=>{vB.registerComponent(j5.type,j5)},()=>{vB.registerComponent(W5.type,W5)},i$,()=>{vB.registerComponent(j3.type,j3),iX()},()=>{vB.registerComponent(G3.type,G3),nX()},()=>{vB.registerComponent(h4.type,h4),lX()},()=>{vB.registerComponent(N3.type,N3),aX._animate=FY,iX()},()=>{vB.registerComponent(Y3.type,Y3),oX._animate=HY,nX()},()=>{vB.registerComponent(c4.type,c4),lX()},()=>{vB.registerComponent(d4.type,d4),lX()},()=>{vB.registerComponent(U3.type,U3)},()=>{vB.registerComponent(Q3.type,Q3)},()=>{vB.registerGraphicComponent(n4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(n4.type,n4,!0,1/0)},()=>{vB.registerGraphicComponent(r4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(r4.type,r4,!0)},()=>{vB.registerComponent(f4.type,f4)},()=>{vB.registerComponent(v4.type,v4)},()=>{vB.registerRuntimePluginInstaller("poptipForText",b4),b4()},()=>{vB.registerLayout(y4.type,y4)},()=>{var t;t=G4,vB.registerComponentPlugin(t.type,t)},()=>{var t;t=$4,vB.registerChartPlugin(t.type,t)},kH,MH]),RH.useRegisters([()=>{BO(iA)}]),t.DEFAULT_CHART_HEIGHT=VB,t.DEFAULT_CHART_WIDTH=UB,t.DEFAULT_CLOSE_STROKE_JOIN=LH,t.DEFAULT_DATA_INDEX=GB,t.DEFAULT_DATA_KEY=YB,t.DEFAULT_DATA_SERIES_FIELD=XB,t.DEFAULT_KEY=uP,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=IH,t.DEFAULT_MAP_LOOK_UP_KEY=pP,t.DEFAULT_MEASURE_CANVAS_ID=WB,t.DEFAULT_SERIES_STYLE_NAME=KB,t.DEFAULT_SMOOTH_INTERPOLATE=OH,t.Factory=vB,t.MOSAIC_CAT_END_PERCENT=hP,t.MOSAIC_CAT_START_PERCENT=lP,t.MOSAIC_VALUE_END_PERCENT=oP,t.MOSAIC_VALUE_START_PERCENT=aP,t.ManualTicker=class extends pb{constructor(t){super(t),this.lastFrameTime=0,this.status=wl.RUNNING}setupTickHandler(){const t=new DH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,!0}},t.PREFIX=NB,t.SEGMENT_FIELD_END=dP,t.SEGMENT_FIELD_START=cP,t.STACK_FIELD_END=ZB,t.STACK_FIELD_END_OffsetSilhouette=eP,t.STACK_FIELD_END_PERCENT=QB,t.STACK_FIELD_KEY=$B,t.STACK_FIELD_START=qB,t.STACK_FIELD_START_OffsetSilhouette=tP,t.STACK_FIELD_START_PERCENT=JB,t.STACK_FIELD_TOTAL=iP,t.STACK_FIELD_TOTAL_BOTTOM=rP,t.STACK_FIELD_TOTAL_PERCENT=sP,t.STACK_FIELD_TOTAL_TOP=nP,t.StreamLight=eF,t.ThemeManager=OB,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=RH,t.boundsInRect=eB,t.builtinThemes=SB,t.calcLayoutNumber=QE,t.calcPadding=tB,t.computeActualDataScheme=FE,t.convertPoint=sB,t.createArc=Vp,t.createArea=Yp,t.createGroup=tg,t.createLine=ag,t.createRect=mg,t.createRichText=jg,t.createSymbol=Gg,t.createText=Jg,t.darkTheme=cB,t.dataScheme=rB,t.default=RH,t.defaultThemeName=AB,t.getActualColor=HE,t.getActualNumValue=nB,t.getColorSchemeBySeries=VE,t.getDataScheme=DE,t.getFunnelTheme=bB,t.getMergedTheme=PB,t.getSpecInfo=HH,t.getTheme=wB,t.hasThemeMerged=TB,t.isColorKey=jE,t.isPercent=ZE,t.isPercentOffset=JE,t.isProgressiveDataColorScheme=NE,t.isTokenKey=oB,t.isValidOrient=qE,t.lightTheme=hB,t.lookup=jH,t.measureText=jB,t.normalizeLayoutPaddingSpec=iB,t.queryColorFromColorScheme=zE,t.queryToken=aB,t.registerDataSetInstanceParser=XP,t.registerDataSetInstanceTransform=YP,t.registerTheme=MB,t.removeTheme=EB,t.themeExist=BB,t.themes=kB,t.token=lB,t.transformColorSchemeToStandardStruct=UE,t.transformToGraphic=PP,t.version="2.1.3",t.vglobal=b_,t.warn=gM,Object.defineProperty(t,"__esModule",{value:!0})})); +let mQ=class t extends nQ{constructor(e){super(H({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),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 C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[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(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?uQ(t,o,l.width,l.height,h):"geometric"===t.type&&fQ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=tQ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};mQ.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vQ extends nQ{constructor(t){super(H({},vQ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vQ.defaultOptions={enlarge:!1};const _Q={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bQ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xQ(t.fontFamily):"sans-serif",d=t.fontStyle?xQ(t.fontStyle):"normal",u=t.fontWeight?xQ(t.fontWeight):"normal",p=t.rotate?xQ(t.rotate):0,g=xQ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?xQ(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},_Q),t.as):_Q,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?xQ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=AQ(kQ(t,l),w);M=i=>e(t(i))}let E=aQ;"fast"===t.layoutType?E=vQ:"grid"===t.layoutType&&(E=mQ);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},xQ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],SQ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),AQ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SQ(t[0]),n=SQ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SQ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},kQ=(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 CQ(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{vB.registerGrammarTransform("wordcloud",{transform:bQ}),aq(),vB.registerAnimation("wordCloud",((t,e)=>({appear:sJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:uH.disappear.duration}}))),vB.registerSeries(TQ.type,TQ)},wQ=t=>d(t)?t():t,EQ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=wQ(e.valueField),v=null!==(i=wQ(e.heightVisual))&&void 0!==i&&i,y=null===(s=wQ(e.isCone))||void 0===s||s,_=wQ(e.range),b=a.reduce(((t,e)=>{const i=Number.parseFloat(e[m]);return k(i)?Math.max(t,i):t}),-1/0),x=null!==(n=null==_?void 0:_.min)&&void 0!==n?n:0,S=null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b,A=t=>k(t)&&k(x)&&k(S)?x===S?t{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0,S=A(n);p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=S),d&&(t[d]=e===a.length-1?y?0:t[c]:A(_)),u&&(t[u]=0===e?1:A(r)),g&&(t[g]=n)})),a},BQ=(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},PQ=`${NB}_FUNNEL_TRANSFORM_RATIO`,RQ=`${NB}_FUNNEL_REACH_RATIO`,OQ=`${NB}_FUNNEL_HEIGHT_RATIO`,IQ=`${NB}_FUNNEL_VALUE_RATIO`,LQ=`${NB}_FUNNEL_LAST_VALUE_RATIO`,DQ=`${NB}_FUNNEL_NEXT_VALUE_RATIO`,FQ=`${NB}_FUNNEL_LAST_VALUE`,zQ=`${NB}_FUNNEL_CURRENT_VALUE`,HQ=`${NB}_FUNNEL_NEXT_VALUE`,jQ=`${NB}_FUNNEL_TRANSFORM_LEVEL`;class NQ extends KH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[RQ])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class UQ extends qz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VQ extends UQ{constructor(){super(...arguments),this.type=VQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VQ.type="polygon";const WQ=()=>{vB.registerMark(VQ.type,VQ),KT(),yT(),w_.registerBuiltInAnimate("growPointsOut",VL),vB.registerGraphicComponent("polygon",ug)},GQ=Object.assign(Object.assign({},aj),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YQ extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class XQ extends Ej{constructor(){super(...arguments),this.type=PE.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YQ,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;YP(this._dataSet,"funnel",EQ),YP(this._dataSet,"funnelTransform",BQ);const t=new za(this._dataSet,{name:`${NB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new Tz(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:zQ,asTransformRatio:PQ,asReachRatio:RQ,asHeightRatio:OQ,asValueRatio:IQ,asNextValueRatio:DQ,asLastValueRatio:LQ,asLastValue:FQ,asNextValue:HQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:jQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},XQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:yj(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},XQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(XQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(XQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new NQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&uM(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&uM(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ew(RQ).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(gj(null===(s=vB.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),fj("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("fadeInOut")(),fj(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(gj(vB.getAnimationInKey("funnel")({},o),fj(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(gj(null===(a=vB.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),fj("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[LQ])/2:this._getSecondaryAxisLength(t[IQ])/2,n=this._getSecondaryAxisLength(t[IQ])/2):(s=this._getSecondaryAxisLength(t[IQ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[DQ])/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[jQ])}_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[YB]===t[YB]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{WQ(),aq(),g$(),vB.registerSeries(XQ.type,XQ),vB.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},gH))),vB.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:lH,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),mH()},$Q=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},qQ=t=>{const e=t.filter((t=>t.context.diffState===tz.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},ZQ=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},JQ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=ZQ(r,s,n);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),QQ=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},t0=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qQ(i.parent.children),a=QQ(r);return $Q(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),e0=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},i0=(t,e={})=>{if(!t)return[];const i=[];return oJ(t,i,e),i},s0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new LJ(i).layout(t,{width:s,height:n})};class n0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var r0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(r0||(r0={}));const a0=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===r0.DrillDown){return Y(AP(t,n,s,"children"))}if(i.type===r0.DrillUp){const e=kP(t,n,s,"children");if(e)return Y(e)}return t};class o0{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=JK(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;YP(t,"drillFilter",a0),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:r0.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:r0.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:r0.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:r0.DrillUp},model:this}),r}}const l0=Object.assign(Object.assign({},aj),{sunburst:{name:"sunburst",type:"arc"}}),h0=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:QH,operations:["max","min","values"]}),t.push({key:tj,operations:["values"]}),t),c0={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class d0 extends xq{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),YP(this._dataSet,"sunburstLayout",s0),YP(this._dataSet,"flatten",i0),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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(d0.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(d0.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new n0(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(gj(null===(e=vB.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}d0.type=PE.sunburst,d0.mark=l0,d0.builtInTheme={sunburst:c0},G(d0,o0);const u0=()=>{vB.registerSeries(d0.type,d0),Oq(),aq(),mH(),vB.registerAnimation("sunburst",((t,e)=>({appear:e0(0,e),enter:JQ(t),exit:t0(t),disappear:{duration:uH.disappear.duration}})))},p0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new AJ(i).layout(t,{width:s,height:n})};class g0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const f0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},m0=Object.assign(Object.assign({},aj),{circlePacking:{name:"circlePacking",type:"arc"}});class v0 extends Rj{constructor(){super(...arguments),this.type=PE.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:tj),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:YB},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),YP(this._dataSet,"circlePackingLayout",p0),YP(this._dataSet,"flatten",i0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(YP(t.dataSet,"addVChartProperty",NH),t.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(v0.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return h0(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new g0(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}v0.type=PE.circlePacking,v0.mark=m0,v0.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(v0,o0);const y0=()=>{vB.registerSeries(v0.type,v0),Oq(),aq(),fH(),vB.registerAnimation("circlePacking",((t,e)=>({appear:f0(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:uH.disappear.duration}})))},_0=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&_0(t,e.children,i)}))},b0=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},x0=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=S0(n,i),a=new RJ(i),o=[];return o.push(a.layout(r,s)),o},S0=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},A0=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:[]},k0=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 C0 extends KH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const T0=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),M0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:T0(t),w0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class E0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class B0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const P0=(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`},R0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class O0 extends j${constructor(){super(...arguments),this.type=O0.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?R0:P0,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}O0.type="linkPath";const I0=Object.assign(Object.assign({},aj),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class L0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const D0=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&Kz(t,e),Xz(t,e,s,n)};class F0 extends Rj{constructor(){super(...arguments),this.type=PE.sankey,this.transformerConstructor=L0,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=IP(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=IP(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):r.target===i.key?(s.includes(r.source)||s.push(r.source),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=IP(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),D0(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation())):(Kz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=IP(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=IP(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=IP(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=IP(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=IP(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s},!0,this._hasLinkStateAnimation())}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value},!0,this._hasLinkStateAnimation());Kz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(IP(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=IP(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=IP(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation());const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a},!0,this._hasLinkStateAnimation())}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void D0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value},!0,this._hasLinkStateAnimation());Kz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}_hasStateAnimation(t){var e;return xj(this)&&!!(null===(e=null==t?void 0:t.hasAnimationByState)||void 0===e?void 0:e.call(t,"state"))}_hasLinkStateAnimation(){return this._hasStateAnimation(this._linkMark)}_hasNodeStateAnimation(){return this._hasStateAnimation(this._nodeMark)}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){YP(this._dataSet,"sankeyLayout",x0),YP(this._dataSet,"sankeyFormat",b0),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;YP(s,"sankeyNodes",A0),YP(s,"flatten",i0);const n=new za(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.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),n.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._nodesSeriesData=n,YP(s,"sankeyLinks",k0);const r=new za(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:ij.bind(this),call:sj}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(F0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(F0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=zH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),fj("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),fj("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:NP.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{Kz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(IP(e).key)?Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasNodeStateAnimation()):Xz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasNodeStateAnimation())}))}initTooltip(){this._tooltipHelper=new C0(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new WE;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return _0(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}F0.type=PE.sankey,F0.transformerConstructor=L0,F0.mark=I0,F0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const z0=()=>{bK(),N$(),cT(),vB.registerGraphicComponent("path",(t=>hg(t))),vB.registerMark(O0.type,O0),aq(),vB.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:M0(t,e)},gH))),vB.registerAnimation("sankeyLinkPath",((t,e)=>({appear:w0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:uH.disappear.duration}}))),w_.registerBuiltInAnimate("linkPathGrowOut",B0),w_.registerBuiltInAnimate("linkPathGrowIn",E0),mH(),vB.registerSeries(F0.type,F0)},H0=(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=i0(n);return i=qH([{latestData:r}],e),i};class j0 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const N0=Object.assign(Object.assign({},aj),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),U0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class V0 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const W0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new HJ(i).layout(t,s),n=[];return oJ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[tj,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class G0 extends Rj{constructor(){super(...arguments),this.type=PE.treemap,this.transformerConstructor=V0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,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:tj),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),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:YB},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),YP(this._dataSet,"treemap",W0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(YP(this._rawData.dataSet,"addVChartProperty",NH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:nj.bind(this),call:rj}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=H0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){YP(this._dataSet,"hierarchyDimensionStatistics",H0),YP(this._dataSet,"flatten",i0);const i=new za(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 h0(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(G0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(G0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("treemap"))||void 0===e?void 0:e(),fj(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 j0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(FP.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(FP.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}G0.type=PE.treemap,G0.mark=N0,G0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},G0.transformerConstructor=V0,G(G0,o0),G(G0,t$);const Y0=()=>{vB.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),vB.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),bK(),aq(),vB.registerAnimation("treemap",((t,e)=>({appear:U0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:uH.disappear.duration}}))),mH(),vB.registerSeries(G0.type,G0)},X0=Object.assign(Object.assign({},MZ),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),K0=Object.assign(Object.assign({},aj),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),$0={type:"fadeIn"};function q0(t,e){return"fadeIn"===e?$0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class Z0 extends Sj{constructor(){super(...arguments),this._supportStack=!1}}class J0 extends KH{enableByType(t){return"dimension"!==t}}const Q0="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",t1={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:Q0,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Q0,fill:"#ddd"}}};class e1 extends EZ{constructor(){super(...arguments),this.type=PE.gaugePointer,this.transformerConstructor=Z0,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(e1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},e1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(e1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new J0(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}e1.type=PE.gaugePointer,e1.mark=K0,e1.builtInTheme={gaugePointer:t1},e1.transformerConstructor=Z0;const i1=()=>{vB.registerSeries(e1.type,e1),XK(),bK(),vB.registerAnimation("gaugePointer",((t,e)=>{const i=q0(t,e);return{appear:i,enter:i,disappear:{duration:uH.disappear.duration}}})),nZ(),iZ()};class s1 extends Sj{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class n1 extends EZ{constructor(){super(...arguments),this.type=PE.gauge,this.transformerConstructor=s1,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();YP(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[dP]=t[this._angleField[0]],t[cP]=e>0?i[e-1][dP]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(n1.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(n1.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[cP])?this.angleAxisHelper.dataToPosition([t[cP]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[dP]])}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(gj(null===(i=vB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),fj("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}n1.type=PE.gauge,n1.mark=X0,n1.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},n1.transformerConstructor=s1;class r1 extends qz{constructor(){super(...arguments),this.type=r1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Gg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}r1.type="cell";function a1(t){return!1===t?{}:{type:"fadeIn"}}class o1 extends KH{enableByType(t){return"dimension"!==t}}const l1=Object.assign(Object.assign({},aj),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class h1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const c1={valueField:!0};class d1 extends Rj{constructor(){super(...arguments),this.type=PE.heatmap,this.transformerConstructor=h1}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),c1)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(d1.mark.cell,{isSeriesMark:!0},{morph:yj(this._spec,d1.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(d1.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Pj(this);this._cellMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),fj("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 o1(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}d1.type=PE.heatmap,d1.mark=l1,d1.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},d1.transformerConstructor=h1;const u1=()=>{aq(),vB.registerMark(r1.type,r1),vB.registerGraphicComponent("symbol",Gg),KT(),iM(),jN(),vB.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},gH),{appear:a1(e)}))),OV(),$V(),vB.registerSeries(d1.type,d1)},p1=Object.assign(Object.assign({},aj),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),g1=`${NB}_CORRELATION_X`,f1=`${NB}_CORRELATION_Y`,m1=`${NB}_CORRELATION_SIZE`,v1=t=>d(t)?t():t,y1=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=v1(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=v1(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=v1(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(v1(e.outerRadius),f),y=v1(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(v1(e.field)),A=c.map(x),[k,C]=It(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=v1(e.radiusField),w=v1(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?It(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),O=Math.max(p,g),I=_1(R,O,c.length),L=[],D=(O-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=I[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),b1({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>O?a=R: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},b1=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,S1=(t,e)=>{if(!t||!_(t))return[];const i=x1(e.keyword),s=x1(e.categoryField),n=t[0].latestData[0];return{[s]:i,[GB]:null==n?void 0:n[GB],[XB]:null==n?void 0:n[XB]}};class A1 extends j${constructor(){super(...arguments),this.type=A1.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}A1.type="ripple";const k1=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class C1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class T1 extends xq{constructor(){super(...arguments),this.type=PE.correlation,this.transformerConstructor=C1,this._viewBox=new Ue}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(){if(super.initData(),!this._data)return;YP(this._dataSet,"correlation",y1);const t=new Fa;XP(t,"dataview",Ia),YP(t,"correlationCenter",S1);const e=new za(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return 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 Tz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(T1.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:GB});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(T1.mark.ripplePoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(T1.mark.centerPoint,{key:GB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[g1],y:t=>t[f1],size:t=>t[m1],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),fj("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}T1.type=PE.correlation,T1.mark=p1,T1.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},T1.transformerConstructor=C1;const M1=()=>{WN(),N$(),iM(),vB.registerMark(A1.type,A1),vB.registerGraphicComponent("symbol",(t=>Gg(t))),vB.registerSeries(T1.type,T1),vB.registerAnimation("correlation",((t,e)=>Object.assign({appear:k1(0,e)},pH)))},w1=Object.assign(Object.assign({},aj),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class E1 extends j${constructor(){super(...arguments),this.type=E1.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}E1.type="liquid";const B1=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class P1 extends KH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class R1 extends Ej{constructor(){super(...arguments),this.type=PE.liquid,this.transformerConstructor=GN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=mg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Gg({x:s,y:n,size:r,symbolType:B1(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=iB(this._spec.outlineMargin),this._paddingSpec=iB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(R1.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(R1.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(R1.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(R1.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new P1(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(gj(null===(i=vB.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),fj("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(gj(null===(s=vB.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),fj("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=RM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}R1.type=PE.liquid,R1.mark=w1,R1.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},R1.transformerConstructor=GN;const O1=t=>Y(t).join(",");class I1 extends KH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>O1(null==t?void 0:t[this.series.getDimensionField()[0]])}}const L1=Object.assign(Object.assign({},aj),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class D1 extends Sj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const F1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?ZJ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class z1 extends Ej{constructor(){super(...arguments),this.type=PE.venn,this.transformerConstructor=D1,this._viewBox=new Ue}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:YB)}initData(){var t;super.initData(),YP(this._dataSet,"venn",F1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(z1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(z1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>O1(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new I1(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:O1(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return O1(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[O1(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(O1(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(gj(null===(e=vB.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),fj(t.name,this._spec,this._markAttributeContext)))}))}}z1.type=PE.venn,z1.mark=L1,z1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},z1.transformerConstructor=D1;class H1 extends TK{constructor(){super(...arguments),this.type=PE.mosaic,this.transformerConstructor=kK}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(oP),this.setFieldX2(aP)),this.setFieldY(hP),this.setFieldY2(lP)):(t&&(this.setFieldY(oP),this.setFieldY2(aP)),this.setFieldX(hP),this.setFieldX2(lP)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}H1.type=PE.mosaic,H1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},H1.transformerConstructor=kK;class j1 extends yW{_isValidSeries(t){return t===PE.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class N1 extends fW{constructor(){super(...arguments),this.transformerConstructor=j1,this.type="map",this.seriesType=PE.map}}N1.type="map",N1.seriesType=PE.map,N1.transformerConstructor=j1;class U1 extends yW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class V1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=oU(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,uB({},s,l)),n&&Object.assign(o,uB({},n,o))}}class W1 extends U1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class G1 extends U1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class Y1 extends fW{constructor(){super(...arguments),this.transformerConstructor=G1}}Y1.transformerConstructor=G1;class X1 extends Y1{constructor(){super(...arguments),this.transformerConstructor=G1,this.type="pie",this.seriesType=PE.pie}}X1.type="pie",X1.seriesType=PE.pie,X1.transformerConstructor=G1;class K1 extends W1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:AU,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:AU,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>uB({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const $1=(t,e)=>{if(!t)return null;const i=Yj(t,(t=>"angle"===t.getOrient()),e),s=Yj(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Lw(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=Aw({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=kw(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=Wj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Lw(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=Aw({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=kw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=Wj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class q1 extends fW{constructor(){super(...arguments),this.transformerConstructor=K1,this.type="rose",this.seriesType=PE.rose}_setModelOption(){this._modelOption.getDimensionInfo=$1}}q1.type="rose",q1.seriesType=PE.rose,q1.transformerConstructor=K1,G(q1,AW);class Z1 extends W1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=uB({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}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=>uB({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class J1 extends fW{constructor(){super(...arguments),this.transformerConstructor=Z1,this.type="radar",this.seriesType=PE.radar}_setModelOption(){this._modelOption.getDimensionInfo=$1}}J1.type="radar",J1.seriesType=PE.radar,J1.transformerConstructor=Z1,G(J1,AW);class Q1 extends yW{_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")&&uB(e,qF(this.type,t))})),this._transformAxisSpec(t)}}class t2 extends fW{constructor(){super(...arguments),this.transformerConstructor=Q1,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=OW(t,e,i))&&void 0!==s?s:[],...null!==(n=$1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}t2.type="common",t2.transformerConstructor=Q1,G(t2,AW);class e2 extends _W{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class i2 extends fW{constructor(){super(...arguments),this.transformerConstructor=e2}}i2.transformerConstructor=e2,G(i2,AW);class s2 extends e2{transformSpec(t){super.transformSpec(t),WF(t)}}class n2 extends i2{constructor(){super(...arguments),this.transformerConstructor=s2,this.type="histogram",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}n2.type="histogram",n2.seriesType=PE.bar,n2.transformerConstructor=s2;class r2 extends V1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class a2 extends fW{constructor(){super(...arguments),this.transformerConstructor=r2,this.type="circularProgress",this.seriesType=PE.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=$1}}a2.type="circularProgress",a2.seriesType=PE.circularProgress,a2.transformerConstructor=r2,G(a2,AW);class o2 extends V1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=PE.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===PE.gauge||t.type===PE.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===PE.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 l2 extends fW{constructor(){super(...arguments),this.transformerConstructor=o2,this.type="gauge",this.seriesType=PE.gaugePointer}}l2.type="gauge",l2.seriesType=PE.gaugePointer,l2.transformerConstructor=o2;class h2 extends yW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class c2 extends fW{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}c2.transformerConstructor=h2;class d2 extends c2{constructor(){super(...arguments),this.transformerConstructor=h2,this.type="wordCloud",this.seriesType=PE.wordCloud}}d2.type="wordCloud",d2.seriesType=PE.wordCloud,d2.transformerConstructor=h2;class u2 extends yW{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class p2 extends fW{constructor(){super(...arguments),this.transformerConstructor=u2,this.type="funnel",this.seriesType=PE.funnel}}p2.type="funnel",p2.seriesType=PE.funnel,p2.transformerConstructor=u2;class g2 extends _W{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=oU(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=oU(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class f2 extends fW{constructor(){super(...arguments),this.transformerConstructor=g2,this.type="linearProgress",this.seriesType=PE.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}f2.type="linearProgress",f2.seriesType=PE.linearProgress,f2.transformerConstructor=g2,G(f2,AW);class m2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),WF(t)}}class v2 extends fW{constructor(){super(...arguments),this.transformerConstructor=m2,this.type="rangeColumn",this.seriesType=PE.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}v2.type="rangeColumn",v2.seriesType=PE.rangeColumn,v2.transformerConstructor=m2;class y2 extends yW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _2 extends fW{constructor(){super(...arguments),this.transformerConstructor=y2,this.type="sunburst",this.seriesType=PE.sunburst}}_2.type="sunburst",_2.seriesType=PE.sunburst,_2.transformerConstructor=y2;class b2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class x2 extends fW{constructor(){super(...arguments),this.transformerConstructor=b2,this.type="circlePacking",this.seriesType=PE.circlePacking}}x2.type="circlePacking",x2.seriesType=PE.circlePacking,x2.transformerConstructor=b2;class S2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class A2 extends fW{constructor(){super(...arguments),this.transformerConstructor=S2,this.type="treemap",this.seriesType=PE.treemap}}A2.type="treemap",A2.seriesType=PE.treemap,A2.transformerConstructor=S2;class k2 extends wK{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),WF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class C2 extends EK{constructor(){super(...arguments),this.transformerConstructor=k2,this.type="waterfall",this.seriesType=PE.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}C2.type="waterfall",C2.seriesType=PE.waterfall,C2.transformerConstructor=k2;class T2 extends _W{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),WF(t)}}class M2 extends fW{constructor(){super(...arguments),this.transformerConstructor=T2,this.type="boxPlot",this.seriesType=PE.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}M2.type="boxPlot",M2.seriesType=PE.boxPlot,M2.transformerConstructor=T2;class w2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class E2 extends fW{constructor(){super(...arguments),this.transformerConstructor=w2,this.type="sankey",this.seriesType=PE.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=IP(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}E2.type="sankey",E2.seriesType=PE.sankey,E2.transformerConstructor=w2;class B2 extends _W{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),WF(t)}}class P2 extends fW{constructor(){super(...arguments),this.transformerConstructor=B2,this.type="rangeArea",this.seriesType=PE.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=OW,this._modelOption.getDimensionInfoByValue=LW,this._modelOption.getRectByDimensionData=NW}}P2.type="rangeArea",P2.seriesType=PE.rangeArea,P2.transformerConstructor=B2;class R2 extends _W{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class O2 extends fW{constructor(){super(...arguments),this.transformerConstructor=R2,this.type="heatmap",this.seriesType=PE.heatmap}}O2.type="heatmap",O2.seriesType=PE.heatmap,O2.transformerConstructor=R2;class I2 extends yW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class L2 extends fW{constructor(){super(...arguments),this.transformerConstructor=I2,this.type="correlation",this.seriesType=PE.correlation}}L2.type="correlation",L2.seriesType=PE.correlation,L2.transformerConstructor=I2;function D2(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=PP(t.style)),P(t.textStyle)||uB(s.textStyle,PP(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&PP(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&PP(s.background.style),s}function F2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const z2=(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},H2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:XB;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},j2={position:!0,item:!0,title:!0,pager:!0,background:!0};class N2 extends EU{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:()=>{Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(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=qE(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||j2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Tz(this._option,e),this._initSelectedData(),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(Tw(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(uB({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(uB({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}N2.specKey="legends";class U2 extends N2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){YP(this._option.dataSet,"discreteLegendFilter",H2),YP(this._option.dataSet,"discreteLegendDataMake",z2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return Tw(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(!CM(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=mP(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,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=qE(s)?s:qE(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=D2(A):M.title={visible:!1},P(k.focusIconStyle)||PP(k.focusIconStyle),k.shape&&(k.shape=F2(wP(k.shape))),k.label&&(k.label=wP(k.label)),k.value&&(k.value=wP(k.value)),k.background&&(k.background=wP(k.background)),ZE(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),ZE(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),ZE(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||PP(C.railStyle),P(C.sliderStyle)||PP(C.sliderStyle)):(P(C.textStyle)||PP(C.textStyle),C.handler&&wP(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(uB(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return kX}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(vX.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(vX.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(vX.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,datum:t.datum,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}=zH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=zH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}U2.specKey="legends",U2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},U2.type=r.discreteLegend;const V2=(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[]},W2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?CP(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function G2(t){const i=uB({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=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=D2(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=PP(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=PP(r.style)),P(a.style)||(w.trackStyle=PP(a.style)),w.startText=wP(o),w.endText=wP(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>PP(i(t,e,s)):P(i)||(e.style=PP(i)),e}(h),P(c)||(w.sizeBackground=PP(c)),u.visible&&!P(u.style)&&(uB(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const Y2={color:EX,size:PX},X2={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}},K2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},X2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},$2={horizontal:K2(!0),vertical:K2(!1)},q2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},X2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},Z2={horizontal:q2(!0),vertical:q2(!1)},J2=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Q2=[2,10];class t5 extends N2{static getSpecInfo(t){const e=HH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){YP(this._option.dataSet,"continuousLegendFilter",W2),YP(this._option.dataSet,"continuousLegendDataMake",V2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>Mw(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=mP(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!CM(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=mP(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?J2:Q2);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},G2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return Y2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}t5.specKey="legends",t5.builtInTheme={colorLegend:$2,sizeLegend:Z2},t5.type=r.continuousLegend;const e5=(t,e)=>p(e)?t.map((t=>e[t])):void 0,i5=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),s5=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function n5(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=r5(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>i5(i,s)(t)&&i5(n,r)(t)&&(u(a)||i5([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:jP.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:jP.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return RH.globalConfig.uniqueTooltip&&RH.hideTooltip(a.id),m}return"none"}const r5=(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=e5(c,t);let y=e5(d,t);const _=s5(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(i5(c,v));if(!_&&(y=e5(d,i),!s5(y)))return;const n=e.type===PE.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=Lw(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(i5(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=e5(d,o),!s5(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(i5(c,n));if(!_&&(y=e5(d,r),!s5(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===PE.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(i5(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=e5(d,i),!s5(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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(i5(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=e5(d,a),h=y,!s5(y)&&!a)return;s5(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},a5=t=>p(t)&&!_(t),o5=t=>p(t)&&_(t),l5=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class h5 extends wU{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=uB({},...l5.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=uB({},s);l5.forEach((t=>{delete r[t]})),delete r.style;const a=uB({},r,i);return a.style=uB({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:xM(this._option.mode)||!_M(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=b_.getElementById(t.parentElement)):_M(this._option.mode)&&(t.parentElement=null==yM?void 0:yM.body)}}const c5={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class d5 extends EU{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=h5,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=_M(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&a5(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&RH.globalConfig.uniqueTooltip&&l&&RH.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:jP.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:jP.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?GW.canvas:GW.dom,n=vB.getComponentPluginInType(t);n||fM("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=vB.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(bM(s)||xM(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=n5(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(o5(t)){if(a5(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>Uj(t,e[i])))}if(o5(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}d5.type=r.tooltip,d5.transformerConstructor=h5,d5.builtInTheme={tooltip:c5},d5.specKey="tooltip";var u5,p5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(u5||(u5={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(p5||(p5={}));const g5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},f5={labelZIndex:!0,gridZIndex:!0},m5={xField:!0,yField:!0,categoryField:!0,valueField:!0},v5={visible:!0,width:!0,style:!0};class y5 extends EU{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Lw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||f5[i]||m5[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||v5[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:NP.chart}:{source:jP.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:bM(e)||xM(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:jP.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:jP.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:jP.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)=>{g5[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}y5.specKey="crosshair";const _5={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class b5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=Oj(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){Oj(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Ij(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"cartesian");e&&(DW(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=HW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new EG(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new BG(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}b5.specKey="crosshair",b5.builtInTheme={crosshair:_5},b5.type=r.cartesianCrosshair;class x5 extends y5{static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=aU(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=zH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new EG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new RG(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new OG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new PG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}x5.specKey="crosshair",x5.builtInTheme={crosshair:_5},x5.type=r.polarCrosshair;const S5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},A5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},k5=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},C5=(t,e,i)=>{const s=e.domain();if(Ow(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},T5=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Ow(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},M5=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},w5=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}},E5=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),B5=(t,e,i)=>{if(Ow(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class P5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===Fj(Dj(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(P5,t$);class R5 extends EU{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:T5(t,this._stateScale,this._isHorizontal),a="percent"===n?e:T5(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=M5(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=B5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&w5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=Dj(t),this._isHorizontal="horizontal"===Fj(this._orient),this._dataFilterEvent=new P5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Ow(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>Fj(t._orient)===Fj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Ow(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};Tw(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Ow(d.getScale(0).type),p=Ow(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else Tw(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;XP(r,"dataview",Ia),YP(r,"dataFilterComputeDomain",k5);const a=new za(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Tz(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(YP(this._option.dataSet,"dataFilterWithNewDomain",A5),YP(this._option.dataSet,"lockStatisticsFilter",S5),Tw(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Ow(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Ow(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;E5("start",i,this._spec)&&E5("end",s,this._spec)&&(t="percent"===i?this._spec.start:T5(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:T5(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?T5(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?T5(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=C5(this._start,this._stateScale,M5(i,this._isHorizontal)),this._endValue=C5(this._end,this._stateScale,M5(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Ow(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=B5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&Tw(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new AE:new iE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=w5(h);if(!this._dataUpdating&&Lw(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,Lw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(R5,t$);class O5 extends wU{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=uB({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const I5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),L5={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:I5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:I5(!0)},D5={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class F5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=O5,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=C5(e,this._stateScale,M5(s,this._isHorizontal)),a=C5(i,this._stateScale,M5(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new AE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(M5(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=M5(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return D5}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new AE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(M5(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Ow(t.type)||e[0]!==X(e))&&(!Lw(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:M5(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new vY(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>C5(t,this._stateScale,M5(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:PP(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:PP(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:PP(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:PP(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:PP(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:PP(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:PP(g.style)},selectedBackgroundStyle:PP(this._spec.selectedBackground.style),dragMaskStyle:PP(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:uB(PP(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:uB(PP(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},PP(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}=zH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(M5(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}F5.type=r.dataZoom,F5.transformerConstructor=O5,F5.builtInTheme={dataZoom:L5},F5.specKey="dataZoom";const z5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},H5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class j5 extends R5{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=vw(this._start,e)&&vw(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=M5(n,this._isHorizontal),a=C5(e,this._stateScale,r),o=C5(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return H5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new uG(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=PP(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=PP(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}j5.type=r.scrollBar,j5.builtInTheme={scrollBar:z5},j5.specKey="scrollBar";const N5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():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},U5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),V5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:U5("l1FontSize","primaryFontColor")},content:{visible:!0,style:U5("l2FontSize","tertiaryFontColor")}};class W5 extends EU{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(IP(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){YP(this._option.dataSet,"indicatorFilter",N5);const t=new za(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 Tz(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=uB({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},BP(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?nB(l,this._computeLayoutRadius()):0,dy:h?nB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},BP(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new IX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}W5.type=r.indicator,W5.builtInTheme={indicator:V5},W5.specKey="indicator";const G5=["sum","average","min","max","variance","standardDeviation","median"];function Y5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function X5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function K5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&Y5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,X5(a,"xAxis"),t.x)),c=ZE(t.x)?J5(t.x,n)+r.x:Q5(h.getXAxisHelper(),[t.x])+r.x,c}function $5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&Y5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(a,"yAxis"),t.y)),c=ZE(t.y)?J5(t.y,n)+r.y:Q5(h.getYAxisHelper(),[t.y])+r.y,c}function q5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&Y5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"angleAxis"),t.angle)),Q5(o.angleAxisHelper,[t.angle])}function Z5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&Y5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(n,"radiusAxis"),t.radius)),Q5(o.radiusAxisHelper,[t.radius])}function J5(t,e){return Number(t.substring(0,t.length-1))*e/100}function Q5(t,e){const i=t.getScale(0);return Ow(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function t3(t){return G5.includes(t)}function e3(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=K5(t,_,n,g,d,l,a),r=$5(t,b,n,g,u,l,a),i3(s,x,A,f.length),i3(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=K5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);i3(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=$5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);i3(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function i3(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=q5(t,h,n,a,r),i=Z5(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=q5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=Z5(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function n3(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function r3(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&Y5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,X5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&Y5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,X5(s,"yAxis"),d[0]))}(t,n3(t,e),i,n)})),a.forEach(((t,i)=>{const n=n3(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=ZE(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=ZE(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:Q5(n.getXAxisHelper(),p)+l.x+d,y:Q5(n.getYAxisHelper(),g)+l.y+u})})),r}function a3(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&Y5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,X5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&Y5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,X5(s,"radiusAxis"),p[0])),n.push({angle:Q5(h.angleAxisHelper,u),radius:Q5(h.radiusAxisHelper,p)})})),n}function o3(t,e,i){let{x:s,y:n}=t;return ZE(s)&&(s=J5(s,e)),ZE(n)&&(n=J5(n,i)),{x:s,y:n}}function l3(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=o3(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>o3(t,n,r)))}function h3(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 c3(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},PP(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},u3(PP(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=u3(PP(r),i,s)),t}return{visible:!1}}function d3(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function u3(t,e,i){return d(t)?t(e,i):t}function p3(t,e){return d(t)?t(e):t}function g3(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 f3(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function m3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=f3(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function v3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=f3(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function y3(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function _3(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&t3(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&t3(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&t3(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&t3(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>x3(i,t,e))):i.x=x3(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>x3(i,t,e))):i.y=x3(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>x3(i,t,e))):i.angle=x3(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>x3(i,t,e))):i.radius=x3(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=x3(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const b3={min:(t,e)=>yw(t[0].latestData,e.field),max:(t,e)=>_w(t[0].latestData,e.field),sum:function(t,e){return bw(t[0].latestData,e.field)},average:function(t,e){return xw(t[0].latestData,e.field)},variance:function(t,e){return Sw(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(Sw(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function x3(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 b3[i](e,{field:s})}return t}function S3(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}const A3=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},k3=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},C3=t=>{if(!t)return;A3(t).forEach((e=>{k3(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{k3(e,t)}))},T3=(t,e)=>{if(!t)return;const i=new Set(A3(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(C3),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},M3="__vchart_marker_coordinate__",w3=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],E3=["position","positions","coordinatesOffset","regionRelative"],B3=["offsetX","offsetY","confine"],P3=t=>Array.isArray(t)?t.map(P3):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,R3=t=>{if(Array.isArray(t))return t.map(R3);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=R3(e[t])})),e},O3=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&w3.forEach((t=>{i[t]=M3})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),E3.forEach((t=>{t in i&&(i[t]=M3)})),"label"in i&&(i.label=P3(i.label)),Object.keys(i).forEach((t=>{i[t]=R3(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),B3.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=M3)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},P3(t)),{text:"__vchart_marker_text__"}))}return i};class I3 extends EU{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&t3(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Fa;return e.registerParser("array",s),new za(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&T3(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}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._updateMarkerLayout()}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._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=ww(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=QE(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QE(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(O3(e,{normalizeDomainPosition:i}),O3(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(O3(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),O3(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerFilter",S3),this._releaseMarkerData();const i=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function L3(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=yw(t,e),r=_w(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class D3 extends I3{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}=m3(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:u3(PP(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{line:d3(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return d3(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return d3(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:u3(PP(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:u3(PP(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=h3([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=m3(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;YP(this._option.dataSet,"markerAggregation",_3),YP(this._option.dataSet,"markerRegression",L3),YP(this._option.dataSet,"markerFilter",S3);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new za(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()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}D3.specKey="markLine";const F3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),z3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},H3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:F3(!1),endSymbol:F3(!0),label:z3};class j3 extends D3{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new sX(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}=m3(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=e3(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=r3(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=l3(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(ZE(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.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));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=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}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_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}=m3(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 za(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}j3.type=r.markLine,j3.coordinateType="cartesian",j3.builtInTheme={markLine:H3};class N3 extends D3{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=m3(this._spec);return e||i?new aX(t):new sX(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}=m3(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=s3(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=a3(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=m3(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}}}N3.type=r.polarMarkLine,N3.coordinateType="polar",N3.builtInTheme={polarMarkLine:H3};class U3 extends EU{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=qE(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return HH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=QE(this._spec.width,a.width,null,a.width),l=QE(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new RX(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}}U3.type=r.title,U3.specKey=r.title,U3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class V3 extends I3{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=v3(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:u3(PP(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>c3(t,this._markerData,this._markAttributeContext))),state:{area:d3(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>d3(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return d3(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=h3([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=v3(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}V3.specKey="markArea";const W3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class G3 extends V3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new rX(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=v3(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=e3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=r3(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=l3(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=v3(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}}}G3.type=r.markArea,G3.coordinateType="cartesian",G3.builtInTheme={markArea:W3};class Y3 extends V3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=v3(this._spec);return i||e||s?new oX(t):new rX(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}=v3(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=s3(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());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=a3(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=v3(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}}}Y3.type=r.polarMarkArea,Y3.coordinateType="polar",Y3.builtInTheme={polarMarkArea:W3};const X3=t=>PP(Object.assign({},t)),K3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},PP(t.style))}),$3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=X3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=X3(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:{},PP(Object.assign({},_)));var _;const b=K3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=K3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=K3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=K3(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},q3=t=>"left"===t||"right"===t,Z3=t=>"top"===t||"bottom"===t,J3={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Q3 extends EU{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({},$3(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({},$3(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?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new KX(t):this._playerComponent=new ZX(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=q3(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=q3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(UX.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(UX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(UX.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(UX.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(UX.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(UX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=q3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Z3(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):q3(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))):Z3(this._orient)?this._maxSize():t.height}_computeDx(t){return q3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Z3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){var i,s;const n=null===(i=this._specs)||void 0===i?void 0:i[e];n&&(null===(s=this._option)||void 0===s?void 0:s.globalInstance)&&(this._option.globalInstance.updateFullData(n.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:n,index:e,specs:this._specs}}))}release(){var e,i,s,n;null===(i=null===(e=this._playerComponent)||void 0===e?void 0:e.pause)||void 0===i||i.call(e),null===(n=null===(s=this._option)||void 0===s?void 0:s.globalInstance)||void 0===n||n.off(t.ChartEvent.rendered,this.autoPlayCallback),super.release(),this._playerComponent=null,this._cacheAttrs=null,this._specs=[]}}Q3.builtInTheme={player:J3},Q3.specKey="player",Q3.type=r.player;class t4 extends EU{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,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=HE({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==tz.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}t4.type=r.label;class e4 extends rq{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}e4.type="text",e4.constructorType="label";const i4=()=>{aq(),vB.registerMark(e4.constructorType,e4)};class s4 extends wU{_initTheme(t,e){return{spec:t,theme:this._theme}}}class n4 extends t4{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=s4,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(FP.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(FP.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Tw(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=uB({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},x$(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[rP])):t=>t.filter((t=>t.data[nP]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?S$(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}n4.type=r.label,n4.specKey="label",n4.transformerConstructor=s4;class r4 extends t4{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[iP]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return uB({textStyle:{pickable:!0===this._spec.interactive},position:a4(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[rP]:t.data[nP]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>S$({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function a4(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}r4.type=r.totalLabel,r4.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},r4.specKey="totalLabel";class o4 extends I3{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=y3(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,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,O,I,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=u3(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=c3(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=u3(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=PP(u3(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=u3(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=u3(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:p3(D.offsetX,j),offsetY:p3(D.offsetY,j)},et),{style:u3(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:u3(z.style,this._markerData,this._markAttributeContext)},state:{line:d3(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:d3(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:d3(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:d3(it,this._markerData,this._markAttributeContext),textBackground:d3(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:d3(null!==(I=null===(O=this._spec.targetSymbol)||void 0===O?void 0:O.state)&&void 0!==I?I:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:PP(lt.style)}):{visible:!1};return new hX(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:PP(C.style)}):{visible:!1},w=c3(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=h3([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=p3(S.offsetX,A),f=p3(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:g3(y,s,A),offsetY:g3(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=y3(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}o4.specKey="markPoint";const l4={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class h4 extends o4{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=e3(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=r3(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=l3(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=y3(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}}}h4.type=r.markPoint,h4.coordinateType="cartesian",h4.builtInTheme={markPoint:l4};class c4 extends o4{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=s3(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}c4.type=r.polarMarkPoint,c4.coordinateType="polar",c4.builtInTheme={polarMarkPoint:l4};class d4 extends o4{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}])]}}}d4.type=r.geoMarkPoint,d4.coordinateType="geo",d4.builtInTheme={geoMarkPoint:l4};const u4="inBrush",p4="outOfBrush",g4={style:!0,inBrush:!0,outOfBrush:!0};class f4 extends EU{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return HH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),u4,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),p4,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||g4[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:PP(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new eK(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:PP(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener($X.brushActive,(s=>{this._initMarkBrushState(i,p4),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener($X.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener($X.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener($X.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener($X.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener($X.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},PP(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];Yz(t,[...s.filter((t=>t!==u4&&t!==p4)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,u4),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,p4),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,u4),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,p4),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;Kz(s,[u4,p4]),i&&Xz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}f4.type=r.brush,f4.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},f4.specKey="brush";const m4={style:!0,state:!0};class v4 extends EU{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${NB}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=gj({},fj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||m4[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_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 Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}v4.type=r.customMark,v4.specKey="customMark";class y4{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>_4(t))),a=n.filter((t=>!_4(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>_4(t))),h=o.filter((t=>!_4(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 _4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}y4.type="grid";const b4=t=>{t?function(t){if(!t)throw new Error("installPoptipToApp requires an app instance");WA(t),MG(NA()),UA(),GA(t)}(t):(MG(m_()),MG(NA()),UA())},x4="vchart-tooltip",S4=`${x4}-container`,A4=`${x4}-title`,k4=`${x4}-content-box`,C4={offsetX:10,offsetY:10},T4="99999999999999";function M4(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const w4=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,E4=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?M4(t):"",B4=(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},P4={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},R4=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=P4[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class O4 extends sU{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=VH(null==T?void 0:T.position,b,e),w=null!==(r=VH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:UB,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:VB;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=_M(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=w4(e,F),N=w4(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(R4(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=B4(t,y),W.top=B4(i,y),W.right=B4(e,y),W.bottom=B4(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=B4(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?O:I,n="x"===t?A:C,r=R4(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",L4=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=I4(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=I4(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},D4=(t={})=>{const{lineHeight:e}=t;return t.fontSize?QE(e,t.fontSize):0},F4=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=I4(o)),{panelStyle:a,panelPadding:o}};function z4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const H4=t=>!!t&&1===t.nodeType&&"function"==typeof t.appendChild&&!!t.children;class j4 extends O4{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(j4.type),this.type=GW.dom,this._tooltipContainer=null==yM?void 0:yM.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}_getTooltipParentElement(t){return H4(t.parentElement)?t.parentElement:H4(this._chartContainer)?this._chartContainer:H4(null==yM?void 0:yM.body)?yM.body:void 0}initEl(){const t=this._component.getSpec(),e=this._getTooltipParentElement(t);if(yM&&e){for(let t=0;t{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=F4(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:I4(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=L4(h),x=L4(d),S=L4(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=I4(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=I4(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=I4(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(D4(p),D4(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(A4))),l=a.find((t=>t.className.includes(k4)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(A4),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(z4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${x4}-column`),e.classList.add(`${x4}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(k4),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];z4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));z4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${x4}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=E4(e.key),e.keyStyle&&L4(e.keyStyle,l)):"value"===i?(o.innerHTML=E4(e.value),e.valueStyle&&L4(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?M4(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?M4(c):m,_=p,b=t=>new Wg({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=su.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?M4(u):"currentColor",`\n \n \n \n `;const M=T?su.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),z4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(k4))),h=[...o.children].find((t=>t.className.includes(A4)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(A4)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=QE(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,z4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=fv({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function V4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:N4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const W4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class G4 extends O4{constructor(){super(G4.type),this.type=GW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new aK({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=iB(d.padding),x=V4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=V4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=V4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:W4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.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:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=uB({},S,V4(b,void 0,{})),{width:s,height:n,text:r}=U4(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=uB({},A,V4(x,void 0,{})),{width:e,height:s,text:n}=U4(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};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=uB({},x,V4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=U4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}G4.type=GW.canvas;const Y4=/\{([^}]+)\}/,X4=/\{([^}]+)\}/g,K4=/:/;class $4 extends sU{constructor(){super($4.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.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[$4.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)),vB.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=Y4.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(X4,((t,i)=>{if(!K4.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 this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}$4.pluginType="chart",$4.specKey="formatter",$4.type="formatterPlugin";RH.useRegisters([()=>{qW(),JW(),tG(),MW(),TW(),lW(),QV(),UN(),WN(),yH(),fH(),OV(),$V(),vB.registerSeries(hW.type,hW),vB.registerChart(eG.type,eG)},()=>{qW(),JW(),tG(),TW(),lW(),QV(),UN(),nG(),WN(),oG(),OV(),$V(),vB.registerSeries(cK.type,cK),MW(),vB.registerChart(uK.type,uK)},()=>{qW(),JW(),tG(),TW(),MK(),MW(),vB.registerChart(EK.type,EK)},()=>{qW(),JW(),MW(),TW(),jK(),vB.registerChart(UK.type,UK)},()=>{JW(),Nq(),vB.registerChart(X1.type,X1)},()=>{qW(),JW(),MW(),TW(),aZ(),vB.registerChart(q1.type,q1)},()=>{qW(),JW(),tG(),MW(),TW(),fZ(),vB.registerChart(J1.type,J1)},()=>{qW(),JW(),tG(),MW(),TW(),MK(),vB.registerTransform("bin",Qr),vB.registerChart(n2.type,n2)},()=>{JW(),i$(),XK(),vB.registerSeries(n$.type,n$),vB.registerImplement("registerMap",ZP),vB.registerImplement("unregisterMap",JP),mH(),vB.registerChart(N1.type,N1)},()=>{JW(),i1(),vB.registerSeries(n1.type,n1),Oq(),OZ(),iZ(),FZ(),vB.registerChart(l2.type,l2)},()=>{JW(),MQ(),vB.registerChart(d2.type,d2)},()=>{JW(),KQ(),vB.registerChart(p2.type,p2)},()=>{qW(),JW(),tG(),MW(),TW(),I$(),vB.registerChart(C2.type,C2)},()=>{qW(),JW(),MW(),TW(),nq(),vB.registerTransform("boxplot",ta),vB.registerChart(M2.type,M2)},()=>{qW(),JW(),MW(),TW(),FZ(),vB.registerChart(a2.type,a2)},()=>{qW(),JW(),MW(),TW(),YZ(),vB.registerChart(f2.type,f2)},()=>{qW(),JW(),MW(),TW(),fq(),vB.registerChart(v2.type,v2)},()=>{qW(),JW(),tG(),MW(),TW(),nG(),OV(),$V(),vB.registerSeries(bq.type,bq),vB.registerChart(P2.type,P2)},()=>{JW(),u0(),vB.registerChart(_2.type,_2)},()=>{JW(),y0(),vB.registerChart(x2.type,x2)},()=>{JW(),Y0(),vB.registerChart(A2.type,A2)},()=>{JW(),gG(),z0(),vB.registerChart(E2.type,E2)},()=>{JW(),u1(),vB.registerChart(O2.type,O2)},()=>{JW(),M1(),vB.registerChart(L2.type,L2)},()=>{qW(),JW(),tG(),MW(),vB.registerChart(t2.type,t2),TW()},$V,OV,()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(oK.type,oK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(lK.type,lK)},()=>{vB.registerGraphicComponent(BU.lineAxis,((t,e)=>new MV(t,e))),vB.registerGraphicComponent(PU.lineAxisGrid,((t,e)=>new iV(t,e))),jU(),vB.registerComponent(hK.type,hK)},nZ,iZ,()=>{vB.registerComponent(U2.type,U2)},()=>{vB.registerComponent(t5.type,t5)},()=>{vB.registerComponent(d5.type,d5)},()=>{vB.registerComponent(b5.type,b5)},()=>{vB.registerComponent(x5.type,x5)},()=>{vB.registerComponent(F5.type,F5)},()=>{vB.registerComponent(j5.type,j5)},()=>{vB.registerComponent(W5.type,W5)},i$,()=>{vB.registerComponent(j3.type,j3),iX()},()=>{vB.registerComponent(G3.type,G3),nX()},()=>{vB.registerComponent(h4.type,h4),lX()},()=>{vB.registerComponent(N3.type,N3),aX._animate=FY,iX()},()=>{vB.registerComponent(Y3.type,Y3),oX._animate=HY,nX()},()=>{vB.registerComponent(c4.type,c4),lX()},()=>{vB.registerComponent(d4.type,d4),lX()},()=>{vB.registerComponent(U3.type,U3)},()=>{vB.registerComponent(Q3.type,Q3)},()=>{vB.registerGraphicComponent(n4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(n4.type,n4,!0,1/0)},()=>{vB.registerGraphicComponent(r4.type,(t=>new $G(t))),i4(),OU(),vB.registerComponent(r4.type,r4,!0)},()=>{vB.registerComponent(f4.type,f4)},()=>{vB.registerComponent(v4.type,v4)},()=>{vB.registerRuntimePluginInstaller("poptipForText",b4),b4()},()=>{vB.registerLayout(y4.type,y4)},()=>{var t;t=G4,vB.registerComponentPlugin(t.type,t)},()=>{var t;t=$4,vB.registerChartPlugin(t.type,t)},kH,MH]),RH.useRegisters([()=>{BO(iA)}]),t.DEFAULT_CHART_HEIGHT=VB,t.DEFAULT_CHART_WIDTH=UB,t.DEFAULT_CLOSE_STROKE_JOIN=LH,t.DEFAULT_DATA_INDEX=GB,t.DEFAULT_DATA_KEY=YB,t.DEFAULT_DATA_SERIES_FIELD=XB,t.DEFAULT_KEY=uP,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=IH,t.DEFAULT_MAP_LOOK_UP_KEY=pP,t.DEFAULT_MEASURE_CANVAS_ID=WB,t.DEFAULT_SERIES_STYLE_NAME=KB,t.DEFAULT_SMOOTH_INTERPOLATE=OH,t.Factory=vB,t.MOSAIC_CAT_END_PERCENT=hP,t.MOSAIC_CAT_START_PERCENT=lP,t.MOSAIC_VALUE_END_PERCENT=oP,t.MOSAIC_VALUE_START_PERCENT=aP,t.ManualTicker=class extends pb{constructor(t){super(t),this.lastFrameTime=0,this.status=wl.RUNNING}setupTickHandler(){const t=new DH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,!0}},t.PREFIX=NB,t.SEGMENT_FIELD_END=dP,t.SEGMENT_FIELD_START=cP,t.STACK_FIELD_END=ZB,t.STACK_FIELD_END_OffsetSilhouette=eP,t.STACK_FIELD_END_PERCENT=QB,t.STACK_FIELD_KEY=$B,t.STACK_FIELD_START=qB,t.STACK_FIELD_START_OffsetSilhouette=tP,t.STACK_FIELD_START_PERCENT=JB,t.STACK_FIELD_TOTAL=iP,t.STACK_FIELD_TOTAL_BOTTOM=rP,t.STACK_FIELD_TOTAL_PERCENT=sP,t.STACK_FIELD_TOTAL_TOP=nP,t.StreamLight=eF,t.ThemeManager=OB,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=RH,t.boundsInRect=eB,t.builtinThemes=SB,t.calcLayoutNumber=QE,t.calcPadding=tB,t.computeActualDataScheme=FE,t.convertPoint=sB,t.createArc=Vp,t.createArea=Yp,t.createGroup=tg,t.createLine=ag,t.createRect=mg,t.createRichText=jg,t.createSymbol=Gg,t.createText=Jg,t.darkTheme=cB,t.dataScheme=rB,t.default=RH,t.defaultThemeName=AB,t.getActualColor=HE,t.getActualNumValue=nB,t.getColorSchemeBySeries=VE,t.getDataScheme=DE,t.getFunnelTheme=bB,t.getMergedTheme=PB,t.getSpecInfo=HH,t.getTheme=wB,t.hasThemeMerged=TB,t.isColorKey=jE,t.isPercent=ZE,t.isPercentOffset=JE,t.isProgressiveDataColorScheme=NE,t.isTokenKey=oB,t.isValidOrient=qE,t.lightTheme=hB,t.lookup=jH,t.measureText=jB,t.normalizeLayoutPaddingSpec=iB,t.queryColorFromColorScheme=zE,t.queryToken=aB,t.registerDataSetInstanceParser=XP,t.registerDataSetInstanceTransform=YP,t.registerTheme=MB,t.removeTheme=EB,t.themeExist=BB,t.themes=kB,t.token=lB,t.transformColorSchemeToStandardStruct=UE,t.transformToGraphic=PP,t.version="2.1.4",t.vglobal=b_,t.warn=gM,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart-extension/package.json b/packages/vchart-extension/package.json index e0b36907d0..7c45abdd7b 100644 --- a/packages/vchart-extension/package.json +++ b/packages/vchart-extension/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-extension", - "version": "2.1.3", + "version": "2.1.4", "description": "vchart extension package, including extension plugins and components", "sideEffects": false, "main": "cjs/index.js", @@ -30,7 +30,7 @@ "@visactor/vrender-kits": "~1.1.4", "@visactor/vrender-components": "~1.1.4", "@visactor/vrender-animate": "~1.1.4", - "@visactor/vchart": "workspace:2.1.3", + "@visactor/vchart": "workspace:2.1.4", "@visactor/vutils": "~1.0.23", "@visactor/vdataset": "~1.0.23", "@visactor/vlayouts": "~1.0.23" diff --git a/packages/vchart-schema/package.json b/packages/vchart-schema/package.json index 07e24961a2..11d8574916 100644 --- a/packages/vchart-schema/package.json +++ b/packages/vchart-schema/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-schema", - "version": "2.1.3", + "version": "2.1.4", "description": "The VChart JSON schema file.", "sideEffects": false, "main": "vchart.json", diff --git a/packages/vchart-schema/vchart.json b/packages/vchart-schema/vchart.json index fbf8ca07c1..0176b323da 100644 --- a/packages/vchart-schema/vchart.json +++ b/packages/vchart-schema/vchart.json @@ -21227,363 +21227,6 @@ ], "type": "object" }, - "IAreaMarkSpec": { - "properties": { - "alpha": { - "description": "x方向的旋转角度", - "type": "number" - }, - "anchor": { - "description": "基于AABB的锚点位置,用于简单的定位某些path的位置", - "items": [ - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "anchor3d": { - "description": "3d的锚点位置", - "items": [ - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "angle": { - "description": "图形的旋转角度", - "type": "number" - }, - "background": { - "anyOf": [ - { - "$ref": "#/definitions/HTMLCanvasElement" - }, - { - "$ref": "#/definitions/HTMLImageElement" - }, - { - "$ref": "#/definitions/ILinearGradient" - }, - { - "$ref": "#/definitions/IRadialGradient" - }, - { - "$ref": "#/definitions/IConicalGradient" - }, - { - "type": "string" - } - ], - "description": "图形的背景色,支持纯色、image元素、canvas元素" - }, - "backgroundClip": { - "description": "背景图是否裁切,是否调用clip避免绘制到图元外部", - "type": "boolean" - }, - "backgroundCornerRadius": { - "anyOf": [ - { - "items": { - "type": "number" - }, - "type": "array" - }, - { - "type": "number" - } - ], - "description": "背景圆角半径" - }, - "backgroundFit": { - "description": "是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效", - "type": "boolean" - }, - "backgroundKeepAspectRatio": { - "description": "是否保持背景图的宽高比", - "type": "boolean" - }, - "backgroundMode": { - "$ref": "#/definitions/BackgroundMode_1", - "description": "背景图绘制模式(与具体图元有关)。\n原有平铺模式为:`repeat` / `repeat-x` / `repeat-y` / `no-repeat`;\n自 `2.0.21` 版本开始,支持 `no-repeat-cover` / `no-repeat-contain` /\n`no-repeat-fill` / `no-repeat-auto` 这几个 `no-repeat` 下的尺寸简写。" - }, - "backgroundOffsetX": { - "description": "背景图偏移,只在no-repeat的时候生效", - "type": "number" - }, - "backgroundOffsetY": { - "description": "背景图偏移,只在no-repeat的时候生效", - "type": "number" - }, - "backgroundOpacity": { - "description": "背景透明度", - "type": "number" - }, - "backgroundPosition": { - "$ref": "#/definitions/BackgroundPosition_1", - "description": "背景图锚定位置,语义类似 CSS `background-position`。\n仅在图片背景且最终为 `no-repeat` 时生效。", - "since": "2.0.21" - }, - "backgroundScale": { - "description": "背景图缩放,只在no-repeat的时候生效", - "type": "number" - }, - "beta": { - "description": "y方向的旋转角度", - "type": "number" - }, - "boundsMode": { - "description": "bounds的计算模式", - "enum": [ - "accurate", - "imprecise" - ], - "type": "string" - }, - "cursor": { - "$ref": "#/definitions/Cursor_1", - "description": "设置图形的鼠标样式" - }, - "curveType": { - "$ref": "#/definitions/InterpolateType", - "description": "取消的差值类型,默认为线性插值,也就是普通的折线" - }, - "defined": { - "description": "设置点是否有效,也就是是否合法", - "type": "boolean" - }, - "fill": { - "anyOf": [ - { - "$ref": "#/definitions/IColorKey" - }, - { - "$ref": "#/definitions/IGradientLinear" - }, - { - "$ref": "#/definitions/IGradientRadial" - }, - { - "$ref": "#/definitions/IGradientConical" - }, - { - "$ref": "#/definitions/IVisualScale" - }, - { - "typeof": "function" - }, - { - "$ref": "#/definitions/IVisualSpecStyle" - }, - { - "const": false, - "type": "boolean" - }, - { - "type": "string" - } - ], - "description": "图形的填充颜色" - }, - "fillOpacity": { - "description": "填充的透明度", - "type": "number" - }, - "html": { - "$ref": "#/definitions/Partial<{dom:string|HTMLElement;}&SimpleDomStyleOptions&CommonDomOptions>", - "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", - "since": "1.10.0" - }, - "innerBorder": { - "$ref": "#/definitions/IBorder", - "description": "内边框,内描边,描边位于图形内侧" - }, - "lineDash": { - "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度", - "items": { - "type": "number" - }, - "type": "array" - }, - "lineDashOffset": { - "description": "设置虚线偏移量的属性", - "type": "number" - }, - "lineWidth": { - "description": "图形的描边宽度", - "type": "number" - }, - "opacity": { - "description": "图形的透明度,既影响描边也影响填充", - "type": "number" - }, - "orient": { - "description": "面积图元的方向,\nhorizontal - 水平方向\nvertical - 垂直方向", - "enum": [ - "horizontal", - "vertical" - ], - "type": "string" - }, - "outerBorder": { - "$ref": "#/definitions/IBorder", - "description": "外边框,外描边,描边位于图形外侧" - }, - "pickMode": { - "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式", - "enum": [ - "accurate", - "custom", - "imprecise" - ], - "type": "string" - }, - "pickStrokeBuffer": { - "default": 0, - "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", - "since": "1.7.3", - "type": "number" - }, - "scaleCenter": { - "description": "图形缩放中心", - "items": [ - { - "type": [ - "string", - "number" - ] - }, - { - "type": [ - "string", - "number" - ] - } - ], - "maxItems": 2, - "minItems": 2, - "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心", - "type": "array" - }, - "scaleX": { - "description": "x方向的缩放比例,默认为1,即不进行缩放", - "type": "number" - }, - "scaleY": { - "description": "y方向的缩放比例,默认为1,即不进行缩放", - "type": "number" - }, - "shadowBlur": { - "description": "图形模糊效果程度", - "type": "number" - }, - "shadowColor": { - "description": "图形的阴影颜色", - "type": "string" - }, - "shadowOffsetX": { - "description": "阴影水平偏移距离", - "type": "number" - }, - "shadowOffsetY": { - "description": "阴影垂直偏移距离", - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/IColorKey" - }, - { - "$ref": "#/definitions/IGradientLinear" - }, - { - "$ref": "#/definitions/IGradientRadial" - }, - { - "$ref": "#/definitions/IGradientConical" - }, - { - "items": { - "type": [ - "number", - "boolean" - ] - }, - "type": "array" - }, - { - "const": false, - "type": "boolean" - }, - { - "type": "string" - } - ], - "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" - }, - "strokeOpacity": { - "description": "描边透明度", - "type": "number" - }, - "texture": { - "description": "纹理的类型", - "type": "string" - }, - "textureColor": { - "description": "纹理的颜色", - "type": "string" - }, - "texturePadding": { - "description": "纹理之间空隙的大小", - "type": "number" - }, - "textureSize": { - "description": "纹理单元的大小", - "type": "number" - }, - "visible": { - "description": "图形是否可见", - "type": "boolean" - }, - "x": { - "description": "图形的x坐标", - "type": "number" - }, - "x1": { - "description": "面积的x1值", - "type": "number" - }, - "y": { - "description": "图形的y坐标", - "type": "number" - }, - "y1": { - "description": "面积的y1值", - "type": "number" - }, - "z": { - "description": "图形的z坐标,仅适用于3D图表", - "type": "number" - }, - "zIndex": { - "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染", - "type": "number" - } - }, - "type": "object" - }, "IAreaSegment": { "properties": { "background": { @@ -25275,317 +24918,6 @@ ], "type": "object" }, - "IBoxPlotMarkSpec": { - "properties": { - "alpha": { - "description": "x方向的旋转角度", - "type": "number" - }, - "anchor": { - "description": "基于AABB的锚点位置,用于简单的定位某些path的位置", - "items": [ - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "anchor3d": { - "description": "3d的锚点位置", - "items": [ - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "angle": { - "description": "图形的旋转角度", - "type": "number" - }, - "beta": { - "description": "y方向的旋转角度", - "type": "number" - }, - "boundsMode": { - "description": "bounds的计算模式", - "enum": [ - "accurate", - "imprecise" - ], - "type": "string" - }, - "boxCornerRadius": { - "description": "箱体的圆角半径\n在 shaftShape = 'line' / 'filled-line' 模式下,控制 box 子图元的 cornerRadius 属性", - "since": "2.0.11", - "type": "number" - }, - "boxHeight": { - "description": "箱体的高度(垂直箱线图)或宽度(水平箱线图)\n在 shaftShape = 'line' / 'filled-line' 模式下使用", - "type": [ - "string", - "number" - ] - }, - "boxStroke": { - "description": "箱体的描边颜色\n在 shaftShape = 'line' / 'filled-line' 模式下,控制 box 子图元的 stroke 属性", - "since": "2.0.11", - "type": "string" - }, - "boxWidth": { - "default": 30, - "description": "箱体的宽度(垂直箱线图)或高度(水平箱线图)\n在 shaftShape = 'line' / 'filled-line' 模式下,控制 box 子图元的尺寸\n支持像素值或百分比字符串(相对于分组宽度)", - "type": [ - "string", - "number" - ] - }, - "cursor": { - "$ref": "#/definitions/Cursor_1", - "description": "设置图形的鼠标样式" - }, - "html": { - "$ref": "#/definitions/Partial<{dom:string|HTMLElement;}&SimpleDomStyleOptions&CommonDomOptions>", - "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", - "since": "1.10.0" - }, - "innerBorder": { - "$ref": "#/definitions/IBorder", - "description": "内边框,内描边,描边位于图形内侧" - }, - "lineDash": { - "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度", - "items": { - "type": "number" - }, - "type": "array" - }, - "lineDashOffset": { - "description": "设置虚线偏移量的属性", - "type": "number" - }, - "lineWidth": { - "default": 2, - "description": "箱线图的描边宽度\n在 shaftShape = 'line' / 'filled-line' 模式下影响所有线条的宽度\n在 shaftShape = 'bar' 模式下,minMaxBox 和 q1q3Box 的 lineWidth 会被强制设为 0", - "type": "number" - }, - "max": { - "typeof": "function" - }, - "median": { - "typeof": "function" - }, - "medianStroke": { - "description": "中位数线的描边颜色\n在 shaftShape = 'line' / 'filled-line' 模式下,控制 median 子图元的 stroke 属性", - "since": "2.0.11", - "type": "string" - }, - "min": { - "typeof": "function" - }, - "minMaxFillOpacity": { - "description": "最小-最大值矩形的填充透明度\n仅在 shaftShape = 'bar' 模式下生效,控制 minMaxBox 子图元的 fillOpacity", - "type": "number" - }, - "minMaxHeight": { - "description": "最小-最大值矩形的高度(垂直箱线图)或宽度(水平箱线图)\n在 shaftShape = 'bar' 模式下使用", - "type": [ - "string", - "number" - ] - }, - "minMaxWidth": { - "description": "最小-最大值矩形的宽度(垂直箱线图)或高度(水平箱线图)\n在 shaftShape = 'bar' 模式下,控制 minMaxBox 子图元的尺寸", - "type": [ - "string", - "number" - ] - }, - "opacity": { - "description": "图形的透明度,既影响描边也影响填充", - "type": "number" - }, - "outerBorder": { - "$ref": "#/definitions/IBorder", - "description": "外边框,外描边,描边位于图形外侧" - }, - "pickMode": { - "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式", - "enum": [ - "accurate", - "custom", - "imprecise" - ], - "type": "string" - }, - "pickStrokeBuffer": { - "default": 0, - "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", - "since": "1.7.3", - "type": "number" - }, - "q1": { - "typeof": "function" - }, - "q1q3Height": { - "description": "Q1-Q3 四分位数矩形的高度(垂直箱线图)或宽度(水平箱线图)\n在 shaftShape = 'bar' 模式下使用", - "type": [ - "string", - "number" - ] - }, - "q1q3Width": { - "description": "Q1-Q3 四分位数矩形的宽度(垂直箱线图)或高度(水平箱线图)\n在 shaftShape = 'bar' 模式下,控制 q1q3Box 子图元的尺寸", - "type": [ - "string", - "number" - ] - }, - "q3": { - "typeof": "function" - }, - "ruleHeight": { - "description": "最大/最小值须线端点的高度(垂直箱线图)或宽度(水平箱线图)\n在 shaftShape = 'line' / 'filled-line' 模式下使用", - "type": [ - "string", - "number" - ] - }, - "ruleWidth": { - "description": "最大/最小值须线端点的宽度(垂直箱线图)或高度(水平箱线图)\n在 shaftShape = 'line' / 'filled-line' 模式下使用", - "type": [ - "string", - "number" - ] - }, - "scaleCenter": { - "description": "图形缩放中心", - "items": [ - { - "type": [ - "string", - "number" - ] - }, - { - "type": [ - "string", - "number" - ] - } - ], - "maxItems": 2, - "minItems": 2, - "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心", - "type": "array" - }, - "scaleX": { - "description": "x方向的缩放比例,默认为1,即不进行缩放", - "type": "number" - }, - "scaleY": { - "description": "y方向的缩放比例,默认为1,即不进行缩放", - "type": "number" - }, - "shaftShape": { - "$ref": "#/definitions/BoxPlotShaftShape", - "default": "'line'", - "description": "中轴线(须线)的绘制形状\n- 'line': 标准线条形式,绘制 shaft(连接线)、box(箱体)、max/min/median(线条)五个子图元\n- 'bar': 柱状形式,绘制 minMaxBox(最小-最大值矩形)、q1q3Box(Q1-Q3矩形)、median(中位数线)三个子图元\n- 'filled-line': 填充线条形式" - }, - "shaftWidth": { - "default": 20, - "description": "最大/最小值须线的宽度(垂直箱线图)或高度(水平箱线图)\n在 shaftShape = 'line' / 'filled-line' 模式下,控制 max/min 子图元的线条长度\n支持像素值或百分比字符串", - "type": [ - "string", - "number" - ] - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/IColorKey" - }, - { - "$ref": "#/definitions/IGradientLinear" - }, - { - "$ref": "#/definitions/IGradientRadial" - }, - { - "$ref": "#/definitions/IGradientConical" - }, - { - "items": { - "type": [ - "number", - "boolean" - ] - }, - "type": "array" - }, - { - "const": false, - "type": "boolean" - }, - { - "type": "string" - } - ], - "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" - }, - "strokeOpacity": { - "description": "描边透明度", - "type": "number" - }, - "texture": { - "description": "纹理的类型", - "type": "string" - }, - "textureColor": { - "description": "纹理的颜色", - "type": "string" - }, - "texturePadding": { - "description": "纹理之间空隙的大小", - "type": "number" - }, - "textureSize": { - "description": "纹理单元的大小", - "type": "number" - }, - "visible": { - "description": "图形是否可见", - "type": "boolean" - }, - "x": { - "description": "图形的x坐标", - "type": "number" - }, - "y": { - "description": "图形的y坐标", - "type": "number" - }, - "z": { - "description": "图形的z坐标,仅适用于3D图表", - "type": "number" - }, - "zIndex": { - "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染", - "type": "number" - } - }, - "type": "object" - }, "IBoxPlotSeriesSpec": { "properties": { "animation": { @@ -37320,6 +36652,9 @@ }, "IFunnelSeriesTheme": { "properties": { + "conversionArrow": { + "typeof": "function" + }, "funnel": { "$ref": "#/definitions/Partial>" }, @@ -50826,216 +50161,6 @@ ], "type": "object" }, - "ILiquidMarkSpec": { - "properties": { - "alpha": { - "description": "x方向的旋转角度", - "type": "number" - }, - "anchor": { - "description": "基于AABB的锚点位置,用于简单的定位某些path的位置", - "items": [ - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "anchor3d": { - "description": "3d的锚点位置", - "items": [ - { - "type": "number" - }, - { - "type": "number" - } - ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "angle": { - "description": "图形的旋转角度", - "type": "number" - }, - "beta": { - "description": "y方向的旋转角度", - "type": "number" - }, - "boundsMode": { - "description": "bounds的计算模式", - "enum": [ - "accurate", - "imprecise" - ], - "type": "string" - }, - "cursor": { - "$ref": "#/definitions/Cursor_1", - "description": "设置图形的鼠标样式" - }, - "html": { - "$ref": "#/definitions/Partial<{dom:string|HTMLElement;}&SimpleDomStyleOptions&CommonDomOptions>", - "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", - "since": "1.10.0" - }, - "innerBorder": { - "$ref": "#/definitions/IBorder", - "description": "内边框,内描边,描边位于图形内侧" - }, - "lineDash": { - "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度", - "items": { - "type": "number" - }, - "type": "array" - }, - "lineDashOffset": { - "description": "设置虚线偏移量的属性", - "type": "number" - }, - "lineWidth": { - "description": "图形的描边宽度", - "type": "number" - }, - "opacity": { - "description": "图形的透明度,既影响描边也影响填充", - "type": "number" - }, - "outerBorder": { - "$ref": "#/definitions/IBorder", - "description": "外边框,外描边,描边位于图形外侧" - }, - "pickMode": { - "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式", - "enum": [ - "accurate", - "custom", - "imprecise" - ], - "type": "string" - }, - "pickStrokeBuffer": { - "default": 0, - "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", - "since": "1.7.3", - "type": "number" - }, - "scaleCenter": { - "description": "图形缩放中心", - "items": [ - { - "type": [ - "string", - "number" - ] - }, - { - "type": [ - "string", - "number" - ] - } - ], - "maxItems": 2, - "minItems": 2, - "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心", - "type": "array" - }, - "scaleX": { - "description": "x方向的缩放比例,默认为1,即不进行缩放", - "type": "number" - }, - "scaleY": { - "description": "y方向的缩放比例,默认为1,即不进行缩放", - "type": "number" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/IColorKey" - }, - { - "$ref": "#/definitions/IGradientLinear" - }, - { - "$ref": "#/definitions/IGradientRadial" - }, - { - "$ref": "#/definitions/IGradientConical" - }, - { - "items": { - "type": [ - "number", - "boolean" - ] - }, - "type": "array" - }, - { - "const": false, - "type": "boolean" - }, - { - "type": "string" - } - ], - "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" - }, - "strokeOpacity": { - "description": "描边透明度", - "type": "number" - }, - "texture": { - "description": "纹理的类型", - "type": "string" - }, - "textureColor": { - "description": "纹理的颜色", - "type": "string" - }, - "texturePadding": { - "description": "纹理之间空隙的大小", - "type": "number" - }, - "textureSize": { - "description": "纹理单元的大小", - "type": "number" - }, - "visible": { - "description": "图形是否可见", - "type": "boolean" - }, - "wave": { - "description": "波浪的变化状态,范围为 [0, 1]", - "type": "number" - }, - "x": { - "description": "图形的x坐标", - "type": "number" - }, - "y": { - "description": "图形的y坐标", - "type": "number" - }, - "z": { - "description": "图形的z坐标,仅适用于3D图表", - "type": "number" - }, - "zIndex": { - "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染", - "type": "number" - } - }, - "type": "object" - }, "ILiquidPaddingSpec": { "anyOf": [ { @@ -55269,215 +54394,215 @@ ], "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { - "$ref": "#/definitions/IArcMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { - "$ref": "#/definitions/IArcMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { - "$ref": "#/definitions/IArcMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { - "$ref": "#/definitions/IArcMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { - "$ref": "#/definitions/IArcMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { - "$ref": "#/definitions/IAreaMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { - "$ref": "#/definitions/IAreaMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { - "$ref": "#/definitions/IAreaMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { - "$ref": "#/definitions/IAreaMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { - "$ref": "#/definitions/IAreaMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { - "$ref": "#/definitions/IBoxPlotMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { - "$ref": "#/definitions/IBoxPlotMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { - "$ref": "#/definitions/IBoxPlotMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { - "$ref": "#/definitions/IBoxPlotMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { - "$ref": "#/definitions/IBoxPlotMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { - "$ref": "#/definitions/ILineMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { - "$ref": "#/definitions/ILineMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { - "$ref": "#/definitions/ILineMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { - "$ref": "#/definitions/ILineMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { - "$ref": "#/definitions/ILineMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { - "$ref": "#/definitions/ILiquidMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { - "$ref": "#/definitions/ILiquidMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { - "$ref": "#/definitions/ILiquidMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { - "$ref": "#/definitions/ILiquidMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { - "$ref": "#/definitions/ILiquidMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { - "$ref": "#/definitions/IPathMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { - "$ref": "#/definitions/IPathMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { - "$ref": "#/definitions/IPathMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { - "$ref": "#/definitions/IPathMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { - "$ref": "#/definitions/IPathMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { - "$ref": "#/definitions/IPolygonMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { - "$ref": "#/definitions/IPolygonMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { - "$ref": "#/definitions/IPolygonMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { - "$ref": "#/definitions/IPolygonMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { - "$ref": "#/definitions/IPolygonMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { - "$ref": "#/definitions/IRectMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { - "$ref": "#/definitions/IRectMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { - "$ref": "#/definitions/IRectMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { - "$ref": "#/definitions/IRectMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { - "$ref": "#/definitions/IRectMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>|Partial>>": { "properties": { "hover": { "anyOf": [ { - "$ref": "#/definitions/IRectMarkSpec" + "$ref": "#/definitions/Partial>" }, { - "$ref": "#/definitions/IPathMarkSpec" + "$ref": "#/definitions/Partial>" } ], "description": "图元在 hover 状态下的主题样式设置" @@ -55485,10 +54610,10 @@ "hover_reverse": { "anyOf": [ { - "$ref": "#/definitions/IRectMarkSpec" + "$ref": "#/definitions/Partial>" }, { - "$ref": "#/definitions/IPathMarkSpec" + "$ref": "#/definitions/Partial>" } ], "description": "图元在 未被hover 状态下的主题样式设置" @@ -55496,10 +54621,10 @@ "normal": { "anyOf": [ { - "$ref": "#/definitions/IRectMarkSpec" + "$ref": "#/definitions/Partial>" }, { - "$ref": "#/definitions/IPathMarkSpec" + "$ref": "#/definitions/Partial>" } ], "description": "图元在正常状态下的主题样式设置" @@ -55507,10 +54632,10 @@ "selected": { "anyOf": [ { - "$ref": "#/definitions/IRectMarkSpec" + "$ref": "#/definitions/Partial>" }, { - "$ref": "#/definitions/IPathMarkSpec" + "$ref": "#/definitions/Partial>" } ], "description": "图元在 选中状态下的主题样式设置" @@ -55518,10 +54643,10 @@ "selected_reverse": { "anyOf": [ { - "$ref": "#/definitions/IRectMarkSpec" + "$ref": "#/definitions/Partial>" }, { - "$ref": "#/definitions/IPathMarkSpec" + "$ref": "#/definitions/Partial>" } ], "description": "图元在 未被选中 状态下的主题样式设置" @@ -55529,82 +54654,82 @@ }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { - "$ref": "#/definitions/IRuleMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { - "$ref": "#/definitions/IRuleMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { - "$ref": "#/definitions/IRuleMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { - "$ref": "#/definitions/IRuleMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { - "$ref": "#/definitions/IRuleMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { - "$ref": "#/definitions/ISymbolMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { - "$ref": "#/definitions/ISymbolMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { - "$ref": "#/definitions/ISymbolMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { - "$ref": "#/definitions/ISymbolMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { - "$ref": "#/definitions/ISymbolMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { - "$ref": "#/definitions/ITextMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { - "$ref": "#/definitions/ITextMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { - "$ref": "#/definitions/ITextMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { - "$ref": "#/definitions/ITextMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { - "$ref": "#/definitions/ITextMarkSpec", + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, "type": "object" }, - "IMarkStateTheme>": { + "IMarkStateTheme>>>": { "properties": { "hover": { "additionalProperties": false, @@ -55649,21 +54774,26 @@ }, "type": "object" }, - "IMarkStateTheme": { + "IMarkStateTheme>>": { "properties": { "hover": { + "$ref": "#/definitions/Partial>", "description": "图元在 hover 状态下的主题样式设置" }, "hover_reverse": { + "$ref": "#/definitions/Partial>", "description": "图元在 未被hover 状态下的主题样式设置" }, "normal": { + "$ref": "#/definitions/Partial>", "description": "图元在正常状态下的主题样式设置" }, "selected": { + "$ref": "#/definitions/Partial>", "description": "图元在 选中状态下的主题样式设置" }, "selected_reverse": { + "$ref": "#/definitions/Partial>", "description": "图元在 未被选中 状态下的主题样式设置" } }, @@ -56549,570 +55679,230 @@ ], "type": "object" }, - "IPathMarkSpec": { + "IPieChartSpec": { "properties": { - "alpha": { - "description": "x方向的旋转角度", - "type": "number" + "angleField": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ] }, - "anchor": { - "description": "基于AABB的锚点位置,用于简单的定位某些path的位置", - "items": [ + "animation": { + "description": "是否开启系列动画", + "type": "boolean" + }, + "animationAppear": { + "anyOf": [ { - "type": "number" + "$ref": "#/definitions/Partial>" }, { - "type": "number" + "$ref": "#/definitions/IStateAnimateSpec" + }, + { + "type": "boolean" } ], - "maxItems": 2, - "minItems": 2, - "type": "array" + "description": "图表入场动画\n支持配置图表内置不同动画效果" }, - "anchor3d": { - "description": "3d的锚点位置", - "items": [ + "animationDisappear": { + "anyOf": [ { - "type": "number" + "$ref": "#/definitions/ICommonStateAnimateSpec" }, { - "type": "number" + "$ref": "#/definitions/Partial>" + }, + { + "type": "boolean" } ], - "maxItems": 2, - "minItems": 2, - "type": "array" - }, - "angle": { - "description": "图形的旋转角度", - "type": "number" + "description": "图表退场动画" }, - "background": { + "animationEnter": { "anyOf": [ { - "$ref": "#/definitions/HTMLCanvasElement" + "$ref": "#/definitions/ICommonStateAnimateSpec" }, { - "$ref": "#/definitions/HTMLImageElement" + "$ref": "#/definitions/Partial>" }, { - "$ref": "#/definitions/ILinearGradient" - }, + "type": "boolean" + } + ], + "description": "数据更新 - 新增数据动画" + }, + "animationExit": { + "anyOf": [ { - "$ref": "#/definitions/IRadialGradient" + "$ref": "#/definitions/ICommonStateAnimateSpec" }, { - "$ref": "#/definitions/IConicalGradient" + "$ref": "#/definitions/Partial>" }, { - "type": "string" + "type": "boolean" } ], - "description": "图形的背景色,支持纯色、image元素、canvas元素" + "description": "数据更新 - 数据删除动画" }, - "backgroundClip": { - "description": "背景图是否裁切,是否调用clip避免绘制到图元外部", - "type": "boolean" + "animationNormal": { + "$ref": "#/definitions/Partial>", + "description": "循环动画" }, - "backgroundCornerRadius": { + "animationState": { "anyOf": [ { - "items": { - "type": "number" - }, - "type": "array" + "$ref": "#/definitions/IStateAnimationConfig" }, { - "type": "number" + "type": "boolean" } ], - "description": "背景圆角半径" - }, - "backgroundFit": { - "description": "是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效", - "type": "boolean" - }, - "backgroundKeepAspectRatio": { - "description": "是否保持背景图的宽高比", - "type": "boolean" - }, - "backgroundMode": { - "$ref": "#/definitions/BackgroundMode_1", - "description": "背景图绘制模式(与具体图元有关)。\n原有平铺模式为:`repeat` / `repeat-x` / `repeat-y` / `no-repeat`;\n自 `2.0.21` 版本开始,支持 `no-repeat-cover` / `no-repeat-contain` /\n`no-repeat-fill` / `no-repeat-auto` 这几个 `no-repeat` 下的尺寸简写。" + "description": "状态切换动画", + "since": "1.12.0" }, - "backgroundOffsetX": { - "description": "背景图偏移,只在no-repeat的时候生效", + "animationThreshold": { + "description": "自动关闭动画的阀值,对应的是单系列data的长度", + "since": "1.2.0", "type": "number" }, - "backgroundOffsetY": { - "description": "背景图偏移,只在no-repeat的时候生效", - "type": "number" + "animationUpdate": { + "anyOf": [ + { + "$ref": "#/definitions/ICommonStateAnimateSpec" + }, + { + "$ref": "#/definitions/Partial>" + }, + { + "type": "boolean" + } + ], + "description": "数据更新 - 数据更新动画" }, - "backgroundOpacity": { - "description": "背景透明度", - "type": "number" + "autoFit": { + "description": "图表宽高是否自适应容器,浏览器环境下默认为 true。\n该配置的优先级高于构造函数中的 autoFit 配置。\n如果用户配置了 width,则以用户配置的 width 为准,height 同理。", + "type": "boolean" }, - "backgroundPosition": { - "$ref": "#/definitions/BackgroundPosition_1", - "description": "背景图锚定位置,语义类似 CSS `background-position`。\n仅在图片背景且最终为 `no-repeat` 时生效。", - "since": "2.0.21" + "axes": { + "description": "轴", + "items": { + "$ref": "#/definitions/ICommonAxisSpec" + }, + "type": "array" }, - "backgroundScale": { - "description": "背景图缩放,只在no-repeat的时候生效", - "type": "number" + "background": { + "$ref": "#/definitions/IBackgroundSpec", + "description": "图表背景色配置,优先级高于构造函数中的 background 配置\n自1.11.6版本支持渐变色对象的配置" }, - "beta": { - "description": "y方向的旋转角度", - "type": "number" + "brush": { + "$ref": "#/definitions/IBrushSpec", + "description": "框选配置" }, - "boundsMode": { - "description": "bounds的计算模式", - "enum": [ - "accurate", - "imprecise" - ], + "categoryField": { + "description": "饼图每个扇区为独立的系列", "type": "string" }, - "cursor": { - "$ref": "#/definitions/Cursor_1", - "description": "设置图形的鼠标样式" + "centerOffset": { + "description": "饼图扇区中心偏移", + "type": "number" }, - "fill": { + "centerX": { "anyOf": [ { - "$ref": "#/definitions/IColorKey" + "items": { + "type": "string" + }, + "type": "array" }, { - "$ref": "#/definitions/IGradientLinear" - }, + "type": "number" + } + ], + "description": "饼图中心点 x 坐标" + }, + "centerY": { + "anyOf": [ { - "$ref": "#/definitions/IGradientRadial" + "items": { + "type": "string" + }, + "type": "array" }, { - "$ref": "#/definitions/IGradientConical" - }, + "type": "number" + } + ], + "description": "饼图中心点 y 坐标" + }, + "color": { + "anyOf": [ { - "$ref": "#/definitions/IVisualScale" + "items": { + "type": "string" + }, + "type": "array" }, { - "typeof": "function" - }, + "$ref": "#/definitions/Omit,\"id\">" + } + ], + "description": "图表色系配置" + }, + "cornerRadius": { + "default": 0, + "description": "饼图扇区圆角半径", + "type": "number" + }, + "crosshair": { + "anyOf": [ { - "$ref": "#/definitions/IVisualSpecStyle" + "$ref": "#/definitions/ICartesianCrosshairSpec" }, { - "const": false, - "type": "boolean" + "$ref": "#/definitions/IPolarCrosshairSpec" }, { - "type": "string" + "items": { + "$ref": "#/definitions/ICrosshairSpec" + }, + "type": "array" } ], - "description": "图形的填充颜色" - }, - "fillOpacity": { - "description": "填充的透明度", - "type": "number" - }, - "html": { - "$ref": "#/definitions/Partial<{dom:string|HTMLElement;}&SimpleDomStyleOptions&CommonDomOptions>", - "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", - "since": "1.10.0" - }, - "innerBorder": { - "$ref": "#/definitions/IBorder", - "description": "内边框,内描边,描边位于图形内侧" + "description": "十字辅助线配置" }, - "lineDash": { - "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度", + "customMark": { + "description": "自定义mark", "items": { - "type": "number" + "$ref": "#/definitions/ICustomMarkSpec" }, "type": "array" }, - "lineDashOffset": { - "description": "设置虚线偏移量的属性", - "type": "number" + "data": { + "$ref": "#/definitions/IData", + "description": "数据" }, - "lineWidth": { - "description": "图形的描边宽度", - "type": "number" + "dataId": { + "$ref": "#/definitions/StringOrNumber", + "description": "系列关联的数据id" }, - "opacity": { - "description": "图形的透明度,既影响描边也影响填充", + "dataIndex": { + "default": 0, + "description": "系列关联的数据索引", "type": "number" }, - "outerBorder": { - "$ref": "#/definitions/IBorder", - "description": "外边框,外描边,描边位于图形外侧" - }, - "path": { - "type": "string" - }, - "pickMode": { - "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式", - "enum": [ - "accurate", - "custom", - "imprecise" - ], - "type": "string" - }, - "pickStrokeBuffer": { - "default": 0, - "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", - "since": "1.7.3", - "type": "number" - }, - "scaleCenter": { - "description": "图形缩放中心", - "items": [ - { - "type": [ - "string", - "number" - ] - }, - { - "type": [ - "string", - "number" - ] - } - ], - "maxItems": 2, - "minItems": 2, - "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心", - "type": "array" - }, - "scaleX": { - "description": "x方向的缩放比例,默认为1,即不进行缩放", - "type": "number" - }, - "scaleY": { - "description": "y方向的缩放比例,默认为1,即不进行缩放", - "type": "number" - }, - "shadowBlur": { - "description": "图形模糊效果程度", - "type": "number" - }, - "shadowColor": { - "description": "图形的阴影颜色", - "type": "string" - }, - "shadowOffsetX": { - "description": "阴影水平偏移距离", - "type": "number" - }, - "shadowOffsetY": { - "description": "阴影垂直偏移距离", - "type": "number" - }, - "smoothScale": { - "description": "平滑缩放,不然会发生跳变,在地图交互场景需要配置为true;常规path缩放不需要", - "type": "boolean" - }, - "stroke": { - "anyOf": [ - { - "$ref": "#/definitions/IColorKey" - }, - { - "$ref": "#/definitions/IGradientLinear" - }, - { - "$ref": "#/definitions/IGradientRadial" - }, - { - "$ref": "#/definitions/IGradientConical" - }, - { - "items": { - "type": [ - "number", - "boolean" - ] - }, - "type": "array" - }, - { - "const": false, - "type": "boolean" - }, - { - "type": "string" - } - ], - "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" - }, - "strokeOpacity": { - "description": "描边透明度", - "type": "number" - }, - "texture": { - "description": "纹理的类型", - "type": "string" - }, - "textureColor": { - "description": "纹理的颜色", - "type": "string" - }, - "texturePadding": { - "description": "纹理之间空隙的大小", - "type": "number" - }, - "textureSize": { - "description": "纹理单元的大小", - "type": "number" - }, - "visible": { - "description": "图形是否可见", - "type": "boolean" - }, - "x": { - "description": "图形的x坐标", - "type": "number" - }, - "y": { - "description": "图形的y坐标", - "type": "number" - }, - "z": { - "description": "图形的z坐标,仅适用于3D图表", - "type": "number" - }, - "zIndex": { - "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染", - "type": "number" - } - }, - "type": "object" - }, - "IPieChartSpec": { - "properties": { - "angleField": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "type": "string" - } - ] - }, - "animation": { - "description": "是否开启系列动画", - "type": "boolean" - }, - "animationAppear": { - "anyOf": [ - { - "$ref": "#/definitions/Partial>" - }, - { - "$ref": "#/definitions/IStateAnimateSpec" - }, - { - "type": "boolean" - } - ], - "description": "图表入场动画\n支持配置图表内置不同动画效果" - }, - "animationDisappear": { - "anyOf": [ - { - "$ref": "#/definitions/ICommonStateAnimateSpec" - }, - { - "$ref": "#/definitions/Partial>" - }, - { - "type": "boolean" - } - ], - "description": "图表退场动画" - }, - "animationEnter": { - "anyOf": [ - { - "$ref": "#/definitions/ICommonStateAnimateSpec" - }, - { - "$ref": "#/definitions/Partial>" - }, - { - "type": "boolean" - } - ], - "description": "数据更新 - 新增数据动画" - }, - "animationExit": { - "anyOf": [ - { - "$ref": "#/definitions/ICommonStateAnimateSpec" - }, - { - "$ref": "#/definitions/Partial>" - }, - { - "type": "boolean" - } - ], - "description": "数据更新 - 数据删除动画" - }, - "animationNormal": { - "$ref": "#/definitions/Partial>", - "description": "循环动画" - }, - "animationState": { - "anyOf": [ - { - "$ref": "#/definitions/IStateAnimationConfig" - }, - { - "type": "boolean" - } - ], - "description": "状态切换动画", - "since": "1.12.0" - }, - "animationThreshold": { - "description": "自动关闭动画的阀值,对应的是单系列data的长度", - "since": "1.2.0", - "type": "number" - }, - "animationUpdate": { - "anyOf": [ - { - "$ref": "#/definitions/ICommonStateAnimateSpec" - }, - { - "$ref": "#/definitions/Partial>" - }, - { - "type": "boolean" - } - ], - "description": "数据更新 - 数据更新动画" - }, - "autoFit": { - "description": "图表宽高是否自适应容器,浏览器环境下默认为 true。\n该配置的优先级高于构造函数中的 autoFit 配置。\n如果用户配置了 width,则以用户配置的 width 为准,height 同理。", - "type": "boolean" - }, - "axes": { - "description": "轴", - "items": { - "$ref": "#/definitions/ICommonAxisSpec" - }, - "type": "array" - }, - "background": { - "$ref": "#/definitions/IBackgroundSpec", - "description": "图表背景色配置,优先级高于构造函数中的 background 配置\n自1.11.6版本支持渐变色对象的配置" - }, - "brush": { - "$ref": "#/definitions/IBrushSpec", - "description": "框选配置" - }, - "categoryField": { - "description": "饼图每个扇区为独立的系列", - "type": "string" - }, - "centerOffset": { - "description": "饼图扇区中心偏移", - "type": "number" - }, - "centerX": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "type": "number" - } - ], - "description": "饼图中心点 x 坐标" - }, - "centerY": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "type": "number" - } - ], - "description": "饼图中心点 y 坐标" - }, - "color": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "$ref": "#/definitions/Omit,\"id\">" - } - ], - "description": "图表色系配置" - }, - "cornerRadius": { - "default": 0, - "description": "饼图扇区圆角半径", - "type": "number" - }, - "crosshair": { - "anyOf": [ - { - "$ref": "#/definitions/ICartesianCrosshairSpec" - }, - { - "$ref": "#/definitions/IPolarCrosshairSpec" - }, - { - "items": { - "$ref": "#/definitions/ICrosshairSpec" - }, - "type": "array" - } - ], - "description": "十字辅助线配置" - }, - "customMark": { - "description": "自定义mark", - "items": { - "$ref": "#/definitions/ICustomMarkSpec" - }, - "type": "array" - }, - "data": { - "$ref": "#/definitions/IData", - "description": "数据" - }, - "dataId": { - "$ref": "#/definitions/StringOrNumber", - "description": "系列关联的数据id" - }, - "dataIndex": { - "default": 0, - "description": "系列关联的数据索引", - "type": "number" - }, - "dataKey": { - "$ref": "#/definitions/DataKeyType", - "description": "dataKey用于绑定数据与Mark的关系, 该配置在动画中非常重要." + "dataKey": { + "$ref": "#/definitions/DataKeyType", + "description": "dataKey用于绑定数据与Mark的关系, 该配置在动画中非常重要." }, "dataZoom": { "anyOf": [ @@ -82188,7 +80978,7 @@ }, "Mapvoid>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82196,14 +80986,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82211,14 +81001,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82226,14 +81016,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82241,14 +81031,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82256,14 +81046,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Map>>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82271,14 +81061,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Map>>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82286,14 +81076,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82301,14 +81091,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82316,14 +81106,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82331,14 +81121,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82346,14 +81136,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -82361,7 +81151,7 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" @@ -86263,7 +85053,7 @@ "type": "boolean" }, "style": { - "$ref": "#/definitions/IArcMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -88439,6 +87229,2406 @@ }, "type": "object" }, + "Partial>": { + "properties": { + "alpha": { + "$ref": "#/definitions/VisualType", + "description": "x方向的旋转角度" + }, + "anchor": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "基于AABB的锚点位置,用于简单的定位某些path的位置" + }, + "anchor3d": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "3d的锚点位置" + }, + "angle": { + "$ref": "#/definitions/VisualType", + "description": "图形的旋转角度" + }, + "autoCapConical": { + "$ref": "#/definitions/VisualType", + "description": "arc 在 roundCap 打开且应用环形渐变时是否对 cap 部分生效" + }, + "background": { + "$ref": "#/definitions/VisualType", + "description": "图形的背景色,支持纯色、image元素、canvas元素" + }, + "backgroundClip": { + "$ref": "#/definitions/VisualType", + "description": "背景图是否裁切,是否调用clip避免绘制到图元外部" + }, + "backgroundCornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "背景圆角半径" + }, + "backgroundFit": { + "$ref": "#/definitions/VisualType", + "description": "是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效" + }, + "backgroundKeepAspectRatio": { + "$ref": "#/definitions/VisualType", + "description": "是否保持背景图的宽高比" + }, + "backgroundMode": { + "$ref": "#/definitions/VisualType", + "description": "背景图绘制模式(与具体图元有关)。\n原有平铺模式为:`repeat` / `repeat-x` / `repeat-y` / `no-repeat`;\n自 `2.0.21` 版本开始,支持 `no-repeat-cover` / `no-repeat-contain` /\n`no-repeat-fill` / `no-repeat-auto` 这几个 `no-repeat` 下的尺寸简写。" + }, + "backgroundOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOpacity": { + "$ref": "#/definitions/VisualType", + "description": "背景透明度" + }, + "backgroundPosition": { + "$ref": "#/definitions/VisualType", + "description": "背景图锚定位置,语义类似 CSS `background-position`。\n仅在图片背景且最终为 `no-repeat` 时生效。", + "since": "2.0.21" + }, + "backgroundScale": { + "$ref": "#/definitions/VisualType", + "description": "背景图缩放,只在no-repeat的时候生效" + }, + "beta": { + "$ref": "#/definitions/VisualType", + "description": "y方向的旋转角度" + }, + "boundsMode": { + "$ref": "#/definitions/VisualType<\"accurate\"|\"imprecise\">", + "description": "bounds的计算模式" + }, + "cap": { + "$ref": "#/definitions/VisualType", + "description": "arc 的 roundCap 属性,即圆角是否伸出 startAngle 和 endAngle 之外" + }, + "centerOffset": { + "$ref": "#/definitions/VisualType", + "description": "arc的中心点偏移距离,一般是通过在交互状态下设置这个属性来实现将扇区移出中心的一个效果" + }, + "cornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "圆角" + }, + "cursor": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的鼠标样式" + }, + "endAngle": { + "$ref": "#/definitions/VisualType", + "description": "圆弧的结束角度" + }, + "fill": { + "$ref": "#/definitions/VisualType>", + "description": "图形的填充颜色" + }, + "fillOpacity": { + "$ref": "#/definitions/VisualType", + "description": "填充的透明度" + }, + "html": { + "$ref": "#/definitions/VisualType>", + "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", + "since": "1.10.0" + }, + "innerBorder": { + "$ref": "#/definitions/VisualType", + "description": "内边框,内描边,描边位于图形内侧" + }, + "innerPadding": { + "$ref": "#/definitions/VisualType", + "description": "内边距" + }, + "innerRadius": { + "$ref": "#/definitions/VisualType", + "description": "内径,既内半径" + }, + "lineDash": { + "$ref": "#/definitions/VisualType", + "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度" + }, + "lineDashOffset": { + "$ref": "#/definitions/VisualType", + "description": "设置虚线偏移量的属性" + }, + "lineWidth": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边宽度" + }, + "opacity": { + "$ref": "#/definitions/VisualType", + "description": "图形的透明度,既影响描边也影响填充" + }, + "outerBorder": { + "$ref": "#/definitions/VisualType", + "description": "外边框,外描边,描边位于图形外侧" + }, + "outerPadding": { + "$ref": "#/definitions/VisualType", + "description": "外边距" + }, + "outerRadius": { + "$ref": "#/definitions/VisualType", + "description": "外径,既外半径" + }, + "padAngle": { + "$ref": "#/definitions/VisualType", + "description": "间隙角度;间隔角度会转换为一个在两个相邻的弧之间的确定的线性距离,定义为 padRadius * | padAngle |\n这个距离在弧的开始和结束处都是相等的;\n间隔角度通常只应用于环形扇区(即当内半径大于 0)" + }, + "pickMode": { + "$ref": "#/definitions/VisualType<\"custom\"|\"accurate\"|\"imprecise\">", + "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式" + }, + "pickStrokeBuffer": { + "$ref": "#/definitions/VisualType", + "default": 0, + "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", + "since": "1.7.3" + }, + "scaleCenter": { + "$ref": "#/definitions/VisualType<[string|number,string|number]>", + "description": "图形缩放中心", + "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心" + }, + "scaleX": { + "$ref": "#/definitions/VisualType", + "description": "x方向的缩放比例,默认为1,即不进行缩放" + }, + "scaleY": { + "$ref": "#/definitions/VisualType", + "description": "y方向的缩放比例,默认为1,即不进行缩放" + }, + "shadowBlur": { + "$ref": "#/definitions/VisualType", + "description": "图形模糊效果程度" + }, + "shadowColor": { + "$ref": "#/definitions/VisualType", + "description": "图形的阴影颜色" + }, + "shadowOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "阴影水平偏移距离" + }, + "shadowOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "阴影垂直偏移距离" + }, + "startAngle": { + "$ref": "#/definitions/VisualType", + "description": "圆弧的开始角度" + }, + "stroke": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" + }, + "strokeOpacity": { + "$ref": "#/definitions/VisualType", + "description": "描边透明度" + }, + "texture": { + "$ref": "#/definitions/VisualType", + "description": "纹理的类型" + }, + "textureColor": { + "$ref": "#/definitions/VisualType", + "description": "纹理的颜色" + }, + "texturePadding": { + "$ref": "#/definitions/VisualType", + "description": "纹理之间空隙的大小" + }, + "textureSize": { + "$ref": "#/definitions/VisualType", + "description": "纹理单元的大小" + }, + "visible": { + "$ref": "#/definitions/VisualType", + "description": "图形是否可见" + }, + "x": { + "$ref": "#/definitions/VisualType", + "description": "图形的x坐标" + }, + "y": { + "$ref": "#/definitions/VisualType", + "description": "图形的y坐标" + }, + "z": { + "$ref": "#/definitions/VisualType", + "description": "图形的z坐标,仅适用于3D图表" + }, + "zIndex": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染" + } + }, + "type": "object" + }, + "Partial>": { + "properties": { + "alpha": { + "$ref": "#/definitions/VisualType", + "description": "x方向的旋转角度" + }, + "anchor": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "基于AABB的锚点位置,用于简单的定位某些path的位置" + }, + "anchor3d": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "3d的锚点位置" + }, + "angle": { + "$ref": "#/definitions/VisualType", + "description": "图形的旋转角度" + }, + "background": { + "$ref": "#/definitions/VisualType", + "description": "图形的背景色,支持纯色、image元素、canvas元素" + }, + "backgroundClip": { + "$ref": "#/definitions/VisualType", + "description": "背景图是否裁切,是否调用clip避免绘制到图元外部" + }, + "backgroundCornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "背景圆角半径" + }, + "backgroundFit": { + "$ref": "#/definitions/VisualType", + "description": "是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效" + }, + "backgroundKeepAspectRatio": { + "$ref": "#/definitions/VisualType", + "description": "是否保持背景图的宽高比" + }, + "backgroundMode": { + "$ref": "#/definitions/VisualType", + "description": "背景图绘制模式(与具体图元有关)。\n原有平铺模式为:`repeat` / `repeat-x` / `repeat-y` / `no-repeat`;\n自 `2.0.21` 版本开始,支持 `no-repeat-cover` / `no-repeat-contain` /\n`no-repeat-fill` / `no-repeat-auto` 这几个 `no-repeat` 下的尺寸简写。" + }, + "backgroundOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOpacity": { + "$ref": "#/definitions/VisualType", + "description": "背景透明度" + }, + "backgroundPosition": { + "$ref": "#/definitions/VisualType", + "description": "背景图锚定位置,语义类似 CSS `background-position`。\n仅在图片背景且最终为 `no-repeat` 时生效。", + "since": "2.0.21" + }, + "backgroundScale": { + "$ref": "#/definitions/VisualType", + "description": "背景图缩放,只在no-repeat的时候生效" + }, + "beta": { + "$ref": "#/definitions/VisualType", + "description": "y方向的旋转角度" + }, + "boundsMode": { + "$ref": "#/definitions/VisualType<\"accurate\"|\"imprecise\">", + "description": "bounds的计算模式" + }, + "cursor": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的鼠标样式" + }, + "curveType": { + "$ref": "#/definitions/VisualType", + "description": "取消的差值类型,默认为线性插值,也就是普通的折线" + }, + "defined": { + "$ref": "#/definitions/VisualType", + "description": "设置点是否有效,也就是是否合法" + }, + "fill": { + "$ref": "#/definitions/VisualType>", + "description": "图形的填充颜色" + }, + "fillOpacity": { + "$ref": "#/definitions/VisualType", + "description": "填充的透明度" + }, + "html": { + "$ref": "#/definitions/VisualType>", + "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", + "since": "1.10.0" + }, + "innerBorder": { + "$ref": "#/definitions/VisualType", + "description": "内边框,内描边,描边位于图形内侧" + }, + "lineDash": { + "$ref": "#/definitions/VisualType", + "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度" + }, + "lineDashOffset": { + "$ref": "#/definitions/VisualType", + "description": "设置虚线偏移量的属性" + }, + "lineWidth": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边宽度" + }, + "opacity": { + "$ref": "#/definitions/VisualType", + "description": "图形的透明度,既影响描边也影响填充" + }, + "orient": { + "$ref": "#/definitions/VisualType<\"horizontal\"|\"vertical\">", + "description": "面积图元的方向,\nhorizontal - 水平方向\nvertical - 垂直方向" + }, + "outerBorder": { + "$ref": "#/definitions/VisualType", + "description": "外边框,外描边,描边位于图形外侧" + }, + "pickMode": { + "$ref": "#/definitions/VisualType<\"custom\"|\"accurate\"|\"imprecise\">", + "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式" + }, + "pickStrokeBuffer": { + "$ref": "#/definitions/VisualType", + "default": 0, + "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", + "since": "1.7.3" + }, + "scaleCenter": { + "$ref": "#/definitions/VisualType<[string|number,string|number]>", + "description": "图形缩放中心", + "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心" + }, + "scaleX": { + "$ref": "#/definitions/VisualType", + "description": "x方向的缩放比例,默认为1,即不进行缩放" + }, + "scaleY": { + "$ref": "#/definitions/VisualType", + "description": "y方向的缩放比例,默认为1,即不进行缩放" + }, + "shadowBlur": { + "$ref": "#/definitions/VisualType", + "description": "图形模糊效果程度" + }, + "shadowColor": { + "$ref": "#/definitions/VisualType", + "description": "图形的阴影颜色" + }, + "shadowOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "阴影水平偏移距离" + }, + "shadowOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "阴影垂直偏移距离" + }, + "stroke": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" + }, + "strokeOpacity": { + "$ref": "#/definitions/VisualType", + "description": "描边透明度" + }, + "texture": { + "$ref": "#/definitions/VisualType", + "description": "纹理的类型" + }, + "textureColor": { + "$ref": "#/definitions/VisualType", + "description": "纹理的颜色" + }, + "texturePadding": { + "$ref": "#/definitions/VisualType", + "description": "纹理之间空隙的大小" + }, + "textureSize": { + "$ref": "#/definitions/VisualType", + "description": "纹理单元的大小" + }, + "visible": { + "$ref": "#/definitions/VisualType", + "description": "图形是否可见" + }, + "x": { + "$ref": "#/definitions/VisualType", + "description": "图形的x坐标" + }, + "x1": { + "$ref": "#/definitions/VisualType", + "description": "面积的x1值" + }, + "y": { + "$ref": "#/definitions/VisualType", + "description": "图形的y坐标" + }, + "y1": { + "$ref": "#/definitions/VisualType", + "description": "面积的y1值" + }, + "z": { + "$ref": "#/definitions/VisualType", + "description": "图形的z坐标,仅适用于3D图表" + }, + "zIndex": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染" + } + }, + "type": "object" + }, + "Partial>": { + "properties": { + "alpha": { + "$ref": "#/definitions/VisualType", + "description": "x方向的旋转角度" + }, + "anchor": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "基于AABB的锚点位置,用于简单的定位某些path的位置" + }, + "anchor3d": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "3d的锚点位置" + }, + "angle": { + "$ref": "#/definitions/VisualType", + "description": "图形的旋转角度" + }, + "beta": { + "$ref": "#/definitions/VisualType", + "description": "y方向的旋转角度" + }, + "boundsMode": { + "$ref": "#/definitions/VisualType<\"accurate\"|\"imprecise\">", + "description": "bounds的计算模式" + }, + "boxCornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "箱体的圆角半径\n在 shaftShape = 'line' / 'filled-line' 模式下,控制 box 子图元的 cornerRadius 属性", + "since": "2.0.11" + }, + "boxHeight": { + "$ref": "#/definitions/VisualType", + "description": "箱体的高度(垂直箱线图)或宽度(水平箱线图)\n在 shaftShape = 'line' / 'filled-line' 模式下使用" + }, + "boxStroke": { + "$ref": "#/definitions/VisualType", + "description": "箱体的描边颜色\n在 shaftShape = 'line' / 'filled-line' 模式下,控制 box 子图元的 stroke 属性", + "since": "2.0.11" + }, + "boxWidth": { + "$ref": "#/definitions/VisualType", + "default": 30, + "description": "箱体的宽度(垂直箱线图)或高度(水平箱线图)\n在 shaftShape = 'line' / 'filled-line' 模式下,控制 box 子图元的尺寸\n支持像素值或百分比字符串(相对于分组宽度)" + }, + "cursor": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的鼠标样式" + }, + "html": { + "$ref": "#/definitions/VisualType>", + "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", + "since": "1.10.0" + }, + "innerBorder": { + "$ref": "#/definitions/VisualType", + "description": "内边框,内描边,描边位于图形内侧" + }, + "lineDash": { + "$ref": "#/definitions/VisualType", + "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度" + }, + "lineDashOffset": { + "$ref": "#/definitions/VisualType", + "description": "设置虚线偏移量的属性" + }, + "lineWidth": { + "$ref": "#/definitions/VisualType", + "default": 2, + "description": "箱线图的描边宽度\n在 shaftShape = 'line' / 'filled-line' 模式下影响所有线条的宽度\n在 shaftShape = 'bar' 模式下,minMaxBox 和 q1q3Box 的 lineWidth 会被强制设为 0" + }, + "max": { + "$ref": "#/definitions/VisualType<(datum:Datum)=>number>_4", + "description": "最大值(箱线图的上限)\n用于计算箱线图的上端须线位置" + }, + "median": { + "$ref": "#/definitions/VisualType<(datum:Datum)=>number>_2", + "description": "中位数(Q2,50%分位数)\n在箱体中绘制中位数线" + }, + "medianStroke": { + "$ref": "#/definitions/VisualType", + "description": "中位数线的描边颜色\n在 shaftShape = 'line' / 'filled-line' 模式下,控制 median 子图元的 stroke 属性", + "since": "2.0.11" + }, + "min": { + "$ref": "#/definitions/VisualType<(datum:Datum)=>number>", + "description": "最小值(箱线图的下限)\n用于计算箱线图的下端须线位置" + }, + "minMaxFillOpacity": { + "$ref": "#/definitions/VisualType", + "description": "最小-最大值矩形的填充透明度\n仅在 shaftShape = 'bar' 模式下生效,控制 minMaxBox 子图元的 fillOpacity" + }, + "minMaxHeight": { + "$ref": "#/definitions/VisualType", + "description": "最小-最大值矩形的高度(垂直箱线图)或宽度(水平箱线图)\n在 shaftShape = 'bar' 模式下使用" + }, + "minMaxWidth": { + "$ref": "#/definitions/VisualType", + "description": "最小-最大值矩形的宽度(垂直箱线图)或高度(水平箱线图)\n在 shaftShape = 'bar' 模式下,控制 minMaxBox 子图元的尺寸" + }, + "opacity": { + "$ref": "#/definitions/VisualType", + "description": "图形的透明度,既影响描边也影响填充" + }, + "outerBorder": { + "$ref": "#/definitions/VisualType", + "description": "外边框,外描边,描边位于图形外侧" + }, + "pickMode": { + "$ref": "#/definitions/VisualType<\"custom\"|\"accurate\"|\"imprecise\">", + "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式" + }, + "pickStrokeBuffer": { + "$ref": "#/definitions/VisualType", + "default": 0, + "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", + "since": "1.7.3" + }, + "q1": { + "$ref": "#/definitions/VisualType<(datum:Datum)=>number>_1", + "description": "第一四分位数(Q1,25%分位数)\n用于确定箱体的下边界" + }, + "q1q3Height": { + "$ref": "#/definitions/VisualType", + "description": "Q1-Q3 四分位数矩形的高度(垂直箱线图)或宽度(水平箱线图)\n在 shaftShape = 'bar' 模式下使用" + }, + "q1q3Width": { + "$ref": "#/definitions/VisualType", + "description": "Q1-Q3 四分位数矩形的宽度(垂直箱线图)或高度(水平箱线图)\n在 shaftShape = 'bar' 模式下,控制 q1q3Box 子图元的尺寸" + }, + "q3": { + "$ref": "#/definitions/VisualType<(datum:Datum)=>number>_3", + "description": "第三四分位数(Q3,75%分位数)\n用于确定箱体的上边界" + }, + "ruleHeight": { + "$ref": "#/definitions/VisualType", + "description": "最大/最小值须线端点的高度(垂直箱线图)或宽度(水平箱线图)\n在 shaftShape = 'line' / 'filled-line' 模式下使用" + }, + "ruleWidth": { + "$ref": "#/definitions/VisualType", + "description": "最大/最小值须线端点的宽度(垂直箱线图)或高度(水平箱线图)\n在 shaftShape = 'line' / 'filled-line' 模式下使用" + }, + "scaleCenter": { + "$ref": "#/definitions/VisualType<[string|number,string|number]>", + "description": "图形缩放中心", + "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心" + }, + "scaleX": { + "$ref": "#/definitions/VisualType", + "description": "x方向的缩放比例,默认为1,即不进行缩放" + }, + "scaleY": { + "$ref": "#/definitions/VisualType", + "description": "y方向的缩放比例,默认为1,即不进行缩放" + }, + "shaftShape": { + "$ref": "#/definitions/VisualType", + "default": "'line'", + "description": "中轴线(须线)的绘制形状\n- 'line': 标准线条形式,绘制 shaft(连接线)、box(箱体)、max/min/median(线条)五个子图元\n- 'bar': 柱状形式,绘制 minMaxBox(最小-最大值矩形)、q1q3Box(Q1-Q3矩形)、median(中位数线)三个子图元\n- 'filled-line': 填充线条形式" + }, + "shaftWidth": { + "$ref": "#/definitions/VisualType", + "default": 20, + "description": "最大/最小值须线的宽度(垂直箱线图)或高度(水平箱线图)\n在 shaftShape = 'line' / 'filled-line' 模式下,控制 max/min 子图元的线条长度\n支持像素值或百分比字符串" + }, + "stroke": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" + }, + "strokeOpacity": { + "$ref": "#/definitions/VisualType", + "description": "描边透明度" + }, + "texture": { + "$ref": "#/definitions/VisualType", + "description": "纹理的类型" + }, + "textureColor": { + "$ref": "#/definitions/VisualType", + "description": "纹理的颜色" + }, + "texturePadding": { + "$ref": "#/definitions/VisualType", + "description": "纹理之间空隙的大小" + }, + "textureSize": { + "$ref": "#/definitions/VisualType", + "description": "纹理单元的大小" + }, + "visible": { + "$ref": "#/definitions/VisualType", + "description": "图形是否可见" + }, + "x": { + "$ref": "#/definitions/VisualType", + "description": "图形的x坐标" + }, + "y": { + "$ref": "#/definitions/VisualType", + "description": "图形的y坐标" + }, + "z": { + "$ref": "#/definitions/VisualType", + "description": "图形的z坐标,仅适用于3D图表" + }, + "zIndex": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染" + } + }, + "type": "object" + }, + "Partial>": { + "properties": { + "alpha": { + "$ref": "#/definitions/VisualType", + "description": "x方向的旋转角度" + }, + "anchor": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "基于AABB的锚点位置,用于简单的定位某些path的位置" + }, + "anchor3d": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "3d的锚点位置" + }, + "angle": { + "$ref": "#/definitions/VisualType", + "description": "图形的旋转角度" + }, + "background": { + "$ref": "#/definitions/VisualType", + "description": "图形的背景色,支持纯色、image元素、canvas元素" + }, + "backgroundClip": { + "$ref": "#/definitions/VisualType", + "description": "背景图是否裁切,是否调用clip避免绘制到图元外部" + }, + "backgroundCornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "背景圆角半径" + }, + "backgroundFit": { + "$ref": "#/definitions/VisualType", + "description": "是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效" + }, + "backgroundKeepAspectRatio": { + "$ref": "#/definitions/VisualType", + "description": "是否保持背景图的宽高比" + }, + "backgroundMode": { + "$ref": "#/definitions/VisualType", + "description": "背景图绘制模式(与具体图元有关)。\n原有平铺模式为:`repeat` / `repeat-x` / `repeat-y` / `no-repeat`;\n自 `2.0.21` 版本开始,支持 `no-repeat-cover` / `no-repeat-contain` /\n`no-repeat-fill` / `no-repeat-auto` 这几个 `no-repeat` 下的尺寸简写。" + }, + "backgroundOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOpacity": { + "$ref": "#/definitions/VisualType", + "description": "背景透明度" + }, + "backgroundPosition": { + "$ref": "#/definitions/VisualType", + "description": "背景图锚定位置,语义类似 CSS `background-position`。\n仅在图片背景且最终为 `no-repeat` 时生效。", + "since": "2.0.21" + }, + "backgroundScale": { + "$ref": "#/definitions/VisualType", + "description": "背景图缩放,只在no-repeat的时候生效" + }, + "beta": { + "$ref": "#/definitions/VisualType", + "description": "y方向的旋转角度" + }, + "boundsMode": { + "$ref": "#/definitions/VisualType<\"accurate\"|\"imprecise\">", + "description": "bounds的计算模式" + }, + "cursor": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的鼠标样式" + }, + "curveType": { + "$ref": "#/definitions/VisualType", + "description": "取消的差值类型,默认为线性插值,也就是普通的折线" + }, + "defined": { + "$ref": "#/definitions/VisualType", + "description": "设置点是否有效,也就是是否合法" + }, + "fill": { + "$ref": "#/definitions/VisualType>", + "description": "图形的填充颜色" + }, + "fillOpacity": { + "$ref": "#/definitions/VisualType", + "description": "填充的透明度" + }, + "html": { + "$ref": "#/definitions/VisualType>", + "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", + "since": "1.10.0" + }, + "innerBorder": { + "$ref": "#/definitions/VisualType", + "description": "内边框,内描边,描边位于图形内侧" + }, + "lineCap": { + "$ref": "#/definitions/VisualType", + "description": "指定如何绘制每一条线段末端的属性。有 3 个可能的值,分别是:'butt', 'round' and 'square'。默认值是 butt。" + }, + "lineDash": { + "$ref": "#/definitions/VisualType", + "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度" + }, + "lineDashOffset": { + "$ref": "#/definitions/VisualType", + "description": "设置虚线偏移量的属性" + }, + "lineJoin": { + "$ref": "#/definitions/VisualType", + "description": "用来设置 2 个长度不为 0 的相连部分(线段、圆弧、曲线)如何连接在一起的属性(长度为 0 的变形部分,其指定的末端和控制点在同一位置,会被忽略)。此属性有 3 个值: 'round', 'bevel' and 'miter'。默认值是 'miter'" + }, + "lineWidth": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边宽度" + }, + "miterLimit": { + "$ref": "#/definitions/VisualType", + "description": "设置斜接面限制比例的属性。当获取属性值时,会返回当前的值(默认值是 10.0 )。当给属性赋值时,0、负数、 Infinity 和 NaN 都会被忽略;除此之外都会被赋予一个新值。" + }, + "opacity": { + "$ref": "#/definitions/VisualType", + "description": "图形的透明度,既影响描边也影响填充" + }, + "outerBorder": { + "$ref": "#/definitions/VisualType", + "description": "外边框,外描边,描边位于图形外侧" + }, + "pickMode": { + "$ref": "#/definitions/VisualType<\"custom\"|\"accurate\"|\"imprecise\">", + "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式" + }, + "pickStrokeBuffer": { + "$ref": "#/definitions/VisualType", + "default": 0, + "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", + "since": "1.7.3" + }, + "scaleCenter": { + "$ref": "#/definitions/VisualType<[string|number,string|number]>", + "description": "图形缩放中心", + "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心" + }, + "scaleX": { + "$ref": "#/definitions/VisualType", + "description": "x方向的缩放比例,默认为1,即不进行缩放" + }, + "scaleY": { + "$ref": "#/definitions/VisualType", + "description": "y方向的缩放比例,默认为1,即不进行缩放" + }, + "shadowBlur": { + "$ref": "#/definitions/VisualType", + "description": "图形模糊效果程度" + }, + "shadowColor": { + "$ref": "#/definitions/VisualType", + "description": "图形的阴影颜色" + }, + "shadowOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "阴影水平偏移距离" + }, + "shadowOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "阴影垂直偏移距离" + }, + "stroke": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" + }, + "strokeBoundsBuffer": { + "$ref": "#/definitions/VisualType", + "description": "stroke 的有界缓冲区" + }, + "strokeOpacity": { + "$ref": "#/definitions/VisualType", + "description": "描边透明度" + }, + "texture": { + "$ref": "#/definitions/VisualType", + "description": "纹理的类型" + }, + "textureColor": { + "$ref": "#/definitions/VisualType", + "description": "纹理的颜色" + }, + "texturePadding": { + "$ref": "#/definitions/VisualType", + "description": "纹理之间空隙的大小" + }, + "textureSize": { + "$ref": "#/definitions/VisualType", + "description": "纹理单元的大小" + }, + "visible": { + "$ref": "#/definitions/VisualType", + "description": "图形是否可见" + }, + "x": { + "$ref": "#/definitions/VisualType", + "description": "图形的x坐标" + }, + "y": { + "$ref": "#/definitions/VisualType", + "description": "图形的y坐标" + }, + "z": { + "$ref": "#/definitions/VisualType", + "description": "图形的z坐标,仅适用于3D图表" + }, + "zIndex": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染" + } + }, + "type": "object" + }, + "Partial>": { + "properties": { + "alpha": { + "$ref": "#/definitions/VisualType", + "description": "x方向的旋转角度" + }, + "anchor": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "基于AABB的锚点位置,用于简单的定位某些path的位置" + }, + "anchor3d": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "3d的锚点位置" + }, + "angle": { + "$ref": "#/definitions/VisualType", + "description": "图形的旋转角度" + }, + "beta": { + "$ref": "#/definitions/VisualType", + "description": "y方向的旋转角度" + }, + "boundsMode": { + "$ref": "#/definitions/VisualType<\"accurate\"|\"imprecise\">", + "description": "bounds的计算模式" + }, + "cursor": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的鼠标样式" + }, + "html": { + "$ref": "#/definitions/VisualType>", + "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", + "since": "1.10.0" + }, + "innerBorder": { + "$ref": "#/definitions/VisualType", + "description": "内边框,内描边,描边位于图形内侧" + }, + "lineDash": { + "$ref": "#/definitions/VisualType", + "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度" + }, + "lineDashOffset": { + "$ref": "#/definitions/VisualType", + "description": "设置虚线偏移量的属性" + }, + "lineWidth": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边宽度" + }, + "opacity": { + "$ref": "#/definitions/VisualType", + "description": "图形的透明度,既影响描边也影响填充" + }, + "outerBorder": { + "$ref": "#/definitions/VisualType", + "description": "外边框,外描边,描边位于图形外侧" + }, + "pickMode": { + "$ref": "#/definitions/VisualType<\"custom\"|\"accurate\"|\"imprecise\">", + "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式" + }, + "pickStrokeBuffer": { + "$ref": "#/definitions/VisualType", + "default": 0, + "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", + "since": "1.7.3" + }, + "scaleCenter": { + "$ref": "#/definitions/VisualType<[string|number,string|number]>", + "description": "图形缩放中心", + "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心" + }, + "scaleX": { + "$ref": "#/definitions/VisualType", + "description": "x方向的缩放比例,默认为1,即不进行缩放" + }, + "scaleY": { + "$ref": "#/definitions/VisualType", + "description": "y方向的缩放比例,默认为1,即不进行缩放" + }, + "stroke": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" + }, + "strokeOpacity": { + "$ref": "#/definitions/VisualType", + "description": "描边透明度" + }, + "texture": { + "$ref": "#/definitions/VisualType", + "description": "纹理的类型" + }, + "textureColor": { + "$ref": "#/definitions/VisualType", + "description": "纹理的颜色" + }, + "texturePadding": { + "$ref": "#/definitions/VisualType", + "description": "纹理之间空隙的大小" + }, + "textureSize": { + "$ref": "#/definitions/VisualType", + "description": "纹理单元的大小" + }, + "visible": { + "$ref": "#/definitions/VisualType", + "description": "图形是否可见" + }, + "wave": { + "$ref": "#/definitions/VisualType", + "description": "波浪的变化状态,范围为 [0, 1]" + }, + "x": { + "$ref": "#/definitions/VisualType", + "description": "图形的x坐标" + }, + "y": { + "$ref": "#/definitions/VisualType", + "description": "图形的y坐标" + }, + "z": { + "$ref": "#/definitions/VisualType", + "description": "图形的z坐标,仅适用于3D图表" + }, + "zIndex": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染" + } + }, + "type": "object" + }, + "Partial>": { + "properties": { + "alpha": { + "$ref": "#/definitions/VisualType", + "description": "x方向的旋转角度" + }, + "anchor": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "基于AABB的锚点位置,用于简单的定位某些path的位置" + }, + "anchor3d": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "3d的锚点位置" + }, + "angle": { + "$ref": "#/definitions/VisualType", + "description": "图形的旋转角度" + }, + "background": { + "$ref": "#/definitions/VisualType", + "description": "图形的背景色,支持纯色、image元素、canvas元素" + }, + "backgroundClip": { + "$ref": "#/definitions/VisualType", + "description": "背景图是否裁切,是否调用clip避免绘制到图元外部" + }, + "backgroundCornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "背景圆角半径" + }, + "backgroundFit": { + "$ref": "#/definitions/VisualType", + "description": "是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效" + }, + "backgroundKeepAspectRatio": { + "$ref": "#/definitions/VisualType", + "description": "是否保持背景图的宽高比" + }, + "backgroundMode": { + "$ref": "#/definitions/VisualType", + "description": "背景图绘制模式(与具体图元有关)。\n原有平铺模式为:`repeat` / `repeat-x` / `repeat-y` / `no-repeat`;\n自 `2.0.21` 版本开始,支持 `no-repeat-cover` / `no-repeat-contain` /\n`no-repeat-fill` / `no-repeat-auto` 这几个 `no-repeat` 下的尺寸简写。" + }, + "backgroundOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOpacity": { + "$ref": "#/definitions/VisualType", + "description": "背景透明度" + }, + "backgroundPosition": { + "$ref": "#/definitions/VisualType", + "description": "背景图锚定位置,语义类似 CSS `background-position`。\n仅在图片背景且最终为 `no-repeat` 时生效。", + "since": "2.0.21" + }, + "backgroundScale": { + "$ref": "#/definitions/VisualType", + "description": "背景图缩放,只在no-repeat的时候生效" + }, + "beta": { + "$ref": "#/definitions/VisualType", + "description": "y方向的旋转角度" + }, + "boundsMode": { + "$ref": "#/definitions/VisualType<\"accurate\"|\"imprecise\">", + "description": "bounds的计算模式" + }, + "cursor": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的鼠标样式" + }, + "fill": { + "$ref": "#/definitions/VisualType>", + "description": "图形的填充颜色" + }, + "fillOpacity": { + "$ref": "#/definitions/VisualType", + "description": "填充的透明度" + }, + "html": { + "$ref": "#/definitions/VisualType>", + "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", + "since": "1.10.0" + }, + "innerBorder": { + "$ref": "#/definitions/VisualType", + "description": "内边框,内描边,描边位于图形内侧" + }, + "lineDash": { + "$ref": "#/definitions/VisualType", + "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度" + }, + "lineDashOffset": { + "$ref": "#/definitions/VisualType", + "description": "设置虚线偏移量的属性" + }, + "lineWidth": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边宽度" + }, + "opacity": { + "$ref": "#/definitions/VisualType", + "description": "图形的透明度,既影响描边也影响填充" + }, + "outerBorder": { + "$ref": "#/definitions/VisualType", + "description": "外边框,外描边,描边位于图形外侧" + }, + "path": { + "$ref": "#/definitions/VisualType" + }, + "pickMode": { + "$ref": "#/definitions/VisualType<\"custom\"|\"accurate\"|\"imprecise\">", + "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式" + }, + "pickStrokeBuffer": { + "$ref": "#/definitions/VisualType", + "default": 0, + "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", + "since": "1.7.3" + }, + "scaleCenter": { + "$ref": "#/definitions/VisualType<[string|number,string|number]>", + "description": "图形缩放中心", + "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心" + }, + "scaleX": { + "$ref": "#/definitions/VisualType", + "description": "x方向的缩放比例,默认为1,即不进行缩放" + }, + "scaleY": { + "$ref": "#/definitions/VisualType", + "description": "y方向的缩放比例,默认为1,即不进行缩放" + }, + "shadowBlur": { + "$ref": "#/definitions/VisualType", + "description": "图形模糊效果程度" + }, + "shadowColor": { + "$ref": "#/definitions/VisualType", + "description": "图形的阴影颜色" + }, + "shadowOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "阴影水平偏移距离" + }, + "shadowOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "阴影垂直偏移距离" + }, + "smoothScale": { + "$ref": "#/definitions/VisualType", + "description": "平滑缩放,不然会发生跳变,在地图交互场景需要配置为true;常规path缩放不需要" + }, + "stroke": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" + }, + "strokeOpacity": { + "$ref": "#/definitions/VisualType", + "description": "描边透明度" + }, + "texture": { + "$ref": "#/definitions/VisualType", + "description": "纹理的类型" + }, + "textureColor": { + "$ref": "#/definitions/VisualType", + "description": "纹理的颜色" + }, + "texturePadding": { + "$ref": "#/definitions/VisualType", + "description": "纹理之间空隙的大小" + }, + "textureSize": { + "$ref": "#/definitions/VisualType", + "description": "纹理单元的大小" + }, + "visible": { + "$ref": "#/definitions/VisualType", + "description": "图形是否可见" + }, + "x": { + "$ref": "#/definitions/VisualType", + "description": "图形的x坐标" + }, + "y": { + "$ref": "#/definitions/VisualType", + "description": "图形的y坐标" + }, + "z": { + "$ref": "#/definitions/VisualType", + "description": "图形的z坐标,仅适用于3D图表" + }, + "zIndex": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染" + } + }, + "type": "object" + }, + "Partial>": { + "properties": { + "alpha": { + "$ref": "#/definitions/VisualType", + "description": "x方向的旋转角度" + }, + "anchor": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "基于AABB的锚点位置,用于简单的定位某些path的位置" + }, + "anchor3d": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "3d的锚点位置" + }, + "angle": { + "$ref": "#/definitions/VisualType", + "description": "图形的旋转角度" + }, + "background": { + "$ref": "#/definitions/VisualType", + "description": "图形的背景色,支持纯色、image元素、canvas元素" + }, + "backgroundClip": { + "$ref": "#/definitions/VisualType", + "description": "背景图是否裁切,是否调用clip避免绘制到图元外部" + }, + "backgroundCornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "背景圆角半径" + }, + "backgroundFit": { + "$ref": "#/definitions/VisualType", + "description": "是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效" + }, + "backgroundKeepAspectRatio": { + "$ref": "#/definitions/VisualType", + "description": "是否保持背景图的宽高比" + }, + "backgroundMode": { + "$ref": "#/definitions/VisualType", + "description": "背景图绘制模式(与具体图元有关)。\n原有平铺模式为:`repeat` / `repeat-x` / `repeat-y` / `no-repeat`;\n自 `2.0.21` 版本开始,支持 `no-repeat-cover` / `no-repeat-contain` /\n`no-repeat-fill` / `no-repeat-auto` 这几个 `no-repeat` 下的尺寸简写。" + }, + "backgroundOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOpacity": { + "$ref": "#/definitions/VisualType", + "description": "背景透明度" + }, + "backgroundPosition": { + "$ref": "#/definitions/VisualType", + "description": "背景图锚定位置,语义类似 CSS `background-position`。\n仅在图片背景且最终为 `no-repeat` 时生效。", + "since": "2.0.21" + }, + "backgroundScale": { + "$ref": "#/definitions/VisualType", + "description": "背景图缩放,只在no-repeat的时候生效" + }, + "beta": { + "$ref": "#/definitions/VisualType", + "description": "y方向的旋转角度" + }, + "boundsMode": { + "$ref": "#/definitions/VisualType<\"accurate\"|\"imprecise\">", + "description": "bounds的计算模式" + }, + "cornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "圆角配置,支持数组配置,数组的顺序同组成 polygon 的顺序对应" + }, + "cursor": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的鼠标样式" + }, + "fill": { + "$ref": "#/definitions/VisualType>", + "description": "图形的填充颜色" + }, + "fillOpacity": { + "$ref": "#/definitions/VisualType", + "description": "填充的透明度" + }, + "html": { + "$ref": "#/definitions/VisualType>", + "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", + "since": "1.10.0" + }, + "innerBorder": { + "$ref": "#/definitions/VisualType", + "description": "内边框,内描边,描边位于图形内侧" + }, + "lineDash": { + "$ref": "#/definitions/VisualType", + "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度" + }, + "lineDashOffset": { + "$ref": "#/definitions/VisualType", + "description": "设置虚线偏移量的属性" + }, + "lineWidth": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边宽度" + }, + "opacity": { + "$ref": "#/definitions/VisualType", + "description": "图形的透明度,既影响描边也影响填充" + }, + "outerBorder": { + "$ref": "#/definitions/VisualType", + "description": "外边框,外描边,描边位于图形外侧" + }, + "pickMode": { + "$ref": "#/definitions/VisualType<\"custom\"|\"accurate\"|\"imprecise\">", + "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式" + }, + "pickStrokeBuffer": { + "$ref": "#/definitions/VisualType", + "default": 0, + "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", + "since": "1.7.3" + }, + "points": { + "$ref": "#/definitions/VisualType", + "description": "顶点坐标" + }, + "scaleCenter": { + "$ref": "#/definitions/VisualType<[string|number,string|number]>", + "description": "图形缩放中心", + "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心" + }, + "scaleX": { + "$ref": "#/definitions/VisualType", + "description": "x方向的缩放比例,默认为1,即不进行缩放" + }, + "scaleY": { + "$ref": "#/definitions/VisualType", + "description": "y方向的缩放比例,默认为1,即不进行缩放" + }, + "shadowBlur": { + "$ref": "#/definitions/VisualType", + "description": "图形模糊效果程度" + }, + "shadowColor": { + "$ref": "#/definitions/VisualType", + "description": "图形的阴影颜色" + }, + "shadowOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "阴影水平偏移距离" + }, + "shadowOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "阴影垂直偏移距离" + }, + "stroke": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" + }, + "strokeOpacity": { + "$ref": "#/definitions/VisualType", + "description": "描边透明度" + }, + "texture": { + "$ref": "#/definitions/VisualType", + "description": "纹理的类型" + }, + "textureColor": { + "$ref": "#/definitions/VisualType", + "description": "纹理的颜色" + }, + "texturePadding": { + "$ref": "#/definitions/VisualType", + "description": "纹理之间空隙的大小" + }, + "textureSize": { + "$ref": "#/definitions/VisualType", + "description": "纹理单元的大小" + }, + "visible": { + "$ref": "#/definitions/VisualType", + "description": "图形是否可见" + }, + "x": { + "$ref": "#/definitions/VisualType", + "description": "图形的x坐标" + }, + "y": { + "$ref": "#/definitions/VisualType", + "description": "图形的y坐标" + }, + "z": { + "$ref": "#/definitions/VisualType", + "description": "图形的z坐标,仅适用于3D图表" + }, + "zIndex": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染" + } + }, + "type": "object" + }, + "Partial>": { + "properties": { + "alpha": { + "$ref": "#/definitions/VisualType", + "description": "x方向的旋转角度" + }, + "anchor": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "基于AABB的锚点位置,用于简单的定位某些path的位置" + }, + "anchor3d": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "3d的锚点位置" + }, + "angle": { + "$ref": "#/definitions/VisualType", + "description": "图形的旋转角度" + }, + "background": { + "$ref": "#/definitions/VisualType", + "description": "图形的背景色,支持纯色、image元素、canvas元素" + }, + "backgroundClip": { + "$ref": "#/definitions/VisualType", + "description": "背景图是否裁切,是否调用clip避免绘制到图元外部" + }, + "backgroundCornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "背景圆角半径" + }, + "backgroundFit": { + "$ref": "#/definitions/VisualType", + "description": "是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效" + }, + "backgroundKeepAspectRatio": { + "$ref": "#/definitions/VisualType", + "description": "是否保持背景图的宽高比" + }, + "backgroundMode": { + "$ref": "#/definitions/VisualType", + "description": "背景图绘制模式(与具体图元有关)。\n原有平铺模式为:`repeat` / `repeat-x` / `repeat-y` / `no-repeat`;\n自 `2.0.21` 版本开始,支持 `no-repeat-cover` / `no-repeat-contain` /\n`no-repeat-fill` / `no-repeat-auto` 这几个 `no-repeat` 下的尺寸简写。" + }, + "backgroundOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOpacity": { + "$ref": "#/definitions/VisualType", + "description": "背景透明度" + }, + "backgroundPosition": { + "$ref": "#/definitions/VisualType", + "description": "背景图锚定位置,语义类似 CSS `background-position`。\n仅在图片背景且最终为 `no-repeat` 时生效。", + "since": "2.0.21" + }, + "backgroundScale": { + "$ref": "#/definitions/VisualType", + "description": "背景图缩放,只在no-repeat的时候生效" + }, + "beta": { + "$ref": "#/definitions/VisualType", + "description": "y方向的旋转角度" + }, + "boundsMode": { + "$ref": "#/definitions/VisualType<\"accurate\"|\"imprecise\">", + "description": "bounds的计算模式" + }, + "cornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "圆角配置。\n1. 如果传入数值,则统一为四个角设置圆角\n2. 如果传入数组,则分别为 [上左, 上右, 下右, 下左]" + }, + "cursor": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的鼠标样式" + }, + "fill": { + "$ref": "#/definitions/VisualType>", + "description": "图形的填充颜色" + }, + "fillOpacity": { + "$ref": "#/definitions/VisualType", + "description": "填充的透明度" + }, + "height": { + "$ref": "#/definitions/VisualType", + "description": "高度" + }, + "html": { + "$ref": "#/definitions/VisualType>", + "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", + "since": "1.10.0" + }, + "innerBorder": { + "$ref": "#/definitions/VisualType", + "description": "内边框,内描边,描边位于图形内侧" + }, + "lineDash": { + "$ref": "#/definitions/VisualType", + "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度" + }, + "lineDashOffset": { + "$ref": "#/definitions/VisualType", + "description": "设置虚线偏移量的属性" + }, + "lineWidth": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边宽度" + }, + "opacity": { + "$ref": "#/definitions/VisualType", + "description": "图形的透明度,既影响描边也影响填充" + }, + "outerBorder": { + "$ref": "#/definitions/VisualType", + "description": "外边框,外描边,描边位于图形外侧" + }, + "pickMode": { + "$ref": "#/definitions/VisualType<\"custom\"|\"accurate\"|\"imprecise\">", + "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式" + }, + "pickStrokeBuffer": { + "$ref": "#/definitions/VisualType", + "default": 0, + "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", + "since": "1.7.3" + }, + "scaleCenter": { + "$ref": "#/definitions/VisualType<[string|number,string|number]>", + "description": "图形缩放中心", + "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心" + }, + "scaleX": { + "$ref": "#/definitions/VisualType", + "description": "x方向的缩放比例,默认为1,即不进行缩放" + }, + "scaleY": { + "$ref": "#/definitions/VisualType", + "description": "y方向的缩放比例,默认为1,即不进行缩放" + }, + "shadowBlur": { + "$ref": "#/definitions/VisualType", + "description": "图形模糊效果程度" + }, + "shadowColor": { + "$ref": "#/definitions/VisualType", + "description": "图形的阴影颜色" + }, + "shadowOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "阴影水平偏移距离" + }, + "shadowOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "阴影垂直偏移距离" + }, + "stroke": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" + }, + "strokeOpacity": { + "$ref": "#/definitions/VisualType", + "description": "描边透明度" + }, + "texture": { + "$ref": "#/definitions/VisualType", + "description": "纹理的类型" + }, + "textureColor": { + "$ref": "#/definitions/VisualType", + "description": "纹理的颜色" + }, + "texturePadding": { + "$ref": "#/definitions/VisualType", + "description": "纹理之间空隙的大小" + }, + "textureSize": { + "$ref": "#/definitions/VisualType", + "description": "纹理单元的大小" + }, + "visible": { + "$ref": "#/definitions/VisualType", + "description": "图形是否可见" + }, + "width": { + "$ref": "#/definitions/VisualType", + "description": "宽度" + }, + "x": { + "$ref": "#/definitions/VisualType", + "description": "图形的x坐标" + }, + "x1": { + "$ref": "#/definitions/VisualType", + "description": "x方向终点坐标" + }, + "y": { + "$ref": "#/definitions/VisualType", + "description": "图形的y坐标" + }, + "y1": { + "$ref": "#/definitions/VisualType", + "description": "y方向终点坐标" + }, + "z": { + "$ref": "#/definitions/VisualType", + "description": "图形的z坐标,仅适用于3D图表" + }, + "zIndex": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染" + } + }, + "type": "object" + }, + "Partial>": { + "properties": { + "alpha": { + "$ref": "#/definitions/VisualType", + "description": "x方向的旋转角度" + }, + "anchor": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "基于AABB的锚点位置,用于简单的定位某些path的位置" + }, + "anchor3d": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "3d的锚点位置" + }, + "angle": { + "$ref": "#/definitions/VisualType", + "description": "图形的旋转角度" + }, + "background": { + "$ref": "#/definitions/VisualType", + "description": "图形的背景色,支持纯色、image元素、canvas元素" + }, + "backgroundClip": { + "$ref": "#/definitions/VisualType", + "description": "背景图是否裁切,是否调用clip避免绘制到图元外部" + }, + "backgroundCornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "背景圆角半径" + }, + "backgroundFit": { + "$ref": "#/definitions/VisualType", + "description": "是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效" + }, + "backgroundKeepAspectRatio": { + "$ref": "#/definitions/VisualType", + "description": "是否保持背景图的宽高比" + }, + "backgroundMode": { + "$ref": "#/definitions/VisualType", + "description": "背景图绘制模式(与具体图元有关)。\n原有平铺模式为:`repeat` / `repeat-x` / `repeat-y` / `no-repeat`;\n自 `2.0.21` 版本开始,支持 `no-repeat-cover` / `no-repeat-contain` /\n`no-repeat-fill` / `no-repeat-auto` 这几个 `no-repeat` 下的尺寸简写。" + }, + "backgroundOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOpacity": { + "$ref": "#/definitions/VisualType", + "description": "背景透明度" + }, + "backgroundPosition": { + "$ref": "#/definitions/VisualType", + "description": "背景图锚定位置,语义类似 CSS `background-position`。\n仅在图片背景且最终为 `no-repeat` 时生效。", + "since": "2.0.21" + }, + "backgroundScale": { + "$ref": "#/definitions/VisualType", + "description": "背景图缩放,只在no-repeat的时候生效" + }, + "beta": { + "$ref": "#/definitions/VisualType", + "description": "y方向的旋转角度" + }, + "boundsMode": { + "$ref": "#/definitions/VisualType<\"accurate\"|\"imprecise\">", + "description": "bounds的计算模式" + }, + "cursor": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的鼠标样式" + }, + "curveType": { + "$ref": "#/definitions/VisualType", + "description": "取消的差值类型,默认为线性插值,也就是普通的折线" + }, + "defined": { + "$ref": "#/definitions/VisualType", + "description": "设置点是否有效,也就是是否合法" + }, + "fill": { + "$ref": "#/definitions/VisualType>", + "description": "图形的填充颜色" + }, + "fillOpacity": { + "$ref": "#/definitions/VisualType", + "description": "填充的透明度" + }, + "html": { + "$ref": "#/definitions/VisualType>", + "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", + "since": "1.10.0" + }, + "innerBorder": { + "$ref": "#/definitions/VisualType", + "description": "内边框,内描边,描边位于图形内侧" + }, + "lineCap": { + "$ref": "#/definitions/VisualType", + "description": "指定如何绘制每一条线段末端的属性。有 3 个可能的值,分别是:'butt', 'round' and 'square'。默认值是 butt。" + }, + "lineDash": { + "$ref": "#/definitions/VisualType", + "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度" + }, + "lineDashOffset": { + "$ref": "#/definitions/VisualType", + "description": "设置虚线偏移量的属性" + }, + "lineJoin": { + "$ref": "#/definitions/VisualType", + "description": "用来设置 2 个长度不为 0 的相连部分(线段、圆弧、曲线)如何连接在一起的属性(长度为 0 的变形部分,其指定的末端和控制点在同一位置,会被忽略)。此属性有 3 个值: 'round', 'bevel' and 'miter'。默认值是 'miter'" + }, + "lineWidth": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边宽度" + }, + "miterLimit": { + "$ref": "#/definitions/VisualType", + "description": "设置斜接面限制比例的属性。当获取属性值时,会返回当前的值(默认值是 10.0 )。当给属性赋值时,0、负数、 Infinity 和 NaN 都会被忽略;除此之外都会被赋予一个新值。" + }, + "opacity": { + "$ref": "#/definitions/VisualType", + "description": "图形的透明度,既影响描边也影响填充" + }, + "outerBorder": { + "$ref": "#/definitions/VisualType", + "description": "外边框,外描边,描边位于图形外侧" + }, + "pickMode": { + "$ref": "#/definitions/VisualType<\"custom\"|\"accurate\"|\"imprecise\">", + "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式" + }, + "pickStrokeBuffer": { + "$ref": "#/definitions/VisualType", + "default": 0, + "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", + "since": "1.7.3" + }, + "scaleCenter": { + "$ref": "#/definitions/VisualType<[string|number,string|number]>", + "description": "图形缩放中心", + "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心" + }, + "scaleX": { + "$ref": "#/definitions/VisualType", + "description": "x方向的缩放比例,默认为1,即不进行缩放" + }, + "scaleY": { + "$ref": "#/definitions/VisualType", + "description": "y方向的缩放比例,默认为1,即不进行缩放" + }, + "shadowBlur": { + "$ref": "#/definitions/VisualType", + "description": "图形模糊效果程度" + }, + "shadowColor": { + "$ref": "#/definitions/VisualType", + "description": "图形的阴影颜色" + }, + "shadowOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "阴影水平偏移距离" + }, + "shadowOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "阴影垂直偏移距离" + }, + "stroke": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" + }, + "strokeBoundsBuffer": { + "$ref": "#/definitions/VisualType", + "description": "stroke 的有界缓冲区" + }, + "strokeOpacity": { + "$ref": "#/definitions/VisualType", + "description": "描边透明度" + }, + "texture": { + "$ref": "#/definitions/VisualType", + "description": "纹理的类型" + }, + "textureColor": { + "$ref": "#/definitions/VisualType", + "description": "纹理的颜色" + }, + "texturePadding": { + "$ref": "#/definitions/VisualType", + "description": "纹理之间空隙的大小" + }, + "textureSize": { + "$ref": "#/definitions/VisualType", + "description": "纹理单元的大小" + }, + "visible": { + "$ref": "#/definitions/VisualType", + "description": "图形是否可见" + }, + "x": { + "$ref": "#/definitions/VisualType", + "description": "图形的x坐标" + }, + "x1": { + "$ref": "#/definitions/VisualType", + "description": "终点x坐标" + }, + "y": { + "$ref": "#/definitions/VisualType", + "description": "图形的y坐标" + }, + "y1": { + "$ref": "#/definitions/VisualType", + "description": "终点y坐标" + }, + "z": { + "$ref": "#/definitions/VisualType", + "description": "图形的z坐标,仅适用于3D图表" + }, + "zIndex": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染" + } + }, + "type": "object" + }, + "Partial>": { + "properties": { + "alpha": { + "$ref": "#/definitions/VisualType", + "description": "x方向的旋转角度" + }, + "anchor": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "基于AABB的锚点位置,用于简单的定位某些path的位置" + }, + "anchor3d": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "3d的锚点位置" + }, + "angle": { + "$ref": "#/definitions/VisualType", + "description": "图形的旋转角度" + }, + "background": { + "$ref": "#/definitions/VisualType", + "description": "图形的背景色,支持纯色、image元素、canvas元素" + }, + "backgroundClip": { + "$ref": "#/definitions/VisualType", + "description": "背景图是否裁切,是否调用clip避免绘制到图元外部" + }, + "backgroundCornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "背景圆角半径" + }, + "backgroundFit": { + "$ref": "#/definitions/VisualType", + "description": "是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效" + }, + "backgroundKeepAspectRatio": { + "$ref": "#/definitions/VisualType", + "description": "是否保持背景图的宽高比" + }, + "backgroundMode": { + "$ref": "#/definitions/VisualType", + "description": "背景图绘制模式(与具体图元有关)。\n原有平铺模式为:`repeat` / `repeat-x` / `repeat-y` / `no-repeat`;\n自 `2.0.21` 版本开始,支持 `no-repeat-cover` / `no-repeat-contain` /\n`no-repeat-fill` / `no-repeat-auto` 这几个 `no-repeat` 下的尺寸简写。" + }, + "backgroundOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOpacity": { + "$ref": "#/definitions/VisualType", + "description": "背景透明度" + }, + "backgroundPosition": { + "$ref": "#/definitions/VisualType", + "description": "背景图锚定位置,语义类似 CSS `background-position`。\n仅在图片背景且最终为 `no-repeat` 时生效。", + "since": "2.0.21" + }, + "backgroundScale": { + "$ref": "#/definitions/VisualType", + "description": "背景图缩放,只在no-repeat的时候生效" + }, + "beta": { + "$ref": "#/definitions/VisualType", + "description": "y方向的旋转角度" + }, + "boundsMode": { + "$ref": "#/definitions/VisualType<\"accurate\"|\"imprecise\">", + "description": "bounds的计算模式" + }, + "cursor": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的鼠标样式" + }, + "dx": { + "$ref": "#/definitions/VisualType", + "description": "x方向的偏移量" + }, + "dy": { + "$ref": "#/definitions/VisualType", + "description": "y方向的偏移量" + }, + "fill": { + "$ref": "#/definitions/VisualType>", + "description": "图形的填充颜色" + }, + "fillOpacity": { + "$ref": "#/definitions/VisualType", + "description": "填充的透明度" + }, + "html": { + "$ref": "#/definitions/VisualType>", + "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", + "since": "1.10.0" + }, + "innerBorder": { + "$ref": "#/definitions/VisualType", + "description": "内边框,内描边,描边位于图形内侧" + }, + "lineDash": { + "$ref": "#/definitions/VisualType", + "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度" + }, + "lineDashOffset": { + "$ref": "#/definitions/VisualType", + "description": "设置虚线偏移量的属性" + }, + "lineWidth": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边宽度" + }, + "opacity": { + "$ref": "#/definitions/VisualType", + "description": "图形的透明度,既影响描边也影响填充" + }, + "outerBorder": { + "$ref": "#/definitions/VisualType", + "description": "外边框,外描边,描边位于图形外侧" + }, + "pickMode": { + "$ref": "#/definitions/VisualType<\"custom\"|\"accurate\"|\"imprecise\">", + "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式" + }, + "pickStrokeBuffer": { + "$ref": "#/definitions/VisualType", + "default": 0, + "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", + "since": "1.7.3" + }, + "scaleCenter": { + "$ref": "#/definitions/VisualType<[string|number,string|number]>", + "description": "图形缩放中心", + "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心" + }, + "scaleX": { + "$ref": "#/definitions/VisualType", + "description": "x方向的缩放比例,默认为1,即不进行缩放" + }, + "scaleY": { + "$ref": "#/definitions/VisualType", + "description": "y方向的缩放比例,默认为1,即不进行缩放" + }, + "shadowBlur": { + "$ref": "#/definitions/VisualType", + "description": "图形模糊效果程度" + }, + "shadowColor": { + "$ref": "#/definitions/VisualType", + "description": "图形的阴影颜色" + }, + "shadowOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "阴影水平偏移距离" + }, + "shadowOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "阴影垂直偏移距离" + }, + "shape": { + "$ref": "#/definitions/VisualType", + "description": "对外声明使用shape,vrender图形属性对应的是shape" + }, + "size": { + "$ref": "#/definitions/VisualType", + "description": "大小,相当于外接圆的半径" + }, + "stroke": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" + }, + "strokeOpacity": { + "$ref": "#/definitions/VisualType", + "description": "描边透明度" + }, + "symbolType": { + "$ref": "#/definitions/VisualType", + "description": "标记的类型\nFIXME: vrender Symbol接收的图形属性,暂时都申明一下" + }, + "texture": { + "$ref": "#/definitions/VisualType", + "description": "纹理的类型" + }, + "textureColor": { + "$ref": "#/definitions/VisualType", + "description": "纹理的颜色" + }, + "texturePadding": { + "$ref": "#/definitions/VisualType", + "description": "纹理之间空隙的大小" + }, + "textureSize": { + "$ref": "#/definitions/VisualType", + "description": "纹理单元的大小" + }, + "visible": { + "$ref": "#/definitions/VisualType", + "description": "图形是否可见" + }, + "x": { + "$ref": "#/definitions/VisualType", + "description": "图形的x坐标" + }, + "y": { + "$ref": "#/definitions/VisualType", + "description": "图形的y坐标" + }, + "z": { + "$ref": "#/definitions/VisualType", + "description": "图形的z坐标,仅适用于3D图表" + }, + "zIndex": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染" + } + }, + "type": "object" + }, + "Partial>": { + "properties": { + "alpha": { + "$ref": "#/definitions/VisualType", + "description": "x方向的旋转角度" + }, + "anchor": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "基于AABB的锚点位置,用于简单的定位某些path的位置" + }, + "anchor3d": { + "$ref": "#/definitions/VisualType<[number,number]>", + "description": "3d的锚点位置" + }, + "angle": { + "$ref": "#/definitions/VisualType", + "description": "图形的旋转角度" + }, + "background": { + "$ref": "#/definitions/VisualType", + "description": "图形的背景色,支持纯色、image元素、canvas元素" + }, + "backgroundClip": { + "$ref": "#/definitions/VisualType", + "description": "背景图是否裁切,是否调用clip避免绘制到图元外部" + }, + "backgroundCornerRadius": { + "$ref": "#/definitions/VisualType", + "description": "背景圆角半径" + }, + "backgroundFit": { + "$ref": "#/definitions/VisualType", + "description": "是否正好填充,只在repeat-x或者repeat-y以及no-repeat的时候生效" + }, + "backgroundKeepAspectRatio": { + "$ref": "#/definitions/VisualType", + "description": "是否保持背景图的宽高比" + }, + "backgroundMode": { + "$ref": "#/definitions/VisualType", + "description": "背景图绘制模式(与具体图元有关)。\n原有平铺模式为:`repeat` / `repeat-x` / `repeat-y` / `no-repeat`;\n自 `2.0.21` 版本开始,支持 `no-repeat-cover` / `no-repeat-contain` /\n`no-repeat-fill` / `no-repeat-auto` 这几个 `no-repeat` 下的尺寸简写。" + }, + "backgroundOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "背景图偏移,只在no-repeat的时候生效" + }, + "backgroundOpacity": { + "$ref": "#/definitions/VisualType", + "description": "背景透明度" + }, + "backgroundPosition": { + "$ref": "#/definitions/VisualType", + "description": "背景图锚定位置,语义类似 CSS `background-position`。\n仅在图片背景且最终为 `no-repeat` 时生效。", + "since": "2.0.21" + }, + "backgroundScale": { + "$ref": "#/definitions/VisualType", + "description": "背景图缩放,只在no-repeat的时候生效" + }, + "beta": { + "$ref": "#/definitions/VisualType", + "description": "y方向的旋转角度" + }, + "boundsMode": { + "$ref": "#/definitions/VisualType<\"accurate\"|\"imprecise\">", + "description": "bounds的计算模式" + }, + "cursor": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的鼠标样式" + }, + "direction": { + "$ref": "#/definitions/VisualType<\"horizontal\"|\"vertical\">", + "default": "'horizontal'", + "description": "文本的排布方向,如果需要文本纵向排布,可以配置为 'vertical'" + }, + "dx": { + "$ref": "#/definitions/VisualType", + "description": "x 方向偏移" + }, + "dy": { + "$ref": "#/definitions/VisualType", + "description": "y 方向偏移" + }, + "ellipsis": { + "$ref": "#/definitions/VisualType", + "description": "文字超出 maxLineWidth 后的省略符" + }, + "fill": { + "$ref": "#/definitions/VisualType>", + "description": "图形的填充颜色" + }, + "fillOpacity": { + "$ref": "#/definitions/VisualType", + "description": "填充的透明度" + }, + "fontFamily": { + "$ref": "#/definitions/VisualType", + "description": "字体" + }, + "fontSize": { + "$ref": "#/definitions/VisualType>", + "description": "字号" + }, + "fontStyle": { + "$ref": "#/definitions/VisualType", + "description": "字体样式,是否为斜体等" + }, + "fontWeight": { + "$ref": "#/definitions/VisualType", + "description": "字重" + }, + "heightLimit": { + "$ref": "#/definitions/VisualType", + "description": "高度限制控制显示内容及省略号" + }, + "html": { + "$ref": "#/definitions/VisualType>", + "description": "html 浮层,会将配置的html相关内容,绝对定位到图元的位置", + "since": "1.10.0" + }, + "innerBorder": { + "$ref": "#/definitions/VisualType", + "description": "内边框,内描边,描边位于图形内侧" + }, + "lineClamp": { + "$ref": "#/definitions/VisualType", + "description": "按照行数限制显示内容及省略号" + }, + "lineDash": { + "$ref": "#/definitions/VisualType", + "description": "给描边配置虚线模式。它使用一组值来指定描述模式的线和间隙的交替长度" + }, + "lineDashOffset": { + "$ref": "#/definitions/VisualType", + "description": "设置虚线偏移量的属性" + }, + "lineHeight": { + "$ref": "#/definitions/VisualType>", + "description": "行高(1.3.1 版本新增字符串类型表示比例值,如\"150%\")", + "since": "1.3.1" + }, + "lineThrough": { + "$ref": "#/definitions/VisualType", + "description": "中划线" + }, + "lineWidth": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边宽度" + }, + "maxLineWidth": { + "$ref": "#/definitions/VisualType", + "description": "文字的最大长度" + }, + "opacity": { + "$ref": "#/definitions/VisualType", + "description": "图形的透明度,既影响描边也影响填充" + }, + "outerBorder": { + "$ref": "#/definitions/VisualType", + "description": "外边框,外描边,描边位于图形外侧" + }, + "pickMode": { + "$ref": "#/definitions/VisualType<\"custom\"|\"accurate\"|\"imprecise\">", + "description": "选择模式,精确模式,粗糙模式(包围盒模式),自定义模式" + }, + "pickStrokeBuffer": { + "$ref": "#/definitions/VisualType", + "default": 0, + "description": "用于扩展描边的拾取范围,为 0 就是默认线宽,正数就加宽,负数就减宽", + "since": "1.7.3" + }, + "poptip": { + "$ref": "#/definitions/VisualType", + "description": "poptip 相关配置" + }, + "scaleCenter": { + "$ref": "#/definitions/VisualType<[string|number,string|number]>", + "description": "图形缩放中心", + "since": "1.4.0\n可以配置固定坐标,例如 [100, 100];或者百分比坐标,例如 ['50%', '50%'],代表以图元中心为缩放中心" + }, + "scaleX": { + "$ref": "#/definitions/VisualType", + "description": "x方向的缩放比例,默认为1,即不进行缩放" + }, + "scaleY": { + "$ref": "#/definitions/VisualType", + "description": "y方向的缩放比例,默认为1,即不进行缩放" + }, + "shadowBlur": { + "$ref": "#/definitions/VisualType", + "description": "图形模糊效果程度" + }, + "shadowColor": { + "$ref": "#/definitions/VisualType", + "description": "图形的阴影颜色" + }, + "shadowOffsetX": { + "$ref": "#/definitions/VisualType", + "description": "阴影水平偏移距离" + }, + "shadowOffsetY": { + "$ref": "#/definitions/VisualType", + "description": "阴影垂直偏移距离" + }, + "stroke": { + "$ref": "#/definitions/VisualType", + "description": "图形的描边颜色。\n支持使用 'rgb(255,255,255)','rgba(255,255,255,1)','#fff' 等方式设置为纯色,也支持设置为渐变色描边" + }, + "strokeOpacity": { + "$ref": "#/definitions/VisualType", + "description": "描边透明度" + }, + "suffixPosition": { + "$ref": "#/definitions/VisualType<\"end\"|\"start\"|\"middle\">", + "default": "'end'", + "description": "文本省略的位置,默认尾部省略\n1. 'start' 文字首部省略\n2. 'middle' 文本中间省略\n3. 'end' 文本尾部省略", + "since": "1.7.3" + }, + "text": { + "$ref": "#/definitions/VisualType", + "description": "文字内容" + }, + "textAlign": { + "$ref": "#/definitions/VisualType", + "description": "文字水平方向的对齐方式" + }, + "textBaseline": { + "$ref": "#/definitions/VisualType", + "description": "文字竖直方向的对齐方式" + }, + "texture": { + "$ref": "#/definitions/VisualType", + "description": "纹理的类型" + }, + "textureColor": { + "$ref": "#/definitions/VisualType", + "description": "纹理的颜色" + }, + "texturePadding": { + "$ref": "#/definitions/VisualType", + "description": "纹理之间空隙的大小" + }, + "textureSize": { + "$ref": "#/definitions/VisualType", + "description": "纹理单元的大小" + }, + "underline": { + "$ref": "#/definitions/VisualType", + "description": "下划线" + }, + "underlineDash": { + "$ref": "#/definitions/VisualType", + "description": "下划线的虚线样式" + }, + "underlineOffset": { + "$ref": "#/definitions/VisualType", + "description": "下划线的虚线偏移量" + }, + "visible": { + "$ref": "#/definitions/VisualType", + "description": "图形是否可见" + }, + "whiteSpace": { + "$ref": "#/definitions/VisualType<\"normal\"|\"no-wrap\">", + "description": "设置如何处理空白字符" + }, + "wordBreak": { + "$ref": "#/definitions/VisualType<\"break-word\"|\"break-all\"|\"keep-all\">" + }, + "x": { + "$ref": "#/definitions/VisualType", + "description": "图形的x坐标" + }, + "y": { + "$ref": "#/definitions/VisualType", + "description": "图形的y坐标" + }, + "z": { + "$ref": "#/definitions/VisualType", + "description": "图形的z坐标,仅适用于3D图表" + }, + "zIndex": { + "$ref": "#/definitions/VisualType", + "description": "设置图形的层级,主意这个是相对层级,图形引擎绘制的时候,会对相同group下的所有图形根据zIndex进行排序,然后从小到大进行渲染" + } + }, + "type": "object" + }, + "Partial>": { + "type": "object" + }, "Partial": { "properties": { "_debug_bounds": { @@ -94233,11 +95423,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/IArcMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94254,11 +95444,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/IAreaMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94275,11 +95465,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/IBoxPlotMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94296,11 +95486,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/ILineMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94317,11 +95507,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/ILiquidMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94346,11 +95536,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/IPathMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94371,11 +95561,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/IPathMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94392,11 +95582,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/IPolygonMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94413,11 +95603,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/IRectMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94464,16 +95654,16 @@ "type": "number" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>|Partial>>", "description": "不同状态下的样式配置" }, "style": { "anyOf": [ { - "$ref": "#/definitions/IRectMarkSpec" + "$ref": "#/definitions/Partial>" }, { - "$ref": "#/definitions/IPathMarkSpec" + "$ref": "#/definitions/Partial>" } ], "description": "默认样式设置" @@ -94503,11 +95693,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/IRuleMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94524,11 +95714,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/ISymbolMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94551,11 +95741,11 @@ "$ref": "#/definitions/IWaterfallStackLabelPosition" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/ITextMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94580,11 +95770,11 @@ "type": "string" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/ITextMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94614,11 +95804,11 @@ ] }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/ITextMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94635,11 +95825,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { - "$ref": "#/definitions/ITextMarkSpec", + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -94656,7 +95846,7 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme>", + "$ref": "#/definitions/IMarkStateTheme>>>", "description": "不同状态下的样式配置" }, "style": { @@ -94681,10 +95871,11 @@ "type": "boolean" }, "state": { - "$ref": "#/definitions/IMarkStateTheme", + "$ref": "#/definitions/IMarkStateTheme>>", "description": "不同状态下的样式配置" }, "style": { + "$ref": "#/definitions/Partial>", "description": "默认样式设置" }, "visible": { @@ -104195,34 +105386,34 @@ }, "Promise": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" } }, "required": [ - "__@toStringTag@12845" + "__@toStringTag@12851" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" } }, "required": [ - "__@toStringTag@12845" + "__@toStringTag@12851" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" } }, "required": [ - "__@toStringTag@12845" + "__@toStringTag@12851" ], "type": "object" }, @@ -118052,7 +119243,7 @@ }, "Set>>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -118060,14 +119251,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Set>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -118075,14 +119266,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Set>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -118090,14 +119281,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Set>>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -118105,14 +119296,14 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" }, "Set>": { "properties": { - "__@toStringTag@12845": { + "__@toStringTag@12851": { "type": "string" }, "size": { @@ -118120,7 +119311,7 @@ } }, "required": [ - "__@toStringTag@12845", + "__@toStringTag@12851", "size" ], "type": "object" diff --git a/packages/vchart-types/package.json b/packages/vchart-types/package.json index 66ca4734be..6793aa39ba 100644 --- a/packages/vchart-types/package.json +++ b/packages/vchart-types/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-types", - "version": "2.1.3", + "version": "2.1.4", "description": "Provide the type declarations of VChart.", "sideEffects": false, "main": "types/index.d.ts", diff --git a/packages/vchart-types/types/component/axis/cartesian/axis.d.ts b/packages/vchart-types/types/component/axis/cartesian/axis.d.ts index 166119a2ed..6f9239b5b8 100644 --- a/packages/vchart-types/types/component/axis/cartesian/axis.d.ts +++ b/packages/vchart-types/types/component/axis/cartesian/axis.d.ts @@ -15,6 +15,14 @@ import type { ICartesianTickDataOpt } from '@visactor/vrender-components'; import type { DataSet } from '@visactor/vdataset'; import { AxisComponent } from '../base-axis'; import type { IGraphic } from '@visactor/vrender-core'; +type ContinuousBarBandwidthCache = { + scale: IBaseScale; + domainStart: number; + domainEnd: number; + rangeStart: number; + rangeEnd: number; + bandWidth: number; +}; export declare abstract class CartesianAxis extends AxisComponent implements IAxis { static type: ComponentTypeEnum; type: ComponentTypeEnum; @@ -28,6 +36,7 @@ export declare abstract class CartesianAxis void; + protected _getContinuousBarBandwidth(depth?: number): number; afterCompile(): void; protected collectScale(): IBaseScale[]; protected collectSeriesField(depth: number, series: ICartesianSeries): string | string[]; @@ -104,3 +115,4 @@ export declare abstract class CartesianAxis number; valueToPosition?: (value: any, cfg?: IAxisLocationCfg) => number; getScale?: (depth: number) => IBaseScale; - getBandwidth?: (depth: number) => number; + getBandwidth?: (depth: number) => number | undefined; setExtendDomain?: (key: string, value: number | undefined) => void; getAxisType: () => string; getAxisId: () => number; diff --git a/packages/vchart-types/types/series/bar/bar.d.ts b/packages/vchart-types/types/series/bar/bar.d.ts index 0fece56737..5aee2bd706 100644 --- a/packages/vchart-types/types/series/bar/bar.d.ts +++ b/packages/vchart-types/types/series/bar/bar.d.ts @@ -26,6 +26,10 @@ export declare class BarSeries extend protected _barBackgroundMark: IRectMark; protected _barBackgroundViewData: ICompilableData; protected _getSpecUpdatePolicy(): ISeriesSpecUpdatePolicy; + getStatisticFields(): { + key: string; + operations: import("../../data/transforms/interface").StatisticOperations; + }[]; initMark(): void; protected _initBarBackgroundMark(): void; initMarkStyle(): void; diff --git a/packages/vchart-types/types/series/treemap/interface.d.ts b/packages/vchart-types/types/series/treemap/interface.d.ts index 3a4688b228..fc090ce1a5 100644 --- a/packages/vchart-types/types/series/treemap/interface.d.ts +++ b/packages/vchart-types/types/series/treemap/interface.d.ts @@ -31,7 +31,7 @@ export interface ITreemapSeriesSpec extends Omit, IAnimatio padding?: TreemapOptions['labelPadding']; }; } -export interface ITreemapSeriesTheme extends ICartesianSeriesTheme { +export interface ITreemapSeriesTheme extends Omit { gapWidth?: TreemapOptions['padding']; nodePadding?: TreemapOptions['padding']; [SeriesMarkNameEnum.leaf]?: Partial>; diff --git a/packages/vchart-types/types/typings/spec/common.d.ts b/packages/vchart-types/types/typings/spec/common.d.ts index 4c41e78421..67f3ae7b56 100644 --- a/packages/vchart-types/types/typings/spec/common.d.ts +++ b/packages/vchart-types/types/typings/spec/common.d.ts @@ -221,10 +221,11 @@ export interface IMarkStateTheme extends Record { selected?: T; selected_reverse?: T; } +type ConvertToThemeMarkStyleSpec = T extends Record ? Partial> : never; export type IMarkTheme = { visible?: boolean; - style?: T; - state?: IMarkStateTheme; + style?: ConvertToThemeMarkStyleSpec; + state?: IMarkStateTheme>; interactive?: boolean; }; export interface IPerformanceHook { @@ -310,3 +311,4 @@ export type IRichTextFormatMethod = (...args: T) => { text: IRichTextCharacter[]; } | IRichTextCharacter[]; export type IFormatMethod = (...args: T) => ReturnType> | ReturnType>; +export {}; diff --git a/packages/vchart-types/types/util/spec/transform.d.ts b/packages/vchart-types/types/util/spec/transform.d.ts index 417a8aff1e..dc01ee99c9 100644 --- a/packages/vchart-types/types/util/spec/transform.d.ts +++ b/packages/vchart-types/types/util/spec/transform.d.ts @@ -1,6 +1,9 @@ -import type { ISeriesSpec } from '../../typings'; +interface IFunctionTransformRegistry { + getFunction: (key: string) => unknown; +} export declare function specTransform(spec: unknown, special?: { [key: string]: (v: unknown) => unknown; }): unknown; -export declare function functionTransform(spec: ISeriesSpec, VChart: any): any; +export declare function functionTransform(value: unknown, registry: IFunctionTransformRegistry): any; export declare function transformFunctionAttribute(att: unknown, ...args: unknown[]): any; +export {}; diff --git a/packages/vchart/CHANGELOG.json b/packages/vchart/CHANGELOG.json index 8ff538c5f8..0910c48d06 100644 --- a/packages/vchart/CHANGELOG.json +++ b/packages/vchart/CHANGELOG.json @@ -1,6 +1,26 @@ { "name": "@visactor/vchart", "entries": [ + { + "version": "2.1.4", + "tag": "@visactor/vchart_v2.1.4", + "date": "Thu, 16 Jul 2026 09:04:49 GMT", + "comments": { + "minor": [ + { + "comment": "feat: support automatic bar width for linear x axis" + }, + { + "comment": "feat: support theming conversion funnel arrow (line / symbol / text) via series.funnel.conversionArrow theme token" + } + ], + "patch": [ + { + "comment": "fix: restore existing axis grid graphics when grid visibility is enabled again through updateSpec with animation disabled" + } + ] + } + }, { "version": "2.1.2", "tag": "@visactor/vchart_v2.1.2", diff --git a/packages/vchart/CHANGELOG.md b/packages/vchart/CHANGELOG.md index d9196b222b..87130730a6 100644 --- a/packages/vchart/CHANGELOG.md +++ b/packages/vchart/CHANGELOG.md @@ -1,6 +1,18 @@ # Change Log - @visactor/vchart -This log was last generated on Wed, 08 Jul 2026 08:25:01 GMT and should not be manually modified. +This log was last generated on Thu, 16 Jul 2026 09:04:49 GMT and should not be manually modified. + +## 2.1.4 +Thu, 16 Jul 2026 09:04:49 GMT + +### Minor changes + +- feat: support automatic bar width for linear x axis +- feat: support theming conversion funnel arrow (line / symbol / text) via series.funnel.conversionArrow theme token + +### Patches + +- fix: restore existing axis grid graphics when grid visibility is enabled again through updateSpec with animation disabled ## 2.1.2 Wed, 08 Jul 2026 08:25:01 GMT diff --git a/packages/vchart/dist/index-wx-simple.min.js b/packages/vchart/dist/index-wx-simple.min.js index c5f480f8b5..4a2ab7fb96 100644 --- a/packages/vchart/dist/index-wx-simple.min.js +++ b/packages/vchart/dist/index-wx-simple.min.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);st;var s,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(s=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",s["mobile-browser"]="mobile-browser",s.node="node",s.worker="worker",s.miniApp="miniApp",s.wx="wx",s.tt="tt",s.harmony="harmony",s["desktop-miniApp"]="desktop-miniApp",s.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);sObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var u=t=>"function"==typeof t;var d=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var C=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const k=Object.prototype;var M=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||k)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(M(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const n=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function I(t,e,i){let n;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const s=_(t),r=t.length;n=s?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=s?void 0:Object.keys(Object(t));let o=-1;if(n)for(;++o<(a||t).length;){const s=a?a[o]:o,r=t[s];i&&i.includes(s.toString())?n[s]=r:n[s]=I(r,e,i)}return n}function D(t,e,i=!1,n=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),r=[];for(const t in s)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(s[a])||"object"!=typeof s[a]||n&&_(t[a])?F(t,a,s[a]):L(t,e,a,i,n)}}}}function L(t,e,i,n=!1,s=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(n)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const s=t[n];let r=!1;e.forEach((t=>{(y(t)&&t===n||t instanceof RegExp&&n.match(t))&&(r=!0)})),r||(i[n]=s)})),i}function j(t){return Object.prototype.toString.call(t)}function z(t){return Object.keys(t)}function W(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(j(t)!==j(e))return!1;if(u(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let n=t.length-1;n>=0;n--)if(!W(t[n],e[n],i))return!1;return!0}if(!m(t))return!1;const n=z(t),s=z(e);if(n.length!==s.length)return!1;n.sort(),s.sort();for(let t=n.length-1;t>=0;t--)if(n[t]!=s[t])return!1;for(let s=n.length-1;s>=0;s--){const r=n[s];if(!W(t[r],e[r],i))return!1}return!0}function H(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s{var i;if(0===t.length)return;let n=t[0];for(let s=1;s0&&(n=r)}return n},K=(t,e)=>{var i;if(0===t.length)return;let n=t[0];for(let s=1;se?1:t>=e?0:NaN}function J(t){return Number(t)}const Q="undefined"!=typeof console;function et(t,e,i){const n=[e].concat([].slice.call(i));Q&&console[t].apply(console,n)}var it;!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"}(it||(it={}));class nt{static getInstance(t,e){return nt._instance&&S(t)?nt._instance.level(t):nt._instance||(nt._instance=new nt(t,e)),nt._instance}static setInstance(t){return nt._instance=t}static setInstanceLevel(t){nt._instance?nt._instance.level(t):nt._instance=new nt(t)}static clearInstance(){nt._instance=null}constructor(t=it.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=it.Info}canLogDebug(){return this._level>=it.Debug}canLogError(){return this._level>=it.Error}canLogWarn(){return this._level>=it.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=it.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):et(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=it.Warn&&et(this._method||"warn","WARN",t),this}info(...t){return this._level>=it.Info&&et(this._method||"log","INFO",t),this}debug(...t){return this._level>=it.Debug&&et(this._method||"log","DEBUG",t),this}}function st(t,e,i=0,n){for(d(n)&&(n=t.length);i>>1;Z(t[s],e)>0?n=s:i=s+1}return i}nt._instance=null;const rt=1e-10,at=1e-10;function ot(t,e,i=at,n=rt){const s=n,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(s,r)}function lt(t,e,i,n){return t>e&&!ot(t,e,i,n)}function ht(t,e,i,n){return t{let e=null,i=null;return(...n)=>(e&&n.every(((t,i)=>t===e[i]))||(e=n,i=t(...n)),i)};var ut=function(t,e,i){return ti?i:t};var dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function pt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let gt=!1;try{gt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){gt=!1}function ft(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,d=!0;const p=!e&&0!==e&>if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function _(t){return o=void 0,d&&n?f(t):(n=s=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(n=t,s=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(u)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,u="maxWait"in i,u&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),d="trailing"in i?!!i.trailing:d),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,n=l=s=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function mt(t,e,i){let n=!0,s=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),ft(t,e,{leading:n,trailing:s,maxWait:e})}function vt(t,e){return i=>t*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}gt=!1;const _t=1e-12,bt=Math.PI,xt=bt/2,St=2*bt,At=2*Math.PI,Ct=Math.abs,wt=Math.atan2,Tt=Math.cos,kt=Math.max,Mt=Math.min,Bt=Math.sin,Et=Math.sqrt,Pt=Math.pow;function Ot(t){return t>=1?xt:t<=-1?-xt:Math.asin(t)}function Rt(t,e,i,n,s){let r=i,a=n;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function It(t,e){return t[0]*e[1]-t[1]*e[0]}function Dt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Lt(t,e){return function(t,e=10){return Math.round(t*e)/e}(t-e,10**Math.max(Dt(t),Dt(e)))}class Ft{constructor(t=0,e=0,i,n){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ft(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 Ut{static distancePP(t,e){return Et(Pt(t.x-e.x,2)+Pt(t.y-e.y,2))}static distanceNN(t,e,i,n){return Et(Pt(t-i,2)+Pt(e-n,2))}static distancePN(t,e,i){return Et(Pt(e-t.x,2)+Pt(i-t.y,2))}static pointAtPP(t,e,i){return new Ft((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t){return t*(Math.PI/180)}const jt=(t=0)=>{if(t<0)for(;t<-St;)t+=St;else if(t>0)for(;t>St;)t-=St;return t};function zt(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 Wt(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Ht(t,e,i,n){const{x:s,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const n=Wt(Math.min(t,e)),s=n+i,r=[n,s];let a=Math.floor(n/Math.PI)*Math.PI/2;for(;an&&r.push(a),a+=Math.PI/2;return r}(i,n),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-s):-1===i?h.push(s):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-s)/i)):h.push(Math.abs(s/i)))})),Math.min.apply(null,h)}function Vt(t){return(t=Wt(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 Gt(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function Yt(t,e,i,n){if(!function(t,e,i,n){let s=t[0],r=e[0],a=i[0],o=n[0];return r=0&&h<=1&&[t[0]+s[0]*h,t[1]+s[1]*h]}var Xt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Xt||(Xt={}));const Kt=(t,e,i)=>{let n=t.x1,s=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(n>s&&([n,s]=[s,n]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function $t(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2e.y2||t.y2l||sc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let n=e.x1,s=e.x2,r=e.y1,a=e.y2;return n>s&&([n,s]=[s,n]),r>a&&([r,a]=[a,r]),t.x>=n&&t.x<=s&&t.y>=r&&t.y<=a}function Zt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Jt({x:t,y:e},i,n={x:0,y:0}){return{x:(t-n.x)*Math.cos(i)-(e-n.y)*Math.sin(i)+n.x,y:(t-n.x)*Math.sin(i)+(e-n.y)*Math.cos(i)+n.y}}function Qt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function te(t,e){const i=e?Nt(t.angle):t.angle,n=Qt(t);return[Jt({x:t.x1,y:t.y1},i,n),Jt({x:t.x2,y:t.y1},i,n),Jt({x:t.x2,y:t.y2},i,n),Jt({x:t.x1,y:t.y2},i,n)]}function ee(t,e,i=!1){const n=te(t,i),s=te(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Qt(t),Qt(e)),o=r(n[0],n[1]),l=r(n[1],n[2]),h=r(s[0],s[1]),c=r(s[1],s[2]),u=i?Nt(t.angle):t.angle;let d=i?Nt(90-t.angle):t.angle+xt;const p=i?Nt(e.angle):e.angle;let g=i?Nt(90-e.angle):e.angle+xt;d>At&&(d-=At),g>At&&(g-=At);const f=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Zt(s,i)+Zt(s,n))/2>Zt(s,a)};return f((t.x2-t.x1)/2,u,h,c)&&f((t.y2-t.y1)/2,d,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}function ie(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}const ne=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};function se(t,e={},i){i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class re{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=se(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:u,textBaseline:d=(null!=u?u:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:d,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:n,lineHeight:s}=this.textSpec;return{width:i.width,height:null!==(e=s)&&void 0!==e?e:n,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=s)&&void 0!==i?i:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(re.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/re.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(re.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(re.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/re.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}re.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",re.NUMBERS_CHAR_SET="0123456789",re.FULL_SIZE_CHAR="字";const ae=(t,e)=>{const{x1:i,x2:n,y1:s,y2:r}=t,a=Math.abs(n-i),o=Math.abs(r-s);let l=(i+n)/2,h=(s+r)/2,c=0,u=0;switch(e){case"top":case"inside-top":u=-.5;break;case"bottom":case"inside-bottom":u=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,u=-.5;break;case"top-left":c=-.5,u=-.5;break;case"bottom-right":c=.5,u=.5;break;case"bottom-left":c=-.5,u=.5}return l+=c*a,h+=u*o,{x:l,y:h}},oe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),le=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function n(t,e,i){const n=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...n),max:Math.max(...n)}}let s=0;for(const r of i){const i=n(t,r.x,r.y),a=n(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(t=0,e=0,i=0,n=0){const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return he(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class ue extends ce{}class de extends ce{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return ee(this,t)}setValue(t=0,e=0,i=0,n=0,s=0){return super.setValue(t,e,i,n),this.angle=s,this}clone(){return new de(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Jt({x:this.x1,y:this.y1},this.angle,t),Jt({x:this.x2,y:this.y1},this.angle,t),Jt({x:this.x1,y:this.y2},this.angle,t),Jt({x:this.x2,y:this.y2},this.angle,t)]}}class pe{constructor(t=1,e=0,i=0,n=1,s=0,r=0){this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new pe,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,u=n*this.e-s*this.f+r,d=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,u=o*t+h*e,d=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new pe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,u=-s/l,d=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*u+p,e.y=f*c+m*d+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new pe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=180*r.rotateDeg/Math.PI,r}}class ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:s=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=s)););if(in;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>i;)t.timestamp.shift()}}function fe(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function me(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const ve=/^#([0-9a-f]{3,8})$/,ye={transparent:4294967040},_e={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function be(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function xe(t){return S(t)?new Te(t>>16,t>>8&255,255&t,1):_(t)?new Te(t[0],t[1],t[2]):new Te(255,255,255)}function Se(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ae(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Ce=(t,e)=>{const i=ve.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Te((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?xe(t):8===e?new Te(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class we{static Brighter(t,e=1){return 1===e?t:new we(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new we(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof we?t:new we(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(ye[t]))return function(t){return S(t)?new Te(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new Te(t[0],t[1],t[2],t[3]):new Te(255,255,255,1)}(ye[t]);if(p(_e[t]))return xe(_e[t]);const e=`${t}`.trim().toLowerCase(),i=Ce(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Te(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=fe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Te(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=we.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Te(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}add(t){const{r:e,g:i,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=me(this.color.r,this.color.g,this.color.b),r=fe(d(t)?s.h:ut(t,0,360),d(e)?s.s:e>=0&&e<=1?100*e:e,d(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new Te(r.r,r.g,r.b,n),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Ce(e,!0);return null!=i?i:this}setColorName(t){const e=_e[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let n,s,r;return n=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),s=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*s+.0722*r}clone(){return new we(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Se(t.color.r),this.color.g=Se(t.color.g),this.color.b=Se(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Ae(t.color.r),this.color.g=Ae(t.color.g),this.color.b=Ae(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Te{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${be(this.r)+be(this.g)+be(this.b)+(1===this.opacity?"":be(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=me(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ke(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),u=Math.round(a*(1-t)+o*t);return new Te(e,c,u,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:me});function Be(t){if(A(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Ee(t,e=0,i=0){if(!t)return{width:e,height:i};let n;try{n=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){n=()=>({})}const s=n(t);if(/^(\d*\.?\d+)(px)$/.exec(s.width)){const n=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,r=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:n<=0?e:n,height:r<=0?i:r}}return{width:e,height:i}}const Pe=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();class Oe{static getInstance(){return Oe.instance||(Oe.instance=new Oe),Oe.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1},this.parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1},this.parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1},this.parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1},this.parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(r=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++r1?s[0]+s.slice(2):s,+i.slice(n+1)]}let Ie;function De(t,e){const i=Re(t,e);if(!i)return t+"";const n=i[0],s=i[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}class Le{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Fe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ue(t){let e;if(e=Fe.exec(t))return new Le({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]});nt.getInstance().error("invalid format: "+t)}const Ne=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class je{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,n){let s=t.length;const r=[];let a=0,o=e[0],l=0;for(;s>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),r.push(t.substring(s-=o,s+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return je.instance||(je.instance=new je),je.instance}newFormat(t){const e=Ue(t);let i=e.fill,n=e.align;const s=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,u=e.type;"n"===u?(l=!0,u="g"):ze[u]||(void 0===h&&(h=12),c=!0,u="g"),(a||"0"===i&&"="===n)&&(a=!0,i="0",n="=");const d="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(u)?"0"+u.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(u)?this.percent:"",g=ze[u],f=/[defgprstz%]/.test(u);h=void 0===h?6:/[gprs]/.test(u)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=d,A=p,C=t;if("c"===u)A=g(C)+A,C="";else{C=+C;let t=C<0||1/C<0;if(C=isNaN(C)?m:g(Math.abs(C),h),c&&(C=function(t){const e=t.length;let i,n=-1;t:for(let s=1;s0&&(n=0)}return n>0?t.slice(0,n)+t.slice(i+1):t}(C)),t&&0==+C&&"+"!==s&&(t=!1),S=(t?"("===s?s:v:"-"===s||"("===s?"":s)+S,A=("s"===u?Ne[8+Ie/3]:"")+A+(t&&"("===s?")":""),f)for(e=-1,r=C.length;++ex||x>57){A=(46===x?y+C.slice(e+1):C.slice(e))+A,C=C.slice(0,e);break}}l&&!a&&(C=_(C,1/0));let w=S.length+C.length+A.length,T=w>1)+S+C+A+T.slice(w);break;default:C=T+S+C+A}return b(C)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Ue(t);i.type="f";const n=this.newFormat(i.toString()),s=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=Re(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-s),a=Ne[8+s/3];return function(t){return n(r*t)+a}}}const ze={"%":(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)=>De(100*t,e),r:De,s:function(t,e){const i=Re(t,e);if(!i)return t+"";const n=i[0],s=i[1],r=s-(Ie=3*Math.max(-8,Math.min(8,Math.floor(s/3))))+1,a=n.length;return r===a?n:r>a?n+new Array(r-a+1).join("0"):r>0?n.slice(0,r)+"."+n.slice(r):"0."+new Array(1-r).join("0")+Re(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};const We=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},He=function(t,...e){return function(t,...e){t||(t={});let i=-1;const n=e.length;for(;++i{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},Ke=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(l.sort&&(A(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(n=l.domain)||void 0===n?void 0:n.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let n=0;n9999?"+"+Qe(e,6):Qe(e,4))+"-"+Qe(t.getUTCMonth()+1,2)+"-"+Qe(t.getUTCDate(),2)+(r?"T"+Qe(i,2)+":"+Qe(n,2)+":"+Qe(s,2)+"."+Qe(r,3)+"Z":s?"T"+Qe(i,2)+":"+Qe(n,2)+":"+Qe(s,2)+"Z":n||i?"T"+Qe(i,2)+":"+Qe(n,2)+"Z":"")}function ei(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return qe;if(h)return h=!1,$e;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a{i.type=Ye.DSV;const n=He(si,e),{delimiter:s}=n;if(!y(s))throw new TypeError("Invalid delimiter: must be a string!");return ei(s).parse(t)},ai=(t,e={},i)=>(i.type=Ye.DSV,ii(t)),oi=(t,e={},i)=>(i.type=Ye.DSV,ni(t)),li=(t,e,i)=>{const n=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let hi=0;function ci(t="dataset"){return hi>1e8&&(hi=0),t+"_"+hi++}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:ci("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:nt.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class di{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&W(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ci("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const s=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(s,e.options,this);this.rawData=s,this.parserData=t,this.history&&this.historyData.push(s,t),this.latestData=t}else this.parserData=s,this.rawData=s,this.history&&this.historyData.push(s),this.latestData=s;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:n,skipEqual:s}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===n||s&&W(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof di||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?U({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ke),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class pi{static GenAutoIncrementId(){return pi.auto_increment_id++}}pi.auto_increment_id=0;var gi=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class fi 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=pi.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return gi(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&nt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof yi))return void nt.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(Si(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof yi))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=Si(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let n=o;for(;n&&n!==this.rootTarget;)i.add(n),n=n.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursorTarget=s.target,this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof yi))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Si(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof yi))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Si(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof yi))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=xi.now(),s=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if(Si(s.pointerType)){const t=2===s.button;this.dispatchEvent(s,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!s.composedPath().includes(a)){let e=a;for(;e&&!s.composedPath().includes(e);){if(s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType)this.notifyTarget(s,"touchendoutside");else if(Si(s.pointerType)){const t=2===s.button;this.notifyTarget(s,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(s,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:n});const a=r.clicksByButton[t.button];a.target===e.target&&n-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=n,e.detail=a.clickCount,Si(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(s)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof yi))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):Si(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof _i))return void nt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,n,s,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===n?void 0:n.stage)&&(null===(r=null===(s=this._prePointTargetCache)||void 0===s?void 0:s[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=xi.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let n=0,s=i.length;n{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=s.supportsTouchEvents,supportsPointerEvents:l=s.supportsPointerEvents}=t;this.manager=new Ai(n,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=s,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new yi,this.rootWheelEvent=new _i,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];s?"string"==typeof s&&i?n.style.cursor=s:"function"==typeof s?s(t):"object"==typeof s&&i&&Object.assign(n.style,s):i&&y(t)&&!R(this.cursorStyles,t)&&(n.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const n=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(n)return n;let s=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0}else s=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:s-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const ki=St-1e-8;class Mi{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>ki)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),lu&&(u=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=St)<0&&(n+=St),(s%=St)<0&&(s+=St),ss;++o,a-=xt)g(a);else for(a=n-n%xt+xt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Ei=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Pi={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},Oi={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Ri,Ii,Di,Li,Fi,Ui;function Ni(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tUi){let t,e=Di;for(let n=1,r=i.length;n1&&(g=Math.sqrt(g),i*=g,n*=g);const f=u/i,m=c/i,v=-c/n,y=u/n,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let C=Math.sqrt(A);r===s&&(C=-C);const w=.5*(_+x)-C*(S-b),T=.5*(b+S)+C*(x-_),k=Math.atan2(b-T,_-w);let M=Math.atan2(S-T,x-w)-k;M<0&&1===r?M+=St:M>0&&0===r&&(M-=St);const B=Math.ceil(Math.abs(M/(xt+.001))),E=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,u=(i%l+l)%l;o?(u>=h&&(u-=l),c=u-h):(u<=h&&(u+=l),c=u-h);const d=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/d;for(let e=0;ee.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function Zi(t,e,i=0,n=0,s=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i,this.p3.x*n+e,this.p3.y*s+i);else if(r>0){const[a]=on(this,r);t.bezierCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i,a.p3.x*n+e,a.p3.y*s+i)}}includeX(t){const e=Mt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Mt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function hn(t,e){const{p0:i,p1:n}=t,s=Ut.pointAtPP(i,n,e);return[new cn(i,s),new cn(s,n)]}class cn extends Ji{constructor(t,e){super(),this.type=Vi.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return Ut.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?Ut.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Hi.ROW?Ct(this.p0.x-this.p1.x):t===Hi.COLUMN?Ct(this.p0.y-this.p1.y):0}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.lineTo(this.p1.x*n+e,this.p1.y*s+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*n+e,a.y*s+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const n=(t-e.x)/(i.x-e.x);return e.y+n*(i.y-e.y)}return 1/0}}class un{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,n,s,r,a,o){const l=new ln(new Ft(this._lastX,this._lastY),new Ft(t,e),new Ft(i,n),new Ft(s,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=s,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,n){const s=this.addLinearCurve(t,e,i,this._lastOriginP,n);this.curves.push(s),this._lastX=t,this._lastY=e,this._lastOriginP=n}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,n){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,n,s){const r=new cn(new Ft(this._lastX,this._lastY),new Ft(t,e));return r.originP1=n,r.originP2=s,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Hi.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],n=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ct(t.p0.y-n.y)}if(t===Hi.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],n=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ct(t.p0.x-n.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class dn extends un{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function pn(t,e,i=1){let n=!1;for(let i=0,s=e.length;i<=s;i++)i>=s===n&&((n=!n)?t.lineStart():t.lineEnd()),n&&t.point(e[i])}function gn(t,e,i){const n=null!=e?e:Ct(i[i.length-1].x-i[0].x)>Ct(i[i.length-1].y-i[0].y)?Hi.ROW:Hi.COLUMN;return"monotoneY"===t?new dn(t,n):new un(t,n)}class fn{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 mn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=gn("linear",i,t);return vn(new fn(s,n),t),s}function vn(t,e){return pn(t,e,1)}function yn(t,e,i,n,s){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n,t.lastPoint1)}class _n{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&&yn(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:yn(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 bn(t,e){return pn(t,e,2)}function xn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return mn(t,e);const s=gn("basis",i,t);return bn(new _n(s,n),t),s}function Sn(t){return t<0?-1:1}function An(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Sn(r)+Sn(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Cn(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function wn(t,e,i,n,s){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,n,t.lastPoint1)}class Tn{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:wn(this,this._t0,Cn(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,wn(this,Cn(this,e=An(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:wn(this,this._t0,e=An(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class kn extends Tn{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Mn(t,e){return pn(t,e,2)}function Bn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return mn(t,e);const s=gn("monotoneX",i,t);return Mn(new Tn(s,n),t),s}function En(t,e){return pn(t,e,2)}function Pn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return mn(t,e);const s=gn("monotoneY",i,t);return En(new kn(s,n),t),s}let On=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(n,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Rn extends On{lineEnd(){this.context.closePath()}}function In(t,e,i={}){const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new un("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?Hi.ROW:Hi.COLUMN);return Dn(new On(r,e,s),t),r}function Dn(t,e){return pn(t,e,1)}function Ln(t,e,i={}){const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new un("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?Hi.ROW:Hi.COLUMN);return Dn(new Rn(r,e,s),t),r}class Fn extends fn{lineEnd(){this.context.closePath()}}function Un(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=gn("linear",i,t);return Nn(new Fn(s,n),t),s}function Nn(t,e){return pn(t,e,1)}function jn(t,e,i,n,s){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>_t){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>_t){const n=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*n+t._x1*t._l23_2a-e*t._l12_2a)/s,l=(l*n+t._y1*t._l23_2a-i*t._l12_2a)/s}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,n,t.lastPoint1)}function zn(t,e){return function(i,n,s={}){const{direction:r,startPoint:a}=s;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return mn(i,s);const o=gn(t,r,i);return pn(new e(o,n,a),i,2),o}}const Wn=zn("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:jn(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Hn=zn("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:jn(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Vn extends Ji{constructor(t,e,i){super(),this.type=Vi.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return rn(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?an(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===Hi.ROW?Ct(this.p0.x-this.p2.x):t===Hi.COLUMN?Ct(this.p0.y-this.p2.y):0}getAngleAt(t){const e=kt(t-.01,0),i=Mt(t+.01,1),n=this.getPointAt(e),s=this.getPointAt(i);return wt(s.y-n.y,s.x-n.x)}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.quadraticCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:n,p2:s}=t,r=rn(i,n,s,e),a=Ut.pointAtPP(i,n,e),o=Ut.pointAtPP(n,s,e);return[new Vn(i,a,r),new Vn(r,o,s)]}(this,r);t.quadraticCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Gn{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new cn(new Ft(this._lastX,this._lastY),new Ft(t,e))}quadraticCurveTo(t,e,i,n){const s=new Vn(new Ft(this._lastX,this._lastY),new Ft(t,e),new Ft(i,n));this.path.addCurve(s),this._lastX=i,this._lastY=n}bezierCurveTo(t,e,i,n,s,r){const a=new ln(new Ft(this._lastX,this._lastY),new Ft(t,e),new Ft(i,n),new Ft(s,r));this.path.addCurve(a),this._lastX=s,this._lastY=r}arcTo(t,e,i,n,s){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,n,s,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,n){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,n,s,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Yn(t,e,i){var n,s;switch(e){case"linear":default:return mn(t,i);case"basis":return xn(t,i);case"monotoneX":return Bn(t,i);case"monotoneY":return Pn(t,i);case"step":return In(t,.5,i);case"stepClosed":return Ln(t,.5,i);case"stepBefore":return In(t,0,i);case"stepAfter":return In(t,1,i);case"catmullRom":return Wn(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return Hn(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"linearClosed":return Un(t,i)}}class Xn extends Bi{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Mi(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Oi.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Oi.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([Oi.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([Oi.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([Oi.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([Oi.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([Oi.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([Oi.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([Oi.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Gn(this);Zi(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Oi.M]=t=>`M${t[1]} ${t[2]}`,t[Oi.L]=t=>`L${t[1]} ${t[2]}`,t[Oi.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Oi.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Oi.A]=t=>{const e=[],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6];$i(e,r,a,i,n,s,s,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Oi.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=Ni(t);return this._runCommandStrList(r,e,i,n,s),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:n}=t.attribute;if(!e)return;const s=Yn(e,i);"x"===n?this.direction=Hi.ROW:"y"===n?this.direction=Hi.COLUMN:"auto"===n&&(this.direction=s.direction),this._curves=s.curves}fromCustomPath2D(t,e,i,n,s){return this.clear(),this._runCommandList(t.commandList,e,i,n,s),this._updateBounds(),this}transform(t,e,i,n){const s=this.commandList;if(!this.transformCbList){const t=[];t[Oi.M]=this.moveToTransform,t[Oi.L]=this.lineToTransform,t[Oi.Q]=this.quadraticCurveToTransform,t[Oi.C]=this.bezierCurveToTransform,t[Oi.AT]=this.arcToTransform,t[Oi.E]=this.ellipseTransform,t[Oi.R]=this.rectTransform,t[Oi.A]=this.arcTransform,t[Oi.Z]=this.closePathTransform,this.transformCbList=t}s.forEach((s=>{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,n=1,s=1){let r,a,o,l,h,c=null,u=0,d=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Zi(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Hi.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ct(t.p0.y-e.p1.y)}if(this.direction===Hi.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ct(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}drawWithClipRange(t,e,i,n,s){this.tryBuildCurves();const r=this.getLength()*s;let a=0;for(let s=0;s{nt.getInstance().warn("空函数")}}),_s=Object.assign(Object.assign({},us),{points:[],cornerRadius:0,closePath:!0}),bs=Object.assign(Object.assign({},us),{width:100,height:100,spikes:5,thickness:.5}),xs=Object.assign(Object.assign({},us),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Ss=Object.assign(Object.assign({},us),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),As=Object.assign(Object.assign({},us),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Cs=Object.assign(Object.assign(Object.assign({},us),as),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ws=Object.assign(Object.assign(Object.assign({},us),as),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Ts=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},us),{fill:!0,cornerRadius:0,cornerType:"round"}),ks=Object.assign(Object.assign({},Ts),{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});class Ms{}const Bs=Symbol.for("@visactor/vrender-core/application-state");function Es(){const t=globalThis;return t[Bs]||(t[Bs]={application:new Ms}),t[Bs]}const Ps=Es().application;class Os{static GetImage(t,e){var i;const n=Os.cache.get(t);n?"fail"===n.loadState?Ps.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):Os.loadImage(t,e)}static GetSvg(t,e){var i;let n=Os.cache.get(t);n?"fail"===n.loadState?Ps.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},Os.cache.set(t,n),n.dataPromise=Ps.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))})),n.waitingMark&&(n.waitingMark=[])})).catch((()=>{var e;n.loadState="fail",null===(e=n.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),n.waitingMark&&(n.waitingMark=[])}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Os.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Os.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ps.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ps.global.loadBlob(t):"json"===e&&(i.dataPromise=Ps.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Os.isLoading&&Os.toLoadAueue.length){Os.isLoading=!0;const t=Os.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,s={type:"image",loadState:"init"};if(Os.cache.set(i,s),s.dataPromise=Ps.global.loadImage(i),s.dataPromise){s.waitingMark=n;const t=s.dataPromise.then((t=>{var e;s.loadState=(null==t?void 0:t.data)?"success":"fail",s.data=null==t?void 0:t.data,null===(e=s.waitingMark)||void 0===e||e.map(((e,n)=>{(null==t?void 0:t.data)?(s.loadState="success",s.data=t.data,e.imageLoadSuccess(i,t.data)):(s.loadState="fail",e.imageLoadFail(i))})),s.waitingMark&&(s.waitingMark=[])}));e.push(t)}else s.loadState="fail",n.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Os.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Os.loading()})).catch((t=>{console.error(t),Os.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Os.loading()}))}}),0)}static loadImage(t,e){const i=Rs(t,Os.toLoadAueue);if(-1!==i)return Os.toLoadAueue[i].marks.push(e),void Os.loading();Os.toLoadAueue.push({url:t,marks:[e]}),Os.loading()}static improveImageLoading(t){const e=Rs(t,Os.toLoadAueue);if(-1!==e){const t=Os.toLoadAueue.splice(e,1);Os.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Rs(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let n=0;n<4;n++)Ds[n]=t,i&&(i=!(null!==(e=Ds[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Ds[e]=!!t[e],i&&(i=!!Ds[e]);else Ds[0]=!1,Ds[1]=!1,Ds[2]=!1,Ds[3]=!1;return{isFullStroke:i,stroke:Ds}},Fs=[0,0,0,0],Us=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Fs[0]=t[0],Fs[2]=t[0],Fs[1]=t[1],Fs[3]=t[1],Fs):t:t:0,Ns=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],js=[1,2,3,0,1,2,3,0];function zs(t,e,i,n){for(;t>=At;)t-=At;for(;t<0;)t+=At;for(;t>e;)e+=At;Ns[0].x=i,Ns[1].y=i,Ns[2].x=-i,Ns[3].y=-i;const s=Math.ceil(t/xt)%4,r=Math.ceil(e/xt)%4;if(n.add(Tt(t)*i,Bt(t)*i),n.add(Tt(e)*i,Bt(e)*i),s!==r||e-t>bt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ft(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ft(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{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)}}Ys.TimeOut=1e3/60;const Xs=new Ys,Ks=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,$s=(t,e)=>{const i=Ks(t,e);return isNaN(i)?i:Math.max(e,i)};class qs{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Zs(t,e,i,n,s){return s?t.arc(i,n,e,0,St,!1,s):t.arc(i,n,e,0,St),!1}var Js=new class extends qs{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,n,s){return Zs(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return Zs(t,this.parseSize(e)/2+s,i,n,r)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} a ${s},${s} 0 1,0 ${2*s},0 a ${s},${s} 0 1,0 -${2*s},0`}};var Qs=new class extends qs{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(-3*e+i,-e+n,s),t.lineTo(-e+i,-e+n,s),t.lineTo(-e+i,-3*e+n,s),t.lineTo(e+i,-3*e+n,s),t.lineTo(e+i,-e+n,s),t.lineTo(3*e+i,-e+n,s),t.lineTo(3*e+i,e+n,s),t.lineTo(e+i,e+n,s),t.lineTo(e+i,3*e+n,s),t.lineTo(-e+i,3*e+n,s),t.lineTo(-e+i,e+n,s),t.lineTo(-3*e+i,e+n,s),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s)}drawOffset(t,e,i,n,s,r){return function(t,e,i,n,s,r){return t.moveTo(-3*e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-3*e+n-s,r),t.lineTo(e+i+s,-3*e+n-s,r),t.lineTo(e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,e+n+s,r),t.lineTo(e+i+s,e+n+s,r),t.lineTo(e+i+s,3*e+n+s,r),t.lineTo(-e+i-s,3*e+n+s,r),t.lineTo(-e+i-s,e+n+s,r),t.lineTo(-3*e+i-s,e+n+s,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s,r)}};function tr(t,e,i,n,s){return t.moveTo(i,n-e,s),t.lineTo(e+i,n,s),t.lineTo(i,n+e,s),t.lineTo(i-e,n,s),t.closePath(),!0}var er=new class extends qs{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,s){return tr(t,this.parseSize(e)/2,i,n,s)}drawFitDir(t,e,i,n,s){return tr(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return tr(t,this.parseSize(e)/2+s,i,n,r)}};function ir(t,e,i,n){const s=2*e;return t.rect(i-e,n-e,s,s),!1}var nr=new class extends qs{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return ir(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return ir(t,this.parseSize(e)/2+s,i,n)}};function sr(t,e,i,n,s=0){return t.moveTo(i+e+2*s,e+n+s),t.lineTo(i-e-2*s,e+n+s),t.lineTo(i,n-e-2*s),t.closePath(),!0}class rr extends qs{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,n){return sr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return sr(t,this.parseSize(e)/2,i,n,s)}}var ar=new rr;var or=new class extends rr{constructor(){super(...arguments),this.type="triangle"}};const lr=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),hr=Math.sin(St/10)*lr,cr=-Math.cos(St/10)*lr;function ur(t,e,i,n){const s=hr*e,r=cr*e;t.moveTo(i,-e+n),t.lineTo(s+i,r+n);for(let a=1;a<5;++a){const o=St*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+n),t.lineTo(l*s-h*r+i,h*s+l*r+n)}return t.closePath(),!0}var dr=new class extends qs{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,n){return ur(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return ur(t,this.parseSize(e)/2+s,i,n)}};const pr=Et(3);function gr(t,e,i,n){const s=e,r=s/pr,a=r/5,o=e;return t.moveTo(0+i,-s+n),t.lineTo(r/2+i,n),t.lineTo(a/2+i,n),t.lineTo(a/2+i,o+n),t.lineTo(-a/2+i,o+n),t.lineTo(-a/2+i,n),t.lineTo(-r/2+i,n),t.closePath(),!0}var fr=new class extends qs{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,n){return gr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return gr(t,this.parseSize(e)/2+s,i,n)}};function mr(t,e,i,n){const s=2*e;return t.moveTo(i,-e+n),t.lineTo(s/3/2+i,e+n),t.lineTo(-s/3/2+i,e+n),t.closePath(),!0}var vr=new class extends qs{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return mr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return mr(t,this.parseSize(e)/2+s,i,n)}};function yr(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var _r=new class extends qs{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,n){return yr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return yr(t,this.parseSize(e)/2+s,i,n)}};const br=-.5,xr=Et(3)/2,Sr=1/Et(12);function Ar(t,e,i,n){const s=e/2,r=e*Sr,a=s,o=e*Sr+e,l=-a,h=o;return t.moveTo(s+i,r+n),t.lineTo(a+i,o+n),t.lineTo(l+i,h+n),t.lineTo(br*s-xr*r+i,xr*s+br*r+n),t.lineTo(br*a-xr*o+i,xr*a+br*o+n),t.lineTo(br*l-xr*h+i,xr*l+br*h+n),t.lineTo(br*s+xr*r+i,br*r-xr*s+n),t.lineTo(br*a+xr*o+i,br*o-xr*a+n),t.lineTo(br*l+xr*h+i,br*h-xr*l+n),t.closePath(),!1}var Cr=new class extends qs{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,n){return Ar(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Ar(t,this.parseSize(e)/2+s,i,n)}};function wr(t,e,i,n,s){return t.moveTo(-e+i-2*s,n),t.lineTo(e+i+s,e+n+2*s),t.lineTo(e+i+s,n-e-2*s),t.closePath(),!0}var Tr=new class extends qs{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,n){return wr(t,this.parseSize(e)/2,i,n,0)}drawOffset(t,e,i,n,s){return wr(t,this.parseSize(e)/2,i,n,s)}};function kr(t,e,i,n,s=0){return t.moveTo(i-e-s,e+n+2*s),t.lineTo(e+i+2*s,n),t.lineTo(i-e-s,n-e-2*s),t.closePath(),!0}var Mr=new class extends qs{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,n){return kr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return kr(t,this.parseSize(e)/2,i,n,s)}};function Br(t,e,i,n,s=0){return t.moveTo(i-e-2*s,n-e-s),t.lineTo(i+e+2*s,n-e-s),t.lineTo(i,n+e+2*s),t.closePath(),!0}var Er=new class extends qs{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,n){return Br(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Br(t,this.parseSize(e)/2,i,n,s)}};const Pr=Et(3);function Or(t,e,i,n){const s=e*Pr;return t.moveTo(i,n+-s/3*2),t.lineTo(e+i,n+s),t.lineTo(i-e,n+s),t.closePath(),!0}var Rr=new class extends qs{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return Or(t,this.parseSize(e)/2/Pr,i,n)}drawOffset(t,e,i,n,s){return Or(t,this.parseSize(e)/2/Pr+s,i,n)}};function Ir(t,e,i,n){const s=2*e;return t.moveTo(e+i,n-s),t.lineTo(i-e,n),t.lineTo(e+i,s+n),!0}var Dr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,n){return Ir(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Ir(t,this.parseSize(e)/4+s,i,n)}};function Lr(t,e,i,n){const s=2*e;return t.moveTo(i-e,n-s),t.lineTo(i+e,n),t.lineTo(i-e,s+n),!0}var Fr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,n){return Lr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Lr(t,this.parseSize(e)/4+s,i,n)}};function Ur(t,e,i,n){const s=2*e;return t.moveTo(i-s,n+e),t.lineTo(i,n-e),t.lineTo(i+s,n+e),!0}var Nr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,n){return Ur(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Ur(t,this.parseSize(e)/4+s,i,n)}};function jr(t,e,i,n){const s=2*e;return t.moveTo(i-s,n-e),t.lineTo(i,n+e),t.lineTo(i+s,n-e),!0}var zr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,n){return jr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return jr(t,this.parseSize(e)/4+s,i,n)}};function Wr(t,e,i,n,s){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var Hr=new class extends qs{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,s){return Wr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Wr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e}, ${i-s} L ${e},${i+s}`}};function Vr(t,e,i,n,s){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var Gr=new class extends qs{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,s){return Vr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Vr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} L ${e+s},${i}`}};function Yr(t,e,i,n,s){return t.moveTo(i-e,n-e),t.lineTo(i+e,n+e),t.moveTo(i+e,n-e),t.lineTo(i-e,n+e),!0}var Xr=new class extends qs{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,n,s){return Yr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Yr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i-s} L ${e+s},${i+s} M ${e+s}, ${i-s} L ${e-s},${i+s}`}};function Kr(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function $r(t,e,i,n){const s=e,r=e/2;return t.rect(i-s/2,n-r/2,s,r),!1}var qr=new class extends qs{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,n){return S(e)?$r(t,e,i,n):Kr(t,e,i,n)}drawWithClipRange(t,e,i,n,s,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*s,l=[{x:i+e[0]/2,y:n-e[1]/2},{x:i+e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/n,s=(i.y-c.y)*(o-h)/n;t.lineTo(c.x+e,c.y+s);break}t.lineTo(i.x,i.y),c=i,h+=n}return!1}drawOffset(t,e,i,n,s){return S(e)?$r(t,e+2*s,i,n):Kr(t,[e[0]+2*s,e[1]+2*s],i,n)}};const Zr=new ue;class Jr{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{t.beginPath(),Zi(s.path.commandList,t,i,n,e,e),a&&a(s.path,s.attribute)})),!1):(Zi(this.path.commandList,t,i,n,e+s,e+s),!1)}draw(t,e,i,n,s,r){return e=this.parseSize(e),this.drawOffset(t,e,i,n,0,s,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,n,s),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,n,s),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Zr.x1=i.bounds.x1*t,Zr.y1=i.bounds.y1*t,Zr.x2=i.bounds.x2*t,Zr.y2=i.bounds.y2*t,e.union(Zr)}))}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 Qr=[Js,Qs,er,nr,Rr,or,dr,fr,vr,_r,Cr,Tr,Mr,ar,Er,Dr,Fr,Nr,zr,qr,Hr,Gr,Xr],ta={};Qr.forEach((t=>{ta[t.type]=t}));const ea={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class ia{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 na(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function sa(t,e,i,n=">"){const s=function(t,e,i=">"){let n,s="";for(let r=e;r",r,"Closing Tag is not closed."),a=s.lastIndexOf(".");s=s.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",r=e}else if("?"===t[r+1])r=sa(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=na(t,"--\x3e",r+4,"Comment is not closed.");else{const a=sa(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(s+=s?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),s=s.substr(0,s.length-1),l=o):l=l.substr(0,l.length-1);const t=new ia(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),s=s.substr(0,s.lastIndexOf("."))}else{const t=new ia(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),i=t}n="",r=c}else n+=t[r];return e.child}}function oa(t,e){return la(t)}function la(t,e){const i={};for(let e=0;eba.set(t,!0)));const xa=new Map;function Sa(t){if(ba.has(t))return!0;if(xa.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Aa(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>xa.set(t,!0)));const Ca=va(),wa=va(),Ta=va(),ka=va(),Ma=va(),Ba=va(),Ea=va(),Pa=va(),Oa=va(),Ra=va(),Ia=va(),Da=va(),La=va(),Fa=va(),Ua=va(),Na=va(),ja=va(),za=Symbol.for("GraphicService"),Wa=Symbol.for("GraphicCreator"),Ha={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},Va=Object.keys(Ha),Ga={"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"},Ya=Object.keys(Ga),Xa={duration:200,easing:"cubicOut"},Ka=Symbol.for("CanvasFactory"),$a=Symbol.for("Context2dFactory");function qa(t){return function(){var t,e;const i=null===(t=Ps.global)||void 0===t?void 0:t.env,n=i?null===(e=Ps.canvasFactory)||void 0===e?void 0:e.call(Ps,i):void 0;if(!n)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return n}()(t)}const Za=1e-4,Ja=Math.sqrt(3),Qa=1/3;function to(t){return t>-fo&&tfo||t<-fo}function io(t){return"number"==typeof t&&Number.isFinite(t)}const no=[0,0],so=[0,0],ro=[0,0];function ao(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function oo(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function lo(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function ho(t){return(t%=At)<0&&(t+=At),t}function co(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+u&&c>n+u&&c>r+u&&c>o+u||ct+u&&h>i+u&&h>s+u&&h>a+u||h=0&&pi||c+hs&&(s+=At);let u=Math.atan2(l,o);return u<0&&(u+=At),u>=n&&u<=s||u+At>=n&&u+At<=s}function go(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(to(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const vo=[-1,-1,-1],yo=[-1,-1];function _o(){const t=yo[0];yo[0]=yo[1],yo[1]=t}function bo(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=u*u-4*c*d;if(to(t)){const t=u/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-u+e),n=c*o+1.5*a*(-u-e);i=i<0?-Math.pow(-i,Qa):Math.pow(i,Qa),n=n<0?-Math.pow(-n,Qa):Math.pow(n,Qa);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*u)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+Ja*Math.sin(e)))/(3*a),h=(-o+i*(n-Ja*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,vo);if(0===c)return 0;let u=0,d=-1,p=0,g=0;for(let h=0;h1&&_o(),p=lo(e,n,r,o,yo[0]),d>1&&(g=lo(e,n,r,o,yo[1]))),2===d?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(to(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,vo);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=oo(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);vo[0]=-l,vo[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=At-1e-4){n=0,s=At;const e=r?1:-1;return a>=vo[0]+t&&a<=vo[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=At,s+=At);let c=0;for(let e=0;e<2;e++){const i=vo[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=At+t),(t>=n&&t<=s||t+At>=n&&t+At<=s)&&(t>bt/2&&t<1.5*bt&&(e=-e),c+=e)}}return c}function Ao(t){return Math.round(t/bt*1e8)/1e8%2*bt}function Co(t,e){let i=Ao(t[0]);i<0&&(i+=At);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=At?s=i+At:e&&i-s>=At?s=i-At:!e&&i>s?s=i+(At-Ao(i-s)):e&&i1&&(i||(h+=ie(c,u,d,p,n,s))),g&&(c=a[1],u=a[2],d=c,p=u);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;wo[0]=S,wo[1]=A,Co(wo,Boolean(a[6])),S=wo[0],A=wo[1];const C=S,w=A-S,T=!!(1-(a[6]?0:1)),k=(n-m)*y/y+m;switch(f){case Oi.M:d=m,p=v,c=d,u=p;break;case Oi.L:if(i){if(go(c,u,m,v,e,n,s))return!0}else h+=ie(c,u,m,v,n,s)||0;c=m,u=v;break;case Oi.C:if(i){if(uo(c,u,m,v,y,_,b,x,e,n,s))return!0}else h+=bo(c,u,m,v,y,_,b,x,n,s)||0;c=b,u=x;break;case Oi.Q:if(i){if(co(c,u,m,v,y,_,e,n,s))return!0}else h+=xo(c,u,m,v,y,_,n,s)||0;c=y,u=_;break;case Oi.A:if(o=Math.cos(C)*y+m,l=Math.sin(C)*y+v,g?(d=o,p=l):h+=ie(c,u,o,l,n,s),i){if(po(m,v,y,C,C+w,T,e,k,s))return!0}else h+=So(m,v,y,C,C+w,T,k,s);c=Math.cos(C+w)*y+m,u=Math.sin(C+w)*y+v;break;case Oi.R:if(d=c=m,p=u=v,o=d+y,l=p+_,i){if(go(d,p,o,p,e,n,s)||go(o,p,o,l,e,n,s)||go(o,l,d,l,e,n,s)||go(d,l,d,p,e,n,s))return!0}else h+=ie(o,p,o,l,n,s),h+=ie(d,l,d,p,n,s);break;case Oi.Z:if(i){if(go(c,u,d,p,e,n,s))return!0}else h+=ie(c,u,d,p,n,s);c=d,u=p}}return i||(g=u,f=p,Math.abs(g-f)0&&i("Invalid input not EOF"),t}()}}();class Mo{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Mo.IsGradientStr(t))try{const e=ko(t)[0];if(e){if("linear"===e.type)return Mo.ParseLinear(e);if("radial"===e.type)return Mo.ParseRadial(e);if("conic"===e.type)return Mo.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const n=t.length>1?i/(t.length-1):0;return{color:e.value,offset:n}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=bt/2,s=parseFloat(e.value)/180*bt-n;return{gradient:"conical",x:.5,y:.5,startAngle:s,endAngle:s+At,stops:Mo.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:Mo.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=bt/2;let s="angular"===e.type?parseFloat(e.value)/180*bt:0;for(;s<0;)s+=At;for(;s>=At;)s-=At;let r=0,a=0,o=0,l=0;return s{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,u,d):"conical"===c.gradient?h=function(t,e,i,n,s,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*s,n+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(s+i,r+n,void 0):l}(t,c,p,g,u,d):"radial"===c.gradient&&(h=function(t,e,i,n,s,r){var a,o,l,h,c,u;const d=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*s,n+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(s,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*s,n+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(s,r)*(null!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,c,p,g,u,d))}return h||"orange"}function Po(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Oo(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+u*n,t[7]=l*s+d*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=u*s-o*n,t[11]=d*s-l*n,t}function Ro(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],u=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-u*n,t[3]=l*s-d*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+u*s,t[11]=l*n+d*s,t}function Io(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+u*n,t[3]=l*s+d*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=u*s-o*n,t[7]=d*s-l*n,t}function Do(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,u,d,p,g,f,m,v;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],u=e[5],d=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=u,t[6]=d,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+u*s+f*r+e[13],t[14]=l*n+d*s+m*r+e[14],t[15]=h*n+p*s+v*r+e[15]),t}function Lo(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 Fo(t,e,i){const n=i[0],s=i[1],r=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Uo(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*u+S*f,t[1]=_*s+b*l+x*d+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*u+S*f,t[5]=_*s+b*l+x*d+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*u+S*f,t[9]=_*s+b*l+x*d+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*u+S*f,t[13]=_*s+b*l+x*d+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function No(t,e,i,n){let s,r,a,o,l,h,c,u,d,p;const g=e[0],f=e[1],m=e[2],v=n[0],y=n[1],_=n[2],b=i[0],x=i[1],S=i[2];return Math.abs(g-b)<_t&&Math.abs(f-x)<_t&&Math.abs(m-S)<_t?Po(t):(c=g-b,u=f-x,d=m-S,p=1/Math.hypot(c,u,d),c*=p,u*=p,d*=p,s=y*d-_*u,r=_*c-v*d,a=v*u-y*c,p=Math.hypot(s,r,a),p?(p=1/p,s*=p,r*=p,a*=p):(s=0,r=0,a=0),o=u*a-d*r,l=d*s-c*a,h=c*r-u*s,p=Math.hypot(o,l,h),p?(p=1/p,o*=p,l*=p,h*=p):(o=0,l=0,h=0),t[0]=s,t[1]=o,t[2]=c,t[3]=0,t[4]=r,t[5]=l,t[6]=u,t[7]=0,t[8]=a,t[9]=h,t[10]=d,t[11]=0,t[12]=-(s*g+r*f+a*m),t[13]=-(o*g+l*f+h*m),t[14]=-(c*g+u*f+d*m),t[15]=1,t)}function jo(t,e,i,n,s,r,a){const o=1/(e-i),l=1/(n-s),h=1/(r-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*o,t[13]=(s+n)*l,t[14]=(a+r)*h,t[15]=1,t}function zo(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}const Wo=Symbol.for("MatrixAllocate"),Ho=Symbol.for("Mat4Allocate");function Vo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}class Go{constructor(){this.pools=[]}allocate(t,e,i,n,s,r){if(!this.pools.length)return new pe(t,e,i,n,s,r);const a=this.pools.pop();return a.a=t,a.b=e,a.c=i,a.d=n,a.e=s,a.f=r,a}allocateByObj(t){if(!this.pools.length)return new pe(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}class Yo{constructor(){this.pools=[]}static identity(t){return Po(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 Yo.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;i0&&(Xo.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Xo.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n,s=!0){this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r,a=!0){this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},qo),function(t,e,i){return To(t,0,!1,e,i)}(this.path.commandList,qo.x,qo.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},qo);const i=Bo(this,this.lineWidth,this.dpr);return function(t,e,i,n){return To(t,e,!0,i,n)}(this.path.commandList,i,qo.x,qo.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix($o,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Xo.free(t))),this.stack.length=0}}const Jo={WIDTH:500,HEIGHT:500,DPR:1};class Qo{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:n=Jo.WIDTH,height:s=Jo.HEIGHT,dpr:r=Jo.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=n*r,this._pixelHeight=s*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=n,this._displayHeight=s,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var tl;Qo.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(tl||(tl={}));class el{static Get(t,e=tl.Color1,i=[0,0,0,1]){if(e===tl.Color1){const e=el.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const n=we.parseColorString(t);if(n){const e=[n.r/255,n.g/255,n.b/255,n.opacity];el.store1[t]=e,el.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const n=el.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;const s=we.parseColorString(t);return s&&(el.store1[t]=[s.r/255,s.g/255,s.b/255,s.opacity],el.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=s.r,i[1]=s.g,i[2]=s.b,i[3]=s.opacity),i}static Set(t,e,i){if(e===tl.Color1){if(el.store1[t])return;el.store1[t]=i,el.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(el.store255[t])return;el.store255[t]=i,el.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function il(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function nl(t,e,i,n,s){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((s,r)=>{var a,o;return sl(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,n)})):sl(t,e,i,n,s)}function sl(t,e,i,n,s){if(!t||!e)return t&&il(t)||e&&il(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=el.Get(t,tl.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=el.Get(e,tl.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:il(a)})))});return o?nl(r,l,i,n,s):nl(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return rl(n,s,i);if("radial"===n.gradient)return al(n,s,i);if("conical"===n.gradient)return ol(n,s,i)}return!1}return s&&s(r,a),il(ll(r,a,i),n)}function rl(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:dl(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}function al(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:dl(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}function ol(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:dl(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}function ll(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]}function hl(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}el.store255={},el.store1={};const cl=[0,0,0,0],ul=[0,0,0,0];function dl(t,e,i){return el.Get(t,tl.Color255,cl),el.Get(e,tl.Color255,ul),`rgba(${Math.round(cl[0]+(ul[0]-cl[0])*i)},${Math.round(cl[1]+(ul[1]-cl[1])*i)},${Math.round(cl[2]+(ul[2]-cl[2])*i)},${cl[3]+(ul[3]-cl[3])*i})`}class pl{static GetCanvas(){try{return pl.canvas||(pl.canvas=Ps.global.createCanvas({})),pl.canvas}catch(t){return null}}static GetCtx(){if(!pl.ctx){const t=pl.GetCanvas();pl.ctx=t.getContext("2d")}return pl.ctx}}class gl extends ge{static getInstance(){return gl._instance||(gl._instance=new gl),gl._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=pl.GetCanvas(),n=pl.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,n,s=[],r=100){let a=`${t}${e}${i}${n}`;s.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new gl(s,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class fl{static GetSize(t){for(let e=0;e=t)return fl.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=fl.GenKey(t,e,i,n,s),l=fl.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,s,r,a,o){const l=fl.GenKey(t,e,i,n,s);fl.cache[l]?fl.cache[l].push({width:a,height:o,pattern:r}):fl.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}function ml(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=At;for(;i>At;)i-=At;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),nl(o.color,l.color,h,!1)}function vl(t,e,i,n,s,r,a,o,l){const h=Math.floor(180*s/Math.PI),c=pl.GetCanvas(),u=pl.GetCtx();if(!u)return null;const d=fl.GetSize(o),p=fl.GetSize(l);let g=fl.Get(e,i,n,r,a,d,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(n,2),Math.pow(d-i,2)+Math.pow(n,2)),Math.max(Math.pow(d-i,2)+Math.pow(p-n,2),Math.pow(i,2)+Math.pow(p-n,2)))),m=h+1,v=s/Math.max(1,m-1),y=gl.getInstance().GetOrCreate(i,n,d,p,e,m),_=2*Math.PI*f/360;c.width=d,c.height=p,u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,d,p),u.translate(i,n),u.rotate(r);for(let t=0,e=m-1;ta);t++){const e=y.getColor(t);u.beginPath(),u.rotate(v),u.moveTo(0,0),u.lineTo(f,-2*_),u.lineTo(f,0),u.fillStyle=e,u.closePath(),u.fill()}const b=u.getImageData(0,0,d,p);return c.width=b.width,c.height=b.height,u.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&fl.Set(e,i,n,r,a,g,d,p),g}fl.cache={},fl.ImageSize=[20,40,80,160,320,640,1280,2560];const yl=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function _l(t){return null==t?void 0:t}class bl{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,n;const s=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(n=e.priority)&&void 0!==n?n:0;return s!==r?s-r:t.name.localeCompare(e.name)})),n=new Map;i.forEach(((t,e)=>{n.set(t.name,e)}));const s=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),s.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=n.get(t.name))&&void 0!==i?i:0,patch:_l(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(s,"exclude"),this.expandRelationClosure(s,"suppress"),s}normalizeDefinition(t,e){var i,n;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>yl.has(t)))){const s=e;return{name:null!==(i=s.name)&&void 0!==i?i:t,priority:null!==(n=s.priority)&&void 0!==n?n:0,patch:_l(s.patch),resolver:s.resolver,declaredAffectedKeys:s.declaredAffectedKeys,exclude:s.exclude,suppress:s.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,n)=>{i.set(n,new Set(t[e]))})),t.forEach(((t,n)=>{const s=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===n||e.has(t)||s.has(t)||(s.add(t),e.add(t),r(t,e),e.delete(t))}))};r(n,new Set([n])),t[e]=s}))}}function xl(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Sl(t){if(!xl(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Sl(t[i])})),e}function Al(t,e){var i;const n=null!==(i=Sl(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],s=n[t];xl(s)&&xl(i)?n[t]=Al(s,i):n[t]=Sl(i)})),n}class Cl{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),n=this.adjudicate(i),s=n.active,r=s.filter((t=>!n.suppressedSet.has(t))),a=s.filter((t=>n.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,s)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=s,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),n=this.compiledDefinitions.get(e);return i&&n?i.priority!==n.priority?i.priority-n.priority:i.rank-n.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const n=e[t],s=this.compiledDefinitions.get(n);s&&(s.exclude.forEach((i=>{const n=e.indexOf(i);-1!==n&&(e.splice(n,1),n{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},n=this.resolverCacheValid&&this.resolverCacheKey===e;n||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const s=this.compiledDefinitions.get(t);if(s&&(s.patch&&this.mergeInto(i,s.patch),s.hasResolver)){const r=n?this.resolverPatchCache.get(t):null===(e=s.resolver)||void 0===e?void 0:e.call(s,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(n||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),n||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Sl(e[i])})):Object.keys(e).forEach((i=>{var n;const s=e[i],r=t[i],a=null===(n=this.baseAttributes)||void 0===n?void 0:n[i];xl(r)&&xl(s)?t[i]=Al(r,s):!xl(r)&&xl(a)&&xl(s)?t[i]=Al(a,s):t[i]=Sl(s)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?wl.PAINT|wl.BOUNDS|wl.PICK:wl.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),n=Number(null!=e?e:0);return i!==n&&(i>0||n>0)?wl.PAINT|wl.BOUNDS:wl.PAINT}};class Ml{analyzeTransition(t,e,i={}){var n,s;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(n=i.noWorkAnimateAttr)&&void 0!==n?n:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(s=i.animateConfig)||void 0===s?void 0:s.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const u=i.extraAnimateAttrs;if(u)for(const e in u){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(u,e)||i&&void 0!==t[e]||c(e,u[e])}return r}applyTransition(t,e,i,n={}){var s,r,a;if(i){const i=null!==(s=n.animateConfig)&&void 0!==s?s:Xa;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:Wi.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:Wi.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:Wi.STATE}),e}applyClearTransition(t,e,i,n={}){var s;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(s=n.shouldSkipDefaultAttribute)&&void 0!==s?s:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:n.animateConfig,extraAnimateAttrs:n.extraAnimateAttrs});return this.applyTransition(t,r,i,n)}}const Bl=new bl;function El(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,Pl(t),!0)}function Pl(t,e=t.revision+1){var i;const n=(s=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},s?s.effectiveSourceDefinitions:a,r));var s,r,a;return t.effectiveSourceDefinitions=n,t.effectiveCompiledDefinitions=Bl.compile(n),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function Ol(t){if(t)return t.parentScope&&Ol(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&Pl(t),t}function Rl(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function Il(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function Dl(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var n;i.sharedStateDirty=!0,Il(null!==(n=null!=e?e:i.stage)&&void 0!==n?n:t.ownerStage,i)})),Rl(null!=e?e:t.ownerStage))}const Ll=new ue,Fl=new pe,Ul=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Nl=["x","y"],jl=["scaleX","scaleY"],zl=["angle"],Wl=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),Hl=new Ft,Vl=[],Gl=wl.PAINT|wl.SHAPE|wl.BOUNDS|wl.TRANSFORM|wl.LAYOUT;function Yl(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Xl(t){if(!Yl(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const n=e[t];i[t]=Yl(n)?Xl(n):n})),i}function Kl(t,e){return t===e||!!(Yl(t)||Yl(e)||Array.isArray(t)||Array.isArray(e))&&W(t,e)}function $l(t,e){var i;const n=null!==(i=Xl(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],s=n[t];Yl(s)&&Yl(i)?n[t]=$l(s,i):n[t]=Xl(i)})),n}const ql={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Zl extends fi{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,Il(this.stage,this),Rl(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&Ol(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Wi.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(Ol(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new bl).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),n=this.resolveUseStatesTransition(this.currentStates,i),s=null!==(e=n.effectiveStates)&&void 0!==e?e:n.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=n.states,this.effectiveStates=[...s],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Xl(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const n=i[t],s=e[t];"deep"===this.stateMergeMode&&Yl(s)&&Yl(n)?e[t]=$l(s,n):e[t]=Xl(n)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const n=this.buildStaticAttributeSnapshot(),s=n;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,s)||(i[e]=void 0===t?t:Xl(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,s));else if(Object.prototype.hasOwnProperty.call(n,e)){const t=n[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,s):t)}else a(this.getStateTransitionDefaultAttribute(e,s))})),i}syncObjectToSnapshot(t,e,i){const n=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((s=>{if(!0===(null==i?void 0:i[s]))return;const r=Object.prototype.hasOwnProperty.call(e,s),a=t[s];if(!r)return void(Object.prototype.hasOwnProperty.call(t,s)&&(n.set(s,{prev:a,next:void 0}),delete t[s]));const o=e[s];Kl(a,o)||(n.set(s,{prev:a,next:o}),t[s]=Xl(o))})),n}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,n){var s;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var n;const s=kl[t];return s?s(e,i):null!==(n=Tl[t])&&void 0!==n?n:wl.PAINT}(e,i,n):null!==(s=Tl[e])&&void 0!==s?s:wl.PAINT;return r&wl.PICK&&(r|=wl.BOUNDS),r===wl.PAINT&&this.needUpdateTag(e)&&(r=wl.SHAPE|wl.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&Gl)!==Gl?(t&wl.SHAPE?this.addUpdateShapeAndBoundsTag():t&wl.BOUNDS&&this.addUpdateBoundTag(),t&wl.PAINT&&this.addUpdatePaintTag(),t&wl.TRANSFORM&&this.addUpdatePositionTag(),t&wl.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=wl.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,n,s;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(n=this.resolverEpoch)&&void 0!==n?n:0)+1,null===(s=this.stateEngine)||void 0===s||s.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!Yl(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const n=e[t];i[t]=Yl(n)?Object.assign({},n):n})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const n=t,s=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r=!0,s[t]=n[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=s,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,n){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(n)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&ji.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const n=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&n.clear(),n}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new de),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=ta[t];if(e)return e;if(e=th.userSymbolMap[t],e)return e;if(!0===ua(t=ea[t]||t)){const e=new pa,{svg:i}=e.parse(t);if(!i)return null;const n=_(i.path)?i.path:[i.path];Ll.clear();const s=[];n.forEach((t=>{const e=(new Xn).fromString(t.d),i={};Ya.forEach((e=>{t[e]&&(i[Ga[e]]=t[e])})),s.push({path:e,attribute:i}),Ll.union(e.bounds)}));const r=Ll.width(),a=Ll.height(),o=1/kt(r,a);s.forEach((t=>t.path.transform(0,0,o,o)));const l=new Jr(t,s,!0);return th.userSymbolMap[t]=l,l}const i=(new Xn).fromString(t),n=i.bounds.width(),s=i.bounds.height(),r=1/kt(n,s);i.transform(0,0,r,r);const a=new Jr(t,i);return th.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const n=this.attribute,s=this.updateAABBBounds(n,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=n,a=Us(r);return a&&s.expand(a),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Mi(t);return Zi(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new pe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&ji.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&ji.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ji.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ji.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&ji.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&ji.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=ji.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===zi.GLOBAL){const i=new Ft(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,n){if(!t)return;const s=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,s,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||n)&&t.preventAttrs(s)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===Wi.STATE||null!=i&&i>=Wi.ANIMATE_BIND&&i<=Wi.ANIMATE_END)return;const n=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,s=this.setFinalAttributes;n&&"function"==typeof s&&s.call(this,n)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var n,s;const r=this.context,a=null!==(n=null==r?void 0:r.diffAttrs)&&void 0!==n?n:t,o=null==i?void 0:i.type;if(!e.length||!a||o===Wi.STATE||null!=o&&o>=Wi.ANIMATE_BIND&&o<=Wi.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(s=this.transientFromAttrsBeforePreventAnimate)&&void 0!==s?s:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),s=this.sortLocalStates(t);return{changed:n,states:n?s:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const n=this.ensureStateEngine();if(n)return this.toGraphicStateTransition(n.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const s=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(s)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,n=this.currentStates.filter(i);return n.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(n)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const n=this.getStateResolveBaseAttrs(),s=this.ensureStateEngine(n);e&&(null==s||s.invalidateResolverCache());const r=s?this.toGraphicStateTransition(s.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},n=null!=e?e:{},s=new Set([...Object.keys(i),...Object.keys(n)]);for(const t of s){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(n,t))return!1;if(!Kl(i[t],n[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var n;const s=null!==(n=this.currentStates)&&void 0!==n?n:Vl,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,s,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Wi.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:Wi.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,n;return null!==(n=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==n?n:Xa}applyStateAttrs(t,e,i,n,s,r){const a=i?this.resolveStateAnimateConfig(s):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(n)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,n;const s=null!==(e=this.currentStates)&&void 0!==e?e:Vl,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===s.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Xl(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(n=this.baseAttributes)&&void 0!==n?n:{};a.changed&&!this.beforeStateUpdate(o,s,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Wi.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:Wi.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const n=this.resolveAddStateTransition(t,e);n.changed&&this.useStates(n.states,i)}setStates(t,e){var i,n,s;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:Vl,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(n=this.effectiveStates)||void 0===n?void 0:n.length)||this.resolvedStatePatch||(null===(s=this.registeredActiveScopes)||void 0===s?void 0:s.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const n=null!==(i=this.currentStates)&&void 0!==i?i:Vl,s=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(n,r.states)||this.beforeStateUpdate(o,n,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,s))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Wi.STATE}):this.restoreAttributeFromStatePatchDelta(s,this.resolvedStatePatch,{type:Wi.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),n=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=n,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Wi.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],n=null!=e?e:[];if(i.length!==n.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=s();n[0]=i.x1+(i.x2-i.x1)*e}else n[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=s();n[1]=i.y1+(i.y2-i.y1)*e}else n[1]=t[1];return n}doUpdateLocalMatrix(){const{x:t=is.x,y:e=is.y,scaleX:i=is.scaleX,scaleY:n=is.scaleY,angle:s=is.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&s&&(l=this.getAnchor(a,h)),!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,u=e.d,d=e.e,p=e.f,g=Tt(a),f=Bt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=n);const y=m-i,_=v-n,b=l*g+c*f,x=h*g+u*f,S=c*g-l*f,A=u*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*A,t.e=d+l*m+c*v-b*y-S*_,t.f=p+h*m+u*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),Ps.transformUtil.fromMatrix(a,a).scale(i,n,{x:l[0],y:l[1]})}const c=this.getOffsetXY(is);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Fl.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){var i,n,s,r,a,o,l,h,c,u;const d=null!==(s=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(n=this.stage)||void 0===n?void 0:n.graphicService)&&void 0!==s?s:Ps.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),n=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),n.push(t)))})),n.length&&(n.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:Wi.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==d?void 0:d.onSetStage)||void 0===h||h.call(d,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(u=this.registeredActiveScopes)||void 0===u?void 0:u.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:Wi.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,n;return t&&(t.shadowHost=this),this.shadowRoot=null!==(n=null!=t?t:null===(i=(e=Ps.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==n?n:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Xn).fromString(t):this.pathProxy=new Xn,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,n;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const s=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:Ps.graphicService;null===(n=null==s?void 0:s.onRelease)||void 0===n||n.call(s,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,n;if(this.hasCustomEvent(t)){const s=new bi(t,e);s.bubbles=!1;const r=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager;return r?(s.manager=r,this.dispatchEvent(s)):fi.prototype.dispatchEvent.call(this,s)}return!0}beforeStateUpdate(t,e,i,n,s){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:Wi.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!n,isClear:!!s})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:Wi.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const n=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ps.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(n){const t=new Zo(null,1);return n.drawShape(this,t,0,0,{},{}),t.path}return null}}Zl.userSymbolMap={};const Jl=Symbol.for("@visactor/vrender-core/graphic-class");function Ql(){var t;const e=globalThis;return null!==(t=e[Jl])&&void 0!==t||(e[Jl]={Graphic:Zl}),e[Jl]}const th=Ql().Graphic;function eh(t){return!!t&&("string"==typeof t?!Wl.has(t)&&(t.startsWith("{t[i]=e[i]}))}const ah=sh();class oh{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},nh.forEach((t=>{this._defaultTheme[t]=Object.create(ah[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0)}this.userTheme?this.doCombine(n&&n.theme.combinedTheme):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,nt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;nh.forEach((n=>{const s=Object.create(ah[n]);t&&t[n]&&rh(s,t[n]),i[n]&&rh(s,i[n]),e[n]&&rh(s,e[n]),this.combinedTheme[n]=s})),e.common&&nh.forEach((t=>{rh(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 lh=new oh;function hh(t,e){return t.glyphHost?hh(t.glyphHost):e?(t.isContainer,e):ch(t)||t.attachedThemeGraphic&&hh(t.attachedThemeGraphic)||lh.getTheme()}function ch(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)):lh.getTheme()}return null}const uh=(t,e,i)=>{const{outerBorder:n,shadowBlur:s=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(r+(s+a)/2)}return i},dh=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...Ul];class ph extends th{constructor(t){super(t),this.type="arc",this.numberType=Ca}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:n=t.outerPadding}=this.attribute;let{outerRadius:s=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(s+=n,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(s-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap,clipRange:s=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(s,1)),e=jt(e),i=e+a,n&&Ct(a)>_t&&Ct(a)_t&&o>_t)return{startAngle:e-r*d*s,endAngle:i+r*d*a,sc:r*d*s,ec:r*d*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:n=i.innerPadding,outerPadding:s=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=s,o-=n;const{padRadius:l=Et(a*a+o*o)}=this.attribute,h=Ct(e-t);let c=t,u=e,d=t,p=e;const g=r/2;let f=h,m=h;if(g>_t&&l>_t){const i=e>t?1:-1;let n=Ot(Number(l)/o*Bt(g)),s=Ot(Number(l)/a*Bt(g));return(f-=2*n)>_t?(n*=i,d+=n,p-=n):(f=0,d=p=(t+e)/2),(m-=2*s)>_t?(s*=i,c+=s,u-=s):(m=0,c=u=(t+e)/2),{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return hh(this).arc}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=Ps.graphicService.updateTempAABBBounds(i);uh(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:n=e.outerRadius,innerRadius:s=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return n+=r,s-=a,no){const t=l;l=o,o=t}return n<=_t?i.set(0,0,0,0):Math.abs(o-l)>At-_t?i.set(-n,-n,n,n):(zs(l,o,n,i),zs(l,o,s,i)),i}needUpdateTags(t){return super.needUpdateTags(t,dh)}needUpdateTag(t){return super.needUpdateTag(t,dh)}toCustomPath(){var t,e,i,n;let s=super.toCustomPath();if(s)return s;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(n=r.outerPadding)&&void 0!==n?n:0);const c=Ct(o-a),u=o>a;if(h=At-_t)s.moveTo(0+h*Tt(a),0+h*Bt(a)),s.arc(0,0,h,a,o,!u),l>_t&&(s.moveTo(0+l*Tt(o),0+l*Bt(o)),s.arc(0,0,l,o,a,u));else{const t=h*Tt(a),e=h*Bt(a),i=l*Tt(o),n=l*Bt(o);s.moveTo(0+t,0+e),s.arc(0,0,h,a,o,!u),s.lineTo(0+i,0+n),s.arc(0,0,l,o,a,u),s.closePath()}return s}clone(){return new ph(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ph.NOWORK_ANIMATE_ATTR}}function gh(t){return new ph(t)}ph.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},ql);const fh=["segments","points","curveType","curveTension",...Ul];class mh extends th{constructor(t){super(t),this.type="area",this.numberType=Ta}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return hh(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ps.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:n=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Vs(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,fh)}needUpdateTag(t){return super.needUpdateTag(t,fh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Xn;const e=this.attribute,i=e.segments,n=e=>{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new mh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mh.NOWORK_ANIMATE_ATTR}}function vh(t){return new mh(t)}mh.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ql);const yh=["radius","startAngle","endAngle",...Ul];class _h extends th{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=ka}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return hh(this).circle}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=Ps.graphicService.updateTempAABBBounds(i);return uh(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:n=e.startAngle,endAngle:s=e.endAngle,radius:r=e.radius}=t;return s-n>At-_t?i.set(-r,-r,r,r):zs(n,s,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,yh)}needUpdateTag(t){return super.needUpdateTag(t,yh)}toCustomPath(){var t,e,i;let n=super.toCustomPath();if(n)return n;const s=this.attribute,r=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return n=new Xn,n.arc(0,0,r,a,o),n}clone(){return new _h(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return _h.NOWORK_ANIMATE_ATTR}}function bh(t){return new _h(t)}_h.NOWORK_ANIMATE_ATTR=ql;class xh extends th{constructor(t){super(t),this.type="glyph",this.numberType=Ma,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,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return hh(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const n=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const s={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(s,i.attributes)})),this.beforeStateUpdate(s,n,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(s,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new xh(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return xh.NOWORK_ANIMATE_ATTR}}function Sh(t){return new xh(t)}var Ah;xh.NOWORK_ANIMATE_ATTR=ql,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Ah||(Ah={}));class Ch extends th{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ba,this._childUpdateTag=ji.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(El(this.sharedStateScope,t),Dl(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new oh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new oh)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===zi.GLOBAL){const i=new Ft(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&ji.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=is.x,y:e=is.y,dx:i=is.dx,dy:n=is.dy,scaleX:s=is.scaleX,scaleY:r=is.scaleY,angle:a=is.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==n||1!==s||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return hh(this).group}updateAABBBounds(t,e,i){const n=i;i=i.clone();const{width:s,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,Math.max(0,s),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:n=0}=t;i.translate(e,n)}return Ps.graphicService.updateTempAABBBounds(i),Ps.graphicService.transformAABBBounds(t,i,e,!1,this),n.copy(i),n}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=ji.CLEAR_BOUNDS,this._childUpdateTag&=ji.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=ji.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&ji.UPDATE_BOUNDS||(this._childUpdateTag|=ji.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,n,s,r,a,o;const l=null!==(s=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(n=this.stage)||void 0===n?void 0:n.graphicService)&&void 0!==s?s:Ps.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&ji.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=Ps.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new Ch(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ch.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const n=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,n),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&El(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return Pl({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,n,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}}function wh(t){return new Ch(t)}Ch.NOWORK_ANIMATE_ATTR=ql;const Th=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...Ul];class kh extends th{constructor(t){super(t),this.type="image",this.numberType=Ea,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,n)}getGraphicTheme(){return hh(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:n=e.maxWidth,maxHeight:s=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>n/s?(r=n,a=n/t):(a=s,r=s*t)}}else r=n,a=s}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:n,tb2:s}=Ps.graphicService.updateTempAABBBounds(i);return uh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Ts[t]}needUpdateTags(t){return super.needUpdateTags(t,Th)}needUpdateTag(t){return super.needUpdateTag(t,Th)}clone(){return new kh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kh.NOWORK_ANIMATE_ATTR}}function Mh(t){return new kh(t)}kh.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},ql);const Bh=["segments","points","curveType","curveTension",...Ul];let Eh=class t extends th{constructor(t={}){super(t),this.type="line",this.numberType=Pa}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Vs(i,n,e))}getGraphicTheme(){return hh(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ps.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points,connectedType:r}=t,a=i;return s.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments,connectedType:r}=t,a=i;return s.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bh)}needUpdateTag(t){return super.needUpdateTag(t,Bh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Xn;const i=e.segments,n=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):e.points&&n(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Ph(t){return new Eh(t)}Eh.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ql);const Oh=["path","customPath",...Ul];class Rh extends th{constructor(t){super(t),this.type="path",this.numberType=Oa}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Xn?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Xn?this.cache:t.path)}getGraphicTheme(){return hh(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:n,tb2:s}=Ps.graphicService.updateTempAABBBounds(i);uh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Xn).fromString(t.path):t.customPath&&(this.cache=new Xn,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Oh)}needUpdateTag(t){return super.needUpdateTag(t,Oh)}toCustomPath(){return(new Xn).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Rh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rh.NOWORK_ANIMATE_ATTR}}function Ih(t){return new Rh(t)}Rh.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},ql);const Dh=["points","cornerRadius",...Ul];class Lh extends th{constructor(t){super(t),this.type="polygon",this.numberType=Ra}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return hh(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ps.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Vs(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,Dh)}needUpdateTag(t){return super.needUpdateTag(t,Dh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Xn,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new Lh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Lh.NOWORK_ANIMATE_ATTR}}function Fh(t){return new Lh(t)}Lh.NOWORK_ANIMATE_ATTR=ql;const Uh=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,n=0,s=0;return e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(s=i,i=-i):Number.isNaN(i)&&(i=0),{x:n,y:s,width:e,height:i}},Nh=["width","x1","y1","height","cornerRadius",...Ul];class jh extends th{constructor(t){super(t),this.type="rect",this.numberType=Da}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return hh(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:n}=t;const{x1:s,y1:r,x:a,y:o}=t;e=null!=e?e:s-a,n=null!=n?n:r-o,(isFinite(e)||isFinite(n)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,n||0)}const{tb1:n,tb2:s}=Ps.graphicService.updateTempAABBBounds(i);return uh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Nh)}needUpdateTag(t){return super.needUpdateTag(t,Nh)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const n=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,s=t=>null!=n[t],r=t=>null==n[t];switch(t){case"width":return r("width")&&s("x")&&s("x1");case"height":return r("height")&&s("y")&&s("y1");case"x1":return r("x1")&&s("x")&&s("width");case"y1":return r("y1")&&s("y")&&s("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const n=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,s=t=>{const e=n[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=s("x"),a=s("y"),o=s("x1"),l=s("y1"),h=s("width"),c=s("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:n,width:s,height:r}=Uh(e);return t=new Xn,t.moveTo(i,n),t.rect(i,n,s,r),t}clone(){return new jh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jh.NOWORK_ANIMATE_ATTR}}function zh(t){return new jh(t)}jh.NOWORK_ANIMATE_ATTR=ql;const Wh=Symbol.for("EnvContribution"),Hh=Symbol.for("VGlobal"),Vh="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",Gh={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Yh=!0,Xh=!1,Kh=/\w|\(|\)|-/,$h=/[.?!,;:/,。?!、;:]/,qh=/\S/,Zh=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Jh(t,e,i,n,s){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ps.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return s&&(a=Qh(t,a)),a}function Qh(t,e,i=!1){let n=e;for(;Kh.test(t[n-1])&&Kh.test(t[n])||$h.test(t[n]);)if(n--,n<=0)return i?tc(t,e):e;return n}function tc(t,e){let i=e;for(;Kh.test(t[i+1])&&Kh.test(t[i])||$h.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function ec(t,e,i="actual"){var n;if(""===t)return{ascent:0,height:0,descent:0,width:0};const s=Ps.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?s.actualBoundingBoxAscent:s.fontBoundingBoxAscent,o="actual"===i?s.actualBoundingBoxDescent:s.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(s.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(s.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(n=e.space)&&void 0!==n?n:0;return r.width+=l,r}class ic{constructor(t,e,i,n,s,r,a,o,l,h,c,u,d,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Gh[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=u,this.singleLine=d,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-s:"center"===this.globalAlign&&(o=-s/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((s-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+s||at&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function nc(t,e,i,n){const s=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(n);return{left:t>s?s:s-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>n?o:o+.5}}class sc{constructor(t,e,i,n){var s,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=n;const a=$s(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=ec(t,i,this.ascentDescentMode);let u=0,d=0,p=0;this.height>l&&(u=(this.height-l)/2,d=Math.ceil(u),p=Math.floor(u)),"top"===this.textBaseline?(this.ascent=u,this.descent=l-u):"bottom"===this.textBaseline?(this.ascent=l-u,this.descent=u):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+d,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(s=i.dx)&&void 0!==s?s:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=ec(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,n,s,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+n;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Jh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=ec(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const u=nc(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},u),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,n,s,r,a){var o;let l=e+i,h=this.text,c=this.left+n+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let u=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,u="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Jh(h,("vertical"===u?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===u);else{const{width:e}=ec(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===u&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:d=1}=this.character;if(this.character.stroke&&d&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===u&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Jh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:n}=ec(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-n}return i}}class rc extends kh{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=Us(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Us(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=Ts.width,height:e=Ts.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class ac{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof rc?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Gh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof sc){const e=qh.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,n=this.height;let s=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const n=this.paragraphs[e];if(n.overflow)t=t&&""===n.text;else if(t){i=!0;break}}let n=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof rc)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===s?"...":s||"";i.ellipsisStr=r;const{width:a}=ec(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+n){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+n+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+n;break}i.ellipsis="hide",n+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,s)=>{if(e instanceof rc)return;const r=e.drawBackground(t,n,this.ascent,i,0===s,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],n=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,n.right-i.left,n.bottom-i.top)})),this.paragraphs.forEach(((e,s)=>{if(e instanceof rc)return e.setAttributes({x:i+e._x,y:n+e._y}),void r(e,t,i+e._x,n+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Xh;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:n=1,opacity:s=1}=e;t.globalAlpha=n*s,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Zh(t,e)})(t,e.character),function(t,e,i){const n=e&&e.fill||Yh;if(!n)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:r=1}=e;t.globalAlpha=s*r,t.fillStyle=i?Eo(t,n,{AABBBounds:i}):n,Zh(t,e)}(t,e.character,a),e.draw(t,n,this.ascent,i,0===s,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n instanceof rc)break;const{width:s}=ec(t,n.character,n.ascentDescentMode),r=s||0;if(r<=this.blankWidth+e){n.ellipsis="add",n.ellipsisWidth=r;break}if(r<=this.blankWidth+e+n.width){n.ellipsis="replace",n.ellipsisWidth=r,n.ellipsisOtherParagraphWidth=this.blankWidth+e;break}n.ellipsis="hide",e+=n.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof rc?t.width:t.getWidthWithEllips(this.direction)})),i}}class oc{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=Gh[this.direction]}store(t){if(t instanceof rc){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 ac(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof rc?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,n=Math.ceil(i/t[this.directionKey.width]*t.length)||0,s=Jh(t.text,i,t.character,n,"break-word"===this.frame.wordBreak);if(0!==s){const[i,n]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new sc(i,t.newLine,t.character,t.ascentDescentMode),new sc(n,!0,t.character,t.ascentDescentMode)]}(t,s);this.store(i),e?this.send():this.deal(n)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let lc=!1;try{lc=Intl&&"function"==typeof Intl.Segmenter}catch(t){lc=!1}const hc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Ul];class cc extends th{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Fa,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const n=this._frameCache.icons.get(t[i]);this.updateHoverIconState(n)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:ws.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:ws.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:ws.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:ws.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:ws.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:ws.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:ws.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:ws.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return hh(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&cc.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&cc.splitText(t.text).length>1)))}static splitText(t){if(lc){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:n}of e.segment(t))i.push(n);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=cc.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let n=0;n0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:n}=t.getActualSize();let s=o||e||0,r=l||n||0;r="number"==typeof c&&r>c?c:r||0,s="number"==typeof h&&s>h?h:s||0,i.set(0,0,s,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(d){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(u){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ps.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ps.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ps.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,hc)}needUpdateTag(t){return super.needUpdateTag(t,hc)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!cc.AllSingleCharacter(y)&&(y=cc.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let n=0;n0,A="number"==typeof n&&Number.isFinite(n)&&n>0,C="number"==typeof s&&Number.isFinite(s)&&s>0&&(!x||s<=i),w="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=n),T=new ic(0,0,(C?s:x?i:0)||0,(w?r:A?n:0)||0,a,o,l,h,c,u||"horizontal",!C&&x,!w&&A,d||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),k=new oc(T);if(k.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const n=_[i];e?(n.overflow=!0,n.left=1/0,n.top=1/0,!n.newLine&&T.lines[T.lines.length-1].paragraphs.push(n)):k.deal(n,!0),T.lines.length!==t&&(t=T.lines.length,k.lineBuffer.length=0,n.overflow=!0,n.left=1e3,n.top=1e3,T.lines[T.lines.length-1].paragraphs.push(n),e=!0),n.newLine&&(e=!1,k.lineWidth=0),k.send()}}else for(let t=0;t<_.length;t++)k.deal(_[t]);if(k.send(),!("horizontal"===T.layoutDirection?C:w)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:n)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new cc(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,n,s,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(a=s.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],s.globalY=(null!==(o=s.attribute.y)&&void 0!==o?o:0)+n+e._marginArray[0])})),s}getNoWorkAnimateAttr(){return cc.NOWORK_ANIMATE_ATTR}}function uc(t){return new cc(t)}cc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},ql);class dc extends Ch{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function pc(t){return new dc(t)}const gc=["symbolType","size",...Ul];let fc=class t extends th{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Na}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let n=null;try{n=new Path2D}catch(t){return null}const s=this.getParsedPath();if(!s)return null;s.draw(n,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return hh(this).symbol}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=Ps.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:n,shadowBlur:s=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=n;fa(i,a+(s+o)/2,!0,r)}})(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:n=e.size}=t;if(_(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){const{size:n=e.size}=t,s=this.getParsedPath();return s?(s.bounds(n,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,gc)}needUpdateTag(t){return super.needUpdateTag(t,gc)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Xn).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Xn).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function mc(t){return new fc(t)}function vc(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function yc(t,e,i,n=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?n-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function _c(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[Pe(i)]=t[i])})),["fontSize","lineHeight"].forEach((n=>{const s=Pe(n);d(t[n])||(e[s]=i(t[n]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}fc.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},ql);class bc{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,n){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===n.length){const t=n[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,n,s="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=qn.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const u=[],d=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,n=t.length;io){const n=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,s,r,l);a=n.str,e=n.width}else e=n.width;u.push({str:a,width:e,ascent:n.ascent,descent:n.descent,keepCenterInLine:c})}d[0]=o}else{let e,i,n=0;for(let s=0,r=t.length;sMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(p,e,i,u),this.layoutWithBBox(p,u,e,i,n)}layoutWithBBox(t,e,i,n,s){const r=[0,0],a=e.length*s;"top"===n||("middle"===n?r[1]=(t.height-a)/2:"bottom"===n&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===s.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=ja}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return hh(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Sc({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const n=this.obbText.AABBBounds,{x:s,y:r}=e,a={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},o=Jt(a,i,{x:s,y:r});return this._OBBBounds.copy(n),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:n=e.text}=this.attribute;Array.isArray(n)?this.updateMultilineAABBBounds(n):this.updateSingallineAABBBounds(n);const{tb1:s}=Ps.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){fa(s,o/Math.abs(r+a),!0,l),i.union(s)}return Ps.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ps.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,he(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:n=e.underlineOffset}=this.attribute,s="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&n&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+n),s}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const n=this.getGraphicTheme(),s=this.attribute,{fontFamily:r=n.fontFamily,textAlign:a=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,fontWeight:h=n.fontWeight,ellipsis:c=n.ellipsis,maxLineWidth:u,stroke:d=n.stroke,wrap:p=n.wrap,measureMode:g=n.measureMode,lineWidth:f=n.lineWidth,whiteSpace:m=n.whiteSpace,suffixPosition:v=n.suffixPosition,ignoreBuf:y=n.ignoreBuf,keepCenterInLine:_=n.keepCenterInLine}=s,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(s,n,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Ps.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new bc(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?n.ellipsis:c||void 0,!1,{lineWidth:u,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:C}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(C.xOffset,C.yOffset,C.xOffset+C.width,C.yOffset+C.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,n,s;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:u,stroke:d=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),C=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const w=Ps.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:C},k=new bc(a,T,w),M=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/C),1)),x&&(P=Math.min(P,x)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let n=0,s=M.length;n{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const t=vc(y,a),e=this.cache.verticalList.length*v,i=yc(_,e,u);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>_a(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?s.ellipsis:h,n=r.clipTextWithSuffixVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,i,!1,m);b[e]=n.verticalList,a=n.width}else{const i=r.clipTextVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===ya.HORIZONTAL?u:r.measureTextWidth(t.text,{fontSize:u,fontWeight:d,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const S=vc(y,a),A=x.verticalList.length*v,C=yc(_,A,u);return this._AABBBounds.set(C,S,C+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const n=this.attribute;return null!==(i=null!==(e=n.maxLineWidth)&&void 0!==e?e:n.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var n;return null!==(n=$s(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==n?n:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=xc){return super.needUpdateTags(t,e)}needUpdateTag(t,e=xc){return super.needUpdateTag(t,e)}_interpolate(t,e,i,n,s){"text"===t&&(s.text=n)}clone(){return new Sc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Sc.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Sc.baselineMapAlign}getAlignMapBaseline(){return Sc.alignMapBaseline}}function Ac(t){return new Sc(t)}Sc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},ql),Sc.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Sc.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Cc=["heightLimit","lineClamp"];class wc extends Sc{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n,s,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:u=a.ellipsis,maxLineWidth:d,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=$s(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=Ps.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(n=this.stage)||void 0===n?void 0:n.textMeasureId)),C=new bc(o,{fontSize:c,fontWeight:m,fontFamily:o},A),w=t.map((t=>t.toString())),T=[],k=[0,0];let M=1/0;if(y>0&&(M=Math.max(Math.floor(y/x),1)),b&&(M=Math.min(M,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),k[0]=t}else{let t,e,i=0;for(let n=0,s=w.length;n!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class Lc extends Dc{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let Fc=0;class Uc{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ps.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Fc,t),this.tryRunAnimationFrameNextFrame(),Fc}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class Nc{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const n=this._resolveCapture(i),s=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(n))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),s&&this._deleteListenerRecord(t,e,n)};a.set(n,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var n,s;if(!e)return;const r=this._resolveCapture(i),a=null===(s=null===(n=this._listenerMap.get(t))||void 0===n?void 0:n.get(e))||void 0===s?void 0:s.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const n=this._listenerMap.get(t);if(!n)return;const s=n.get(e);s&&(s.delete(i),0===s.size&&n.delete(e),0===n.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var jc=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class zc extends Nc{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=pi.GenAutoIncrementId(),this.hooks={onSetEnv:new Lc(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Uc);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Uc),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return jc(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class Wc{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=qa(Object.assign({nativeCanvas:Ps.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=qa(Object.assign({nativeCanvas:Ps.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const Hc=new Wc,Vc=Symbol.for("VWindow"),Gc=Symbol.for("WindowHandlerContribution");function Yc(t){const e=Ps.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Xc extends Nc{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(t=Ps.global,e=Yc){super(),this.handlerFactory=e,this.hooks={onChange:new Lc(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=pi.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const n=this._handler.getWH();this._width=n.width,this._height=n.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,n,s,r){this._handler.setViewBoxTransform(t,e,i,n,s,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),n={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},n),n.x-=i.x1,n.y-=i.y1,n}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&ot(this.width,t.width())&&ot(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)}}class Kc{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ps.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Hc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:as.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new re(Object.assign({defaultFontParams:{fontFamily:as.fontFamily,fontSize:as.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+re.ALPHABET_CHAR_SET+re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var n,s;if(!e.defaultLayer)return null;const r=null!==(s=null===(n=Ps.windowFactory)||void 0===n?void 0:n.call(Ps))&&void 0!==s?s:new Xc(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const u=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=u;const d=r.getNativeHandler();return d.nativeCanvas?d.nativeCanvas:null}}var $c;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}($c||($c={}));const qc=new pe;class Zc{constructor(){this.matrix=new pe}init(t){return this.mode=$c.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=$c.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(qc.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(qc.a,qc.b,qc.c,qc.d,qc.e,qc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(qc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:n}=e;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(qc.a,qc.b,qc.c,qc.d,qc.e,qc.f),this}scale(t,e,i){return this.mode===$c.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===$c.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return qc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(qc.a,qc.b,qc.c,qc.d,qc.e,qc.f),this}translate(t,e){return this.mode===$c.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===$c.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const Jc=Symbol.for("@visactor/vrender-core/factory-state");function Qc(){const t=globalThis;return t[Jc]||(t[Jc]={pluginClasses:{}}),t[Jc]}class tu{constructor(){this.global=Ps.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new pe(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new Ft(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,n);a&&(s.graphic=a.graphic,s.params=a.params)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i,n){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var eu=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function iu(t,e,i){const n={},s=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;n[i]?n[i].push(t):(n[i]=[t],s.push(i))}),i),s.sort(((t,e)=>i?e-t:t-e)),{childMap:n,zIdxArray:s}}function nu(t,e,i,n=!1,s=!1){let r=!1;if(s)r=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return r=!0,!0;return!1}),n)}if(r){const{childMap:r,zIdxArray:a}=iu(t,e,n);let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return s=!0,!0;return!1}),n);let r=null,a=!1;if(s){const{childMap:s,zIdxArray:o}=iu(t,i,n);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),n);return r}const au=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new ue)}allocate(t,e,i,n){if(!this.pools.length)return(new ue).setValue(t,e,i,n);const s=this.pools.pop();return s.x1=t,s.y1=e,s.x2=i,s.y2=n,s}allocateByObj(t){if(!this.pools.length)return new ue(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class ou{constructor(){this.time=Gi.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:C=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const s=t.resources.get(cu(g));if(!s||"success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=hh(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,this.doDrawImage(e,s.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:C}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n){yu(t,e,i,n)}}const lu=new ou,hu=new Set(["top","center","bottom"]);function cu(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function uu({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const du={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function pu({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const n=du[t];return n?{backgroundRepeatMode:"no-repeat",backgroundSizing:n}:{backgroundRepeatMode:t,backgroundSizing:uu({backgroundFit:e,backgroundKeepAspectRatio:i})}}function gu(t,e,i,n,s){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===n)return e/2;if(r===s)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function fu(t,e,i){const[n,s]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const n=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===n.length)return["left","top"];if(1===n.length){const t=n[0];return"center"===t?["center","center"]:hu.has(t)?["center",t]:[t,"center"]}let s,r;const a=[];for(let t=0;t<2;t++){const e=n[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:s=e}return null==s&&a.length&&(s=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=s?s:"left",null!=r?r:"top"]}(t);return{x:gu(n,e,"left","center","right"),y:gu(s,i,"top","center","bottom")}}function mu(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function vu(t){if(!t)return null;const e=mu(t.naturalWidth,t.videoWidth,t.width),i=mu(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function yu(t,e,i,n){var s,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:u=0,backgroundPosition:d="top-left"}=n,p=i.width(),g=i.height(),f=vu(e),{backgroundRepeatMode:m,backgroundSizing:v}=pu({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let n=null!==(s=null==f?void 0:f.width)&&void 0!==s?s:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(n=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);n=f.width*t,a=f.height*t}n*=h,a*=h;const{x:o,y:l}=fu(d,p-n,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+u,n,a)}if(o&&"repeat"!==m&&f){const i=f.width,n=f.height;"repeat-x"===m?(y=i*(g/n),_=g):"repeat-y"===m&&(_=n*(p/i),y=p);const s=t.dpr,r=Hc.allocate({width:y,height:_,dpr:s}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),Hc.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class _u{constructor(t){this.subRenderContribitions=t,this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}}class bu{constructor(){this.time=Gi.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||u),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,n+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const xu=new bu;class Su{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||u||e.restore())}}const Au=new Su,Cu={getContributions:()=>[]};class wu{constructor(t=[],e=Cu,i={}){var n,s,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,n)=>{var s;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,n):this.renderItem(t,i))})):nu(e,us.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,n):this.renderItem(t,i))}),!1,!!(null===(s=i.context)||void 0===s?void 0:s.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new ce,this.backupDirtyBounds=new ce,this.global=null!==(n=i.global)&&void 0!==n?n:Ps.global,this.layerService=null!==(s=i.layerService)&&void 0!==s?s:Ps.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:Cu,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:n,stage:s,viewBox:r,transMatrix:a}=e;if(!n)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=function(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=Kt(t,e,i);return n>=l||s<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(n,o),y1:Math.max(r,h),x2:Math.min(s,l),y2:Math.min(a,c)}}(o,s.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=n.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*n.dpr)/n.dpr,o.y1=Math.floor(o.y1*n.dpr)/n.dpr,o.x2=Math.ceil(o.x2*n.dpr)/n.dpr,o.y2=Math.ceil(o.y2*n.dpr)/n.dpr),this.backupDirtyBounds.copy(o),n.reset(!1),n.save(),n.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),n.clearMatrix(!1),n.translate(r.x1,r.y1,!0),n.beginPath(),n.rect(o.x1,o.y1,o.width(),o.height()),n.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,n,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:us.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:us.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Xo.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),n.restore(),n.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=ru(e,i,us.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,n){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!$t(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let s,r=i;if(this.useDirtyBounds){s=au.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Xo.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:n,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(s),au.free(s),Xo.free(r))}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||function(){const t=Ps.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class ku{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class Mu{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Bu{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Eu{constructor(){this.entries=new Map}register(t,e){var i;const n=null!==(i=this.entries.get(t))&&void 0!==i?i:[];n.push(e),this.entries.set(t,n)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const n=i.filter((t=>t!==e));n.length?this.entries.set(t,n):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const Pu={getContributions:()=>[]};class Ou{constructor(t=Pu,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new Bu}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class Ru{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class Iu{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ps.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ps.global.getRequestAnimationFrame();this.rafId=t((()=>{Ps.global.devicePixelRatio!==this.dpr&&(this.dpr=Ps.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ps.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Du{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ps.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Lu=new ue;class Fu{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const n=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(n._updateTag&ji.UPDATE_PAINT)||n._updateTag&ji.UPDATE_BOUNDS)return;const s=this.ensurePaintDirtyBoundsCache(n);s&&!s.empty()&&i.dirty(s),n.clearUpdatePaintTag();const r=n.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(Lu.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(Lu,t.parent&&t.parent.globalTransMatrix)))})),t.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Uu;function Nu(){if(null==Uu)try{const t=document.createElement("canvas"),e=t.getContext("2d");Uu=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Uu&&(Uu=!!document.createElement)}catch(t){Uu=!1}}function ju(){Nu();const t=Ps.global&&Ps.global.env;return t?"browser"===t:Uu}function zu(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:u=i.scaleY,scaleZ:d=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(n=m[2])&&void 0!==n?n:0}if(Po(t),Do(t,t,[s+o,r+l,a+h]),Do(t,t,[y[0],y[1],y[2]]),Oo(t,t,g),Ro(t,t,p),Do(t,t,[-y[0],-y[1],y[2]]),Fo(t,t,[c,u,d]),f){const i=Ko.allocate(),n=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}Do(i,i,[n[0],n[1],0]),Io(i,i,f),Do(i,i,[-n[0],-n[1],0]),Uo(t,t,i)}}function Wu(t){const{alpha:e,beta:i}=t.attribute;return e||i}class Hu{constructor(t=Oc){this.creator=t,this.hooks={onAttributeUpdate:new Lc(["graphic"]),onSetStage:new Lc(["graphic","stage"]),onRemove:new Lc(["graphic"]),onRelease:new Lc(["graphic"]),onAddIncremental:new Lc(["graphic","group","stage"]),onClearIncremental:new Lc(["graphic","group","stage"]),beforeUpdateAABBBounds:new Lc(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Lc(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new Lc(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new ue,this.tempAABBBounds2=new ue,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,n){const{textAlign:s,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),n=yc(r,e,e);i.set(i.x1,n,i.x2,n+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),n=vc(s,e);i.set(n,i.y1,n+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){if(!e.empty()){const{scaleX:s=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(a&&l){fa(u,(l+h)/Math.abs(s+r),n,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(o){const{shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;fa(u,o/Math.abs(s+r)*2,!1,c+1),u.translate(n,a),e.union(u)}}if(this.combindShadowAABBBounds(e,s),e.empty())return;let r=!0;const a=s.transMatrix;s&&s.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&he(e,e,a)}validCheck(t,e,i,n){if(!n)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(n.shadowRoot||n.isContainer)return!0;const{visible:s=e.visible}=t;return!(!n.valid||!s)||(i.empty()||(n.parent&&i.transformWithMatrix(n.parent.globalTransMatrix),this.clearAABBBounds(n,n.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const Vu="white";class Gu extends Ch{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:Vu}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new oh,this.hooks={beforeRender:new Lc(["stage"]),afterRender:new Lc(["stage"]),afterClearScreen:new Lc(["stage"]),afterClearRect:new Lc(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:Ps.global,!this.global.env&&ju()&&this.global.setEnv("browser"),this.windowFactory=null!==(s=null!==(n=e.windowFactory)&&void 0!==n?n:Ps.windowFactory)&&void 0!==s?s:()=>new Xc(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=Ps.pickerServiceFactory)&&void 0!==a?a:()=>new tu,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(u=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=Ps.renderServiceFactory)||void 0===h?void 0:h.call(Ps))&&void 0!==c?c:Ps.renderService)&&void 0!==u?u:new Tu,this.pluginService=null!==(f=null!==(g=null!==(d=e.pluginService)&&void 0!==d?d:null===(p=Ps.pluginServiceFactory)||void 0===p?void 0:p.call(Ps))&&void 0!==g?g:Ps.pluginService)&&void 0!==f?f:new Ou,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:Ps.layerService)&&void 0!==v?v:new Zu(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:Ps.graphicService)&&void 0!==b?b:new Hu,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:Vu,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var n,s;i&&(s=e,(n=i).themeStateDefinitions!==s&&(n.themeStateDefinitions=s,Pl(n)),Dl(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Ti(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:u,beta:d,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(u)+y,S=Math.sin(d)+_,A=Math.cos(u)*Math.cos(d)*1);const C=$u.getPlugin("DirectionalLight");C&&(this.light=new C(f,m,v));const w={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=w;else{const t=$u.getPlugin("OrthoCamera");t&&(this.camera=new t(w))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=$u.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new Ru))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new Iu))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Du))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new ce;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Fu,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=$u.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=$u.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=$u.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return Pl({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Ft(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),n=e?-e.x1:0,s=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:n,y1:s,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class Yu{constructor(t=Gu,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Xu extends Ch{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new oh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ps.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=>{Ps.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)))}}class Ku{constructor(t=Xu){this.LayerCtor=t}create({stage:t,global:e,window:i,params:n}){return new this.LayerCtor(t,e,i,n)}}let $u=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function qu(t){const e=Ps.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}$u._pluginClasses=Qc().pluginClasses;class Zu{static GenerateLayerId(){return`${Zu.idprefix}_${Zu.prefix_count++}`}constructor(t=Ps.global,e=new Ku,i=qu){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let n=this.getRecommendedLayerType(e.layerMode);n=e.main||e.canvasId?"static":n;const s=this.getLayerHandler(n),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Zu.GenerateLayerId(),layerHandler:s})}),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}}Zu.idprefix="visactor_layer",Zu.prefix_count=0;const Ju=Symbol.for("TransformUtil"),Qu=Symbol.for("GraphicUtil"),td=Symbol.for("LayerService"),ed=Symbol.for("StaticLayerHandlerContribution"),id=Symbol.for("DynamicLayerHandlerContribution"),nd=Symbol.for("VirtualLayerHandlerContribution"),sd=Symbol.for("@visactor/vrender-core/contribution-store-state");function rd(){const t=globalThis;return t[sd]||(t[sd]={store:new Map}),t[sd]}const ad=Symbol("ContributionProvider");class od{constructor(t,e){this.serviceIdentifier=t,this.container=e,ud.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function ld(t,e){return new od(t,e)}function hd(t,e){t(ad).toDynamicValue((({container:t})=>ld(e,t))).inSingletonScope().whenTargetNamed(e)}function cd(t,e){t(ad).toDynamicValue((({container:t})=>ld(e,t))).whenTargetNamed(e)}class ud{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}ud.store=rd().store;class dd{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:n}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=n,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=n}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:n}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=n}return t}estimate(t,{fontSize:e=Cs.fontSize}){let i=0,n=0;for(let e=0;e{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(n&&a.str!==t){let i=Qh(t,a.str.length,s);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,n,s,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,n,s),a&&(o.result=a+o.str);else if("middle"===r){const n=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:n.width,result:n.left+a+n.right}}else o=this._clipTextEnd(t,e,i,n,s),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,n,s){if(n===s){nt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${n}, ${s}`);const i=t.substring(0,s+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextEnd(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,s)}return{str:a,width:o}}_clipTextStart(t,e,i,n,s){const r=Math.ceil((n+s)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(r,t.length);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,n,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,n,s,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:n,right:s,width:r+a};const c=t.substring(t.length-o,t.length),u=this.measureTextWidth(c,e);return h+u>i?{left:l,right:s,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,u,o+1)}clipTextWithSuffixVertical(t,e,i,n,s,r){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,s);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(n,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,s);const a=this.revertVerticalList(l.verticalList);a.unshift({text:n,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,s),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,s);r.verticalList.push({text:n,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,s),l.verticalList.push({text:n,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,n,s,r,a=!1){if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(n,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+n,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,n);if(s&&h.str!==t){const i=Qh(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+n);return h.str=h.result,h.width+=l,h}}const pd=Symbol.for("TextMeasureContribution");class gd extends dd{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function fd({bind:t}){t(Hh).toDynamicValue((({container:t})=>new zc(ld(Wh,t)))).inSingletonScope(),t(Vc).to(Xc),t(Qu).toDynamicValue((({container:t})=>new Kc(ld(pd,t)))).inSingletonScope(),t(Ju).to(Zc).inSingletonScope(),t(td).to(Zu).inSingletonScope()}const md=Symbol.for("RenderService"),vd=Symbol.for("BeforeRenderConstribution");function yd({bind:t}){t(md).to(Tu)}const _d=Symbol.for("GraphicPicker"),bd=Symbol.for("PickerService"),xd=Symbol.for("BoundsPicker"),Sd=Symbol.for("GlobalPickerService"),Ad=Symbol.for("PickItemInterceptor"),Cd=Symbol.for("PickServiceInterceptor"),wd=(t,e,i,n)=>{let s,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===wa,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=At;for(;o<0;)o+=At;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),n.hack_pieFace="outside",s=i(r,a),s&&s.graphic||(n.hack_pieFace="inside",s=i(r,a)),s&&s.graphic||(n.hack_pieFace="top",s=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const n=e.getChildren(),o=n.map((e=>({ave_z:e.findFace().vertices.map((i=>{var n;return t.view(i[0],i[1],null!==(n=i[2]+e.attribute.z)&&void 0!==n?n:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),s=i(r,a),e.removeAllChild(),n.forEach((t=>{t._next=null,t._prev=null})),e.update(),n.forEach((t=>{e.add(t)}))}else s=i(r,a);return s},Td=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class kd extends jh{constructor(t){super(t),this.type="rect3d",this.numberType=La}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:n,x:s,y:r,length:a=Mt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-s,l=null!=l?l:n-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return hh(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:n=0}=t;(isFinite(e)||isFinite(n))&&i.set(0,0,e,n)}const{tb1:n,tb2:s}=Ps.graphicService.updateTempAABBBounds(i);return i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:n=e.height,spikes:s=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(s)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,n)/2,c=h*(1-o),u=i/2,d=n/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,s=Math.PI/a*t,r=i/(2*h),o=n/(2*h);l.push({x:u+Math.sin(s)*e*r,y:d-Math.cos(s)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,n,s){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(s[t]=i+(n-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,Bd)}needUpdateTag(t){return super.needUpdateTag(t,Bd)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Xn,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new Ed(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ed.NOWORK_ANIMATE_ATTR}}function Pd(t){return new Ed(t)}Ed.NOWORK_ANIMATE_ATTR=ql;class Od extends ph{constructor(t){super(t),this.type="arc3d",this.numberType=wa}updateAABBBounds(t,e,i){const n=this.stage;if(!n||!n.camera)return i;const{outerRadius:s=e.outerRadius,height:r=0}=t,a=s+r;return i.setValue(-a,-a,a,a),Ps.graphicService.updateTempAABBBounds(i),Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Od.NOWORK_ANIMATE_ATTR}}function Rd(t){return new Od(t)}Od.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},ql);class Id extends Lh{constructor(t){super(t),this.type="pyramid3d",this.numberType=Ia}updateAABBBounds(t,e,i){const n=this.stage;return n&&n.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)})),Ps.graphicService.updateTempAABBBounds(i),Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return Id.NOWORK_ANIMATE_ATTR}}function Dd(t){return new Id(t)}let Ld,Fd;function Ud(t){return Ld||(Ld=Ic("text",{})),Ld.initAttributes(t),Ld.AABBBounds}function Nd(t){return Fd||(Fd=Ic("richtext",{})),Fd.setAttributes(t),Fd.AABBBounds}Id.NOWORK_ANIMATE_ATTR=ql;class jd{constructor(){this.order=1}afterPickItem(t,e,i,n,s){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class zd{constructor(){this.order=1}afterPickItem(t,e,i,n,s){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,n,s):null}beforePickItem(t,e,i,n,s){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,n,s):null}_pickItem(t,e,i,n,s){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=s||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=hh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=Xo.allocateByObj(a),d=new Ft(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),p=e.pickGroup(c,d,u,n);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class Wd{constructor(){this.order=1}beforePickItem(t,e,i,n,s){const r=t.baseGraphic;if(r&&r.parent){const t=new Ft(i.x,i.y),s=e.pickContext;s.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,n):e.pickItem(r,t.clone(),a,n);return s.highPerformanceRestore(),o}return null}}class Hd{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=wd(r,t,(()=>e.pickGroup(t,i,s.parentMatrix,n)),n);return r.camera=null,n.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function Vd({bind:t,isBound:e}){e(bd)||(t(Sd).toSelf(),t(bd).toService(Sd)),t(Hd).toSelf().inSingletonScope(),t(Ad).toService(Hd),t(zd).toSelf().inSingletonScope(),t(Ad).toService(zd),t(Wd).toSelf().inSingletonScope(),t(Ad).toService(Wd),hd(t,Ad),t(jd).toSelf().inSingletonScope(),t(Cd).toService(jd),hd(t,Cd)}function Gd({bind:t}){t(za).to(Hu),t(Wa).toConstantValue(Oc)}const Yd=Symbol.for("AutoEnablePlugins"),Xd=Symbol.for("PluginService");class Kd{constructor(){this.type="static",this.offscreen=!1,this.global=Ps.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=qa({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}}function $d(t){(function({bind:t}){hd(t,Wh)})({bind:t.bind}),function({bind:t}){t(pd).to(gd).inSingletonScope(),hd(t,pd)}({bind:t.bind}),function({bind:t}){t(Kd).toSelf(),t(ed).toService(Kd)}({bind:t.bind})}const qd=bt/2;function Zd(t,e,i,n,s,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),n<0&&(e+=n,n=-n),s<0&&(i+=s,s=-s),S(r,!0))l=[r=Ct(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ct(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ct(t[0]),i=Ct(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ct(l[0]),l[1]=Ct(l[1]),l[2]=Ct(l[2]),l[3]=Ct(l[3])}}else l=[0,0,0,0];if(n<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,n,s);const[h,c,u,d]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],p=Math.min(n/2,s/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[u[0]-g[2],u[1]],b=[u[0],u[1]-g[2]],x=[d[0]+g[3],d[1]],A=[d[0],d[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!$(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-qd,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!$(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,qd,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!$(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],qd,bt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],bt,bt+qd,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Jd(t,e){return!(!t&&!e)}function Qd(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function tp(t,e,i){return i&&t*e>0}function ep(t,e,i,n,s){return s&&t*e>0&&0!==i&&0!==n}function ip(t,e){return t*e>0}function np(t,e,i,n,s){return s?t*e>0:t*e>0&&0!==i&&0!==n}function sp(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,u=o-r;let d=u*l-c*h;return d*d<_t?[]:(d=(c*(e-r)-u*(t-s))/d,[t+d*l,e+d*h])}function rp(t,e,i,n,s,r,a){const o=t-i,l=e-n,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,u=-h*o,d=t+c,p=e+u,g=i+c,f=n+u,m=(d+g)/2,v=(p+f)/2,y=g-d,_=f-p,b=y*y+_*_,x=s-r,S=d*f-g*p,A=(_<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let C=(S*_-y*A)/b,w=(-S*y-_*A)/b;const T=(S*_+y*A)/b,k=(-S*y+_*A)/b,M=C-m,B=w-v,E=T-m,P=k-v;return M*M+B*B>E*E+P*P&&(C=T,w=k),{cx:C,cy:w,x01:-c,y01:-u,x11:C*(s/x-1),y11:w*(s/x-1)}}function ap(t,e,i,n,s){const r=Ct(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:u,innerEndAngle:d,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=s*Tt(c),C=s*Bt(c),w=n*Tt(d),T=n*Bt(d);let k,M,B,E;if((b>_t||y>_t)&&(k=s*Tt(u),M=s*Bt(u),B=n*Tt(p),E=n*Bt(p),r1?0:P<-1?bt:Math.acos(P))/2),l=Et(t[0]*t[0]+t[1]*t[1]);S=Mt(b,(n-l)/(o-1)),x=Mt(y,(s-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:C,xirs:B,yirs:E,xore:k,yore:M,xire:w,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:u,innerDeltaAngle:h,innerEndAngle:d,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function op(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let u=!1;if(s=At-_t)e.moveTo(i+s*Tt(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>_t&&(e.moveTo(i+r*Tt(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const{outerDeltaAngle:h,xors:d,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:C,outerEndAngle:w,limitedIcr:T,innerDeltaAngle:k,innerEndAngle:M,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:O}=ap(t,o,l,r,s);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+d,n+p),u=!0;else if(m>_t){const t=Mt(v,m),r=Mt(y,m),o=rp(g,f,d,p,s,t,Number(c)),l=rp(b,x,S,A,s,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),e.arc(i+o.cx,n+o.cy,m,wt(o.y01,o.x01),wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Tt(wt(l.y01,l.x01)),n+o.cy+m*Bt(wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),t>0&&e.arc(i+o.cx,n+o.cy,t,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,n,s,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Tt(wt(l.y01,l.x01)),n+l.cy+r*Bt(wt(l.y01,l.x01))):e.moveTo(i+b,n+s*Bt(w))}else!a||a[0]?(e.moveTo(i+d,n+p),e.arc(i,n,s,C,w,!c)):e.moveTo(i+s*Tt(w),n+s*Bt(w));if(!(r>_t)||k<.001)!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),u=!0;else if(T>_t){const t=Mt(E,T),s=Mt(P,T),o=rp(S,A,b,x,r,-s,Number(c)),l=rp(d,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),T0&&e.arc(i+o.cx,n+o.cy,s,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,n,r,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Tt(wt(l.y01,l.x01)),n+l.cy+t*Bt(wt(l.y01,l.x01))):e.moveTo(i+g,n+f)}else!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),!a||a[2]?e.arc(i,n,r,M,B,c):e.moveTo(i+r*Tt(B),n+r*Bt(B))}return a?a[3]&&e.lineTo(i+s*Tt(o),n+s*Bt(o)):e.closePath(),u}const lp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class hp{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=n.dpr,o=Hc.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),s(r,l);const h=n.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Hc.free(o),h}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,At),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,n,l,g,f,m)}drawTexture(t,e,i,n,s,r,a,o,l){var h,c,u,d,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:u}=m,d=e.AABBBounds;n=d.x1,s=d.y1;const p=i;let g;if(u){g=Hc.allocate({width:d.width(),height:d.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,d.width(),d.height()),n=0,s=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,n,s,r),p.clip();const v=d.width(),y=d.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,C=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=mc({}));const w=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[w-A,T-C],symbolType:t});const k=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:lp.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${n}|dpr:${s}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${s}`}createResourcePattern(t,e,i,n,s){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(n>0||s>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*n,a=e+2*n,l=Hc.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),s>0){const i=Math.max(0,Math.min(s,Math.min(t,e)/2)),r=n,a=n,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,n,n,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),Hc.free(l),c}Hc.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const cp=new hp;class up{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{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:C=l.scaleY,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:k=l.outerRadius}=t.attribute;k+=v,T-=m;const M=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=w?o:Bo(e,o,e.dpr),c=o/k,d="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:k+d*h,innerRadius:T-d*h,startAngle:y-d*c,endAngle:_+d*c}),e.beginPath(),op(t,e,i,n,k+d*h,T-d*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,s,(x-i)/A,(S-n)/C,l[r]),l[r].opacity=a,e.stroke()}};g&&M(d,"outerBorder"),f&&M(p,"innerBorder"),t.setAttributes({outerRadius:k,innerRadius:T,startAngle:y,endAngle:_})}}const dp=new up,pp=cp,gp=lu;class fp{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute,w=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=C?o:Bo(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,n,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,s,(b-i)/S,(x-n)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&w(d,"outerBorder"),f&&w(p,"innerBorder")}}const mp=new fp,vp=cp,yp=lu;class _p extends ou{constructor(){super(...arguments),this.time=Gi.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{background:d,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const i=t.resources.get(cu(d));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,n,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=d,e.fill(),e.highPerformanceRestore()}}const bp=new _p;function xp(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Sp{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:C,y1:w,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:C-i)||0,M=(null!=M?M:w-n)||0;const B=(s,r)=>{const a=!(!s||!s.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=s,c=T?h:Bo(e,h,e.dpr),d=i+o*c,p=n+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(d,p,k-o*g,M-o*g)):(e.beginPath(),Zd(e,d,p,k-o*g,M-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,s,(b-i)/S,(x-n)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(d,"outerBorder"),f&&B(p,"innerBorder")}}class Ap{constructor(){this.time=Gi.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;xp(p)&&(d.doStroke=!1)}}class Cp{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{x1:d,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:d-g)||0,x=(null!=x?x:p-f)||0,xp(m)){if(e.setStrokeStyle(t,t.attribute,i,n,l),!(0===v||_(v)&&v.every((t=>0===t)))){let s,r=0;return Zd(e,i,n,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,u)=>{m[o]&&(r===o-1&&m[o]===s||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,n,l),e.beginPath(),e.moveTo(a,h),s=m[o]),r=o,e.lineTo(c,u),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,n),m[0]?e.lineTo(i+b,n):e.moveTo(i+b,n),m[1]?e.lineTo(i+b,n+x):e.moveTo(i+b,n+x),m[2]?e.lineTo(i,n+x):e.moveTo(i,n+x),m[3]){const t=m[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}}const wp=new Sp,Tp=cp,kp=lu;class Mp extends Sp{constructor(){super(...arguments),this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){return super.drawShape(t,e,i,n,s,r,a,o,l,h,c,u)}}const Bp=new Mp,Ep=lu;class Pp{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const d=t.getParsedPath();if(!d)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,C=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=A?o:Bo(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===d.drawOffset(e,v,i,n,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,s,(_-i)/x,(b-n)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&C(p,"outerBorder"),m&&C(g,"innerBorder")}}class Op{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,n,p,m,((s,r)=>{var a,h,c,d;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(d=r.lineWidth)&&void 0!==d?d:t.attribute.lineWidth,r=e}r.stroke&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-n)/_,l),e.stroke()))})),r&&!b.isSvg&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-n)/_,l),e.stroke())))}}const Rp=new Pp,Ip=new Op,Dp=cp,Lp=lu,Fp=cp,Up=lu;class Np extends hp{constructor(){super(...arguments),this.time=Gi.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=d||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:Gs(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Gs(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Gs(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Gs(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,n,l,_,b,x)}}class jp{constructor(t){this.groupRenderContribitions=t,this.numberType=Ba}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(bp)}drawShape(t,e,i,n,s,r,a,o,l){const{clip:h,fill:c,stroke:u,background:d}=t.attribute;if(!(h||c||u||d))return;l=null!=l?l:hh(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:C=l.cornerType,x:w=l.x,y:T=l.y}=t.attribute,k=ep(p,m,g,f,c),M=np(p,v,g,f),B=Jd(c,d),E=Qd(u,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(k||M||a||o||d))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,n,g,f)):(e.beginPath(),Zd(e,i,n,g,f,y,"bevel"!==C));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(bp));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Gi.beforeFillStroke&&r.drawShape(t,e,i,n,B,E,k,M,l,s,a,o,P)})),h&&e.clip();const O=()=>{P.doFill&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,w-i,T-n,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,w-i,T-n,l),e.stroke()))};A?(R(),O()):(O(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Gi.afterFillStroke&&r.drawShape(t,e,i,n,B,E,k,M,l,s,a,o)}))}draw(t,e,i,n){var s,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,u=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:n,height:s}=t.attribute,r=a.canvas,o=Ps.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,n,s),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const d=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=hh(t,null==n?void 0:n.theme).group,i=Ko.allocate(),s=Ko.allocate();zu(s,t,e),Uo(i,p||i,s),a.modelMatrix=i,Ko.free(s),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),n.skipDraw?this.drawShape(t,a,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),n&&n.renderInGroup&&(m=n.renderInGroup(null===(s=n.renderInGroupParams)||void 0===s?void 0:s.skipSort,t,i,null===(r=n.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Ko.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=d,h>0){const{x:e,y:i,width:n,height:s}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,n,s),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=u,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var zp,Wp=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(zp||(zp={}));class Hp extends wu{constructor(t,e,i,n){super(t,n),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=n,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=zp.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Lc([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Wp(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,viewBox:s}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s.x1,s.y1,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:us.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:us.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Wp(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Wp(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Wp(this,void 0,void 0,(function*(){if(2!==t.count)yield su(t,us.zIndex,((i,n)=>{if(this.status===zp.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Wp(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Wp(this,void 0,void 0,(function*(){this.rendering&&(this.status=zp.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=zp.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 Wp(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:()=>Wp(this,void 0,void 0,(function*(){yield su(t,us.zIndex,(t=>Wp(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const Vp=Symbol.for("IncrementalDrawContribution"),Gp=Symbol.for("ArcRender"),Yp=Symbol.for("Arc3dRender"),Xp=Symbol.for("AreaRender"),Kp=Symbol.for("CircleRender"),$p=Symbol.for("GraphicRender"),qp=Symbol.for("GroupRender"),Zp=Symbol.for("LineRender"),Jp=Symbol.for("PathRender"),Qp=Symbol.for("PolygonRender"),tg=Symbol.for("RectRender"),eg=Symbol.for("Rect3DRender"),ig=Symbol.for("SymbolRender"),ng=Symbol.for("TextRender"),sg=Symbol.for("RichTextRender"),rg=Symbol.for("Pyramid3dRender"),ag=Symbol.for("GlyphRender"),og=Symbol.for("ImageRender"),lg=Symbol.for("RenderSelector"),hg=Symbol.for("DrawContribution"),cg=Symbol.for("StarRender"),ug=Symbol.for("DrawItemInterceptor"),dg=new ue,pg=new ue;class gg{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,n,s),!1}beforeDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){dg.copy(n.dirtyBounds),pg.copy(n.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e),n.backupDirtyBounds.copy(n.dirtyBounds)}return n.renderGroup(t.shadowRoot,i,Xo.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&(n.dirtyBounds.copy(dg),n.backupDirtyBounds.copy(pg)),!0}}class fg{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}class mg{constructor(){this.order=1,this.interceptors=[new gg,new yg,new vg,new fg]}afterDrawItem(t,e,i,n,s){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rn.renderGroup(t,i,t.parent.globalTransMatrix,!e&&s)),i):n.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Ko.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const _g=Symbol.for("ArcRenderContribution"),bg=Symbol.for("AreaRenderContribution"),xg=Symbol.for("CircleRenderContribution"),Sg=Symbol.for("GroupRenderContribution"),Ag=Symbol.for("ImageRenderContribution"),Cg=Symbol.for("PathRenderContribution"),wg=Symbol.for("PolygonRenderContribution"),Tg=Symbol.for("RectRenderContribution"),kg=Symbol.for("SymbolRenderContribution"),Mg=Symbol.for("TextRenderContribution"),Bg=Symbol.for("StarRenderContribution"),Eg=Symbol.for("CommonRenderContribution"),Pg=Symbol.for("InteractiveSubRenderContribution");function Og(t){!function({bind:t}){t(ou).toSelf().inSingletonScope(),t(hp).toSelf().inSingletonScope(),t(hg).to(wu),t(Vp).to(Hp),t(qp).toDynamicValue((({container:t})=>new jp(ld(Sg,t)))).inSingletonScope(),t($p).toService(qp),hd(t,Sg),hd(t,Pg),t(_u).toDynamicValue((({container:t})=>new _u(ld(Pg,t)))).inSingletonScope(),hd(t,$p),t(mg).toSelf().inSingletonScope(),t(ug).toService(mg),hd(t,ug)}({bind:t.bind})}class Rg{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class Ig{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new Rg(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const n=i.find((t=>t.named===e));return n?this.resolveBinding(n):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function Dg(){return new Ig}const Lg=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const Fg=function(){const t=globalThis;return t[Lg]||(t[Lg]={legacyBindingContext:Dg(),preloaded:!1}),t[Lg]}(),Ug=Fg.legacyBindingContext;function Ng(){Fg.preloaded||(Fg.preloaded=!0,fd({bind:Ug.bind}),Gd({bind:Ug.bind}),yd({bind:Ug.bind}),Vd({bind:Ug.bind,isBound:Ug.isBound}),function({bind:t}){t(Xd).to(Ou),cd(t,Yd)}({bind:Ug.bind}),$d(Ug),Og(Ug))}function jg(){return Ug}function zg(t){Ng();const[e]=Ug.getAll(t);return e}function Wg(t,e){return Ng(),Ug.getNamed(t,e)}function Hg(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const n=e()[i];return"function"==typeof n?n.bind(e()):n},set:(t,i,n)=>(e()[i]=n,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const n=Object.getOwnPropertyDescriptor(e(),i);if(n)return Object.assign(Object.assign({},n),{configurable:!0})}})}const Vg=Hg((()=>zg(Hh)));Ps.global=Vg;class Gg{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let n;return n=e?"string"==typeof e?Ps.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Ps.global.createDom(Object.assign({tagName:"div",parent:n},i)),nativeContainer:n}}parseDefaultStyleFromGraphic(t){return _c("text"===t.type&&t.attribute?t.attribute:hh(t).text)}getTransformOfText(t){const e=hh(t).text,{textAlign:i=e.textAlign,textBaseline:n=e.textBaseline}=t.attribute,s=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=s,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[n]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[n]}`}}updateStyleOfWrapContainer(t,e,i,n,s){const{pointerEvents:r,penetrateEventList:a=[]}=s;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",n.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=s.anchorType;if(d(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ae(c,p);l=t.x,h=t.y}const f=Ps.global.getElementTopLeft(n,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),u(s.style)){const e=s.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(s.style)?o=Object.assign(Object.assign({},o),s.style):y(s.style)&&s.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),n=i[1].trim();t&&n&&(e[t]=n)}}})),e})(s.style)));Ps.global.updateDom(i,{width:s.width,height:s.height,style:o})}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"===Ps.global.env&&(t.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:us.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:us.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&&Ps.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const{dom:s,container:r}=i;if(!s)return;const a=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof s?this.htmlMap[a].wrapContainer.innerHTML=s:s!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(s));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,r);t&&("string"==typeof s?t.innerHTML=s:t.appendChild(s),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,n,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===Ps.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 Yg=()=>{$u.registerPlugin("HtmlAttributePlugin",Gg)};class Xg extends Gg{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:n}=this.htmlMap[t];e?Ps.global.getRequestAnimationFrame()((()=>{e.unmount()})):n&&n(),i&&Ps.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const s=n.params.ReactDOM,{element:r,container:a}=i;if(!r||!s||!s.createRoot&&!s.render)return;const o=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])s.createRoot?this.htmlMap[o].root.render(r):s.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,a);if(t)if(this.htmlMap||(this.htmlMap={}),s.createRoot){const i=s.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else s.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{s.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,n,l,h,i),this.htmlMap[o].renderId=this.renderId}}const Kg=()=>{$u.registerPlugin("ReactAttributePlugin",Xg)};class $g{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return $g.instance||($g.instance=new $g),$g.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var n,s,r,a;let o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get(e);return o?o(i,t):(o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let n=this.transitions.get(t);n||(n=new Map,this.transitions.set(t,n)),n.set(e,i)}}function qg(t){if(!t||!u(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function Zg(t,e,i,n){const s=function(t,e,i,n){var s;const r=t,a=null===(s=r.context)||void 0===s?void 0:s.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var n,s;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const n=this.resolveValue(t.delay,i,0),s=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=n+r+s,Object.assign(Object.assign({},t),{delay:n,delayAfter:s,duration:r})}));let n=0;l&&(n="number"==typeof l?l:l?e:0),o.oneByOneDelay=n;let s=1;if(r){const t=e+n*(this._target.count-2);s=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*s,delayAfter:t.delayAfter*s,duration:t.duration*s,effects:e.map((t=>{var e,i;const n=null!==(e=t.custom)&&void 0!==e?e:Jg.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],s=qg(n);return Object.assign(Object.assign({},t),{custom:n,customType:s})}))})})),o.oneByOneDelay=n*s,o.startTime=a*s}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(n=t.custom)&&void 0!==n?n:Jg.builtInAnimateMap[null!==(s=t.type)&&void 0!==s?s:"fromTo"];const d=qg(o.custom);o.customType=d;const p=e+h+c+u*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=u*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,n;return t.partitioner(null===(n=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===n?void 0:n[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var n,s,r,a;return t.sort(null===(s=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===s?void 0:s[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const n=e?(i,n,s)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,n,s);a&&this._trackAnimation(a)}:(i,n,s)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,n,s);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>n(t,e,i.length))):this._target.count<=1?n(this._target,0,1):this._target.forEachChildren(((t,e)=>n(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,n){var s,r,a,o,l,h,c,d;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:C=0,options:w,custom:T,customType:k,controlOptions:M}=t,B=e.animate();B.priority=C;const E=u(v)?v(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],O=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&O&&(i=null!==(h=P[O])&&void 0!==h?h:i),B.startAt(b);const R=i*x+E;R>0&&B.wait(R);let I=null,D=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.props),L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,T,k,L,D,_,m,f,M,w,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(B,e,p,D);let U=0;x&&(U=x*(n-i-1));const N=u(y)?y(null===(d=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===d?void 0:d[0],e,{}):y;return N>0&&(U+=N),U>0&&B.wait(U),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,n,s,r,a,o,l,h,c,d){var p,g,f,m,v,y,_,b;if(e&&i){i=qg(e);let c=this.resolveValue(o,d);"function"==typeof c&&(c=c(null===(g=null===(p=d.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],d,{})),c=Object.assign({width:(null===(f=d.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=d.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=u(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=d.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],d,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,n,s,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,s,r,a,c)}else"to"===c?t.to(s,r,a):"from"===c&&t.from(s,r,a)}executeTimelineItem(t,e,i,n){var s,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:u,oneByOneDelay:d,priority:p,controlOptions:g}=t,f=null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*d),c&&c>0&&v.loop(c),u&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),d&&v.wait(d*(n-i-1)),v}applyTimeSliceToAnimate(t,e,i,n){var s,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:d=0}=t,p=u(c)?c(null===(r=null===(s=i.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],i,{}):c,g=u(d)?d(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):d;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var s;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let u=null,d=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);d||(u||(u=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),d=u.props),p||(u||(u=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=u.from),u.attrOutChannel&&i.setAttributes(u.attrOutChannel);const f=null!==(s=t.custom)&&void 0!==s?s:Jg.builtInAnimateMap[r],m=t.custom?t.customType:qg(f);this._handleRunAnimate(e,f,m,p,d,h,l,o,n,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,n,s,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,n,s,a,o)=>{e(s,i,n,a,o,t.target,r)},t.to(i,n,s)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,n){if("update"===i||!n||!this.isUpdateDiffContext(e))return;const s=this.collectAnimatedUpdateDiffAttrKeys(e,n);(null==s?void 0:s.length)&&t.onEnd((()=>{Zg(e,s,t,n)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const n=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!n)return null;let s=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(n,t)&&void 0!==n[t]&&(null!=s||(s=[]),s.push(t));return s}createCustomAnimation(t,e,i,n,s,r,a){const o=new e(i,n,s,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,n){var s;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(s=e.context)||void 0===s?void 0:s.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var n,s,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(s=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===s?void 0:s[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==n?void 0:n[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var n,s;return void 0===t?i:"function"==typeof t&&e?t(null===(s=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===s?void 0:s[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,n=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!n)return null;let s=null;for(let e=0;ethis._executeItem(t,e,i,n))).filter(Boolean)}finally{this._activeConfigList=s}}return[this._executeItem(t,e,i,n)].filter(Boolean)}_executeItem(t,e,i=0,n=1){if(!e)return null;const s="timeSlices"in t;let r=null;const a=this.parseParams(t,s);return r=s?this.executeTimelineItem(a,e,i,n):this.executeTypeConfigItem(a,e,i,n),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=ts.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}Jg.builtInAnimateMap={};const Qg="appear",tf="disappear",ef="update",nf="highlight",sf="unhighlight";class rf{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class af{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const n={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);n.allowTransition=n.allowTransition&&i.allowTransition})),n.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new Jg(this.graphic)}),r.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new Jg(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var s;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(s=this.stateList)&&void 0!==s?s:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==n)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([Qg],[{name:Qg,animation:t}],e)}applyDisappearState(t,e){this.applyState([tf],[{name:tf,animation:t}],e)}applyUpdateState(t,e){this.applyState([ef],[{name:ef,animation:t}],e)}applyHighlightState(t,e){this.applyState([nf],[{name:nf,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([sf],[{name:sf,animation:t}],e)}stopState(t,e){var i;const n=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));n&&n.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class of{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new af(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new rf(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((n=>{n.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class lf{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-lf.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*lf.bounceIn(2*t):.5*lf.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/At*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*At/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/At*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*At/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/At*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*At/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*At/e)*.5+1}}static registerFunc(t,e){lf[t]=e}}function hf(t,e){const i=1/e;let n=1;for(;t>i;)t-=i,n*=-1;const s=n*t/i;return s>0?s:1+s}lf.quadIn=lf.getPowIn(2),lf.quadOut=lf.getPowOut(2),lf.quadInOut=lf.getPowInOut(2),lf.cubicIn=lf.getPowIn(3),lf.cubicOut=lf.getPowOut(3),lf.cubicInOut=lf.getPowInOut(3),lf.quartIn=lf.getPowIn(4),lf.quartOut=lf.getPowOut(4),lf.quartInOut=lf.getPowInOut(4),lf.quintIn=lf.getPowIn(5),lf.quintOut=lf.getPowOut(5),lf.quintInOut=lf.getPowInOut(5),lf.backIn=lf.getBackIn(1.7),lf.backOut=lf.getBackOut(1.7),lf.backInOut=lf.getBackInOut(1.7),lf.elasticIn=lf.getElasticIn(1,.3),lf.elasticOut=lf.getElasticOut(1,.3),lf.elasticInOut=lf.getElasticInOut(1,.3*1.5),lf.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),lf.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},lf.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)lf[`flicker${t}`]=e=>hf(e,t);for(let t=2;t<10;t++)lf[`aIn${t}`]=e=>t*e*e+(1-t)*e;function cf(t,e,i){return t+(e-t)*i}const uf=new class{constructor(){this.opacity=(t,e,i,n,s,r)=>{r.attribute.opacity=cf(e,i,n)},this.baseOpacity=(t,e,i,n,s,r)=>{r.attribute.baseOpacity=cf(e,i,n)},this.fillOpacity=(t,e,i,n,s,r)=>{r.attribute.fillOpacity=cf(e,i,n)},this.strokeOpacity=(t,e,i,n,s,r)=>{r.attribute.strokeOpacity=cf(e,i,n)},this.zIndex=(t,e,i,n,s,r)=>{r.attribute.zIndex=cf(e,i,n)},this.backgroundOpacity=(t,e,i,n,s,r)=>{r.attribute.backgroundOpacity=cf(e,i,n)},this.shadowOffsetX=(t,e,i,n,s,r)=>{r.attribute.shadowOffsetX=cf(e,i,n)},this.shadowOffsetY=(t,e,i,n,s,r)=>{r.attribute.shadowOffsetY=cf(e,i,n)},this.shadowBlur=(t,e,i,n,s,r)=>{r.attribute.shadowBlur=cf(e,i,n)},this.fill=(t,e,i,n,s,r)=>{r.attribute.fill=nl(e,i,n,!1)},this.fillPure=(t,e,i,n,s,r)=>{r.attribute.fill=s.fromParsedProps.fill?hl(s.fromParsedProps.fill,s.toParsedProps.fill,n):s.toParsedProps.fill},this.stroke=(t,e,i,n,s,r)=>{r.attribute.stroke=nl(e,i,n,!1)},this.strokePure=(t,e,i,n,s,r)=>{r.attribute.stroke=s.fromParsedProps.stroke?hl(s.fromParsedProps.stroke,s.toParsedProps.stroke,n):s.toParsedProps.stroke},this.width=(t,e,i,n,s,r)=>{r.attribute.width=cf(e,i,n),r.addUpdateBoundTag()},this.height=(t,e,i,n,s,r)=>{r.attribute.height=cf(e,i,n),r.addUpdateBoundTag()},this.x=(t,e,i,n,s,r)=>{r.attribute.x=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,n,s,r)=>{r.attribute.y=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,n,s,r)=>{r.attribute.dx=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,n,s,r)=>{r.attribute.dy=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,n,s,r)=>{r.attribute.angle=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,n,s,r)=>{r.attribute.scaleX=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,n,s,r)=>{r.attribute.scaleY=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,n,s,r)=>{r.attribute.lineWidth=cf(e,i,n),r.addUpdateBoundTag()},this.startAngle=(t,e,i,n,s,r)=>{r.attribute.startAngle=cf(e,i,n),r.addUpdateBoundTag()},this.endAngle=(t,e,i,n,s,r)=>{r.attribute.endAngle=cf(e,i,n),r.addUpdateBoundTag()},this.radius=(t,e,i,n,s,r)=>{r.attribute.radius=cf(e,i,n),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,n,s,r)=>{r.attribute.outerRadius=cf(e,i,n),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,n,s,r)=>{r.attribute.innerRadius=cf(e,i,n),r.addUpdateBoundTag()},this.size=(t,e,i,n,s,r)=>{r.attribute.size=cf(e,i,n),r.addUpdateBoundTag()},this.points=(t,e,i,n,s,r)=>{r.attribute.points=Vs(e,i,n),r.addUpdateBoundTag()}}};function df(t,e,i,n,s,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*n,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const s=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:Wi.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=n?"function"==typeof n?n:null!==(s=lf[n])&&void 0!==s?s:lf.linear:lf.linear,"wait"===t&&(this.onUpdate=Sf),this.id=pi.GenAutoIncrementId(),this.syncAttributeUpdate=Sf}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],n=this.props[e];if(y(i)&&y(n)){const s=el.Get(i,tl.Color255),r=el.Get(n,tl.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=s,this.toParsedProps[e]=r,t.push(uf["fill"===e?"fillPure":"strokePure"])}else uf[e]?t.push(uf[e]):t.push(df)}else uf[e]?t.push(uf[e]):t.push(df)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const n=this.interpolateUpdateFunctions,s=this.propKeys;if(n&&s)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const n=e.getStartProps();let s=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,n),this.onUpdate(t,n,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class wf extends Cf{constructor(t,e,i,n){super(t,e,i,n)}onStart(){super.onStart();const t=this.getFromProps();bf(this.target,t,Wi.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class Tf extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=pi.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const n=e.next;t(e.animate,i),i++,e=n}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===ts.END?this.removeAnimate(t,!0):t.status!==ts.RUNNING&&t.status!==ts.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const kf=new Tf;kf.isGlobal=!0;class Mf extends Cf{constructor(t,e,i,n,s){super("customAnimate",null!=e?e:{},i,n),this.type="customAnimate",this.customFrom=t,this.params=s,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.onUpdate(t,n,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Bf extends Mf{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Ef extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===ts.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,n=i.getContext("2d");return!!n&&(n.clearRect(0,0,i.width,i.height),n.drawImage(e,0,0),i)}}class Pf extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.from=null!=t?t:{}}applyTransientFromAttributes(){bf(this.target,this.from,Wi.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.from,this.props,n),this.onUpdate(t,n,i),this.syncAttributeUpdate()}}function Of(t,e){for(let i=0;i{var i;if(t===e||t.status===ts.END)return;const n=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(n)for(const t in n)!Object.prototype.hasOwnProperty.call(n,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class Df{constructor(t=pi.GenAutoIncrementId(),e=kf,i){this.id=t,this.status=ts.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(If(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const n=new Cf(Qn.to,t,e,i);return n.bind(this.target,this),this.updateStepAfterAppend(n),this}wait(t){const e=new wf(Qn.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const n=new Pf(t,{},e,i);return n.bind(this.target,this),this.updateStepAfterAppend(n),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===ts.RUNNING&&(this.status=ts.PAUSED)}resume(){this.status===ts.PAUSED&&(this.status=ts.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,n;if(this.status===ts.END)return void console.warn("aaa 动画已经结束,不能推进");const s=this.currentTime+t;if(s=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=ts.END;const t=this.target;return t.restoreStaticAttribute(If(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=ts.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=s;let r=s-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(s-this._startTime)%this._duration;const t=Math.floor((s-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&bf(this.target,this._startProps,Wi.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(n=this.lastRunStep)||void 0===n||n.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const Lf=new Uc;class Ff{constructor(){this.released=!1}tick(t,e){Lf.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class Uf extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const n=t.getTime();this._lastTickTime=n,this.lastFrameTime<0&&(this.lastFrameTime=n-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const s=n-this.lastFrameTime,r=this.checkSkip(s);return r||(this._handlerTick(s),this.lastFrameTime=n,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Jn.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Jn.INITIAL,Ps.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ps.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new Ff;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Jn.INITIAL&&(this.status=Jn.PAUSE,!0)}resume(){return this.status!==Jn.INITIAL&&(this.status=Jn.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Jn.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Jn.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Jn.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Jn.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Jn.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Jn.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ps.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,n;return"performance"!==(null===(n=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===n?void 0:n.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function jf(){Rc("arc",gh)}function zf(){Rc("arc3d",Rd)}function Wf(){Rc("area",vh)}function Hf(){Rc("circle",bh)}function Vf(){Rc("glyph",Sh)}function Gf(){Rc("group",wh)}function Yf(){Rc("image",Mh)}function Xf(){Rc("line",Ph)}function Kf(){Rc("path",Ih)}function $f(){Rc("polygon",Fh)}function qf(){Rc("pyramid3d",Dd)}function Zf(){Rc("rect",zh)}function Jf(){Rc("rect3d",Md)}function Qf(){Rc("richtext",uc)}function tm(){Rc("shadowRoot",pc)}function em(){Rc("star",Pd)}function im(){Rc("symbol",mc)}function nm(){Rc("text",Ac)}function sm(){Rc("wrapText",Tc)}function rm(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const am={x:0,y:0,z:0,lastModelMatrix:null};class om{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(xu),e(Au),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Gi.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Gi.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,n,s,r,a,o,l,h,c,u,d){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}afterRenderStep(t,e,i,n,s,r,a,o,l,h,c,u,d){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}drawPathProxy(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=hh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=tp(u,d,h),_=ip(u,g),b=Jd(h),x=Qd(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Zi(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,b,x,y,_,l,s,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,n-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,n-v,l),e.fill())),this.afterRenderStep(t,e,i,n,b,x,y,_,l,s,a,o),!0}valid(t,e,i,n){const{fill:s=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:u=e.visible}=t.attribute,d=tp(o,l,s),p=ip(o,c),g=Jd(s,r),f=Qd(a,h);return!(!t.valid||!u)&&!(!g&&!f)&&!!(d||p||i||n||r)&&{fVisible:d,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,n=!1){const{x:s=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,u=i.modelMatrix,d=i.camera;am.x=s,am.y=r,am.z=a,am.lastModelMatrix=u;const p=d&&(n||Wu(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const n=Ko.allocate(),s=Ko.allocate();zu(s,t,e),Uo(n,u||n,s),am.x=0,am.y=0,am.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),Ko.free(s)}if(g&&!u){const n=t.getOffsetXY(e);am.x+=n.x,am.y+=n.y,am.z=a,i.setTransformForCurrent()}else if(p)am.x=0,am.y=0,am.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const n=t.getOffsetXY(e);am.x+=n.x,am.y+=n.y,this.transformWithoutTranslate(i,am.x,am.y,am.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),am.x=0,am.y=0,am.z=0;return am}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},u={x:s,y:r};n.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+u.y*o.x+(c.y-u.y)*a.x)*d,g=(c.y*l.y+h.y*(o.y-l.y)-u.y*o.y+(u.y-c.y)*a.y)*d,f=(h.x*(l.x-o.x)-c.x*l.x+u.x*o.x+(c.x-u.x)*a.x)*d,m=-(c.x*l.y+h.x*(o.y-l.y)-u.x*o.y+(u.x-c.x)*a.y)*d,v=(h.x*(u.y*o.x-c.y*l.x)+h.y*(c.x*l.x-u.x*o.x)+(u.x*c.y-c.x*u.y)*a.x)*d,y=(h.x*(u.y*o.y-c.y*l.y)+h.y*(c.x*l.y-u.x*o.y)+(u.x*c.y-c.x*u.y)*a.y)*d;n.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,n,s,r){const{context:a}=n;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.z=u,this.drawPathProxy(t,a,h,c,n,s)||(this.drawShape(t,a,h,c,n,s,null,null,r),this.z=0,a.modelMatrix!==d&&Ko.free(a.modelMatrix),a.modelMatrix=d),a.highPerformanceRestore()}}class lm extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ca,this.builtinContributions=[dp,gp,pp],this.init(t)}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let u=h.endAngle;u=o;const d=u>c;let p=!1;if(s_t){const t=Mt(b,_),r=Mt(x,_),a=rp(v,y,f,m,s,t,Number(d)),o=rp(A,C,w,T,s,r,Number(d));if(_0&&e.arc(i+o.cx,n+o.cy,r,wt(o.y11,o.x11),wt(o.y01,o.x01),!d)}}else e.moveTo(i+f,n+m);if(!(r>_t)||M<.001)e.lineTo(i+w,n+T),p=!0;else if(k>_t){const t=Mt(E,k),s=Mt(P,k),a=rp(w,T,A,C,r,-s,Number(d)),o=rp(f,m,v,y,r,-t,Number(d));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),k0&&e.arc(i+a.cx,n+a.cy,s,wt(a.y01,a.x01),wt(a.y11,a.x11),!d);const t=wt(a.cy+a.y11,a.cx+a.x11),o=u-l-.03;e.arc(i,n,r,t,o,d)}}else e.lineTo(i+r*Tt(B),n+r*Bt(B));return p}drawShape(t,e,i,n,s,r,a,o,l){l=null!=l?l:hh(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:u=l.stroke,x:d=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:C=l.outerRadius,innerRadius:w=l.innerRadius}=t.attribute;C+=b,w-=x;let T=0;const k=(c(S)&&S||S[0])&&"conical"===h.gradient;if(k){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Ct(n-i)=At-_t){e.beginPath();const r=Math.abs(C-w)/2/C,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,u=h;this.drawArcTailCapPath(t,e,i,n,C,w,u,u+r),M||this.beforeRenderStep(t,e,i,n,y,_,m,v,l,s,a,o);const d=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()))};(()=>{if(y){const s=c;if("conical"===s.gradient){const r=ml(0,0,h,s);a||tp&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=r,e.fill())}}})(),d()}}this.afterRenderStep(t,e,i,n,y,_,m,v,l,s,a,o),k&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,n,s,r,a,o,l,h){r&&(h?h(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l){r&&a&&(l?l(e,t.attribute,s):o&&(e.setStrokeStyle(t,t.attribute,i,n,s),e.stroke()))}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).arc;this._draw(t,s,!1,i,n,s)}}const hm=new WeakSet;function cm({bind:t}){rm(hm,t)||(t(lm).toDynamicValue((({container:t})=>new lm(ld(_g,t)))).inSingletonScope(),t(Gp).toService(lm),t($p).toService(Gp),t(_g).toService(_u),hd(t,_g))}const um=cm;class dm extends om{constructor(){super(...arguments),this.numberType=wa}drawShape(t,e,i,n,s,r,a,o){var l;const h=hh(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,u=this.valid(t,h,a,o);if(!u)return;const{fVisible:d,sVisible:p,doFill:g,doStroke:f}=u,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=el.Get(c,tl.Color255),{light:A}=s.stage||{},C=s.hack_pieFace,w={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===C||"top"===C?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let u=!1;if(r=At-_t)e.moveTo(i+r*Tt(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>_t&&(e.moveTo(i+a*Tt(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:d,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Tt(p),y=r*Bt(p),_=a*Tt(f),b=a*Bt(f);h<.001?u=!0:(e.moveTo(i+v,n+y,s),e.arc(i,n,r,p,g,!c,s)),!(a>_t)||d<.001?(e.lineTo(i+_,n+b,s),u=!0):(e.lineTo(i+_,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,w[C],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):d&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=A?A.computeColor(T[C],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==C&&"inside"!==C||("inside"===C&&(e.save(),e.beginPath(),e.arc(i,n,x,0,At,!0,w.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Ct(h-l),u=h>l;let d=!1;if(a<=_t)e.moveTo(i,n,s);else if(c>=At-_t)e.moveTo(i+a*Tt(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!u,s),e.lineTo(i+a*Tt(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,u,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Tt(c),f=a*Bt(c),m=a*Tt(p),v=a*Bt(p);t<.001?d=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!u,s),e.lineTo(i+m,n+v,r),e.arc(i,n,a,p,c,u,r))}e.closePath()}(t,e,i,n,w.top,w.bottom,"outside"===C?b:x,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===C?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):d&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=A?A.computeColor(T[C],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===C&&e.restore())}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).arc;this._draw(t,s,!1,i,n)}}const pm=new WeakSet;function gm({bind:t}){rm(pm,t)||(t(dm).toDynamicValue((()=>new dm)).inSingletonScope(),t(Yp).toService(dm),t($p).toService(Yp))}const fm=gm;function mm(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=on(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}function vm(t,e,i,n){var s;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;ou?Hi.ROW:Hi.COLUMN,Number.isFinite(c)||(o=Hi.COLUMN),Number.isFinite(u)||(o=Hi.ROW);const d=i*(o===Hi.ROW?c:u);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),mm(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),mm(t,l,1,n),o=!1):o=!0}t.closePath()}function _m(t,e,i,n,s,r,a){var o;let l=e.p0,h=n;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)n||(t.lineTo(l.x+s,l.y+r,a),h=!n);else{const{originP1:c,originP2:u}=e;let d;if(c&&!1!==c.defined&&!i?d=l:c&&!1!==u.defined&&(d=null!==(o=e.p3)&&void 0!==o?o:e.p1),n){h=!n;const i=d?d.x:e.p0.x,o=d?d.y:e.p0.y;t.moveTo(i+s,o+r,a)}else d&&(h=!n,t.lineTo(d.x+s,d.y+r,a))}return h}function bm(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=s||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:u}=e;if(i>=1){if(h){let e,i=!0;u.forEach(((n,s)=>{n.originP1!==n.originP2?(i=_m(t,n,e,i,r,a,o),e=n):e=n}))}else u.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),mm(t,e,1,s),c=!1):c=!0}));return}if(i<=0)return;let d;"x"===n?d=Hi.ROW:"y"===n?d=Hi.COLUMN:"auto"===n&&(d=e.direction);const p=i*e.tryUpdateLength(d);let g=0,f=!0,m=null;for(let e=0,i=u.length;e{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}function Sm(t,e,i,n){const{offsetX:s=0,offsetY:r=0}=n||{},{points:a}=i,o=[];for(let t=0;t{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}const Am=new Np,Cm=lu;class wm extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ta,this.builtinContributions=[Am,Cm],this.init(t)}drawLinearAreaHighPerformance(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,u,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(u?u(e,t.attribute,l):s&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,u,null,{attribute:t.attribute}),(()=>{var i,s;if(n){const{stroke:n=l&&l.stroke}=t.attribute;if(_(n)&&(n[0]||n[2])&&!1===n[1])if(e.beginPath(),n[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const n=m[t];e.lineTo((null!==(i=n.x1)&&void 0!==i?i:n.x)+a,(null!==(s=n.y1)&&void 0!==s?s:n.y)+o,v)}}d?d(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,n,s,r,a,o){var l,h,c,u,d,p;const g=hh(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,C=S.doStroke&&S.sVisible,{clipRange:w=g.clipRange,closePath:T,points:k,segments:M}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===B&&(B="linearClosed"),1===w&&!M&&!k.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,C,v,_,i,n,g,s,r,a,o);if(t.shouldUpdateShape()){if(M&&M.length){let e,i;const n=M.map(((t,n)=>{if(t.points.length<=1&&0===n)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===n?e={x:i.endX,y:i.endY}:n>1&&(e.x=i.endX,e.y=i.endY);const s=Yn(E(t.points,x),B,{startPoint:e,curveTension:b});return i=s,s})).filter((t=>!!t));let s;const r=[];for(let t=M.length-1;t>=0;t--){const e=M[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=M[t-1].points,n=e[e.length-1];n&&i.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(u=n.y1)&&void 0!==u?u:n.y})}i.length>1&&(s=Yn(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(s))}t.cacheArea=r.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!k||!k.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(k,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(d=e[t].x1)&&void 0!==d?d:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const n=Yn(e,B,{curveTension:b}),s=Yn(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:n,bottom:s}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===w){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,C,_,r[c],[g,t.attribute],w,i,n,y,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=w*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(u=this.drawSegmentItem(e,l,A,v,C,_,r[d],[g,t.attribute],Mt(f,1),i,n,y,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,C,_,t.attribute,g,w,i,n,y,t,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).area;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f){return this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f)}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=d.attribute;let y,b,x=Hi.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Ct(y.x-b.x),A=Ct(y.y-b.y);x=null==y.x1?Hi.ROW:null==y.y1?Hi.COLUMN:Number.isFinite(S+A)?S>A?Hi.ROW:Hi.COLUMN:Hi.ROW,vm(t,e,l,{offsetX:h,offsetY:c,offsetZ:u,direction:x}),this.beforeRenderStep(d,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:C=0,x:w=0}=a;return!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(d,a,C-h,w-c,o),t.fill())),this.afterRenderStep(d,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==s)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),bm(t,i[0]?e.top:e.bottom,l,x===Hi.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u})),t.setStrokeStyle(d,a,C-h,w-c,o),t.stroke()}})(),!1}}const Tm=new WeakSet;function km({bind:t}){rm(Tm,t)||(t(wm).toDynamicValue((({container:t})=>new wm(ld(bg,t)))).inSingletonScope(),t(Xp).toService(wm),t($p).toService(Xp),t(bg).toService(_u),hd(t,bg))}const Mm=km;class Bm extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ka,this.builtinContributions=[mp,yp,vp],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=hh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:u=l.endAngle,x:d=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,n,h,c,u),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,y,_,m,v,l,s,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,p-n,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,p-n,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,n,y,_,m,v,l,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).circle;this._draw(t,s,!1,i,n)}}const Em=new WeakSet;function Pm({bind:t}){rm(Em,t)||(t(Bm).toDynamicValue((({container:t})=>new Bm(ld(xg,t)))).inSingletonScope(),t(Kp).toService(Bm),t($p).toService(Kp),t(xg).toService(_u),hd(t,xg))}const Om=Pm;class Rm{constructor(){this.numberType=Ma}reInit(){}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=hh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}}const Im=new WeakSet;function Dm({bind:t}){rm(Im,t)||(t(Rm).toDynamicValue((()=>new Rm)).inSingletonScope(),t(ag).toService(Rm),t($p).toService(ag))}const Lm=Dm,Fm=["","repeat-x","repeat-y","repeat"];function Um(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?Fm[i]:"no-repeat"}function Nm({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const n=Um(t,e);return{repeatMode:n,sizingMode:"no-repeat"===n&&null!=i?i:"fill"}}const jm={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function zm(t){return{backgroundMode:jm[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function Wm({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:n=1,imageOffsetX:s=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=Nm({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==n||0!==s||0!==r)}function Hm(t,e,i,n,s,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:u=0,imagePosition:d="top-left"}){const{repeatMode:p,sizingMode:g}=Nm({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?zm(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};yu(t,e,{x1:i,y1:n,x2:i+s,y2:n+r,width:()=>s,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:u,backgroundPosition:d})}class Vm extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ea,this.builtinContributions=[Bp,Ep],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=hh(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:u=l.x,y:d=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:C,sVisible:w,doFill:T,doStroke:k}=A;if(!S||!t.resources)return;const M=t.resources.get(S);if("success"!==M.state)return;const B=t.width,E=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,n,B,E):(Zd(e,i,n,B,E,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const O=()=>{T&&(a?a(e,t.attribute,l):C&&(e.setCommonStyle(t,t.attribute,i,n,l),Hm(e,M.data,i,n,B,E,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},R=()=>{k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,u-i,d-n,l),e.stroke()))},I=Wm({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),D=P||I;g?(R(),D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,n,T,!1,C,!1,l,s,a),O(),D&&e.restore()):(D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,n,T,!1,C,!1,l,s,a),O(),D&&e.restore(),R()),this.afterRenderStep(t,e,i,n,T,!1,C,!1,l,s,a)}draw(t,e,i){const{image:n}=t.attribute;if(!n||!t.resources)return;const s=t.resources.get(n);if("loading"===s.state&&y(n))return void Os.improveImageLoading(n);if("success"!==s.state)return;const{context:r}=e.drawParams;if(!r)return;const a=hh(t).image;this._draw(t,a,!1,i)}}const Gm=new WeakSet;function Ym({bind:t}){rm(Gm,t)||(t(og).toDynamicValue((({container:t})=>new Vm(ld(Ag,t)))).inSingletonScope(),t($p).toService(og),t(Ag).toService(_u),hd(t,Ag))}const Xm=Ym;class Km extends om{constructor(){super(...arguments),this.numberType=Pa}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).line;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g){var f;if(!e)return;t.beginPath();bm(t,e,l,h,{offsetX:c,offsetY:u,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),d.cache&&!_(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(d,a,m-c,v-u,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(d,a,m-c,v-u,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,n,s,r,a,o,l,h,c,u,d){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,i,n,l,s,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,n=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const s=Yn(x(t.points,v),y,{startPoint:e,curveTension:m});return n=s,s})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,u,d,s[g],[l,t.attribute],_,b,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,d,s[m],[l,t.attribute],Mt(y,1),b,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,_,b,i,n,t,a,o)}}const $m=new WeakSet;function qm({bind:t}){rm($m,t)||(t(Km).toDynamicValue((()=>new Km)).inSingletonScope(),t(Zp).toService(Km),t($p).toService(Zp))}const Zm=qm,Jm=cp,Qm=lu;class tv extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Oa,this.builtinContributions=[Qm,Jm],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const u=null!==(l=this.tempTheme)&&void 0!==l?l:hh(t,null==r?void 0:r.theme).path,{x:d=u.x,y:p=u.y,fillStrokeOrder:g=u.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,u,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Zi(t.pathShape.commandList,e,i,n,1,1,f);else{Zi((null!==(c=t.attribute.path)&&void 0!==c?c:u.path).commandList,e,i,n,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,_,b,v,y,u,s,a,o);const x=()=>{b&&(o?o(e,t.attribute,u):y&&(e.setStrokeStyle(t,t.attribute,d-i,p-n,u),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,u):v&&(e.setCommonStyle(t,t.attribute,d-i,p-n,u),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,n,_,b,v,y,u,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).path;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}}const ev=new WeakSet;function iv({bind:t}){rm(ev,t)||(t(tv).toDynamicValue((({container:t})=>new tv(ld(Cg,t)))).inSingletonScope(),t(Jp).toService(tv),t($p).toService(Jp),t(Cg).toService(_u),hd(t,Cg))}const nv=iv;function sv(t,e,i,n){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s0===t))?sv(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s,r=!0){var a;if(e.length<3)return void sv(t,e,i,n);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+n));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],u=h.x-o.x,d=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(d,u)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(s)?null!==(a=s[r%e.length])&&void 0!==a?a:0:s,y=v/m;const _=rv(u,d),b=rv(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=av(h,y,_,u,d),A=av(h,y,b,p,g),C=2*h.x-S.x-A.x,w=2*h.y-S.y-A.y,T=rv(C,w),k=av(h,rv(y,v),T,C,w);let M=Math.atan2(S.y-k.y,S.x-k.x);const B=Math.atan2(A.y-k.y,A.x-k.x);let E=B-M;E<0&&(M=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+n):t.lineTo(S.x+i,S.y+n),E&&t.arcTo(h.x+i,h.y+n,A.x+i,A.y+n,v),t.lineTo(A.x+i,A.y+n)}r||t.lineTo(e[l+1].x+i,e[l+1].y+n)}(e.camera?e:e.nativeContext,h,i,n,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,y,b,m,v,l,s,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,d-n,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,d-n,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,n,y,b,m,v,l,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).polygon;this._draw(t,s,!1,i,n)}}const cv=new WeakSet;function uv({bind:t}){rm(cv,t)||(t(Qp).toDynamicValue((({container:t})=>new hv(ld(wg,t)))).inSingletonScope(),t($p).toService(Qp),t(wg).toService(_u),hd(t,wg))}const dv=uv;class pv extends om{stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c){const u=el.Get(r,tl.Color255),d=n.vertices,p=d.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];n.polygons.forEach(((t,e)=>{if(s&&!s[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,n=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=n+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((n=>{const{polygon:s,normal:p}=n.polygon,g=d[s[0]],f=d[s[1]],m=d[s[2]],v=d[s[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,u):r,a.fill())}))}}class gv extends pv{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=Ia}drawShape(t,e,i,n,s,r,a,o){var l;const h=hh(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:u=h.stroke,face:d=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=s.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,p,f,d,s,e,g,t,h,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,p,f,e))}draw(t,e,i){const n=hh(t).polygon;this._draw(t,n,!1,i)}}const fv=new WeakSet;function mv({bind:t}){rm(fv,t)||(t(gv).toDynamicValue((()=>new gv)).inSingletonScope(),t(rg).toService(gv),t($p).toService(rg))}const vv=mv;class yv extends om{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Da,this.builtinContributions=[wp,kp,Tp],this.init(t)}drawShape(t,e,i,n,s,r,a,o,l){l=null!=l?l:hh(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:u=l.stroke,cornerRadius:d=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:C=l.fillStrokeOrder,drawStrokeWhenZeroWH:w=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:k}=t.attribute;T=(null!=T?T:b-S)||0,k=(null!=k?k:x-A)||0;const M=ep(g,f,T,k,h),B=np(g,v,T,k,w),E=Jd(h,c),P=Qd(u,m);if(!t.valid||!y)return;if(!E&&!P)return;if(!(M||B||a||o||c))return;0===d||_(d)&&d.every((t=>0===t))?(e.beginPath(),e.rect(i,n,T,k)):(e.beginPath(),Zd(e,i,n,T,k,d,"bevel"!==p));const O={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,E,P,M,B,l,s,a,o,O),C?(this._runStroke(t,e,i,n,l,O,B,S,A,o),this._runFill(t,e,i,n,l,O,M,S,A,a)):(this._runFill(t,e,i,n,l,O,M,S,A,a),this._runStroke(t,e,i,n,l,O,B,S,A,o)),this.afterRenderStep(t,e,i,n,E,P,M,B,l,s,a,o)}_runFill(t,e,i,n,s,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,s):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-n,s),e.stroke()))}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).rect;this._draw(t,s,!1,i,n,s)}}const _v=new WeakSet;function bv({bind:t}){rm(_v,t)||(t(yv).toDynamicValue((({container:t})=>new yv(ld(Tg,t)))).inSingletonScope(),t(tg).toService(yv),t($p).toService(tg),t(Cp).toSelf(),t(Ap).toSelf(),t(Tg).toService(Cp),t(Tg).toService(Ap),t(Tg).toService(_u),hd(t,Tg))}const xv=bv;class Sv extends pv{constructor(){super(...arguments),this.type="rect3d",this.numberType=La}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=hh(t,null==r?void 0:r.theme).rect,{fill:u=c.fill,stroke:d=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:C}=t.attribute;A=(null!=A?A:p-f)||0,C=(null!=C?C:g-m)||0;const w=null!==(h=this.z)&&void 0!==h?h:0,T=ep(v,y,A,C,u),k=np(v,b,A,C,S),M=Jd(u),B=Qd(d,_);if(!t.valid||!x)return;if(!M&&!B)return;if(!(T||k||a||o))return;const{light:E}=s.stage||{},P=t.findFace();if(!1!==u){e.setCommonStyle(t,t.attribute,i,n,c);let s=u;"string"!=typeof s&&(s="black"),this.fill(i,n,w,P,null,s,e,E,null,null,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,c),this.stroke(i,n,w,P,e))}draw(t,e,i){const n=hh(t).rect;this._draw(t,n,!1,i)}}const Av=new WeakSet;function Cv({bind:t}){rm(Av,t)||(t(Sv).toDynamicValue((()=>new Sv)).inSingletonScope(),t(eg).toService(Sv),t($p).toService(eg))}const wv=Cv;const Tv=new class extends ou{constructor(){super(...arguments),this.time=Gi.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){var d,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:C=l.opacity,backgroundMode:w=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:k=l.backgroundKeepAspectRatio,backgroundScale:M=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:O=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let I,{background:D}=t.attribute;if(!D)return;const L=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const U=g(D)&&D.background?D:null,N=t.transMatrix.onlyTranslate();if(U){const e=t.AABBBounds,i=(null!==(d=U.x)&&void 0!==d?d:e.x1)+(null!==(p=U.dx)&&void 0!==p?p:0),n=(null!==(f=U.y)&&void 0!==f?f:e.y1)+(null!==(m=U.dy)&&void 0!==m?m:0),s=null!==(v=U.width)&&void 0!==v?v:e.width(),r=null!==(y=U.height)&&void 0!==y?y:e.height();if(F=au.allocate(i,n,i+s,n+r),D=U.background,!N){const t=F.width(),e=F.height();F.set((null!==(_=U.x)&&void 0!==_?_:0)+(null!==(b=U.dx)&&void 0!==b?b:0),(null!==(x=U.y)&&void 0!==x?x:0)+(null!==(S=U.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,N||(F=Ud(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 i=t.resources.get(D);if(!i||"success"!==i.state||!i.data)return void L();e.highPerformanceSave(),N&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*C,O&&(e.beginPath(),R?Zd(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:w,backgroundFit:T,backgroundKeepAspectRatio:k,backgroundScale:M,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=A*C,e.fillStyle=D,R?(Zd(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();U&&au.free(F),L()}};class kv extends om{constructor(){super(),this.numberType=Fa,this.builtinContributions=[Tv],this.init()}drawShape(t,e,i,n,s){const r=hh(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=tp(o,l,!0),u=tp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,n),this.beforeRenderStep(t,e,i,n,c,u,c,u,r,s),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,n,c,u,c,u,r,s))}drawIcon(t,e,i,n,s){var r;const a=hh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:d=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(v-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,v,y)):(e.beginPath(),Zd(e,i-t,n-s,v,y,f,!0)),u&&(e.globalAlpha=d,e.fillStyle=u,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const n=hh(t).richtext;this._draw(t,n,!1,i)}}const Mv=new WeakSet;function Bv({bind:t}){rm(Mv,t)||(t(kv).toDynamicValue((()=>new kv)).inSingletonScope(),t(sg).toService(kv),t($p).toService(sg))}const Ev=Bv;class Pv extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ua,this.builtinContributions=[Up,Fp],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=hh(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:u=l.fillStrokeOrder}=t.attribute,d=this.valid(t,l,a,o);if(!d)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=d,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,s)=>{0===s?e.moveTo(i+t.x,n+t.y):e.lineTo(i+t.x,n+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,f,m,p,g,l,s,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-n,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-n,l),e.stroke()))};u?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,n,f,m,p,g,l,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).star;this._draw(t,s,!1,i,n)}}const Ov=new WeakSet;function Rv({bind:t}){rm(Ov,t)||(t(Pv).toDynamicValue((({container:t})=>new Pv(ld(Bg,t)))).inSingletonScope(),t(cg).toService(Pv),t($p).toService(cg),hd(t,Bg))}const Iv=Rv;class Dv extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Na,this.builtinContributions=[Rp,Lp,Dp,Ip],this.init(t)}drawShape(t,e,i,n,s,r,a,o,l){var h;l=null!=l?l:hh(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:u=l.x,y:d=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:C=l.keepDirIn3d}=t.attribute,w=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,k=n,M=w;const B=e.camera;if(C&&B&&e.project){const t=e.project(i,n,w);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,k=t.y,M=void 0}!1===A.draw(e,c,T,k,M,((s,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,u-i,d-n,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(u-i)/p,(d-n)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,x,S,y,b,l,s,a,o),f?(this._runStroke(t,e,i,n,l,S,b,u,d,A,m,p,g,o),this._runFill(t,e,i,n,l,x,y,u,d,A,a)):(this._runFill(t,e,i,n,l,x,y,u,d,A,a),this._runStroke(t,e,i,n,l,S,b,u,d,A,m,p,g,o)),this.afterRenderStep(t,e,i,n,x,S,y,b,l,s,a,o)}_runFill(t,e,i,n,s,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l,h,c,u,d,p){r&&!h.isSvg&&(p?p(e,t.attribute,s):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/u,(l-n)/d,s),e.stroke()))}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).symbol;this._draw(t,s,!1,i,n)}}const Lv=new WeakSet;function Fv({bind:t}){rm(Lv,t)||(t(Dv).toDynamicValue((({container:t})=>new Dv(ld(kg,t)))).inSingletonScope(),t(ig).toService(Dv),t($p).toService(ig),t(kg).toService(_u),hd(t,kg))}const Uv=Fv;class Nv extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ja,this.builtinContributions=[Tv],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const u=hh(t,null==r?void 0:r.theme).text,{text:d,underline:p=u.underline,lineThrough:g=u.lineThrough,keepDirIn3d:f=u.keepDirIn3d,direction:m=u.direction,fontSize:v=u.fontSize,verticalMode:y=u.verticalMode,x:_=u.x,y:b=u.y}=t.attribute,x=null!==(l=$s(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,u,a,o);if(!S)return;const{fVisible:A,sVisible:C,doFill:w,doStroke:T}=S,k=!f,M=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,w,T,A,C,u,s,a,o),k&&this.transformUseContext2d(t,u,M,e);const B=(s,r,l,h)=>{let c=i+r;const d=n+l;if(h){e.highPerformanceSave(),c+=v;const t=Xo.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),Xo.free(t)}T&&(o?o(e,t.attribute,u):C&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,u),e.strokeText(s,c,d,M))),w&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-n,u),e.fillText(s,c,d,M))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,M),"horizontal"===m){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;T&&(o?o(e,t.attribute,u):C&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,u),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,M)})))),w&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-n,u),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,M),this.drawUnderLine(p,g,t,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,s.descent,(s.descent-s.ascent)/2,M,u,e,{width:s.width})}))))}else{let{textAlign:i=u.textAlign,textBaseline:n=u.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[n])&&void 0!==h?h:"left",n=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const s=t.cache,{verticalList:r}=s;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=kt(e,o)}));let l=0,d=0;"bottom"===n?d=-a:"middle"===n&&(d=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const n=t.reduce(((t,e)=>t+(e.width||0)),0),s=o-n;let r=l;"center"===i?r+=s/2:"right"===i&&(r+=s),t.forEach((t=>{const{text:i,width:n,direction:s}=t;B(i,a-(e+1)*x+d,r,s),r+=n}))}))}k&&this.restoreTransformUseContext2d(t,u,M,e),this.afterRenderStep(t,e,i,n,w,T,A,C,u,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).text,{keepDirIn3d:r=s.keepDirIn3d}=t.attribute,a=!r;this._draw(t,s,a,i,n)}drawUnderLine(t,e,i,n,s,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:vc(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,n,s,l),m&&h.setLineDash(m),h.beginPath();const e=s+r+f;h.moveTo(n+b,e,o),h.lineTo(n+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,n,s,l),h.beginPath();const t=s+a;h.moveTo(n+b,t,o),h.lineTo(n+b+_,t,o),h.stroke()}}}const jv=new WeakSet;function zv({bind:t}){rm(jv,t)||(t(ng).toDynamicValue((({container:t})=>new Nv(ld(Mg,t)))).inSingletonScope(),t($p).toService(ng),t(Mg).toService(_u),hd(t,Mg))}const Wv=zv,Hv=ju();function Vv(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function Gv(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const Yv=Symbol.for("MathPickerContribution"),Xv=Symbol.for("MathArcPicker"),Kv=Symbol.for("MathAreaPicker"),$v=Symbol.for("MathCirclePicker"),qv=Symbol.for("MathImagePicker"),Zv=Symbol.for("MathLinePicker"),Jv=Symbol.for("MathPathPicker"),Qv=Symbol.for("MathRectPicker"),ty=Symbol.for("MathSymbolPicker"),ey=Symbol.for("MathTextPicker"),iy=Symbol.for("MathPolygonPicker"),ny=Symbol.for("MathGlyphPicker"),sy=Symbol.for("MathRichTextPicker"),ry=Symbol.for("CanvasArcPicker"),ay=Symbol.for("CanvasArc3dPicker"),oy=Symbol.for("CanvasAreaPicker"),ly=Symbol.for("CanvasCirclePicker"),hy=Symbol.for("CanvasImagePicker"),cy=Symbol.for("CanvasGifImagePicker"),uy=Symbol.for("CanvasLinePicker"),dy=Symbol.for("CanvasLottiePicker"),py=Symbol.for("CanvasPathPicker"),gy=Symbol.for("CanvasRectPicker"),fy=Symbol.for("CanvasRect3dPicker"),my=Symbol.for("CanvasSymbolPicker"),vy=Symbol.for("CanvasTextPicker"),yy=Symbol.for("CanvasPolygonPicker"),_y=Symbol.for("CanvasPyramid3dPicker"),by=Symbol.for("CanvasRichTextPicker"),xy=Symbol.for("CanvasGlyphPicker"),Sy=Symbol.for("CanvasGroupPicker"),Ay=Symbol.for("CanvasStarPicker"),Cy=Symbol.for("CanvasPickerContribution"),wy=jg(),Ty=Hg((()=>zg(Qu))),ky=Hg((()=>zg(Ju))),My=Hg((()=>zg(za))),By=Hg((()=>zg(td)));function Ey(){Ps.global=Vg,Ps.graphicUtil=Ty,Ps.transformUtil=ky,Ps.graphicService=My,Ps.layerService=By,Ps.canvasFactory=t=>Wg(Ka,t),Ps.context2dFactory=t=>Wg($a,t),Ps.windowFactory=()=>new Xc(Ps.global),Ps.windowHandlerFactory=t=>function(t){const e=Wg(Gc,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),Ps.renderServiceFactory=()=>zg(md),Ps.renderService=Hg((()=>zg(md))),Ps.pluginServiceFactory=()=>zg(Xd),Ps.pluginService=Hg((()=>zg(Xd))),Ps.pickerServiceFactory=()=>zg(bd),Ps.layerHandlerFactory=t=>zg("static"===t?ed:"dynamic"===t?id:nd),Ps.incrementalDrawContributionFactory=()=>zg(Vp)}Ey();var Py=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class Oy{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new ue}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return Py(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class Ry{constructor(){this._uid=pi.GenAutoIncrementId(),this.viewBox=new ue,this.modelMatrix=new pe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,n,s,r){this.modelMatrix.setValue(t,e,i,n,s,r)}getViewBoxTransform(){return this.modelMatrix}}class Iy{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=el.Get(e,tl.Color1),this.ambient=i;const n=Et(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Mt(kt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=y(e)?el.Get(e,tl.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*s[0]*n}, ${r[1]*s[1]*n}, ${r[2]*s[2]*n})`}}const Dy=()=>{$u.registerPlugin("DirectionalLight",Iy)};class Ly{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=Ko.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Ko.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return No(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Ko.allocate()),this._vp=Uo(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Ko.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Ko.allocate());const{left:t,top:e,right:i,bottom:n}=this._params;return jo(this._projectionMatrixCached,t,i,n,e,0,-2e6),this._vp||(this._vp=Ko.allocate()),this._vp=Uo(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:n}=this._params;return(null!=e?e:n-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const n=[0,0,0];return zo(n,[t,e,i],this._viewMatrixCached),n}vp(t,e,i){const n=[0,0,0],{pos:s}=this._params.viewParams;zo(n,[t,e,i],this._viewMatrixCached),t=n[0],e=n[1],i=n[2];const r=this.getProjectionScale(i);return{x:t*r+s[0],y:e*r+s[1]}}}const Fy=()=>{$u.registerPlugin("OrthoCamera",Ly)},Uy={getContributions:()=>[]},Ny={getContributions:()=>[]};class jy{constructor(t=Uy,e=Ny,i={}){var n,s,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(n=i.global)&&void 0!==n?n:Ps.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(s=i.pickItemInterceptorContributions)&&void 0!==s?s:this.pickItemInterceptorContributions)&&void 0!==r?r:Uy,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:Ny,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;const s=i.bounds.width(),r=i.bounds.height();if(!(new ue).setValue(0,0,s,r).containsPoint(e))return n;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new pe(1,0,0,1,0,0);let o;for(let s=t.length-1;s>=0&&(n=t[s].isContainer?this.pickGroup(t[s],e,a,i):this.pickItem(t[s],e,a,i),!n.graphic);s--)o||(o=n.group);if(n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new Ft(e.x,e.y),a=hh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,s=this.pickGroup(r,i,l,n)}else{const a=new Ft(e.x,e.y);l.transformPoint(a,a);const o=hh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const u=this.pickItem(r,a,i,n);u&&u.graphic&&(s.graphic=u.graphic,s.params=u.params)}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&Ko.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),Xo.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class zy{constructor(t={}){var e,i,n,s,r,a,o,l,h,c,u,d,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new ku,picker:null!==(s=null===(n=t.registry)||void 0===n?void 0:n.picker)&&void 0!==s?s:new Mu,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new Eu,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new Bu},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new Yu(void 0,(()=>this.createStageDeps())),layer:null!==(d=null===(u=t.factory)||void 0===u?void 0:u.layer)&&void 0!==d?d:new Ku,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new kc}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),n=i,s=null===(e=n.release)||void 0===e?void 0:e.bind(i);let r=!1;return s&&(n.release=()=>{r||(r=!0,this.stageResources.delete(n),s())}),this.stageResources.add(n),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new Tu(new wu([],(t=this.registry.contribution,e=ug,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class Wy{constructor(t={}){this.context=new zy(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function Hy(t={}){return new Wy(t)}class Vy extends Wy{}class Gy extends Wy{}class Yy extends wm{constructor(){super(...arguments),this.numberType=Ta}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=hh(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,g=tp(d,u,c),f=Jd(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;sl.length)return;const h=hh(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=tp(d,p,c),y=ip(d,g),_=Jd(c),b=Qd(u,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=s;for(let s=e;s{};function r_(){qy.preloaded||(qy.preloaded=!0,fd({bind:Zy.bind}),Gd({bind:Zy.bind}),yd({bind:Zy.bind}),Vd({bind:Zy.bind,isBound:Zy.isBound}),$d(Zy),Og(Zy))}function a_(t,e){const i=c_().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function o_(t,e,i){e.forEach(((e,n)=>{var s,r,a;const o=null!==(a=null!==(s=null==e?void 0:e.type)&&void 0!==s?s:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${n}`,e)}))}function l_(t,e){let i=t_.get(t);i||(i=new Map,t_.set(t,i));let n=i.get(e);return n||(n=new Set,i.set(e,n)),n}function h_(t,e,i){const n=l_(t,e);i&&n.forEach((t=>i(t))),n.clear()}function c_(){return r_(),Zy}function u_(){ud.refreshAllContributions()}function d_(){var t;return r_(),null!==(t=qy.runtimeGlobal)&&void 0!==t||(qy.runtimeGlobal=new zc(ld(Wh,Zy))),qy.runtimeGlobal}function p_(t){const e=c_(),i=d_();Ps.global=i,Ps.canvasFactory=t=>e.getNamed(Ka,t),Ps.context2dFactory=t=>e.getNamed($a,t),Ps.windowHandlerFactory=t=>a_(Gc,t),Ps.windowFactory=()=>new Xc(i,(t=>a_(Gc,t))),Ps.pluginServiceFactory=()=>new Ou(ld(Yd,e),{pluginRegistry:t.context.registry.plugin}),Ps.incrementalDrawContributionFactory=()=>new Hp([],new Xy,new Yy(ld(bg,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,ug))}function g_(t){var e;const i=c_();u_();const n=i.getAll($p),s=l_(t.registry.renderer,Jy);h_(t.registry.renderer,Jy,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),o_(((e,i)=>{var n;null===(n=null==i?void 0:i.reInit)||void 0===n||n.call(i),t.registry.renderer.register(e,i),s.add(e)}),n,Jy)}function f_(t){var e;const i=c_();u_();const n=i.getAll(ug),s=null!==(e=e_.get(t.context.registry.contribution))&&void 0!==e?e:new Set;s.forEach((e=>{var i,n;null===(n=(i=t.context.registry.contribution).unregister)||void 0===n||n.call(i,ug,e)})),s.clear(),e_.set(t.context.registry.contribution,s);const r=new Set(t.context.registry.contribution.get(ug));n.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(ug,e),r.add(e)),s.add(e)}))}function m_(t,e){var i;const n=c_();u_();const s=n.getAll(e),r=l_(t.registry.picker,Qy);h_(t.registry.picker,Qy,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),o_(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),s,Qy)}function v_(t,e){(function(t,e){var i,n;return null!==(n=null===(i=i_.get(t))||void 0===i?void 0:i.has(e))&&void 0!==n&&n})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,s_,t.isBound,t.rebind),function(t,e){let i=i_.get(t);i||(i=new WeakSet,i_.set(t,i)),i.add(e)}(t,e))}function y_(t,{app:e,legacy:i=!0,targets:n}={}){v_(c_(),t),i&&(Ng(),v_(jg(),t)),u_(),e&&function(t,e){const i=null!=e?e:n_;let n=!1,s=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?n=!0:"draw-contribution"===t?s=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),s&&f_(t),n&&g_(t),r.forEach((e=>{m_(t,e)}))}(e,n)}function __(t,e,i){const n={};for(const i in e)i in t&&W(t[i],e[i])||(n[i]=e[i]);if(i)for(const s in t)if(!(s in e)){const t=i(s);void 0!==t&&(n[s]=t)}return n}function b_(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,u=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=u,r[4]=u,r[5]=c,r[6]=l,r[7]=n}function x_(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const u=s.filter((t=>t.length>2));return 1===u.length?[u[0]]:u}function B_(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:n}=Uh(t.attribute),s=P_(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=P_(o*(r+a)/2,l,e),c=[],u=l/h.length,d=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=P_(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;s{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return z_(l,e,h),h},F_=(t,e)=>{const i=t.attribute,n=i.points;if(n)return D_(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return D_(t,e)}return[]};const U_=t=>t.map((t=>({x:t.x,y:t.y}))),N_=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,u=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)u.push({x:t[e].x,y:t[e].y});u.push({x:c.x,y:c.y});const d=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];d.push({x:i.x,y:i.y})}return d.push({x:h.x,y:h.y}),[u,d]},j_=t=>{const e=new ce;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return N_(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return N_(t,{x:e.x1,y:s},{x:e.x2,y:s})},z_=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=j_(t);z_(s[0],n,i),z_(s[1],e-n,i)}},W_=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:U_(i)}];const n=[];return z_(i,e,n),n},H_=(t,e)=>{const i=M_(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;rObject.assign({},t))):[]}function G_(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:V_(t.touches),configurable:!0},changedTouches:{value:V_(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Y_(t,e){try{return t[e]}catch(t){return}}function X_(t,e,i,n){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const s=e();if(1===(r=s).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=G_(t),l=Y_(t,"target"),h=Y_(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)n(t.clientX,t.clientY,s,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];n(t.clientX,t.clientY,s,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];n(t.clientX,t.clientY,s,a,t)}}return o}}var K_=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s=0;a++)"\n"===t[a].text?(s-=Number(r),r=!0):(s--,r=!1);return s>=0?t.length:(a-=1,e>n&&!r&&(a+=1),a)}function Z_(t,e){var i,n,s,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(n=t[t.length-1])||void 0===n?void 0:n.text)?a+.9:a+.1;const l="\n"===(null===(s=t[e])||void 0===s?void 0:s.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class J_{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:q_(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},$_(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},$_(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,n=K_(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let s=t.data;this.isComposing||"Backspace"===t.type||s||(s="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=q_(i,this.selectionStartCursorIdx),a=q_(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=$_(n));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=s,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;s&&s.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Z_(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(s,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(s,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),Ps.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,n=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const s=n.text,r=s?Array.from(s.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=n,this.selectionStartCursorIdx=s}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),Ps.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Q_{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,n=q_(i,Math.ceil(t)),s=q_(i,Math.floor(e));let r="";for(let t=n;t<=s;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let n=Math.round(e);const s=this.rt.attribute.textConfig;if(!s.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const n=e.getSelection();if(!n)return;const{selectionStartCursorIdx:s,curCursorIdx:r}=n,a=Math.min(s,r),o=Math.max(s,r),l=q_(i.attribute.textConfig,a),h=q_(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const n=i.attribute.textConfig;this._formatTextCommand(t,n,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,n)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,n)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const s=this.computedCursorPosByCursorIdx(i,n);this.setCursorAndTextArea(s.x,s.y1,s.y2,n),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(tb,[this.formatTextCommandCb]),this.commandCbs.set(eb,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>U(e,t))),i.setAttributes(i.attribute);const n=i.getFrameCache();n&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,n),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],n=i.indexOf(e);n>-1&&i.splice(n,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new J_,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),Ps.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(Ps.global.isMacOS()&&t.metaKey&&"c"===t.key||!Ps.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return Ps.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const n=i.getFrameCache();if(!n)return;const{lines:s}=n,r=s.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,n)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:n,y1:s,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:n,y:(s+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const n=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,n+.1)}fullSelectionKeyHandler(t){return!!(Ps.global.isMacOS()&&t.metaKey&&"a"===t.key||!Ps.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,n=0;"ArrowUp"===t.key?n=-1:"ArrowDown"===t.key?n=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:s,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===s.paragraphs[s.paragraphs.length-2]&&this.curCursorIdx0&&r===s.paragraphs[s.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===s.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===s.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(n){if(n>0&&s===e.lines[e.lines.length-1])return;if(n<0&&s===e.lines[0])return;const t=e.lines.findIndex((t=>t===s))+n;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=n*s.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let u=this.getColumnIndex(e,h)+c;const d=this.computedCursorPosByCursorIdx(u,this.currRt);u<-.1?u=-.1:u>o+.1&&(u=o+.1),this.curCursorIdx=u,this.selectionStartCursorIdx=u,this.setCursorAndTextArea(d.x,d.y1,d.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:n,placeholderColor:s="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},$_(this.currRt.attribute)),{text:n});s&&(l.fill=s),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=uc(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:Nd(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:n}=i;if(!i||!n)return;this.offsetShadowRoot();const s=this.getRichTextAABBBounds(this.currRt),r=s.height(),a=s.width();this.shadowBounds=this.shadowBounds||zh({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:n,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},$_(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),Ps.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=wh({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,ib.tryUpdateRichtext(i);const n=this.getShadow(i),s=i.getFrameCache();if(!s)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=Ph({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=wh({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,n),this.addEditLineOrBgOrBounds(this.editBg,n)}if(e=e||this.computedCursorPosByEvent(t,s)){const{x:t,y1:n,y2:s,cursorIndex:r}=e;this.startCursorPos={x:t,y:(n+s)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,n,s,i)}else{const t=0,e=0,n=Nd(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+n)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,n,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,n=0,s=t.attribute;"middle"!==e&&"bottom"!==e||(s.textConfig.length||(s=Object.assign(Object.assign({},s),{textConfig:[{text:"a"}]})),i=Nd(Object.assign(Object.assign({},s),{scaleX:1,scaleY:1}))),"middle"===e?n=-i.height()/2:"bottom"===e&&(n=-i.height()),this.editLine&&this.editLine.setAttributes({dy:n}),this.editBg&&this.editBg.setAttributes({dy:n}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:n})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const n=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,n),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,n),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,n),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const n=e.lineInfo,s=n.paragraphs.findIndex((t=>t===e.columnInfo));if(s<0)return;const r=n.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return n=Math.min(n+1,t.length),{startIdx:i,endIdx:n}}(r,s);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,n={x:t.x,y:(t.y1+t.y2)/2},s=this.getLineByPoint(e,i),r=this.getLineByPoint(e,n);if((i.y>n.y||i.y===n.y&&i.x>n.x)&&([i,n]=[n,i],[r,s]=[s,r]),this.hideSelection(),s===r)this.editBg.setAttributes({x:i.x,y:s.top,width:n.x-i.x,height:s.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:s.top,width:0,height:0});const t=e.lines.findIndex((t=>t===s)),a=e.lines.findIndex((t=>t===r));let o=0;for(let s=t;s<=a;s++){const r=e.lines[s];if(s===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(zh({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(s===a){const t=r.paragraphs[0];this.editBg.add(zh({x:t.left,y:o,width:n.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(zh({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let n=0;n=e.y);n++)i=t.lines[n+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],n=0;if(t.paragraphs.length){const s=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=s.left?(n=-.1,i=s):e.x>=r.left+r.width&&(n=.1,i=r)}if(!n)for(let s=0;s=e.x){n=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:n}}getColumnIndex(t,e){let i=-1;for(let n=0;nMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-n/2:"right"===t.globalAlign&&(this.deltaX=-n),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const n=this.currRt,{textBaseline:s}=n.attribute;let r=0;return"middle"===s?r=Nd(Object.assign(Object.assign({},n.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===s&&(r=Nd(Object.assign(Object.assign({},n.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,n){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const s={x:0,y:0};n.globalTransMatrix.getInverse().transformPoint({x:t,y:e},s);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();s.x+=r,s.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(s.x,s.y,n,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),n=this.getLineByPoint(e,i);if(!n)return;const{columnInfo:s,delta:r}=this.getColumnAndIndexByLinePoint(n,i);if(!s)return;const a=n.top,o=n.top+n.height;let l=this.getColumnIndex(e,s);return l+=r,{x:s.left+(r>0?s.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:n,columnInfo:s}}computedCursorPosByCursorIdx(t,e){var i,n,s;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(s=null===(n=e.attribute.textConfig)||void 0===n?void 0:n[0])||void 0===s?void 0:s.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:Nd(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:u}=l,d=c.top,p=c.top+c.height;return{x:u.left+(a<0?0:u.width),y1:d,y2:p,lineInfo:c,columnInfo:u}}getColumnByIndex(t,e){for(let i=0,n=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const xb=new bb;class Sb{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}const Ab=()=>{$u.registerPlugin("ViewTransform3dPlugin",Sb)},Cb=new ue;class wb{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=pi.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new ue}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const n=hh(i).group,{display:s=n.display}=i.attribute;if("flex"!==s)return;const{flexDirection:r=n.flexDirection,flexWrap:a=n.flexWrap,alignItems:o=n.alignItems,clip:l=n.clip}=i.attribute,{alignContent:h=(null!=o?o:n.alignContent)}=i.attribute;let{width:c,height:u,justifyContent:d=n.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==u){let t=0,e=0,i=0;if(p.forEach((n=>{const s=this.getAABBBounds(n);s.empty()||("column"===r||"column-reverse"===r?(e+=s.height(),t=Math.max(t,s.width())):(t+=s.width(),e=Math.max(e,s.height())),i+=s.x1,i+=s.y1,i+=s.x2,i+=s.y2)})),!isFinite(i))return;c=t,u=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=u:u=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:u,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=u,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===d?d="flex-end":"flex-end"===d?d="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),n="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:n}),v+=i,y=Math.max(y,n)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach((({mainLen:i,crossLen:n},s)=>{t+i>f.len?0===t?(b.push({idx:s,mainLen:t+i,crossLen:n}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=i,e=n):(t+=i,e=Math.max(e,n))})),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,d,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,n,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,n)=>{const s={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[n],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,n)=>{const s={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[n],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,n,s,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else if("flex-end"===i){let t=n.len;for(let i=a.idx;i>=r;i--){t-=s[i].mainLen;const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`]))}}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(r,e[t].attribute[n.field],a[`${n.field}1`])),o+=s[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(r,e[t].attribute[n.field],a[`${n.field}1`])),o+=s[t].mainLen+2*i}}else if("center"===i){let t=(n.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}}layoutCross(t,e,i,n,s,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=n[a])&&void 0!==o?o:n["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-s[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-s[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&Cb.copy(n)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(Cb.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const Tb=()=>{$u.registerPlugin("FlexLayoutPlugin",wb)};var kb=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:Bs,ARC3D_NUMBER_TYPE:wa,ARC_NUMBER_TYPE:Ca,AREA_NUMBER_TYPE:Ta,AbstractGraphicRender:class{},get AnimateMode(){return Zn},get AnimateStatus(){return ts},get AnimateStepType(){return Qn},AppContext:zy,Application:Ms,Arc:ph,Arc3d:Od,Arc3dRender:Yp,ArcRender:Gp,ArcRenderContribution:_g,Area:mh,AreaRender:Xp,AreaRenderContribution:bg,get AttributeUpdateType(){return Wi},AutoEnablePlugins:Yd,Base3dRender:pv,BaseCanvas:Qo,BaseEnvContribution:Oy,BaseRender:om,get BaseRenderContributionTime(){return Gi},BaseWindowHandlerContribution:Ry,Basis:_n,BeforeRenderConstribution:vd,BoundsContext:Mi,BoundsPicker:xd,BrowserEntry:Wy,CIRCLE_NUMBER_TYPE:ka,CONTRIBUTION_STORE_STATE_SYMBOL:sd,Canvas3DDrawItemInterceptor:yg,Canvas3DPickItemInterceptor:Hd,CanvasFactory:Ka,CanvasTextLayout:bc,Circle:_h,CircleRender:Kp,CircleRenderContribution:xg,ColorInterpolate:gl,ColorStore:el,get ColorType(){return tl},CommonDrawItemInterceptorContribution:mg,CommonRenderContribution:Eg,Context2dFactory:$a,ContributionProvider:ad,ContributionRegistry:Eu,ContributionStore:ud,CubicBezierCurve:ln,CurveContext:Gn,get CurveTypeEnum(){return Vi},CustomEvent:bi,CustomPath2D:Xn,CustomSymbolClass:Jr,DEFAULT_TEXT_FONT_FAMILY:Vh,DebugDrawItemInterceptorContribution:fg,DefaultArcAllocate:ab,DefaultArcAttribute:ds,DefaultArcRenderContribution:up,DefaultAreaAllocate:lb,DefaultAreaAttribute:ps,DefaultAreaTextureRenderContribution:Np,DefaultAttribute:us,DefaultBaseBackgroundRenderContribution:ou,DefaultBaseClipRenderAfterContribution:Su,DefaultBaseClipRenderBeforeContribution:bu,DefaultBaseInteractiveRenderContribution:_u,DefaultBaseTextureRenderContribution:hp,DefaultCanvasAllocate:Wc,DefaultCanvasArc3DRender:dm,DefaultCanvasArcRender:lm,DefaultCanvasAreaRender:wm,DefaultCanvasCircleRender:Bm,DefaultCanvasGroupRender:jp,DefaultCanvasImageRender:Vm,DefaultCanvasLineRender:Km,DefaultCanvasPathRender:tv,DefaultCanvasPolygonRender:hv,DefaultCanvasPyramid3dRender:gv,DefaultCanvasRect3dRender:Sv,DefaultCanvasRectRender:yv,DefaultCanvasSymbolRender:Dv,DefaultCanvasTextRender:Nv,DefaultCircleAllocate:cb,DefaultCircleAttribute:gs,DefaultCircleRenderContribution:fp,DefaultConnectAttribute:hs,DefaultDebugAttribute:cs,DefaultFillStyle:ns,DefaultGlobal:zc,DefaultGlobalPickerService:tu,DefaultGlyphAttribute:ms,DefaultGraphicAllocate:nb,DefaultGraphicMemoryManager:bb,DefaultGraphicService:Hu,DefaultGraphicUtil:Kc,DefaultGroupAttribute:fs,DefaultGroupBackgroundRenderContribution:_p,DefaultImageAttribute:Ts,DefaultImageRenderContribution:Mp,DefaultLayerService:Zu,DefaultLayout:es,DefaultLineAllocate:db,DefaultLineAttribute:vs,DefaultMat4Allocate:Yo,DefaultMatrixAllocate:Go,DefaultPathAllocate:gb,DefaultPathAttribute:ys,DefaultPickService:jy,DefaultPickStyle:os,DefaultPolygonAttribute:_s,DefaultRect3dAttribute:Ss,DefaultRectAllocate:sb,DefaultRectAttribute:xs,DefaultRectRenderContribution:Sp,DefaultRenderService:Tu,DefaultRichTextAttribute:ws,DefaultRichTextIconAttribute:ks,DefaultStarAttribute:bs,DefaultStrokeStyle:rs,DefaultStyle:ls,DefaultSymbolAllocate:mb,DefaultSymbolAttribute:As,DefaultSymbolClipRangeStrokeRenderContribution:Op,DefaultSymbolRenderContribution:Pp,DefaultTextAllocate:yb,DefaultTextAttribute:Cs,DefaultTextMeasureContribution:gd,DefaultTextStyle:as,DefaultTransform:is,DefaultTransformUtil:Zc,DefaultWindow:Xc,get Direction(){return Hi},DirectionalLight:Iy,DrawContribution:hg,DrawItemInterceptor:ug,DynamicLayerHandlerContribution:id,get Edge(){return Is},EditModule:J_,EmptyContext2d:Zo,EnvContribution:Wh,EventManager:Ai,EventSystem:Ti,EventTarget:Ci,FACTORY_STATE_SYMBOL:Jc,FORMAT_ALL_TEXT_COMMAND:eb,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:tb,Factory:$u,FederatedEvent:mi,FederatedMouseEvent:vi,FederatedPointerEvent:yi,FederatedWheelEvent:_i,FlexLayoutPlugin:wb,GLYPH_NUMBER_TYPE:Ma,GRAPHIC_CLASS_SYMBOL:Jl,GRAPHIC_REGISTRY_SYMBOL:Bc,GRAPHIC_UPDATE_TAG_KEY:Ul,GROUP_NUMBER_TYPE:Ba,Generator:pi,GlobalPickerService:Sd,Glyph:xh,GlyphRender:ag,GradientParser:Mo,Graphic:th,GraphicCreator:Wa,GraphicFactory:kc,GraphicPicker:_d,GraphicRender:$p,GraphicService:za,GraphicUtil:Qu,Group:Ch,GroupRender:qp,GroupRenderContribution:Sg,get GroupUpdateAABBBoundsMode(){return Ah},HtmlAttributePlugin:Gg,get IContainPointMode(){return zi},IMAGE_NUMBER_TYPE:Ea,Image:kh,ImageRender:og,ImageRenderContribution:Ag,IncrementalDrawContribution:Vp,InteractiveDrawItemInterceptorContribution:vg,InteractivePickItemInterceptorContribution:Wd,InteractiveSubRenderContribution:Pg,LINE_NUMBER_TYPE:Pa,Layer:Xu,LayerFactory:Ku,LayerService:td,Line:Eh,LineRender:Zp,Linear:fn,LinearClosed:Fn,Mat4Allocate:Ho,MatrixAllocate:Wo,get MeasureModeEnum(){return qn},MiniappEntry:Gy,MonotoneX:Tn,MonotoneY:kn,NOWORK_ANIMATE_ATTR:ql,Node:fi,NodeEntry:Vy,OrthoCamera:Ly,PATH_NUMBER_TYPE:Oa,POLYGON_NUMBER_TYPE:Ra,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:Ia,Path:Rh,PathRender:Jp,PathRenderContribution:Cg,PerformanceRAF:Uc,PickItemInterceptor:Ad,PickServiceInterceptor:Cd,PickerRegistry:Mu,PickerService:bd,PluginRegistry:Bu,PluginService:Xd,Polygon:Lh,PolygonRender:Qp,PolygonRenderContribution:wg,Pyramid3d:Id,Pyramid3dRender:rg,RECT3D_NUMBER_TYPE:La,RECT_NUMBER_TYPE:Da,RICHTEXT_NUMBER_TYPE:Fa,RUNTIME_INSTALLER_STATE_SYMBOL:Ky,RafBasedSTO:Ys,ReactAttributePlugin:Xg,Rect:jh,Rect3DRender:eg,Rect3d:kd,RectRender:tg,RectRenderContribution:Tg,ReflectSegContext:dn,RenderSelector:lg,RenderService:md,RendererRegistry:ku,ResourceLoader:Os,RichText:cc,RichTextEditPlugin:ib,RichTextRender:sg,STAR_NUMBER_TYPE:Ua,get STATUS(){return Jn},SVG_ATTRIBUTE_MAP:Ha,SVG_ATTRIBUTE_MAP_KEYS:Va,SVG_PARSE_ATTRIBUTE_MAP:Ga,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Ya,SYMBOL_NUMBER_TYPE:Na,SegContext:un,ShadowPickServiceInterceptorContribution:jd,ShadowRoot:dc,ShadowRootDrawItemInterceptorContribution:gg,ShadowRootPickItemInterceptorContribution:zd,SplitRectAfterRenderContribution:Cp,SplitRectBeforeRenderContribution:Ap,Stage:Gu,StageFactory:Yu,Star:Ed,StarRender:cg,StarRenderContribution:Bg,StateDefinitionCompiler:bl,StateEngine:Cl,StaticLayerHandlerContribution:ed,Step:On,StepClosed:Rn,Symbol:fc,SymbolRender:ig,SymbolRenderContribution:kg,TEXT_NUMBER_TYPE:ja,Text:Sc,get TextDirection(){return ya},TextMeasureContribution:pd,TextRender:ng,TextRenderContribution:Mg,Theme:oh,TransformUtil:Ju,get UpdateTag(){return ji},VGlobal:Hh,VWindow:Vc,ViewTransform3dPlugin:Sb,VirtualLayerHandlerContribution:nd,WILDCARD:"*",WindowHandlerContribution:Gc,WrapText:wc,XMLParser:pa,_calculateLineHeight:Ks,_interpolateColor:sl,addArcToBezierPath:$i,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:k_,alignSubpath:x_,application:Ps,applyTransformOnBezierCurves:B_,arc3dModule:fm,arcModule:um,areaModule:Mm,bezier:Xi,bezierCurversToPath:E_,binarySplitPolygon:j_,bindArc3dRenderModule:gm,bindArcRenderModule:cm,bindAreaRenderModule:km,bindCircleRenderModule:Pm,bindContributionProvider:hd,bindContributionProviderNoSingletonScope:cd,bindGlyphRenderModule:Dm,bindImageRenderModule:Ym,bindLineRenderModule:qm,bindPathRenderModule:iv,bindPolygonRenderModule:uv,bindPyramid3dRenderModule:mv,bindRect3dRenderModule:Cv,bindRectRenderModule:bv,bindRichtextRenderModule:Bv,bindStarRenderModule:Rv,bindSymbolRenderModule:Fv,bindTextRenderModule:zv,boundStroke:fa,builtInSymbolStrMap:ea,builtinSymbols:Qr,builtinSymbolsMap:ta,calcLineCache:Yn,calculateArcCornerRadius:ap,calculateLineHeight:$s,canvasAllocate:Hc,centroidOfSubpath:C_,circleBounds:zs,circleModule:Om,clock:xi,colorEqual:function(t,e){const i=we.parseColorString(t),n=we.parseColorString(e);return!(!i||!n)&&i.r===n.r&&i.g===n.g&&i.b===n.b&&i.opacity===n.opacity},colorStringInterpolationToStr:dl,configureRuntimeApplicationForApp:p_,container:wy,cornerTangents:rp,createApp:Hy,createArc:gh,createArc3d:Rd,createArea:vh,createBrowserApp:Hy,createCanvasEventTransformer:function(t,e,i,n){return X_(t.parentElement,e,i,n)},createCircle:bh,createColor:Eo,createConicalGradient:vl,createContributionProvider:ld,createEventTransformer:X_,createGlyph:Sh,createGraphic:Ic,createGroup:wh,createImage:Mh,createLine:Ph,createMat4:Vo,createMiniappApp:function(t={}){return new Gy(t)},createNodeApp:function(t={}){return new Vy(t)},createPath:Ih,createPolygon:Fh,createPyramid3d:Dd,createRect:zh,createRect3d:Md,createRectPath:Zd,createRichText:uc,createShadowRoot:pc,createStage:function(t){return Ey(),(new Yu).create(t)},createStar:Pd,createSymbol:mc,createText:Ac,createWrapText:Tc,cubicCalc:en,cubicLength:tn,cubicPointAt:nn,cubicSubdivide:b_,defaultArcAllocate:ob,defaultArcBackgroundRenderContribution:gp,defaultArcRenderContribution:dp,defaultArcTextureRenderContribution:pp,defaultAreaAllocate:hb,defaultBaseBackgroundRenderContribution:lu,defaultBaseClipRenderAfterContribution:Au,defaultBaseClipRenderBeforeContribution:xu,defaultBaseTextureRenderContribution:cp,defaultCircleAllocate:ub,defaultCircleBackgroundRenderContribution:yp,defaultCircleRenderContribution:mp,defaultCircleTextureRenderContribution:vp,defaultGraphicMemoryManager:xb,defaultGroupBackgroundRenderContribution:bp,defaultImageBackgroundRenderContribution:Ep,defaultImageRenderContribution:Bp,defaultLineAllocate:pb,defaultPathAllocate:fb,defaultRectAllocate:rb,defaultRectBackgroundRenderContribution:kp,defaultRectRenderContribution:wp,defaultRectTextureRenderContribution:Tp,defaultStarBackgroundRenderContribution:Up,defaultStarTextureRenderContribution:Fp,defaultSymbolAllocate:vb,defaultSymbolBackgroundRenderContribution:Lp,defaultSymbolClipRangeStrokeRenderContribution:Ip,defaultSymbolRenderContribution:Rp,defaultSymbolTextureRenderContribution:Dp,defaultTextAllocate:_b,diff:__,divideCubic:on,drawArc:Ki,drawArcPath:op,drawAreaSegments:vm,drawBackgroundImage:yu,drawImageWithLayout:Hm,drawIncrementalAreaSegments:Sm,drawIncrementalSegments:xm,drawSegments:bm,enumCommandMap:Oi,fillVisible:tp,findBestMorphingRotation:T_,findConfigIndexByCursorIdx:q_,findCursorIdxByConfigIndex:Z_,findNextGraphic:ru,flatten_simplify:function(t,e,i){return t.length<=10||i?t:function(t,e){let i,n,s=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(s=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===s&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)},foreach:nu,foreachAsync:su,genBasisSegments:xn,genBasisTypeSegments:bn,genLinearClosedSegments:Un,genLinearClosedTypeSegments:Nn,genLinearSegments:mn,genLinearTypeSegments:vn,genMonotoneXSegments:Bn,genMonotoneXTypeSegments:Mn,genMonotoneYSegments:Pn,genMonotoneYTypeSegments:En,genNumberType:va,genStepClosedSegments:Ln,genStepSegments:In,genStepTypeSegments:Dn,getApplicationState:Es,getAttributeFromDefaultAttrList:Gs,getBackgroundImage:cu,getConicGradientAt:ml,getContributionStoreState:rd,getCurrentEnv:function(){return ju()?"browser":"node"},getDefaultCharacterConfig:$_,getExtraModelMatrix:function(t,e,i){const{alpha:n,beta:s}=i.attribute;if(!n&&!s)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=vc(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Ko.allocate();return Do(o,o,[a[0],a[1],0]),s&&Oo(o,o,s),n&&Ro(o,o,n),Do(o,o,[-a[0],-a[1],0]),o},getFactoryState:Qc,getGraphicClassState:Ql,getGraphicRegistryState:Ec,getLegacyBindingContext:jg,getModelMatrix:zu,getRichTextBounds:Nd,getRuntimeInstallerBindingContext:c_,getRuntimeInstallerGlobal:d_,getRuntimeInstallerState:$y,getScaledStroke:Bo,getTextBounds:Ud,getTheme:hh,getThemeFromGroup:ch,globalTheme:lh,glyphModule:Lm,graphicCreator:Oc,graphicService:My,graphicUtil:Ty,identityMat4:Po,imageModule:Xm,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:y_,installRuntimeDrawContributionsToApp:f_,installRuntimeGraphicRenderersToApp:g_,installRuntimePickersToApp:m_,interpolateColor:nl,interpolateGradientConicalColor:ol,interpolateGradientLinearColor:rl,interpolateGradientRadialColor:al,interpolatePureColorArray:ll,interpolatePureColorArrayToStr:hl,intersect:sp,isBrowserEnv:ju,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){Nu();const t=Ps.global&&Ps.global.env;return t?"node"===t:!Uu},isSvg:ua,isXML:da,layerService:By,lineModule:Zm,lookAt:No,mapToCanvasPointForCanvas:function(t){var e;if(io(t._canvasX)&&io(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:Lo,mat4Allocate:Ko,matrixAllocate:Xo,multiplyMat4Mat3:function(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;return t[0]=_*n+b*o+x*u+S*f,t[1]=_*s+b*l+x*d+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i.c,b=i.d,x=0,S=0,t[4]=_*n+b*o+x*u+S*f,t[5]=_*s+b*l+x*d+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=0,b=0,x=1,S=0,t[8]=_*n+b*o+x*u+S*f,t[9]=_*s+b*l+x*d+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i.e,b=i.f,x=0,S=1,t[12]=_*n+b*o+x*u+S*f,t[13]=_*s+b*l+x*d+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t},multiplyMat4Mat4:Uo,newThemeObj:sh,ortho:jo,parsePadding:Us,parseStroke:Ls,parseSvgPath:Ni,pathModule:nv,pathToBezierCurves:M_,point:yn,pointEqual:Ws,pointInterpolation:Hs,pointInterpolationHighPerformance:function(t,e,i,n){const{x:s,y:r}=Rt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Rt(t.x1,t.y1,e.x1,e.y1,i);return n.x=s,n.y=r,n.x1=a,n.y1=o,n.defined=e.defined,n},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>Ws(t,e[i]))):!Number.isNaN(t.x+t.y)&&Ws(t,e))},pointsInterpolation:Vs,polygonModule:dv,preLoadAllModule:Ng,pyramid3dModule:vv,quadCalc:sn,quadLength:an,quadPointAt:rn,rafBasedSto:Xs,rect3dModule:wv,rectFillVisible:ep,rectModule:xv,rectStrokeVisible:np,recursiveCallBinarySplit:z_,refreshRuntimeInstallerContributions:u_,registerArc3dGraphic:zf,registerArcGraphic:jf,registerAreaGraphic:Wf,registerCircleGraphic:Hf,registerDirectionalLight:Dy,registerFlexLayoutPlugin:Tb,registerGlobalEventTransformer:function(t,e,i,n,s){const r=X_(0,i,n,s);t.setEventListenerTransformer(r)},registerGlyphGraphic:Vf,registerGraphic:Rc,registerGroupGraphic:Gf,registerHtmlAttributePlugin:Yg,registerImageGraphic:Yf,registerLineGraphic:Xf,registerOrthoCamera:Fy,registerPathGraphic:Kf,registerPolygonGraphic:$f,registerPyramid3dGraphic:qf,registerReactAttributePlugin:Kg,registerRect3dGraphic:Jf,registerRectGraphic:Zf,registerRichtextGraphic:Qf,registerShadowRootGraphic:tm,registerStarGraphic:em,registerSymbolGraphic:im,registerTextGraphic:nm,registerViewTransform3dPlugin:Ab,registerWindowEventTransformer:function(t,e,i,n,s){const r=X_(0,i,n,s);t.setEventListenerTransformer(r)},registerWrapTextGraphic:sm,renderCommandList:Zi,resolveBackgroundDrawMode:pu,resolveBackgroundParamsByImageSizing:zm,resolveBackgroundPosition:fu,resolveBackgroundSizing:uu,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:Nm,resolveImageRepeatMode:Um,resolveRenderableImageSize:vu,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:Ev,rotateX:Oo,rotateY:Ro,rotateZ:Io,runFill:Jd,runStroke:Qd,scaleMat4:Fo,segments:Yi,shouldClipImageByLayout:Wm,shouldUseMat4:Wu,snapLength:Qi,splitArc:R_,splitArea:L_,splitCircle:I_,splitLine:F_,splitPath:H_,splitPolygon:W_,splitRect:O_,splitToGrids:P_,starModule:Iv,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:ip,symbolModule:Uv,textAttributesToStyle:_c,textDrawOffsetX:vc,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:yc,textModule:Wv,transformMat4:zo,transformPointForCanvas:function(t,e,i,n,s){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(s,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:ky,translate:Do,verticalLayout:_a,vglobal:Vg,waitForAllSubLayers:function(t){return ga(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ps.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)}))},wrapCanvas:qa,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=Ps.global)||void 0===t?void 0:t.env,n=i?null===(e=Ps.context2dFactory)||void 0===e?void 0:e.call(Ps,i):void 0;if(!n)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return n}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===da(e)){const t=(new pa).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Aa(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Aa(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class Mb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme();n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n,s)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=s||l,o)),((t,i,s,r)=>{if(o||l)return!0;const a=i.lineWidth||s.lineWidth,h=i.pickStrokeBuffer||s.pickStrokeBuffer,c=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=c?a+h:Bo(n,a+h,n.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),n.highPerformanceRestore(),o}}class Bb extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Ca}}let Eb=!1;function Pb(t){Eb||(Eb=!0,t.bind(ry).toDynamicValue((()=>new Bb(Vv(t,Gp)))).inSingletonScope(),t.bind(Cy).toService(ry))}class Ob extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Ca}}let Rb=!1;function Ib(t){Rb||(Rb=!0,t.bind(Xv).toDynamicValue((()=>new Ob(Vv(t,Gp)))).inSingletonScope(),t.bind(Yv).toService(Xv))}function Db(){if(Db.__loaded)return;Db.__loaded=!0;const t=jg();jf(),um({bind:t.bind}),Hv?Pb(t):Ib(t)}Db.__loaded=!1;const Lb=Db;class Fb extends om{contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme();n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,n.modelMatrix!==h&&Ko.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}}class Ub extends Fb{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=wa,this.themeType="arc"}}let Nb=!1;function jb(t){var e;Nb||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Yp))&&(Nb=!0,t.bind(ay).toDynamicValue((()=>new Ub(Vv(t,Yp)))).inSingletonScope(),t.bind(Cy).toService(ay))}function zb(){if(zb.__loaded)return;zb.__loaded=!0;const t=jg();zf(),Dy(),Fy(),fm({bind:t.bind}),jb(t)}zb.__loaded=!1;const Wb=zb;class Hb extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Ta}}let Vb=!1;function Gb(t){Vb||(Vb=!0,t.bind(oy).toDynamicValue((()=>new Hb(Vv(t,Xp)))).inSingletonScope(),t.bind(Cy).toService(oy))}class Yb extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Ta}}let Xb=!1;function Kb(t){Xb||(Xb=!0,t.bind(Kv).toDynamicValue((()=>new Yb(Vv(t,Xp)))).inSingletonScope(),t.bind(Yv).toService(Kv))}function $b(){if($b.__loaded)return;$b.__loaded=!0;const t=jg();Wf(),Mm({bind:t.bind}),Hv?Gb(t):Kb(t)}$b.__loaded=!1;const qb=$b;class Zb{constructor(){this.type="glyph",this.numberType=Ma}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{if(n)return;const r=s.pickItem(t,e,null,i);n=!(!r||!r.graphic)})),n}return!1}}class Jb extends Zb{constructor(t){super(),this.canvasRenderer=t}}let Qb=!1;function tx(t){Qb||(Qb=!0,t.bind(xy).toDynamicValue((()=>new Jb(Vv(t,ag)))).inSingletonScope(),t.bind(Cy).toService(xy))}class ex extends Zb{constructor(t){super(),this.canvasRenderer=t}}let ix=!1;function nx(t){ix||(ix=!0,t.bind(ny).toDynamicValue((()=>new ex(Vv(t,ag)))).inSingletonScope(),t.bind(Yv).toService(ny))}function sx(){if(sx.__loaded)return;sx.__loaded=!0;const t=jg();Vf(),Lm({bind:t.bind}),Hv?tx(t):nx(t)}sx.__loaded=!1;const rx=sx;function ax(){ax.__loaded||(ax.__loaded=!0,Gf())}ax.__loaded=!1;const ox=ax;class lx extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Ea}}let hx=!1;function cx(t){hx||(hx=!0,t.bind(hy).toDynamicValue((()=>new lx(Vv(t,og)))).inSingletonScope(),t.bind(Cy).toService(hy))}class ux{constructor(){this.type="image",this.numberType=Ea}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}}let dx=!1;function px(t){dx||(dx=!0,t.bind(qv).toDynamicValue((()=>new ux)).inSingletonScope(),t.bind(Yv).toService(qv))}function gx(){if(gx.__loaded)return;gx.__loaded=!0;const t=jg();Yf(),Xm({bind:t.bind}),Hv?cx(t):px(t)}gx.__loaded=!1;const fx=gx;class mx extends om{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=t.getGraphicTheme(),r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?s+r:Bo(n,s+r,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Ko.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}}class vx extends mx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Pa}}let yx=!1;function _x(t){yx||(yx=!0,t.bind(uy).toDynamicValue((()=>new vx(Vv(t,Zp)))).inSingletonScope(),t.bind(Cy).toService(uy))}class bx extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Pa}}let xx=!1;function Sx(t){xx||(xx=!0,t.bind(Zv).toDynamicValue((()=>new bx(Vv(t,Zp)))).inSingletonScope(),t.bind(Yv).toService(Zv))}function Ax(){if(Ax.__loaded)return;Ax.__loaded=!0;const t=jg();Xf(),Zm({bind:t.bind}),Hv?_x(t):Sx(t)}Ax.__loaded=!1;const Cx=Ax;class Tx extends mx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Oa}}let kx=!1;function Mx(t){kx||(kx=!0,t.bind(py).toDynamicValue((()=>new Tx(Vv(t,Jp)))).inSingletonScope(),t.bind(Cy).toService(py))}class Bx extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Oa}}let Ex=!1;function Px(t){Ex||(Ex=!0,t.bind(Jv).toDynamicValue((()=>new Bx(Vv(t,Jp)))).inSingletonScope(),t.bind(Yv).toService(Jv))}function Ox(){if(Ox.__loaded)return;Ox.__loaded=!0;const t=jg();Kf(),nv({bind:t.bind}),Hv?Mx(t):Px(t)}Ox.__loaded=!1;const Rx=Ox;class Ix extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ra}}let Dx=!1;function Lx(t){Dx||(Dx=!0,t.bind(yy).toDynamicValue((()=>new Ix(Vv(t,Qp)))).inSingletonScope(),t.bind(Cy).toService(yy))}class Fx extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ra}}let Ux=!1;function Nx(t){Ux||(Ux=!0,t.bind(iy).toDynamicValue((()=>new Fx(Vv(t,Qp)))).inSingletonScope(),t.bind(Yv).toService(iy))}function jx(){if(jx.__loaded)return;jx.__loaded=!0;const t=jg();$f(),dv({bind:t.bind}),Hv?Lx(t):Nx(t)}jx.__loaded=!1;const zx=jx;class Wx extends Fb{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=Ia,this.themeType="polygon"}}let Hx=!1;function Vx(t){var e;Hx||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rg))&&(Hx=!0,t.bind(_y).toDynamicValue((()=>new Wx(Vv(t,rg)))).inSingletonScope(),t.bind(Cy).toService(_y))}function Gx(){if(Gx.__loaded)return;Gx.__loaded=!0;const t=jg();qf(),Dy(),Fy(),vv({bind:t.bind}),Vx(t)}Gx.__loaded=!1;const Yx=Gx,Xx=new ue;class Kx{constructor(){this.type="rect",this.numberType=Da}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme(),{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer,o=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=o?r+a:Bo(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;Xx.setValue(i.x1,i.y1,i.x2,i.y2),Xx.expand(-r/2),h=!Xx.containsPoint(e)}}return n.highPerformanceRestore(),h}}class $x extends Kx{constructor(t){super(),this.canvasRenderer=t}}let qx=!1;function Zx(t){qx||(qx=!0,t.bind(gy).toDynamicValue((()=>new $x(Vv(t,tg)))).inSingletonScope(),t.bind(Cy).toService(gy))}class Jx extends Kx{constructor(t){super(),this.canvasRenderer=t}}let Qx=!1;function tS(t){Qx||(Qx=!0,t.bind(Qv).toDynamicValue((()=>new Jx(Vv(t,tg)))).inSingletonScope(),t.bind(Yv).toService(Qv))}function eS(){if(eS.__loaded)return;eS.__loaded=!0;const t=jg();Zf(),xv({bind:t.bind}),Hv?Zx(t):tS(t)}eS.__loaded=!1;const iS=eS;class nS extends Fb{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=La,this.themeType="rect"}}let sS=!1;function rS(t){var e;sS||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,eg))&&(sS=!0,t.bind(fy).toDynamicValue((()=>new nS(Vv(t,eg)))).inSingletonScope(),t.bind(Cy).toService(fy))}function aS(){if(aS.__loaded)return;aS.__loaded=!0;const t=jg();Jf(),wv({bind:t.bind}),rS(t)}aS.__loaded=!1;const oS=aS;class lS{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Fa}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let hS=!1;function cS(t){hS||(hS=!0,t.bind(by).toDynamicValue((()=>new lS(Vv(t,sg)))).inSingletonScope(),t.bind(Cy).toService(by))}class uS{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Fa}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let dS=!1;function pS(t){dS||(dS=!0,t.bind(sy).toDynamicValue((()=>new uS(Vv(t,sg)))).inSingletonScope(),t.bind(Yv).toService(sy))}function gS(){if(gS.__loaded)return;gS.__loaded=!0;const t=jg();Qf(),Ev({bind:t.bind}),Hv?cS(t):pS(t)}gS.__loaded=!1;const fS=gS;function mS(){mS.__loaded||(mS.__loaded=!0,tm())}mS.__loaded=!1;const vS=mS;class yS extends Fb{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Na}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getParsedPath();if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(s.isSvg||"imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,n),{x:o,y:l,z:h,lastModelMatrix:c}=a;let u=e;if(n.camera){u=e.clone();const i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,n,o,l,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?s+r:Bo(n,s+r,n.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==c&&Ko.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),d}}let _S=!1;function bS(t){_S||(_S=!0,t.bind(my).toDynamicValue((()=>new yS(Vv(t,ig)))).inSingletonScope(),t.bind(Cy).toService(my))}class xS extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Na}}let SS=!1;function AS(t){SS||(SS=!0,t.bind(ty).toDynamicValue((()=>new xS(Vv(t,ig)))).inSingletonScope(),t.bind(Yv).toService(ty))}function CS(){if(CS.__loaded)return;CS.__loaded=!0;const t=jg();im(),Uv({bind:t.bind}),Hv?bS(t):AS(t)}CS.__loaded=!1;const wS=CS;class TS extends Fb{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=ja}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,d=l.height(),f=l.width(),m=yc(a,d,s),v=vc(o,f);return e.rect(v+h,m+c,f,d,u),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==d&&Ko.free(n.modelMatrix),n.modelMatrix=d,n.highPerformanceRestore(),g}}let kS=!1;function MS(t){kS||(kS=!0,t.bind(vy).toDynamicValue((()=>new TS(Vv(t,ng)))).inSingletonScope(),t.bind(Cy).toService(vy))}class BS{constructor(){this.type="text",this.numberType=ja}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let ES=!1;function PS(t){ES||(ES=!0,t.bind(ey).toDynamicValue((()=>new BS)).inSingletonScope(),t.bind(Yv).toService(ey))}function OS(){if(OS.__loaded)return;OS.__loaded=!0;const t=jg();nm(),Wv({bind:t.bind}),Hv?MS(t):PS(t)}OS.__loaded=!1;const RS=OS;function IS(t){const e=[];for(let i=0;int.getInstance().info(`[VChart log]: ${t}`,...e),LS=(t,e)=>(u(US.warnHandler)&&US.warnHandler.call(null,t,e),e?nt.getInstance().warn(`[VChart warn]: ${t}`,e):nt.getInstance().warn(`[VChart warn]: ${t}`)),FS=(t,e,i)=>{if(!u(US.errorHandler))throw new Error(t);US.errorHandler.call(null,t,e)},US={silent:!1,warnHandler:!1,errorHandler:!1},NS=ju(),jS=NS&&globalThis?globalThis.document:void 0;function zS(t){return("desktop-browser"===t||"mobile-browser"===t)&&NS}function WS(t){return HS(t)||"mobile-browser"===t}function HS(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let VS=0;function GS(){return VS>=9999999&&(VS=0),VS++}function YS(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function XS(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}function KS(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&KS(t,e)}))}const $S=t=>!d(t)&&!1!==t.visible;const qS=["#ffffff","#000000"];function ZS(t,e,i,n,s,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new we(t).toHex(),o=new we(e).toHex();return JS(a,o,i,n,r)?a:function(t,e,i,n,s,r){const a=[];s&&(s instanceof Array?a.push(...s):a.push(s)),a.push(...qS);for(const s of a)if(t!==s&&JS(s,e,i,n,r))return s}(a,o,i,n,s,r)}function JS(t,e,i,n,s){if("lightness"===s){const i=we.getColorBrightness(new we(e));return we.getColorBrightness(new we(t))<.5?i>=.5:i<.5}return n?QS(t,e)>n:"largeText"===i?QS(t,e)>3:QS(t,e)>4.5}function QS(t,e){const i=tA(t),n=tA(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function tA(t){const e=ke(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function eA(t,e,i,n){let s;switch(t){case"base":s=e;break;case"invertBase":s=i;break;case"similarBase":s=n}return s}function iA(t){let e=function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}function nA(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=It(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const sA=Ic,rA={arc:t=>sA("arc",t),circle:t=>sA("circle",t),group:t=>sA("group",t),image:t=>sA("image",t),line:t=>sA("line",t),path:t=>sA("path",t),polygon:t=>sA("polygon",t),rect:t=>sA("rect",t),richtext:t=>sA("richtext",t),symbol:t=>sA("symbol",t),text:t=>sA("text",t)},aA=-.5*Math.PI,oA=1.5*Math.PI,lA="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 hA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(hA||(hA={}));const cA={[hA.selectedReverse]:{},[hA.selected]:{},[hA.hover]:{},[hA.hoverReverse]:{}},uA={container:"",width:30,height:30,style:{}},dA=(t,e,i,n)=>new re(Object.assign({defaultFontParams:Object.assign({fontFamily:lA,fontSize:14},n),getTextBounds:i?void 0:Ud,specialCharSet:"-/: .,@%'\"~"+re.ALPHABET_CHAR_SET+re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function pA(t,e,i={}){if(!t)return{width:0,height:0};const n=Ud({text:t,fontFamily:e.fontFamily||i.fontFamily||lA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:n.width(),height:n.height()}}function gA(t,e="type"){var i,n;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(n=t[e])&&void 0!==n?n:"text"}function fA(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function mA(t,e="type"){const i=gA(t,e);return"rich"===i?rA.richtext(fA(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.html=n,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.react=n,t.text=i,t.renderable=!1,t}(t)),rA.text(t))}function vA(t,e,i,n,s){"right"===t?"center"===i?e.setAttribute("x",n-s/2):"right"===i||"end"===i?e.setAttribute("x",n):e.setAttribute("x",n-s):"center"===i?e.setAttribute("x",n+s/2):"right"===i||"end"===i?e.setAttribute("x",n+s):e.setAttribute("x",n)}const yA={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},_A={size:8,stroke:"#000",lineWidth:1,zIndex:1};function bA(t,e){var i,n;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(n=e.OBBBounds)||void 0===n?void 0:n.empty())?$t(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||ee(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const xA=Math.sin(Math.PI/10);function SA(t,e=xA){const i=!d(t)&&0!==t,n=i?Math.cos(t):1;return i&&Math.abs(n)<=e}function AA(t,e=xA){const i=!d(t)&&0!==t,n=i?Math.sin(t):0;return!i||Math.abs(n)<=e}function CA(t){const e={};return KS(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function wA(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function TA(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 kA(t,e,i){var n;if(AA(null===(n=t.attribute)||void 0===n?void 0:n.angle,Number.EPSILON))return i>oe(t.AABBBounds,e.AABBBounds);const s=t.OBBBounds,r=e.OBBBounds;return!s||!r||s.empty()||r.empty()?i>oe(t.AABBBounds,e.AABBBounds):s.intersects(r)||i>le(s,r)}function MA(t,e){for(let i,n=1,s=t.length,r=t[0];n{const n=e?+i[e]:+i;return A(n)&&(t+=n),t}),0)}function EA(t,e){const i=PA(t),n=PA(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function PA(t,e={x:0,y:0}){return Ut.distancePP(t,e)}function OA(t,e,i){let n=!1;if(e&&u(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function RA(t){return function(e){let i;return i=_(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function IA(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&IA(t[i],e)}}var DA;!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"}(DA||(DA={}));const LA={};function FA(t){switch(t){case DA.Linear:case DA.Log:case DA.Pow:case DA.Sqrt:case DA.Symlog:case DA.Time:return!0;default:return!1}}function UA(t){return!!LA[t]}function NA(t){switch(t){case DA.Ordinal:case DA.Point:case DA.Band:return!0;default:return!1}}function jA(t){return t}Object.values(DA).forEach((t=>{LA[t]=!0}));const zA=t=>-Math.log(-t),WA=t=>-Math.exp(-t),HA=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,VA=t=>10===t?HA:t===Math.E?Math.exp:e=>Math.pow(t,e),GA=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),YA=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),XA=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function KA(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 $A(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function qA(t,e,i){let n;return n=1===t?t+2*i:t-e+2*i,t?n>0?n:1:0}function ZA(t,e,i,n){return 1===i&&(i=0),qA(t,i,n)*(e/(1-i))}function JA(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),n=t[0]-i*e[0];return[n,i+n]}function QA(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let s;return s=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,s*Math.pow(10,i)};class 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=JA(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:n}=this._fishEyeOptions,s=this.range(),r=s[0],a=s[s.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ut(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(n)?(l-o)*i:n;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const iC=Symbol("implicit");class nC 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=DA.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iC}clone(){const t=(new nC).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let n=this._index.get(e);if(!n){if(this._unknown!==iC)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}const s=this._ordinalRange[(n-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(s):s}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return sC(t,e,r,s)}class aC extends nC{constructor(t){super(),this.type=DA.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),n=super.domain().length,s=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=ZA(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),n=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const s=this._rangeFactorStart+n<=1,r=this._rangeFactorEnd-n>=0;if("rangeFactorStart"===e&&s?this._rangeFactorEnd=this._rangeFactorStart+n:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-n:t[0]<=t[1]?s?this._rangeFactorEnd=this._rangeFactorStart+n:r?this._rangeFactorStart=this._rangeFactorEnd-n:(this._rangeFactorStart=0,this._rangeFactorEnd=n):r?this._rangeFactorStart=this._rangeFactorEnd-n:s?this._rangeFactorEnd=this._rangeFactorStart+n:(this._rangeFactorStart=1-n,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,n=e+i;this._wholeRange=[e,n]}else{const e=t[1]+i*(1-this._rangeFactorEnd),n=e-i;this._wholeRange=[n,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=n,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[J(t[0]),J(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[J(t[0]),J(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:rC(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return rC(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n;if(i=pt(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,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new aC(!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:oC}=Me;function lC(t,e){const i=typeof e;let n;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return vt(t,e);if("string"===i){if(n=we.parseColorString(e)){const e=oC(we.parseColorString(t),n);return t=>e(t).formatRgb()}return vt(Number(t),Number(e))}return e instanceof Te?oC(t,e):e instanceof we?oC(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):vt(Number(t),Number(e))}class hC extends eC{constructor(t=jA,e=jA){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=jA,this._piecewise=$A,this._interpolate=lC}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),vt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const n=Array.from(t,J);return this._domain=n,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=yt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,n=i.length,s=this._range.length;let r=Math.min(n,s);if(n&&n=2?(e-i[n-2])/t:0;for(let s=1;s<=t;s++)i[n-2+s]=e-a*(t-s);r=s}return this._autoClamp&&(this._clamp=pt(i[0],i[r-1])),this._piecewise=r>2?QA:$A,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:jA),this.rescale(i)):this._clamp!==jA}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const cC=Math.sqrt(50),uC=Math.sqrt(10),dC=Math.sqrt(2),pC=[1,2,5,10],gC=(t,e,i)=>{let n=1,s=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?s=0:t<0&&t>=-Number.MIN_VALUE?s=-(e-1):!i&&a<1?n=yC(a).step:(i||a>1)&&(s=Math.floor(t)-r*n),n>0?(t>0?s=Math.max(s,0):t<0&&(s=Math.min(s,-(e-1)*n)),function(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ns+t*n))):t>0?mC(0,-(e-1)/n,n):mC((e-1)/n,0,n)},fC=ct(((t,e,i,n)=>{let s,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((s=e0){let i=Math.round(t/o),n=Math.round(e/o);for(i*oe&&--n,a=new Array(r=n-i+1);++le&&--n,a=new Array(r=n-i+1);++l{let n,s,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,s=new Array(n=o-a+1);++re&&--o,s=new Array(n=o-a+1);++r{let s,r,a;if(i=+i,(t=+t)==(e=+e))return gC(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return gC(t,i,null==n?void 0:n.noDecimals);(s=e0){let n=1;const{power:s,gap:a}=o,h=10===a?2*10**s:1*10**s;for(;n<=5&&(r=mC(t,e,l),r.length>i+1)&&i>2;)l+=h,n+=1;i>2&&r.length{let n;const s=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(n=a;n>=1;n--)e.push(s-n*i);return e.concat(t)}if(s>=0){for(n=1;n<=a;n++)t.push(r+n*i);return t}let o=[];const l=[];for(n=1;n<=a;n++)n%2==0?o=[s-Math.floor(n/2)*i].concat(o):l.push(r+Math.ceil(n/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==n?void 0:n.noDecimals)&&l<0&&(l=1),r=mC(t,e,l);return s&&r.reverse(),r})),yC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=pC[0];return i>=cC?n=pC[3]:i>=uC?n=pC[2]:i>=dC&&(n=pC[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function _C(t,e,i){const n=(e-t)/Math.max(0,i);return yC(n)}function bC(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e0;){if(n=_C(a,o,e).step,n===i)return t[s]=a,t[r]=o,t;if(n>0)a=Math.floor(a/n)*n,o=Math.ceil(o/n)*n;else{if(!(n<0))break;a=Math.ceil(a*n)/n,o=Math.floor(o*n)/n}i=n}}function SC(t,e){const i=S(e.forceMin),n=S(e.forceMax);let s=null;const r=[];let a=null;const o=i&&n?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:n?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const AC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CC=ct(((t,e,i,n,s,r,a)=>{let o=t,l=e;const h=l0){for(;d<=p;++d)for(c=1;cl)break;g.push(u)}}else for(;d<=p;++d)for(c=n-1;c>=1;--c)if(u=d>0?c/r(-d):c*r(d),!(ul)break;g.push(u)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),wC=ct(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=vC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?AC(t,e,s):AC(t,e,tC(s)),h=AC(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),TC=ct(((t,e,i,n,s)=>bC(n(t),n(e),i).map((t=>tC(s(t))))));class kC extends hC{constructor(){super(...arguments),this.type=DA.Linear}clone(){var t;const e=new kC;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return fC(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(u(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=vC(s[0],s[s.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=n.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return bC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n,s,r=-1;if(i=+i,(s=(e=+e)<(t=+t))&&(n=t,t=e,e=n),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(s=o[1])&&void 0!==s?s:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function BC(t){return e=>-t(-e)}function EC(t=Number.EPSILON){return e=>Math.max(e,t)}class PC extends hC{constructor(){super(GA(10),VA(10)),this.type=DA.Log,this._limit=EC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new PC).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=GA(this._base),n=VA(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=BC(i),this._pows=BC(n),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=zA,this.untransformer=WA):(this._logs=i,this._pows=n,this._limit=EC(),this.transformer=this._logs,this.untransformer=n),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return jA}d3Ticks(t=10,e){const i=this.domain(),n=this._limit(i[0]),s=this._limit(i[i.length-1]);return CC(n,s,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return wC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}V(PC,MC);class OC extends kC{constructor(){super(YA(1),XA(1)),this.type=DA.Symlog,this._const=1}clone(){return(new OC).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=YA(t),this.untransformer=XA(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),n=i[0],s=i[i.length-1];return CC(n,s,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return wC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}V(OC,MC);class RC{constructor(){this.type=DA.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&A(+t)?this._range[st(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new RC).domain(this._domain).range(this._range).unknown(this._unknown)}}var IC,DC,LC;function FC(t){var e,i;const{type:n}=t;return n===DC.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(IC||(IC={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(DC||(DC={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(LC||(LC={}));const UC={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},NC={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function jC(t,e){var i;if(!t)return[];const n=XC(t,e);if(!n||_(n))return null!==(i=n)&&void 0!==i?i:[];if(g(n)){const{dataScheme:i}=n;return i?GC(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>VC(i)?WC(t,i,e):i)).filter(p)}))):i.map((i=>VC(i)?WC(t,i,e):i)).filter(p):[]}return[]}function zC(t,e){var i,n;return GC(t)?null!==(n=null===(i=t.find((t=>p(t.isAvailable)?u(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function WC(t,e,i){var n;const s=XC(t,i);if(!s)return;let r;const{palette:a}=s;if(g(a)&&(r=null!==(n=function(t,e){const i=UC[e];if(i&&t[i])return t[i];if(t[e])return t[e];const n=NC[e];return n?t[n]:void 0}(a,e.key))&&void 0!==n?n:e.default),!r)return;if(d(e.a)&&d(e.l)||!y(r))return r;let o=new we(r);if(p(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=me(t,i,n),a=fe(s,r,e.l),l=new we(`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 HC=(t,e)=>{if(e&&VC(t)){const i=WC(e,t);if(i)return i}return t};function VC(t){return t&&"palette"===t.type&&!!t.key}function GC(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function YC(t){return _(t)?{dataScheme:t}:t}function XC(t,e){var i,n;const{type:s}=null!=e?e:{};let r;if(!e||d(s))r=null==t?void 0:t.default;else{const a=FC(e);r=null!==(n=null!==(i=null==t?void 0:t[`${s}_${a}`])&&void 0!==i?i:null==t?void 0:t[s])&&void 0!==n?n:null==t?void 0:t.default}return r}class KC extends nC{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!GC(this._range))return void super.range(this._range);const t=zC(this._range,this._domain);super.range(t)}}const $C={linear:kC,band:aC,point:class extends aC{constructor(t){super(!1),this.type=DA.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:nC,threshold:RC,colorOrdinal:KC};function qC(t){const e=$C[t];return e?new e:null}function ZC(t,e,i){if(!e)return t;const n=e.range(),s=i&&e._calculateWholeRange?e._calculateWholeRange(n):e.range(),r=Math.min(s[0],s[s.length-1]),a=Math.max(s[0],s[s.length-1]);return Math.min(Math.max(r,t),a)}function JC(t,e,i){if(!e)return!0;const n=e.range(),s=(i&&e._calculateWholeRange?e._calculateWholeRange(n):e.range()).map((t=>e.invert(t))),r=Math.min(s[0],s[s.length-1]),a=Math.max(s[0],s[s.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function QC(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function tw(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ew(t){return!!y(t)&&(!!t.endsWith("%")&&YS(t.substring(0,t.length-1)))}function iw(t){return!!g(t)&&("percent"in t||"offset"in t)}function nw(t,e,i,n=0){var s,r;return S(t)?t:ew(t)?Number(t.substring(0,t.length-1))*e/100:u(t)?t(i):g(t)?e*(null!==(s=t.percent)&&void 0!==s?s:0)+(null!==(r=t.offset)&&void 0!==r?r:0):n}function sw(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(n=t.top)&&void 0!==n?n:0,o.right=null!==(s=t.right)&&void 0!==s?s:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((n=>{o[n]=nw(t[n],e.size,i)}))})),o}function rw(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function aw(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):S(t)||ew(t)||u(t)||iw(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function ow(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const lw=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i},hw=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function cw(t,e){return t&&e.key in t?t[e.key]:e.default}function uw(t){return t&&"token"===t.type&&!!t.key}const dw={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%"},pw={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:hw,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:dw,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},gw={name:"dark",colorScheme:{default:{dataScheme:hw,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},fw=(t,e,i)=>{if(d(e))return t;const n=e[0];return d(n)?t:1===e.length?(t[n]=i,t):(d(t[n])&&("number"==typeof e[1]?t[n]=[]:t[n]={}),fw(t[n],e.slice(1),i))};function mw(t,...e){let i=-1;const n=e.length;for(;++i{const n=t[i];return e[i]=YC(n),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}xw._charts=bw.charts,xw._series=bw.series,xw._components=bw.components,xw._graphicComponents=bw.graphicComponents,xw._marks=bw.marks,xw._regions=bw.regions,xw._animations=bw.animations,xw._implements=bw.implements,xw._chartPlugin=bw.chartPlugin,xw._vChartPlugin=bw.vChartPlugin,xw._componentPlugin=bw.componentPlugin,xw.transforms=bw.transforms,xw.dataParser=bw.dataParser,xw._layout=bw.layout,xw._grammarTransforms=bw.grammarTransforms,xw._stageEventPlugins=bw.stageEventPlugins,xw.registerStageEventPlugin=(t,e)=>{xw._stageEventPlugins[t]=e},xw.getStageEventPlugin=t=>xw._stageEventPlugins[t],xw._interactionTriggers=bw.interactionTriggers,xw.registerInteractionTrigger=(t,e)=>{xw._interactionTriggers[t]=e},xw._composedEventMap=bw.composedEventMap,xw.registerComposedEvent=(t,e)=>{xw._composedEventMap[t]=e},xw._tooltipProcessors=bw.tooltipProcessors,xw.registerTooltipProcessor=(t,e)=>{xw._tooltipProcessors[t]=e},xw.createTooltipProcessor=(t,e)=>{const i=xw._tooltipProcessors[t];return i?new i(e):null},xw._runtimePluginInstallers=bw.runtimePluginInstallers,xw.registerRuntimePluginInstaller=(t,e)=>{xw._runtimePluginInstallers[t]=e},xw.getRuntimePluginInstaller=t=>xw._runtimePluginInstallers[t];const Cw=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e};Cw();const ww={[pw.name]:pw},Tw=pw.name,kw=new Map(Object.keys(ww).map((t=>[t,ww[t]]))),Mw=new Map,Bw=new Map(Object.keys(ww).map((t=>[t,t===Tw]))),Ew=(t,e)=>{if(!t)return;const i=Iw(e);kw.set(t,i),Bw.set(t,!0)},Pw=(t=Tw)=>(Bw.has(t)&&!Bw.get(t)&&Ew(t,kw.get(t)),kw.get(t)),Ow=t=>kw.delete(t)&&Mw.delete(t)&&Bw.delete(t),Rw=t=>!!y(t)&&kw.has(t),Iw=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Tw;return Sw({},Pw(i),t)};class Dw{static registerInstance(t){Dw.instances.set(t.id,t)}static unregisterInstance(t){Dw.instances.delete(t.id)}static getInstance(t){return Dw.instances.get(t)}static instanceExist(t){return Dw.instances.has(t)}static forEach(t,e=[],i){const n=G(e);return Dw.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}Dw.instances=new Map;class Lw{static registerTheme(t,e){Ew(t,e)}static getTheme(t,e=!1){return Pw(t)}static removeTheme(t){return Ow(t)}static themeExist(t){return Rw(t)}static getDefaultTheme(){return Lw.themes.get(Tw)}static setCurrentTheme(t){Lw.themeExist(t)&&(Lw._currentThemeName=t,Dw.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Lw.getTheme(Lw._currentThemeName,t)}static getCurrentThemeName(){return Lw._currentThemeName}}function Fw(t){return y(t)?Lw.themeExist(t)?Lw.getTheme(t):{}:g(t)?t:{}}Lw.themes=kw,Lw._currentThemeName=Tw;const Uw=["animationThreshold","colorScheme","name","padding"];function Nw(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((s=>{const r=t[s];Uw.includes(s)?n[s]=r:m(r)?VC(r)?n[s]=HC(r,e):uw(r)?n[s]=cw(i,r):n[s]=Nw(r,e,i):n[s]=r})),n}function jw(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=jw(t[n],e)}return i}return _(t)?t.map((t=>jw(t,e))):t}function zw(t,e){if(!t)return t;if(m(t)){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(y(t[n])&&e.getFunction(t[n])){i[n]=e.getFunction(t[n]);continue}i[n]=zw(t[n],e)}return i}return _(t)?t.map((t=>zw(t,e))):t}function Ww(t,...e){return u(t)?t(...e):t}const Hw=(t,e,i,n)=>((t,e,i)=>dA(t,e,i,{fontFamily:dw.fontFamily,fontSize:dw.fontSize}))(e,i,n).measure(t),Vw="__VCHART",Gw=500,Yw=500,Xw=`${Vw}_MEASURE_CANVAS_ID`,Kw=`${Vw}_DEFAULT_DATA_INDEX`,$w=`${Vw}_DEFAULT_DATA_KEY`,qw=`${Vw}_DEFAULT_DATA_SERIES_FIELD`,Zw=`${Vw}_DEFAULT_SERIES_STYLE_NAME`,Jw=`${Vw}_STACK_KEY`,Qw=`${Vw}_STACK_START`,tT=`${Vw}_STACK_END`,eT=`${Vw}_STACK_START_PERCENT`,iT=`${Vw}_STACK_END_PERCENT`,nT=`${Vw}_STACK_START_OffsetSilhouette`,sT=`${Vw}_STACK_END_OffsetSilhouette`,rT=`${Vw}_STACK_TOTAL`,aT=`${Vw}_STACK_TOTAL_PERCENT`,oT=`${Vw}_STACK_TOTAL_TOP`,lT=`${Vw}_STACK_TOTAL_BOTTOM`,hT=`${Vw}_MOSAIC_VALUE_START_PERCENT`,cT=`${Vw}_MOSAIC_VALUE_END_PERCENT`,uT=`${Vw}_MOSAIC_CAT_START_PERCENT`,dT=`${Vw}_MOSAIC_CAT_END_PERCENT`,pT=`${Vw}_SEGMENT_START`,gT=`${Vw}_SEGMENT_END`,fT=`${Vw}_KEY`,mT=`${Vw}_MAP_LOOK_UP_KEY`;function vT(t,e){for(let i=0;it.key===e))}function _T(t,e){var i;if(!t)return null!=e?e:null;const n=t.getFields();return n&&n[e]?null!==(i=n[e].alias)&&void 0!==i?i:e:null!=e?e:null}function bT(t,e,i){const n=t.getStackSort(),s={};let r=null;return n&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var n;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(s[o]=null!==(n=s[o])&&void 0!==n?n:{groupField:a.groupField,nodes:{}},wT(t,a,s[o],l,e,r))})),n?xT(s):s}function xT(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))):xT(t[e].nodes);return t}function ST(t,e){if("values"in t&&t.values.length){const i=BA(t.values,e),n=function(t,e){const i=[];return t.forEach((t=>{const n=+t[e];A(n)&&i.push(n)})),0===i.length?null:X(i)}(t.values,iT);t.values.forEach((t=>{t[rT]=i,t[aT]=n}))}else for(const i in t.nodes)ST(t.nodes[i],e)}function AT(t){if(!t.values.length)return;const e=t.values[t.values.length-1][tT]/2;for(let i=0;i0){let n=0,o=0,l=1,h=0,c=null,u=null;const d=t.values.length;for(let i=0;i=0?(l[s.start]=n,n+=l[s.end],l[s.end]=n):(l[s.start]=o,o+=l[s.end],l[s.end]=o),l[s.key]=t.key,a&&(delete l[s.max],(!u||l[s.end]>u[s.end])&&(u=l)),r&&(delete l[s.min],(!c||l[s.start]=0?n:o;l=h>=0?1:-1,r[s.startPercent]=0===a?0:Math.min(1,r[s.start]/a)*l,r[s.endPercent]=0===a?0:Math.min(1,r[s.end]/a)*l}}for(const r in t.nodes)CT(t.nodes[r],e,i,n,s)}function wT(t,e,i,n,s,r,a){var o;if("values"in e)if(s&&e.values.forEach((t=>t[tT]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[n]))),i.series.push({s:t,values:e.values}),r){const n=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:n?r[n].sort[e[n]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),wT(t,e.nodes[l],i.nodes[l],n,s,r,h)}}function TT(t){return!u(t)&&!E(t)&&Object.keys(t).some((e=>u(t[e])))}function kT(t,e,i,n,s){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(u(t))return ET(t(r,i,n,s));if(TT(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{u(e[t])&&(e[t]=e[t](r,i,n,s))})),ET(e)}return ET(t)}function MT(t={}){const e=Object.assign({},t);if(u(t.style)||TT(t.style)?e.style=(e,i,n,s)=>kT(t.style,e,i,n,s):E(t.style)||(e.style=ET(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{u(t.state[e])||TT(t.state[e])?i[e]=(i,n,s,r)=>kT(t.state[e],i,n,s,r):E(t.state[e])||(i[e]=ET(t.state[e]))})),e.state=i}return e}function BT(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,n,s,r)=>ET(t[i](e,n,s,r)):E(t[i])||(e[i]=ET(t[i]))})),e}function ET(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:Nt(t.angle)}):t}const PT=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},OT=t=>"line"===t||"area"===t,RT=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return OT(i)?e:null==e?void 0:e[0]},IT=(t,e)=>{const i=t.getAttributes(!0),n={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(n[t]=e[t])})),n};let DT=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},s=xw.getComposedEvent(t);if(s){const e=new s(this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(n.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,n),this._addEventHandler(t,n);return this}off(t,e,i){var n,s,r;const a=null!=i?i:e;if(xw.getComposedEvent(t))if(a)null===(n=this._composedEventMap.get(a))||void 0===n||n.event.unregister(),this._composedEventMap.delete(a);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(s=this._composedEventMap.get(e[0]))||void 0===s||s.event.unregister(),this._composedEventMap.delete(e[0]));else if(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var LT;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(LT||(LT={}));const FT=["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 UT,NT,jT;t.ChartEvent=void 0,(UT=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",UT.rendered="rendered",UT.renderFinished="renderFinished",UT.animationFinished="animationFinished",UT.regionSeriesDataFilterOver="regionSeriesDataFilterOver",UT.afterInitData="afterInitData",UT.afterInitEvent="afterInitEvent",UT.afterInitMark="afterInitMark",UT.rawDataUpdate="rawDataUpdate",UT.viewDataFilterOver="viewDataFilterOver",UT.viewDataUpdate="viewDataUpdate",UT.viewDataStatisticsUpdate="viewDataStatisticsUpdate",UT.markDeltaYUpdate="markDeltaYUpdate",UT.viewDataLabelUpdate="viewDataLabelUpdate",UT.scaleDomainUpdate="scaleDomainUpdate",UT.scaleRawDomainUpdate="scaleRawDomainUpdate",UT.scaleUpdate="scaleUpdate",UT.dataZoomChange="dataZoomChange",UT.drill="drill",UT.layoutStart="layoutStart",UT.layoutEnd="layoutEnd",UT.layoutRectUpdate="layoutRectUpdate",UT.playerPlay="playerPlay",UT.playerPause="playerPause",UT.playerEnd="playerEnd",UT.playerChange="playerChange",UT.playerForward="playerForward",UT.playerBackward="playerBackward",UT.scrollBarChange="scrollBarChange",UT.brushStart="brushStart",UT.brushChange="brushChange",UT.brushEnd="brushEnd",UT.brushClear="brushClear",UT.brushActive="brushActive",UT.legendSelectedDataChange="legendSelectedDataChange",UT.legendFilter="legendFilter",UT.legendItemClick="legendItemClick",UT.legendItemHover="legendItemHover",UT.legendItemUnHover="legendItemUnHover",UT.tooltipShow="tooltipShow",UT.tooltipHide="tooltipHide",UT.tooltipRelease="tooltipRelease",UT.afterResize="afterResize",UT.afterRender="afterRender",UT.afterLayout="afterLayout",UT.afterMarkLayoutEnd="afterMarkLayoutEnd",UT.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(NT||(NT={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(jT||(jT={}));const zT=[jT.mark,jT.model,jT.chart,jT.vchart];class WT{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(jT.vchart,[]),this._levelNodes.set(jT.chart,[]),this._levelNodes.set(jT.model,[]),this._levelNodes.set(jT.mark,[])}addHandler(t,e){var i;const n={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(n),this._map.set(t.callback,n),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),n=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&(null==i||i.splice(n,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const HT={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class VT{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),n=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;n&&"component"===n.modelType&&(a=null!==(e=n.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:n,mark:null!=s?s:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let n=null;i.graphics&&(n=i.graphics);const s={event:t.event,chart:e,graphics:n,datums:n&&n.map((t=>RT(t)))};this.dispatch(t.type,s)},this.globalInstance=t,this._compiler=e}register(t,e){var i,n,s,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||NT.chart),l=this.getEventListeners((null===(n=e.filter)||void 0===n?void 0:n.source)||NT.chart);o.get(t)||o.set(t,new WT);if(o.get(t).addHandler(e,null===(s=e.filter)||void 0===s?void 0:s.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,n,s,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||NT.chart),l=this.getEventListeners((null===(n=null==e?void 0:e.filter)||void 0===n?void 0:n.source)||NT.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(s=null==e?void 0:e.wrappedCallback)||void 0===s?void 0:s.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||NT.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||NT.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{let i=0;for(;!s&&i{const n=this.getEventBubble(i).get(t);n&&n.getAllHandlers().forEach((t=>{e?zT.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[NT.chart,NT.window,NT.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var n,s,r;if(u(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.name)!==t.markName)return!1;let a=null===(s=i.model)||void 0===s?void 0:s.type;return HT[a]&&(a=HT[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(n=t.query)||void 0===n?void 0:n.consume;return a&&(null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?jT.model:jT.vchart:jT.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=mt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=ft(t.callback,i.debounce));let n=this._getQueryLevel(i),s=null,r=NT.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||n!==jT.model&&n!==jT.mark||(s=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,n=jT.model),t.filter={level:n,markName:o,type:s,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case NT.chart:return this._viewBubbles;case NT.window:return this._windowBubbles;case NT.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case NT.chart:return this._viewListeners;case NT.window:return this._windowListeners;case NT.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return FT.includes(t)||Object.values(LT).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&xw.hasInteractionTrigger(e)}}function GT(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function YT(t,e,i){t.getParser(e)||t.registerParser(e,i)}const XT=new Map;function KT(t,e=!1){let i=e;return t.latestData instanceof di&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const $T=(t,e)=>0===t.length?[]:1===t.length?KT(t[0],null==e?void 0:e.deep):t.map((t=>KT(t,null==e?void 0:e.deep)));function qT(e,i,n){GT(i=i instanceof ui?i:e.dataSet,"copyDataView",$T);const s=new di(i,n);return s.parse([e],{type:"dataview"}),s.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),s}function ZT(t,e,i=[]){var n;if(t instanceof di)return t;const{id:s,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let u;h.clone=!(!1===h.clone);const d=i.find((t=>t.name===s));if(d)u=d;else{const t={name:s};if(c&&(t.fields=c),u=new di(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return LS(`no data matches fromDataId ${o}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return LS(`no data matches fromDataIndex ${a}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else Array.isArray(r)?u.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(u.parse([]),LS("values should be array")):u.parse(r,null!==(n=h)&&void 0!==n?n:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&u.transform(t)}))}return u}function JT(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var QT,tk,ek,ik;t.TransformLevel=void 0,(QT=t.TransformLevel||(t.TransformLevel={}))[QT.copyDataView=-10]="copyDataView",QT[QT.treemapFilter=-8]="treemapFilter",QT[QT.treemapFlatten=-7]="treemapFlatten",QT[QT.dotObjFlat=-7]="dotObjFlat",QT[QT.linkDotInfo=-7]="linkDotInfo",QT[QT.sankeyLayout=-7]="sankeyLayout",QT[QT.dataZoomFilter=-6]="dataZoomFilter",QT[QT.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(tk||(tk={})),function(t){t.data="data",t.mark="mark"}(ek||(ek={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(ik||(ik={}));const nk=["line","area","trail"];function sk(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(fT,i?t.slice().sort(i):t.slice()),{keys:[fT],data:n};if(1===t.length){const i=e(t[0],0);return n.set(i,[t[0]]),{keys:[i],data:n}}const s=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=n.get(a))&&void 0!==r?r:[];o.push(t),n.set(a,o),s.add(a)})),i&&s.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(s),data:n}}const rk=(t,e,i={})=>(t&&Object.keys(t).forEach((n=>{i[n]=t[n](e)})),i);function ak(t,e,i,n,s){const r=t=>{if(!n&&t&&(!i||i(t))){const i=e.call(null,t);if(s&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{ak(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function lk(t,e,i,n){const s=sk(t,(t=>i(t))),r=sk(e,(t=>n(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const hk=`${Vw}_BuiltIn_CallBack_Disappear`;var ck;!function(t){t.render="render",t.disappear="disappear"}(ck||(ck={}));const uk=[0,0,0];class dk{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},ns),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},rs),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},as),{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 pe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new pe(1,0,0,1,0,0),this._clearMatrix=new pe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&nt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new pe(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Xo.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&&(Xo.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Xo.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n,s=!0){this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r,a=!0){this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=At;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,u=cthis.canvas.nativeCanvas)));const s=null!==(i=this.fontFamily)&&void 0!==i?i:as.fontFamily,r=null!==(n=this.fontSize)&&void 0!==n?n:as.fontSize;return this.mathTextMeasure.textSpec.fontFamily===s&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=s,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(zo(uk,[e,i,n],this.modelMatrix),e=uk[0],i=uk[1],n=uk[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=Eo(this,l,t,i,n))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const n=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(n,t)})),this._setShadowBlendStyle(t,e,n)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(s<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;n.shadowBlur=r*this.dpr,n.shadowColor=t,n.shadowOffsetX=s*this.dpr,n.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0);l?(n.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1),h?(n.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(n.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=s.lineWidth,stroke:o=s.stroke,lineJoin:l=s.lineJoin,lineDash:h=s.lineDash,lineDashOffset:c=s.lineDashOffset,lineCap:u=s.lineCap,miterLimit:d=s.miterLimit,keepStrokeScale:p=s.keepStrokeScale}=e;r.lineWidth=p?a:Bo(this,a,this.dpr),r.strokeStyle=Eo(this,o,t,i,n),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=u,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=se(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=se(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Xo.free(t))),this.stack.length=0}}dk.env="browser";class pk extends Qo{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ps.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new dk(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.width=`${n}px`,t.style.height=`${s}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}}function gk(t,e){return i=>{var n,s;const r=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Ka,t.env)),a=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,$a,e.env));r||i.bind(Ka).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind($a).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}pk.env="browser";const fk=gk(pk,dk);class mk extends dk{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,n){return new Promise(((s,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}mk.env="feishu";class vk extends Qo{constructor(t){super(t)}init(){this._context=new mk(this,this._dpr)}release(...t){}}vk.env="feishu";const yk=gk(vk,mk);class _k extends dk{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:u=s.lineDash,lineCap:d=s.lineCap,miterLimit:p=s.miterLimit,keepStrokeScale:g=s.keepStrokeScale,lineDashOffset:f=s.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:Bo(this,l,this.dpr),r.strokeStyle=Eo(this,h,t,i,n),r.lineJoin=c,0===u[0]&&0===u[1]||(u&&r.setLineDash(u),r.lineDashOffset=f),r.lineCap=d,r.miterLimit=p}}measureText(t,e=Ps.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ps.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;let r="";r=t.font?t.font:se(t,e,s&&this.camera&&this.camera.getProjectionScale(i)),n.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:se(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}_k.env="harmony";class bk extends Qo{constructor(t){super(t)}init(){this._context=new _k(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}bk.env="harmony";const xk=gk(bk,_k);class Sk extends dk{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:u=s.lineDash,lineCap:d=s.lineCap,miterLimit:p=s.miterLimit,keepStrokeScale:g=s.keepStrokeScale,lineDashOffset:f=s.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:Bo(this,l,this.dpr),r.strokeStyle=Eo(this,h,t,i,n),r.lineJoin=c,0===u[0]&&0===u[1]||!u||(r.setLineDash(u),r.lineDashOffset=f),r.lineCap=d,r.miterLimit=p}}measureText(t,e=Ps.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ps.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}Sk.env="lynx";class Ak extends Qo{constructor(t){super(t)}init(){this._context=new Sk(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}Ak.env="lynx";const Ck=gk(Ak,Sk);class wk extends dk{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 pe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}wk.env="node";class Tk extends Qo{constructor(t){super(t)}init(){this._context=new wk(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&u(this._nativeCanvas.release)&&this._nativeCanvas.release()}}Tk.env="node";const kk=gk(Tk,wk);class Mk extends dk{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(Eo(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:u=s.lineDash,lineDashOffset:d=s.lineDashOffset,lineCap:p=s.lineCap,miterLimit:g=s.miterLimit,keepStrokeScale:f=s.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:Bo(this,l,this.dpr)),r.setStrokeStyle(Eo(this,h,t,i,n)),r.setLineJoin(c),u&&(r.setLineDash(u),r.lineDashOffset=d),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=se(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=se(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}getImageData(t,e,i,n){const s=this.nativeContext,r=s.taro;if(s&&r)return!s.getImageData&&r.canvasGetImageData?new Promise(((s,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:n,success(t){s(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,n,s,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,n,s,r)}}Mk.env="taro";class Bk extends Qo{constructor(t){super(t)}init(){this._context=new Mk(this,this._dpr)}release(...t){}}Bk.env="taro";const Ek=gk(Bk,Mk);class Pk extends mk{}Pk.env="tt";class Ok extends Qo{constructor(t){super(t)}init(){this._context=new Pk(this,this._dpr)}release(...t){}}Ok.env="tt";const Rk=gk(Ok,Pk);class Ik extends dk{draw(){}createPattern(t,e){return null}}Ik.env="wx";class Dk extends Qo{constructor(t){super(t)}init(){this._context=new Ik(this,this._dpr)}release(...t){}}Dk.env="wx";const Lk=gk(Dk,Ik);class Fk extends jy{constructor(t,e,i,n){super(i,n),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=n,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=Hc.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let s=0;snew jk(Vv(t,Kp)))).inSingletonScope(),t.bind(Cy).toService(ly))}class Hk extends Kx{constructor(t){super(),this.canvasRenderer=t}}let Vk=!1;class Gk extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=Ua}}let Yk=!1;function Xk(t){var e;Yk||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cg))&&(Yk=!0,t.bind(Ay).toDynamicValue((()=>new Gk(Vv(t,cg)))).inSingletonScope(),t.bind(Cy).toService(Ay))}const Kk=va();va();class $k{constructor(){this.type="gif-image",this.numberType=Kk}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}}let qk=!1;function Zk(t){qk||(qk=!0,t.bind(cy).toDynamicValue((()=>new $k)).inSingletonScope(),t.bind(Cy).toService(cy))}function Jk(t){t.isBound(Fk)||t.bind(Fk).toDynamicValue((()=>new Fk(Gv(Cy,t),Vv(t,hg),Gv(Ad,t),Gv(Cd,t)))).inSingletonScope(),t.isBound(bd)?t.rebind(bd).toService(Fk):t.bind(bd).toService(Fk)}function Qk(t){(function(t){Nk||(Nk=!0,t.bind(Sy).toDynamicValue((()=>new Uk)).inSingletonScope(),t.bind(Cy).toService(Sy),hd(t.bind.bind(t),Cy))})(t),Pb(t),jb(t),Gb(t),Wk(t),tx(t),cx(t),_x(t),function(t){Vk||(Vk=!0,t.bind(dy).toDynamicValue((()=>new Hk(Vv(t,tg)))).inSingletonScope(),t.bind(Cy).toService(dy))}(t),Mx(t),Lx(t),Vx(t),Zx(t),rS(t),cS(t),Xk(t),bS(t),MS(t),Zk(t),Jk(t)}class tM extends Ry{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${tM.idprefix}_${tM.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ps.global,this.viewBox=new ue,this.modelMatrix=new pe(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(){var t;if(null===(t=this.global)||void 0===t?void 0:t.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>n)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:tM.GenerateCanvasId(),canvasControled:!0};this.canvas=new pk(n)}createWindowByCanvas(t){var e,i,n;let s;if("string"==typeof t.canvas){if(s=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),s||"undefined"==typeof document||(s=document.getElementById(t.canvas)),!s)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else s=t.canvas;if(!s)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=s.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=s.getContext("2d").pixelRatio)&&void 0!==i?i:s.width/r),this.canvas=new pk({width:r,height:a,dpr:o,nativeCanvas:s,canvasControled:null!==(n=t.canvasControled)&&void 0!==n&&n})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}}function eM(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,tM))||t.bind(tM).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,tM.env))||t.bind(Gc).toService(tM).whenTargetNamed(tM.env)}tM.env="browser",tM.idprefix="visactor_window",tM.prefix_count=0;var iM=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class nM{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 sM(t,e=!1){const i=document.createElement("img");if(Ps.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class rM extends Oy{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,n;let s=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0,a=s,o=r}else s=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=s,i=r,a=e.getBoundingClientRect(),o=null===(n=e.getNativeHandler)||void 0===n?void 0:n.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new nM(t)}return new ue}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:n,style:s}=e;return s&&(y(s)?t.setAttribute("style",s):Object.keys(s).forEach((e=>{t.style[e]=s[e]}))),null!=i&&(t.style.width=`${i}px`),null!=n&&(t.style.height=`${n}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,n=document.createElement(e);if(this.updateDom(n,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(n)}return n}loadImage(t){return sM(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return sM(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:pi.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,n=n.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetLeft,n=n.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,n=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,n+=s.offsetLeft,s=s.offsetParent;return{top:i,left:n}}loadFont(t,e,i){return iM(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function aM(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,rM))||(t.bind(rM).toSelf().inSingletonScope(),t.bind(Wh).toService(rM))}function oM(t=jg(),e=!0){oM.__loaded||(oM.__loaded=!0,aM(t),fk(t),eM(t),e&&Qk(t))}oM.__loaded=!1;class lM extends Ry{get container(){return null}constructor(t=Ps.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new vk(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new vk({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function hM(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,lM))||t.bind(lM).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,lM.env))||t.bind(Gc).toService(lM).whenTargetNamed(lM.env)}lM.env="feishu";class cM extends jy{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Zo(null,1)}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;const s=this.pickerMap.get(t.numberType);if(!s)return null;const r=s.contains(t,e,n),a=r?t:null;return a?{graphic:a,params:r}:null}}let uM=!1;class dM extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=ka}}let pM=!1;function gM(t){pM||(pM=!0,t.bind($v).toDynamicValue((()=>new dM(Vv(t,Kp)))).inSingletonScope(),t.bind(Yv).toService($v))}function fM(t){(function(t){uM||(uM=!0,hd(t.bind.bind(t),Yv))})(t),function(t){t.isBound(cM)||t.bind(cM).toDynamicValue((()=>new cM(Gv(Yv,t),Gv(Ad,t),Gv(Cd,t)))).inSingletonScope(),t.isBound(bd)?t.rebind(bd).toService(cM):t.bind(bd).toService(cM)}(t),Ib(t),Kb(t),gM(t),nx(t),px(t),Sx(t),Nx(t),Px(t),tS(t),pS(t),AS(t),PS(t)}class mM{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,n,s,r){this.nativeCanvas=t,this.ctx=e,this._w=n,this._h=s,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class vM{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,n,s,r){this.nativeCanvas=t,this.ctx=e,this._w=n,this._h=s,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function yM(t,e,i=null==t.id){var n,s,r;return{id:null==t.id?void 0:String(t.id),width:null!==(n=t.width)&&void 0!==n?n:0,height:null!==(s=t.height)&&void 0!==s?s:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function _M(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new mM(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function bM(t,e,i,n){const s=yM(t,e),r=s.id;if(null!=r){const t=i.get(r);if(t)return t}if(!n)return null;const a=function(t,e){var i;const n=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!n)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new vM(t,n,e.dpr,e.width,e.height,e.id)}(n(s),s);return null!=r&&i.set(r,a),a}function xM(t){var e,i,n,s,r;try{return null!==(n=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==n?n:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(s=null==t?void 0:t.feishu)&&void 0!==s?s:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function SM(t,e=xM(t)){var i,n,s,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(s=null===(n=null==e?void 0:e.getSystemInfoSync)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.pixelRatio)&&void 0!==r?r:1}class AM extends Oy{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,n=xM(i),s=null!==(e=t.dpr)&&void 0!==e?e:SM(i,n),r=bM(t,s,this.canvasMap,i.canvasFactory);if(r)return r;const a=yM(t,s,!1);if(null==a.id||"function"!=typeof(null==n?void 0:n.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=_M(n.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SM(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function CM(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,AM))||(t.bind(AM).toSelf().inSingletonScope(),t.bind(Wh).toService(AM))}function wM(t=jg(),e=!0){wM.__loaded||(wM.__loaded=!0,CM(t),yk(t),hM(t),e&&fM(t))}wM.__loaded=!1;function TM(t,e,i){if(t&&i)try{t[e]=i}catch(n){Object.defineProperty(t,e,{configurable:!0,value:i})}}function kM(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new bk(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new bk({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const n=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return TM(t,"target",n),TM(t,"currentTarget",n),function(t){var e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0];if(!y)return;const _=kM(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=kM(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&MM(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),MM(t,"x",_),MM(t,"y",b),MM(t,"offsetX",null!==(s=t.offsetX)&&void 0!==s?s:_),MM(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),MM(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),MM(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),MM(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),MM(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(u=y.y)&&void 0!==u?u:b,y.offsetX=null!==(d=y.offsetX)&&void 0!==d?d:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function EM(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,BM))||t.bind(BM).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,BM.env))||t.bind(Gc).toService(BM).whenTargetNamed(BM.env)}BM.env="harmony";const PM="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function OM(t){return"number"==typeof t&&Number.isFinite(t)}function RM(...t){for(let e=0;e({width:i,height:n})),new vM(t,l,s,i,n,e)}function UM(t,e,i,n,s,r,a){const o={id:t,width:e,height:i,dpr:n,offscreen:s};if(r.canvasFactory)return r.canvasFactory(o);if(s&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!s&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(s){const t=LM(e*n,i*n);if(t)return t}throw new Error(PM)}class NM extends Oy{constructor(){super(),this.type="harmony",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,this.rafSTO=new Ys(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=IM(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const n=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},s=IM(n),r=null!==(i=t.dpr)&&void 0!==i?i:DM(n),a=function(t,e){if(!OM(t)||!OM(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=FM(UM(e,a.width,a.height,r,!1,n,s),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=FM(UM(l,a.width,a.height,r,!0,n,s),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return DM(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,n;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0]}(t),i=RM(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),n=RM(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==n?null:{x:i,y:n}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function jM(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,NM))||(t.bind(NM).toSelf().inSingletonScope(),t.bind(Wh).toService(NM))}function zM(t=jg(),e=!0){zM.__loaded||(zM.__loaded=!0,jM(t),xk(t),EM(t),e&&fM(t))}zM.__loaded=!1;function WM(t,e,i){if(t&&i)try{t[e]=i}catch(n){Object.defineProperty(t,e,{configurable:!0,value:i})}}function HM(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Ak(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new Ak({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const n=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return WM(t,"target",n),WM(t,"currentTarget",n),function(t){var e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0];if(!y)return;const _=HM(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=HM(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&VM(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),VM(t,"x",_),VM(t,"y",b),VM(t,"offsetX",null!==(s=t.offsetX)&&void 0!==s?s:_),VM(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),VM(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),VM(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),VM(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),VM(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(u=y.y)&&void 0!==u?u:b,y.offsetX=null!==(d=y.offsetX)&&void 0!==d?d:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function YM(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,GM))||t.bind(GM).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,GM.env))||t.bind(Gc).toService(GM).whenTargetNamed(GM.env)}GM.env="lynx";function XM(t){return"number"==typeof t&&Number.isFinite(t)}function KM(...t){for(let e=0;e{n.onload=()=>{t(n)},n.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,n,s;if(null!=t.id){const n=String(t.id),s=this.canvasMap.get(n);if(s)return s;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=qM(r),o=null!==(i=t.dpr)&&void 0!==i?i:ZM(r,a),l=QM(t.width,t.height),h=tB(eB(n,l.width,l.height,o,!1,r,a),n,l.width,l.height,o);return this.canvasMap.set(n,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(n=this.lynxEnvParams)&&void 0!==n?n:{},o=qM(a),l=null!==(s=t.dpr)&&void 0!==s?s:ZM(a,o),h=QM(t.width,t.height),c=Math.random().toString(),u=tB(eB(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,u),this.freeCanvasList.push(u),u}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return ZM(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,n;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0]}(t),i=KM(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),n=KM(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==n?null:{x:i,y:n}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function nB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,iB))||(t.bind(iB).toSelf().inSingletonScope(),t.bind(Wh).toService(iB))}function sB(t=jg(),e=!0){sB.__loaded||(sB.__loaded=!0,nB(t),Ck(t),YM(t),e&&fM(t))}sB.__loaded=!1;class rB extends Ry{get container(){return null}constructor(t=Ps.global){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:pi.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new Tk(i)}createWindowByCanvas(t){var e;const i=t.canvas,n=null!==(e=t.dpr)&&void 0!==e?e:1;let s=t.width,r=t.height;null!=s&&null!=r&&t.canvasControled||(s=i.width/n,r=i.height/n),this.canvas=new Tk({width:s,height:r,dpr:n,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function aB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rB))||t.bind(rB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,rB.env))||t.bind(Gc).toService(rB).whenTargetNamed(rB.env)}rB.env="node";class oB extends Oy{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function lB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,oB))||(t.bind(oB).toSelf().inSingletonScope(),t.bind(Wh).toService(oB))}function hB(t=jg(),e=!0){hB.__loaded||(hB.__loaded=!0,lB(t),kk(t),aB(t))}hB.__loaded=!1;class cB extends Ry{get container(){return null}constructor(t=Ps.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Bk(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new Bk({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function uB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cB))||t.bind(cB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,cB.env))||t.bind(Gc).toService(cB).whenTargetNamed(cB.env)}cB.env="taro";class dB extends Oy{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const n=this.taroEnvParams,s=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=bM(t,s,this.canvasMap,n.canvasFactory);if(r)return r;const a=yM(t,s,!1);if(null==a.id||"function"!=typeof(null===(i=n.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=_M(n.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function pB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,dB))||(t.bind(dB).toSelf().inSingletonScope(),t.bind(Wh).toService(dB))}function gB(t=jg(),e=!0){gB.__loaded||(gB.__loaded=!0,pB(t),Ek(t),uB(t),e&&fM(t))}gB.__loaded=!1;class fB extends Ry{get container(){return null}constructor(t=Ps.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Ok(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new Ok({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fB))||t.bind(fB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,fB.env))||t.bind(Gc).toService(fB).whenTargetNamed(fB.env)}fB.env="tt";function vB(t){var e,i,n;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(n=null==t?void 0:t.tt)&&void 0!==n?n:null==t?void 0:t.runtime}}function yB(t,e=vB(t)){var i,n,s,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(s=null===(n=null==e?void 0:e.getSystemInfoSync)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.pixelRatio)&&void 0!==r?r:1}class _B extends Oy{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,n=vB(i),s=null!==(e=t.dpr)&&void 0!==e?e:yB(i,n),r=bM(t,s,this.canvasMap,i.canvasFactory);if(r)return r;const a=yM(t,s,!1);if(null==a.id||"function"!=typeof(null==n?void 0:n.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=_M(n.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return yB(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function bB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,_B))||(t.bind(_B).toSelf().inSingletonScope(),t.bind(Wh).toService(_B))}function xB(t=jg(),e=!0){xB.__loaded||(xB.__loaded=!0,bB(t),Rk(t),mB(t),e&&fM(t))}xB.__loaded=!1;class SB{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={}}}function AB(t,e,i){if(t&&i)try{t[e]=i}catch(n){Object.defineProperty(t,e,{configurable:!0,value:i})}}class CB extends Ry{get container(){return null}constructor(t=Ps.global){super(),this.global=t,this.type="wx",this.eventManager=new SB}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:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Dk(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new Dk({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return AB(t,"target",o),AB(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(n=t.changedTouches[0].x)&&void 0!==n?n: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!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function wB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,CB))||t.bind(CB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,CB.env))||t.bind(Gc).toService(CB).whenTargetNamed(CB.env)}CB.env="wx";function TB(t){var e,i,n;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(n=null==t?void 0:t.wx)&&void 0!==n?n:null==t?void 0:t.runtime}}function kB(t,e=TB(t)){var i,n,s,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(s=null===(n=null==e?void 0:e.getSystemInfoSync)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.pixelRatio)&&void 0!==r?r:1}class MB extends Oy{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,n=TB(i),s=null!==(e=t.dpr)&&void 0!==e?e:kB(i,n),r=bM(t,s,this.canvasMap,i.canvasFactory);if(r)return r;const a=yM(t,s,!1);if(null==a.id||"function"!=typeof(null==n?void 0:n.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=_M(n.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return kB(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function BB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,MB))||(t.bind(MB).toSelf().inSingletonScope(),t.bind(Wh).toService(MB))}function EB(t=jg(),e=!0){EB.__loaded||(EB.__loaded=!0,BB(t),Lk(t),wB(t),e&&fM(t))}EB.__loaded=!1;var PB={},OB={},RB={};Object.defineProperty(RB,"__esModule",{value:!0}),RB.loop=RB.conditional=RB.parse=void 0;RB.parse=function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n;if(Array.isArray(i))i.forEach((function(i){return t(e,i,n,s)}));else if("function"==typeof i)i(e,n,s,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(s[r]={},t(e,i[r],n,s[r])):s[r]=i[r](e,n,s,t)}return n};RB.conditional=function(t,e){return function(i,n,s,r){e(i,n,s)&&r(i,t,n,s)}};RB.loop=function(t,e){return function(i,n,s,r){for(var a=[],o=i.pos;e(i,n,s);){var l={};if(r(i,t,n,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var IB={};Object.defineProperty(IB,"__esModule",{value:!0}),IB.readBits=IB.readArray=IB.readUnsigned=IB.readString=IB.peekBytes=IB.readBytes=IB.peekByte=IB.readByte=IB.buildStream=void 0;IB.buildStream=function(t){return{data:t,pos:0}};var DB=function(){return function(t){return t.data[t.pos++]}};IB.readByte=DB;IB.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var LB=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};IB.readBytes=LB;IB.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};IB.readString=function(t){return function(e){return Array.from(LB(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};IB.readUnsigned=function(t){return function(e){var i=LB(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};IB.readArray=function(t,e){return function(i,n,s){for(var r="function"==typeof e?e(i,n,s):e,a=LB(t),o=new Array(r),l=0;l=n){var a=n-t.pos;e.push((0,i.readBytes)(a)(t)),s+=a;break}e.push((0,i.readBytes)(r)(t)),s+=r}for(var o=new Uint8Array(s),l=0,h=0;h>=a,g-=a,c>n||c==o)break;if(c==s){r=(1<<(a=d+1))-1,n=s+2,h=-1;continue}if(-1==h){C[m++]=A[c],h=c,f=c;continue}for(l=c,c==n&&(C[m++]=f,c=h);c>s;)C[m++]=A[c],c=S[c];f=255&A[c],C[m++]=f,n<_&&(S[n]=h,A[n]=f,0==(++n&r)&&n<_&&(a++,r+=n)),h=l}m--,x[v++]=C[m],u++}for(u=v;u{const e=YB(t),i=jB(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=YB(this.attribute.gifImage),e=jB(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=Ps.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=Ps.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const n=this.loadedFrames[this.frameIndex||0];2===n.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(n),this.manipulate(t,e,i);const s=(new Date).getTime()-this.lastTime;n.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function $B(t){return new KB(t)}class qB extends Vm{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=Kk,this._renderContribitions=void 0,this.builtinContributions=[ZB],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=hh(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:u=l.fillStrokeOrder}=t.attribute,d=this.valid(t,l,a);if(!d)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=d,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-n,l),e.stroke()))};u?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,n,f,!1,p,!1,l,s,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,n,f,!1,p,!1,l,s,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,n,f,!1,p,!1,l,s,a)}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=hh(t).image;this._draw(t,s,!1,i)}}const ZB=new class extends Sp{constructor(){super(...arguments),this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){t.renderFrame&&t.playing&&t.renderFrame(e,i,n)}};let JB=!1;function QB(t){JB||(JB=!0,t.bind(qB).toDynamicValue((()=>new qB(Gv(Ag,t)))).inSingletonScope(),t.bind($p).toService(qB))}function tE(){Oc.RegisterGraphicCreator("gif",$B)}function eE(){if(eE.__loaded)return;eE.__loaded=!0;const t=jg();tE(),QB(t),Zk(t)}eE.__loaded=!1;const iE=eE,nE=[{register:jf,bindModule:um},{register:zf,bindModule:fm},{register:Wf,bindModule:Mm},{register:Hf,bindModule:Om},{register:Vf,bindModule:Lm},{register:Gf},{register:Yf,bindModule:Xm},{register:Xf,bindModule:Zm},{register:Kf,bindModule:nv},{register:$f,bindModule:dv},{register:qf,bindModule:vv},{register:Zf,bindModule:xv},{register:Jf,bindModule:wv},{register:Qf,bindModule:Ev},{register:tm},{register:em,bindModule:Iv},{register:im,bindModule:Uv},{register:nm,bindModule:Wv},{register:sm},{register:tE}];let sE=!1;const rE=[Pb,jb,Gb,Wk,tx,cx,_x,Mx,Lx,Vx,Zx,rS,cS,Xk,bS,MS,Zk];function aE(t){return{getContributions:t}}function oE(t,{envParams:e,force:i=!1}={}){d_().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function lE(t,e,{bindEnv:i,bindCanvasModules:n,bindWindowContribution:s},r){p_(t);const a=c_();i(a),n(a),s(a),u_(),oE(e,{envParams:r,force:!0})}function hE(t,e){lE(t,"browser",{bindEnv:aM,bindCanvasModules:fk,bindWindowContribution:eM},e)}function cE(t,e){lE(t,"node",{bindEnv:lB,bindCanvasModules:kk,bindWindowContribution:aB},e)}function uE(t){p_(t),function(){if(sE)return;const t=c_();sE=!0,nE.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),QB(t),u_()}(),f_(t),g_(t)}function dE(t){p_(t);const e=c_();rE.forEach((t=>t(e))),Jk(e),m_(t,Cy),function(t){const e=c_(),i=aE((()=>t.registry.picker.getAll())),n=aE((()=>e.isBound(Ad)?e.getAll(Ad):[])),s=aE((()=>e.isBound(Cd)?e.getAll(Cd):[])),r=d_();Ps.pickerServiceFactory=()=>new Fk(i,{},n,s),Ps.global=r}(t)}function pE(t){p_(t);fM(c_()),m_(t,Yv),function(t){const e=c_(),i=aE((()=>t.registry.picker.getAll())),n=aE((()=>e.isBound(Ad)?e.getAll(Ad):[])),s=aE((()=>e.isBound(Cd)?e.getAll(Cd):[]));Ps.pickerServiceFactory=()=>new cM(i,n,s)}(t)}function gE(){if(gE.__loaded)return;gE.__loaded=!0;const t=jg();Hf(),Om({bind:t.bind}),Hv?Wk(t):gM(t)}gE.__loaded=!1;const fE=gE;function mE(){if(mE.__loaded)return;mE.__loaded=!0;const t=jg();em(),Iv({bind:t.bind}),Xk(t)}mE.__loaded=!1;const vE=mE;function yE(){yE.__loaded||(yE.__loaded=!0,sm())}yE.__loaded=!1;const _E=yE;class bE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const n=this.target.getFinalAttribute(),s=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==n?void 0:n[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:s[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,a)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class xE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((n=>{var s;e[n]=0,i[n]=null!==(s=t[n])&&void 0!==s?s:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,bf(this.target,i,Wi.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class SE extends bE{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class AE extends xE{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["clipRange"]}}class CE extends bE{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class wE extends xE{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const TE=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s,endAngle:s},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}})(t,e):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==n?void 0:n.endAngle},to:{startAngle:null==n?void 0:n.startAngle}}:{from:{endAngle:null==n?void 0:n.startAngle},to:{endAngle:null==n?void 0:n.endAngle}}})(t,e)};class kE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){yf(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){yf(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class ME extends kE{onBind(){var t,e,i;super.onBind();const{from:n,to:s}=TE(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,r),this.determineUpdateFunction()}}class BE extends kE{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,this.params,!1!==(null!==(s=null==n?void 0:n.overall)&&void 0!==s&&s)?((t,e,i)=>{const n=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:n.startAngle,endAngle:n.endAngle},to:{startAngle:t,endAngle:t}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n.startAngle,endAngle:n.endAngle},to:{startAngle:s,endAngle:s}}})(i,n):((t,e,i)=>{const n=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:n.startAngle},to:{startAngle:null==n?void 0:n.endAngle}}:{from:{endAngle:n.endAngle},to:{endAngle:null==n?void 0:n.startAngle}}})(i,n));var i,n,s;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class EE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=((t,e,i)=>{const n=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=n.x,e=n.x1,i=n.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=n.y,e=n.y1,i=n.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=n.x,e=n.x1,i=n.width,s=n.y,r=n.y1,a=n.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=s+a/2,o.height=0,o.y1=void 0):(o.y=(s+r)/2,o.y1=(s+r)/2,o.height=void 0),{from:o,to:{x:t,y:s,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class PE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const n=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=n.x,e=n.x1,i=n.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=n.y,e=n.y1,i=n.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=n.x,e=n.y,i=n.x1,s=n.y1,r=n.width,a=n.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+s)/2,o.y1=(e+s)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const OE=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n,s,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(n=i.groupHeight)&&void 0!==n?n:null===(s=e.layoutRect)||void 0===s?void 0:s.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const n=t.getFinalAttribute(),s=n.y,r=n.y1,a=n.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:s,y1:r,height:a}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:s,y1:r,height:a}}}(t,e)};class RE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=OE(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){_f(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class IE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,s=this.params,!1!==(null!==(r=null==n?void 0:n.overall)&&void 0!==r&&r)?function(t,e,i){var n,s,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(n=i.groupHeight)&&void 0!==n?n:null===(s=e.layoutRect)||void 0===s?void 0:s.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,n,s):function(t,e,i){const n=t.getFinalAttribute(),s=n.y,r=n.y1,a=n.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,n));var i,n,s,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){_f(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const DE=(t,e,i)=>{const n=t.getFinalAttribute().points,s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,e&&e.center&&(A(e.center.x)&&(s.x=e.center.x),A(e.center.y)&&(s.y=e.center.y)),"area"===t.type&&(s.x1=s.x,s.y1=s.y),n.map((t=>Object.assign({},t,s)))};class LE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){var n,s;const r=null===(n=this.from)||void 0===n?void 0:n.points,a=null===(s=this.to)||void 0===s?void 0:s.points;r&&a&&(yf(this.target,{points:r.map(((t,i)=>Hs(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class FE extends LE{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:DE(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&xf(this.target,e)}else this.valid=!1}}class UE extends LE{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:n,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:DE(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=n||i,this.to=s}else this.valid=!1;var t,e}}const NE=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class jE extends LE{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:NE(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&xf(this.target,e)}else this.valid=!1}}class zE extends LE{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:n,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:NE(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=n||i,this.to=s}else this.valid=!1;var t,e}}const WE=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class HE extends LE{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:WE(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&xf(this.target,e)}else this.valid=!1}}class VE extends LE{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:WE(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=null!=i?i:this.target.attribute,this.to=n}else this.valid=!1;var t,e}}const GE=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute(),s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:s,outerRadius:s},to:{innerRadius:null==n?void 0:n.innerRadius,outerRadius:null==n?void 0:n.outerRadius}}})(t,e):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==n?void 0:n.outerRadius},to:{innerRadius:null==n?void 0:n.innerRadius}}:{from:{outerRadius:null==n?void 0:n.innerRadius},to:{outerRadius:null==n?void 0:n.outerRadius}}})(t,e)};class YE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class XE extends YE{onBind(){var t,e,i;super.onBind();const{from:n,to:s}=GE(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,r)}}class KE extends YE{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(n=null==i?void 0:i.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute(),s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==n?void 0:n.innerRadius,outerRadius:null==n?void 0:n.outerRadius},to:{innerRadius:s,outerRadius:s}}})(e,i):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==n?void 0:n.innerRadius},to:{innerRadius:null==n?void 0:n.outerRadius}}:{from:{outerRadius:null==n?void 0:n.outerRadius},to:{outerRadius:null==n?void 0:n.innerRadius}}})(e,i));var e,i,n;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const $E=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAttribute(),r=s.x,a=s.x1,o=s.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const n=t.getFinalAttribute(),s=n.x,r=n.x1,a=n.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:s,x1:r,width:a}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:s,x1:r,width:a}}}(t,e)};class qE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=$E(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){_f(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ZE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,s=this.params,!1!==(null!==(r=null==n?void 0:n.overall)&&void 0!==r&&r)?function(t,e,i){var n;const s=t.getFinalAttribute(),r=s.x1,a=s.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,n,s):function(t,e,i){const n=t.getFinalAttribute(),s=n.x,r=n.x1,a=n.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,n));var i,n,s,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){_f(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class JE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class QE extends JE{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var n,s,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:d=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(n=p.width)&&void 0!==n?n:t.stage.viewWidth,f=null!==(s=p.height)&&void 0!==s?s:t.stage.viewHeight),g+=o,f+=o;const m=u(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=d.includes("x")?v:m&&A(m.x)?m.x:g,b=d.includes("y")?y:m&&A(m.y)?m.y:f;switch(h){case"x":return{from:{x:d.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&xf(this.target,e)}}class tP extends JE{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var n,s,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},d=i.group?i.group.AABBBounds:null,p=null!==(n=d.width())&&void 0!==n?n:i.width,g=null!==(s=d.height())&&void 0!==s?s:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=u(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&A(v.x)?v.x:f,_=v&&A(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class eP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.formatTemplate=null,this.decimalLength=null==s?void 0:s.decimalLength,(null==s?void 0:s.formatTemplate)&&s.formatTemplate.includes("{{var}}")&&(this.formatTemplate=s.formatTemplate)}onFirstRun(){var t,e,i;const n=this.getLastProps(),s=this.getEndProps(),r=null!==(t=n.text)&&void 0!==t?t:0,a=null!==(e=s.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",u=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=u)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const n=this.fromNumber+(this.toNumber-this.fromNumber)*e;let s="";const r=this.format,a=("%"===r?100*n:n).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;s=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,bf(this.target,{text:s})}}class iP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nP extends iP{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const n=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let s=0;return s=ot(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:A(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:s},to:{angle:n}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&xf(this.target,e)}}class sP extends iP{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const n=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let s=0;return s=ot(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:A(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:s}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class rP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v,y,_,b,x,S;let A,C;super.onBind();const w=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},k=null===(e=this.params)||void 0===e?void 0:e.options,M=null!==(n=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==n?n:null==k?void 0:k.direction,B=null!==(l=null!==(a=null!==(r=null===(s=this.params)||void 0===s?void 0:s.fromScaleX)&&void 0!==r?r:null==k?void 0:k.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==k?void 0:k.fromScale,E=null!==(p=null!==(u=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==k?void 0:k.fromScaleY)&&void 0!==u?u:null===(d=this.params)||void 0===d?void 0:d.fromScale)&&void 0!==p?p:null==k?void 0:k.fromScale;switch(M){case"x":A={scaleX:null!==(g=null!=B?B:T.scaleX)&&void 0!==g?g:0},C={scaleX:null!==(f=null==w?void 0:w.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=E?E:T.scaleY)&&void 0!==m?m:0},C={scaleY:null!==(v=null==w?void 0:w.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=B?B:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=E?E:T.scaleY)&&void 0!==_?_:0},C={scaleX:null!==(b=null==w?void 0:w.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==w?void 0:w.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=C,this.from=A,this.to=C,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&xf(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const n={};e&&(n.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(n.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),yf(this.target,n)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class aP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(n=null==o?void 0:o.scaleX)&&void 0!==n?n:1,scaleY:null!==(s=null==o?void 0:o.scaleY)&&void 0!==s?s:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class oP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,n),this.onUpdate(t,n,i),this.syncAttributeUpdate()}}const lP={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function hP(t,e){for(let i=0;ilP[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&Zg(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,n),this.syncParentClipPathToTarget(),this.onUpdate(t,n,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,n=i.parent,s=null===(t=null==n?void 0:n.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==n?void 0:n.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(s)||!s.length)return;const r=this.getClipPathSyncChildIndex(n);if(r<0||r>=s.length)return;const a=s[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(yf(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,n)=>t===e&&(i=n,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const n=this.target,s=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&s&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=s[t])&&void 0!==e?e:null===(i=n.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const n=this.target;return null!==(i=null!==(e=null===(t=n.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:n.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,n={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var s;const r=null===(s=i.attribute)||void 0===s?void 0:s[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(n[e]=r)})),Object.keys(n).length?n:null}}class uP{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new Jg(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function dP(t){return new uP(t)}class pP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==s?void 0:s.showCursor)&&(this.showCursor=s.showCursor),void 0!==(null==s?void 0:s.cursorChar)&&(this.cursorChar=s.cursorChar),void 0!==(null==s?void 0:s.blinkCursor)&&(this.blinkCursor=s.blinkCursor),void 0!==(null==s?void 0:s.beforeText)&&(this.beforeText=s.beforeText),void 0!==(null==s?void 0:s.afterText)&&(this.afterText=s.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),n=this.getEndProps(),s=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=n.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=s.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const n=this.toText.length,s=this.fromText.length;let r,a;s>n?(r=Math.round(s-(s-n)*e),a=this.fromText.substring(0,r)):(r=Math.round(s+(n-s)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=s?this.fromText.substring(0,r):this.toText.substring(0,r-s+Math.min(s,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;bf(this.target,{text:o})}}class gP extends Bf{onBind(){super.onBind();const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target,{symbolStartOuterType:s="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(xf(n._symbolStart,{scaleX:0,scaleY:0}),t.animate(n._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===s?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),xf(n._symbolStartOuter,l),t.animate(n._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),xf(n._symbolEnd,{scaleX:0,scaleY:0}),t.animate(n._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),xf(n._line,{clipRange:0}),t.animate(n._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=n._titleTop.attribute.text;xf(n._titleTop,{text:""}),t.animate(n._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:pP});const i=n._titleBottom.attribute.text;xf(n._titleBottom,{text:""}),t.animate(n._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:pP})}else xf(n._titleTop,{dy:n._titleTop.AABBBounds.height()+10}),t.animate(n._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),xf(n._titleBottom,{dy:-(10+n._titleBottom.AABBBounds.height())}),t.animate(n._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[n._titleTopPanel,n._titleBottomPanel].forEach((n=>{var s;const r=null!==(s=n.attribute.scaleX)&&void 0!==s?s:1;xf(n,{scaleX:0}),t.animate(n,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[n._titleTopPanel,n._titleBottomPanel].forEach((n=>{const s=n.AABBBounds,r=2*(s.width()+s.height());xf(n,{lineDash:[0,10*r]}),t.animate(n,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class fP extends Bf{onBind(){super.onBind();const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target,{mode:s}=this.params;"scale"===s?t.animate(n._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(n._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(n._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(n._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(n._titleTop,{type:"to",to:{dy:n._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(n._titleBottom,{type:"to",to:{dy:-(10+n._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(n._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(n._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(n._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class mP extends Bf{onBind(){super.onBind();const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target,{wave:s}=this.params;if(xf(n,{scaleX:0,scaleY:0}),t.animate(n,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),n.titleShape&&t.animate(n.titleShape,{type:"custom",to:{text:n.titleShape.attribute.text},duration:e,easing:i,custom:pP}),n.contentShape&&t.animate(n.contentShape,{type:"custom",to:{text:n.contentShape.attribute.text},duration:e,easing:i,custom:pP}),s){const r=e/6;t.animate(n.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:s},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-s},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:s},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class vP extends Bf{onBind(){super.onBind();const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target;t.animate(n,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class yP extends Ef{constructor(t,e,i,n,s){super(t,e,i,n,s),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=Vg.createCanvas({width:t.width,height:t.height,dpr:Vg.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),n=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!n)return null;const s=this.gl.createProgram();return s?(this.gl.attachShader(s,i),this.gl.attachShader(s,n),this.gl.linkProgram(s),this.gl.getProgramParameter(s,this.gl.LINK_STATUS)?s:(console.error("Shader program link error:",this.gl.getProgramInfoLog(s)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=Vg.createCanvas({width:t.width,height:t.height,dpr:Vg.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==yP.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class _P extends yP{constructor(t,e,i,n,s){super(t,e,i,n,s)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class bP extends yP{constructor(t,e,i,n,s){super(t,e,i,n,s)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==bP.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==bP.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,n;let s=null;if(!1!==(null===(n=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===n?void 0:n.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(s=this.applyWebGLEffect(e),s)return s;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(s=this.applyCanvas2DEffect(e),s)return s;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(s=this.applyCanvas2DEffect(e),s)return s;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class xP{static createTempCanvas(t,e,i){return Vg.createCanvas({width:t,height:e,dpr:i||Vg.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}static distance(t,e,i,n){const s=i-t,r=n-e;return Math.sqrt(s*s+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const n=Math.floor(t/i)*i,s=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*n+78.233*s);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,n,s)}static blendImageData(t,e,i){const{data:n,width:s,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(n.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=xP.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const n=this.createFullScreenQuad();return n?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(n),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),n=this.gl.getUniformLocation(this.program,"u_dissolveType"),s=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(s,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(n,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:n}=e,s=n.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(s,r);break;case"inward":a=this.applyInwardDissolve(s,r);break;case"radial":a=this.applyRadialDissolve(s,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(s,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(s,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(s,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(s,r);break;default:a=s}return n.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:n,height:s}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=n/2,o=s/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)d+=.4*(xP.pixelNoise(i,t,h)-.5),p=u>d?0:1;else if(this.dissolveConfig.fadeEdge){const t=d-.15;p=ud?0:1-(u-t)/(d-t)}else p=u>d?0:1;const g=4*(t*n+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,n,s)}applyInwardDissolve(t,e){const{data:i,width:n,height:s}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=n/2,o=s/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)d+=.4*(xP.pixelNoise(i,t,h)-.5),p=ut?1:(u-d)/(t-d)}else p=u0)u+=.3*(xP.pixelNoise(i,t,l)-.5),d=ct?1:(c-u)/(t-u)}else d=c0)o+=.3*(xP.pixelNoise(i,t,a)-.5),l=st?1:(s-o)/(t-o)}else l=s0)o+=.3*(xP.pixelNoise(i,t,a)-.5),l=s>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=so?0:1-(s-t)/(o-t)}else l=s>o?0:1;const h=4*(t*n+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,n,s)}applyTopToBottomDissolve(t,e){const{data:i,width:n,height:s}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(xP.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(xP.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*n+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,n,s)}}class CP extends bP{constructor(t,e,i,n,s){var r,a,o;super(t,e,i,n,s),this.distortionConfig={distortionType:(null===(r=null==s?void 0:s.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==s?void 0:s.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==s?void 0:s.options)||void 0===o?void 0:o.useWebGL)||s.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),n=this.gl.getUniformLocation(this.program,"u_distortionType"),s=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(s,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(n,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const n=i.getImageData(0,0,t.width,t.height),s=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(n,this.distortionConfig.strength,s);break;case"ripple":r=this.applyRippleDistortion(n,this.distortionConfig.strength,s);break;case"swirl":r=this.applySwirlDistortion(n,this.distortionConfig.strength,s);break;default:r=n}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:n,width:s,height:r}=t,a=new Uint8ClampedArray(n.length);for(let t=0;t=0&&c=0&&u=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class MP extends bP{constructor(t,e,i,n,s){var r,a,o,l,h;super(t,e,i,n,s),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==s?void 0:s.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==s?void 0:s.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==s?void 0:s.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==s?void 0:s.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==s?void 0:s.options)||void 0===h?void 0:h.useWebGL)||s.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:n}=e,s=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(n,t,s);break;case"gravity":this.applyCanvas2DGravity(n,t,s);break;case"vortex":this.applyCanvas2DVortex(n,t,s);break;default:n.globalAlpha=Math.max(0,1-s),n.drawImage(t,0,0)}return i}extractParticles(t){const e=xP.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const n=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const s=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const n=r/e.width*t.width,s=i/e.height*t.height,c={x:n,y:s,originX:n,originY:s,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,n=this.currentAnimationRatio,s=this.getDurationFromParent(),r=s<2e3,a=r?Math.max(1.5,3e3/s):1,o=r?Math.min(2,2e3/s):1;this.particles.forEach((s=>{const l=s.x-e,h=s.y-i,c=Math.sqrt(l*l+h*h),u=Math.atan2(h,l);this.applyParticleForces(s,u,c,n,o,t),this.updateParticleProperties(s,n,r,a,o)}))}applyParticleForces(t,e,i,n,s,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=n*this.particleConfig.strength*s*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,n,s,r,a);break;case"vortex":this.applyVortexEffect(t,n,s,r,e,i)}}applyGravityEffect(t,e,i,n,s){const r=(t.originX+.7*t.originY)/(n.width+n.height)*.8;if(e>r){const n=(e-r)/(1-r),a=this.particleConfig.strength*n*n*12*i;t.vy+=a;const o=Math.sin(3*s+.02*t.originX)*Math.cos(2*s+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,n,s,r){const a=n.width/2,o=n.height/2,l=s+e*Math.PI*.8,h=r+e*Math.max(n.width,n.height)*.7*1.8,c=a+Math.cos(l)*h,u=o+Math.sin(l)*h,d=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*d,t.vy+=(u-t.y)*d}updateParticleProperties(t,e,i,n,s){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/n);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),n=new Float32Array(this.particles.length);this.particles.forEach(((t,s)=>{e[2*s]=t.x,e[2*s+1]=t.y,i[4*s]=t.r,i[4*s+1]=t.g,i[4*s+2]=t.b,i[4*s+3]=Math.max(.1,t.a),n[s]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,n),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,n){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const s=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(s),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,n,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),n=t.getUniformLocation(this.program,"u_forceStrength"),s=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(n,this.particleConfig.strength),t.uniform1i(s,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const n=e.width/2,s=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(n,s);const r=1+.5*i;t.scale(r,r),t.translate(-n,-s),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const n=i*e.height*.3;t.drawImage(e,0,n),t.restore()}applyCanvas2DVortex(t,e,i){const n=e.width/2,s=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(n,s),t.rotate(i*Math.PI*2),t.translate(-n,-s),t.drawImage(e,0,0),t.restore()}}class BP extends yP{constructor(t,e,i,n,s){var r,a;super(t,e,i,n,s),this.pixelationConfig={maxPixelSize:(null===(r=null==s?void 0:s.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==s?void 0:s.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:n}=t,s=Math.ceil(i/e),r=Math.ceil(n/e),a=Vg.createCanvas({width:s,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=Vg.createCanvas({width:i,height:n,dpr:Vg.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,s,r),h.drawImage(a,0,0,i,n),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class EP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==s?void 0:s.showCursor)&&(this.showCursor=s.showCursor),void 0!==(null==s?void 0:s.cursorChar)&&(this.cursorChar=s.cursorChar),void 0!==(null==s?void 0:s.blinkCursor)&&(this.blinkCursor=s.blinkCursor),void 0!==(null==s?void 0:s.fadeInChars)&&(this.fadeInChars=s.fadeInChars),void 0!==(null==s?void 0:s.fadeInDuration)&&(this.fadeInDuration=s.fadeInDuration),void 0!==(null==s?void 0:s.strokeFirst)&&(this.strokeFirst=s.strokeFirst),void 0!==(null==s?void 0:s.strokeToFillRatio)&&(this.strokeToFillRatio=s.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?cc.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=cc.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const n=this.toTextConfig.length,s=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(s>n)a=Math.round(s-(s-n)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(s+(n-s)*t)}else a=Math.round(s+(n-s)*e);if(o=s>n?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const s=Object.assign({},t);if(this.strokeFirst){const t=i/n*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in s&&s.fill&&(s.stroke=s.fill,l<1&&(s.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));s.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/n*r)/this.fadeInDuration;s.opacity=Math.max(0,Math.min(1,t))}return s}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}bf(this.target,{textConfig:o})}}class PP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==s?void 0:s.showCursor)&&(this.showCursor=s.showCursor),void 0!==(null==s?void 0:s.cursorChar)&&(this.cursorChar=s.cursorChar),void 0!==(null==s?void 0:s.blinkCursor)&&(this.blinkCursor=s.blinkCursor),void 0!==(null==s?void 0:s.beforeText)&&(this.beforeText=s.beforeText),void 0!==(null==s?void 0:s.afterText)&&(this.afterText=s.afterText),void 0!==(null==s?void 0:s.fadeOutChars)&&(this.fadeOutChars=s.fadeOutChars),void 0!==(null==s?void 0:s.fadeOutDuration)&&(this.fadeOutDuration=s.fadeOutDuration),void 0!==(null==s?void 0:s.direction)&&(this.direction=s.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=cc.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?cc.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const n=this.fromTextConfig.length,s=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/s);r=Math.round(n*(1-t))}else r=Math.round(n*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(n-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,n,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),bf(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/s);r=Math.round(n*(1-t))}else r=Math.round(n*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,n,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),bf(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,n){const s=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,s));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const n=[...t];return"forward"===this.direction?n[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):n[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),n}}return t}}class OP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==s?void 0:s.fadeOutDuration)&&(this.fadeOutDuration=s.fadeOutDuration),void 0!==(null==s?void 0:s.slideDirection)&&(this.slideDirection=s.slideDirection),void 0!==(null==s?void 0:s.slideDistance)&&(this.slideDistance=s.slideDistance),void 0!==(null==s?void 0:s.wordByWord)&&(this.wordByWord=s.wordByWord),void 0!==(null==s?void 0:s.wordRegex)&&(this.wordRegex=s.wordRegex),void 0!==(null==s?void 0:s.reverseOrder)&&(this.reverseOrder=s.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=cc.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?cc.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,n=0;for((this.fromTextConfig.forEach(((i,s)=>{if("text"in i){const r=String(i.text);t+=r,e[n]=s,n++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,n=i.index+i[0].length,s=[];for(let i=t;i0&&this.wordGroups.push(s)}const s=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>s.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const n=1-this.fadeOutDuration;let s;s=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,n):this.updateByCharacter(e,n),bf(this.target,{textConfig:s})}updateByWord(t,e){const i=this.wordGroups.length,n=[...this.singleCharConfig];for(let s=0;s0?cc.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=cc.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,n=0;for((this.toTextConfig.forEach(((i,s)=>{if("text"in i){const r=String(i.text);t+=r,e[n]=s,n++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,n=i.index+i[0].length,s=[];for(let i=t;i0&&this.wordGroups.push(s)}const s=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>s.add(t)))}));for(let t=0;t0?this.updateByWord(e,n):this.updateByCharacter(e,n),bf(this.target,{textConfig:s})}updateByWord(t,e){const i=this.wordGroups.length,n=[...this.singleCharConfig];for(let s=0;s{s[t]=e[t]+(i[t]-e[t])*n})),s}function LP(t,e){yf(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class FP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a,o,l,h,c,u;super.onBind();const d=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(s=d.y)&&void 0!==s?s:0)-g,v.y=null!==(r=d.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=d.y)&&void 0!==a?a:0)+g,v.y=null!==(o=d.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=d.x)&&void 0!==l?l:0)-g,v.x=null!==(h=d.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=d.x)&&void 0!==c?c:0)+g,v.x=null!==(u=d.x)&&void 0!==u?u:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,xf(this.target,m)}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class UP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(s=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==s?s:0,u={opacity:c,baseOpacity:c},d={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(u.scaleX=l,d.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(u.scaleY=l,d.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=u,this.to=d,this.props=d,xf(this.target,u)}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class NP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,u=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==n?n:0,d=null!==(r=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==r?r:0,p={opacity:d,baseOpacity:d,angle:c,scaleX:u,scaleY:u},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,xf(this.target,p)}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class jP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,n=null!==(t=i.width)&&void 0!==t?t:100,s=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(n+s)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(n=t.radiusX)&&void 0!==n?n:50,i=null!==(s=t.radiusY)&&void 0!==s?s:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(d=null===(u=this.params)||void 0===u?void 0:u.dashLength)&&void 0!==d?d:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,xf(this.target,this.from)}onUpdate(t,e,i){var n;const s={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(n=this.params)||void 0===n?void 0:n.showFill)&&(s.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),bf(this.target,s)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class zP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,n=null!==(t=i.width)&&void 0!==t?t:100,s=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(n+s)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(n=t.radiusX)&&void 0!==n?n:50,i=null!==(s=t.radiusY)&&void 0!==s?s:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(d=null===(u=this.params)||void 0===u?void 0:u.dashLength)&&void 0!==d?d:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,xf(this.target,this.from)}onUpdate(t,e,i){var n;const s={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(n=this.params)||void 0===n?void 0:n.showFill)&&(s.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),bf(this.target,s)}}class WP extends Mf{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,n,s,r;super.onBind();const a=new Jg(this.target);a.execute({type:"custom",custom:FP,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:UP,customParameters:{fromScale:(null===(s=this.params)||void 0===s?void 0:s.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class HP extends Mf{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,n,s,r;super.onBind();const a=new Jg(this.target);a.execute({type:"custom",custom:FP,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:NP,customParameters:{fromAngle:(null===(s=this.params)||void 0===s?void 0:s.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class VP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onFirstRun(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:1,y=null!==(r=null===(s=this.params)||void 0===s?void 0:s.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(u=g.x)&&void 0!==u?u:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(d=g.x)&&void 0!==d?d:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class GP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onFirstRun(){var t,e,i,n,s,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,u=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",d=null!==(s=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==s?s:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:d,baseOpacity:d},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==u&&"xy"!==u||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==u&&"xy"!==u||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class YP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onFirstRun(){var t,e,i,n,s,r,a,o,l,h,c;const u=this.target.getAttributes(),d=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==n?n:0,g=null!==(r=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=u.angle)&&void 0!==l?l:0,scaleX:null!==(h=u.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=u.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:d,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class XP extends Mf{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,n;const s=new Jg(this.target);s.execute({type:"custom",custom:GP,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),s.execute({type:"custom",custom:VP,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(n=this.params)||void 0===n?void 0:n.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class KP extends Mf{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,n;const s=new Jg(this.target);s.execute({type:"custom",custom:YP,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),s.execute({type:"custom",custom:VP,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(n=this.params)||void 0===n?void 0:n.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class $P extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==s?void 0:s.pulseCount)&&(this.pulseCount=s.pulseCount),void 0!==(null==s?void 0:s.pulseScale)&&(this.pulseScale=s.pulseScale),void 0!==(null==s?void 0:s.pulseColor)&&(this.pulseColor=s.pulseColor),void 0!==(null==s?void 0:s.pulseColorIntensity)&&(this.pulseColorIntensity=s.pulseColorIntensity),void 0!==(null==s?void 0:s.strokeOnly)&&(this.strokeOnly=s.strokeOnly),void 0!==(null==s?void 0:s.fillOnly)&&(this.fillOnly=s.fillOnly),void 0!==(null==s?void 0:s.useScale)&&(this.useScale=s.useScale),void 0!==(null==s?void 0:s.useOpacity)&&(this.useOpacity=s.useOpacity),void 0!==(null==s?void 0:s.useStroke)&&(this.useStroke=s.useStroke),void 0!==(null==s?void 0:s.useFill)&&(this.useFill=s.useFill),void 0!==(null==s?void 0:s.useColor)&&(this.useColor=s.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const n=e*Math.PI*this.pulseCount,s=Math.abs(Math.sin(n)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*s;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*s;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,s),yf(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=nl(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=nl(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class qP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),n=Ps.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=n,n.pathProxy=new Xn,i.add(n)}onStartRect(){var t,e,i;const n=this.target.attachShadow(),s=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=s?"height":"width",a=s?"width":"height",o=this.target.AABBBounds[r](),l=s?0:this.target.AABBBounds.y1,h=Ps.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,n.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var n,s,r,a,o,l,h,c,u,d,p,g,f,m,v,y;const _=null===(s=null===(n=this.params)||void 0===n?void 0:n.isHorizontal)||void 0===s||s,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,n=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,s=null!==(u=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==u?u:60,d=-s,p=d+(n-d)*e,g=Math.max(p,0),f=Math.min(Math.min(p+s,s),n-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Wi.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(d=b.height)&&void 0!==d?d:Math.abs(b.y1-b.y))&&void 0!==p?p:250,n=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,s=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(n+s)*e;let a=Math.min(r,i);const o=Math.min(i-r,s);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Wi.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const n=this.line||this.area;if(!n)return;const s=n.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(s,r,t,e,i):this._onUpdateLineWithoutCache(s,r,t,e,i);const a=r.attribute;n.setAttributes(Object.assign({stroke:a.stroke},n.attribute)),n.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,n,s){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const s=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,s,n)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,s=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,s,n)}}_updateCurves(t,e,i,n){var s,r;const a=i*n,o=Math.min(a+(null!==(r=null===(s=this.params)||void 0===s?void 0:s.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,n.p2&&n.p3){const[e,i]=on(n,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=n.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(n.p2&&n.p3){c&&(u=(o-a)/c.getLength());const[e]=on(c||n,u);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=n.getPointAt(u);t.lineTo(e.x,e.y)}break}if(h)if(n.p2&&n.p3){const e=c||n;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(n.p1.x,n.p1.y);l+=s}}_onUpdateLineWithoutCache(t,e,i,n,s){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&d.push(Ut.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pu){d.push(Ut.pointAtPP(o[t-1],o[t],1-(p+e-u)/e));break}d.length&&d.push(o[t]),p+=e}if(d.length&&!(d.length<2)){t.clear(),t.moveTo(d[0].x,d[0].y);for(let e=1;ei(t))),n.clear()}function nO(t){var e,i;const n=null!==(e=jg().getAll($p))&&void 0!==e?e:[],s=eO(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;iO(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),n.forEach((e=>{var i;const n=tO(e,"vrender:legacy-renderer");r.has(n)||(r.add(n),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(n,e),s.add(n))}))}function sO(t,e){var i,n;const s=null!==(i=jg().getAll(e))&&void 0!==i?i:[],r=eO(t.registry.picker,"vrender:legacy-picker"),a=new Set;iO(t.registry.picker,"vrender:legacy-picker",null===(n=t.registry.picker.unregister)||void 0===n?void 0:n.bind(t.registry.picker)),s.forEach((e=>{const i=tO(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const rO=hE,aO=cE,oO={taro:{installEnv:function(t,e){lE(t,"taro",{bindEnv:pB,bindCanvasModules:Ek,bindWindowContribution:uB},e)},loadEnv:gB},feishu:{installEnv:function(t,e){lE(t,"feishu",{bindEnv:CM,bindCanvasModules:yk,bindWindowContribution:hM},e)},loadEnv:wM},tt:{installEnv:function(t,e){lE(t,"tt",{bindEnv:bB,bindCanvasModules:Rk,bindWindowContribution:mB},e)},loadEnv:xB},wx:{installEnv:function(t,e){lE(t,"wx",{bindEnv:BB,bindCanvasModules:Lk,bindWindowContribution:wB},e)},loadEnv:EB},lynx:{installEnv:function(t,e){lE(t,"lynx",{bindEnv:nB,bindCanvasModules:Ck,bindWindowContribution:YM},e)},loadEnv:sB},harmony:{installEnv:function(t,e){lE(t,"harmony",{bindEnv:jM,bindCanvasModules:xk,bindWindowContribution:EM},e)},loadEnv:zM}},lO=[Tb,Ab,Yg,Kg,Dy,Fy],hO=[()=>{Jg.registerBuiltInAnimate("increaseCount",eP),Jg.registerBuiltInAnimate("fromTo",Pf),Jg.registerBuiltInAnimate("scaleIn",rP),Jg.registerBuiltInAnimate("scaleOut",aP),Jg.registerBuiltInAnimate("growHeightIn",RE),Jg.registerBuiltInAnimate("growHeightOut",IE),Jg.registerBuiltInAnimate("growWidthIn",qE),Jg.registerBuiltInAnimate("growWidthOut",ZE),Jg.registerBuiltInAnimate("growCenterIn",EE),Jg.registerBuiltInAnimate("growCenterOut",PE),Jg.registerBuiltInAnimate("clipIn",SE),Jg.registerBuiltInAnimate("clipOut",AE),Jg.registerBuiltInAnimate("fadeIn",CE),Jg.registerBuiltInAnimate("fadeOut",wE),Jg.registerBuiltInAnimate("growPointsIn",FE),Jg.registerBuiltInAnimate("growPointsOut",UE),Jg.registerBuiltInAnimate("growPointsXIn",jE),Jg.registerBuiltInAnimate("growPointsXOut",zE),Jg.registerBuiltInAnimate("growPointsYIn",HE),Jg.registerBuiltInAnimate("growPointsYOut",VE),Jg.registerBuiltInAnimate("growAngleIn",ME),Jg.registerBuiltInAnimate("growAngleOut",BE),Jg.registerBuiltInAnimate("growRadiusIn",XE),Jg.registerBuiltInAnimate("growRadiusOut",KE),Jg.registerBuiltInAnimate("moveIn",QE),Jg.registerBuiltInAnimate("moveOut",tP),Jg.registerBuiltInAnimate("rotateIn",nP),Jg.registerBuiltInAnimate("rotateOut",sP),Jg.registerBuiltInAnimate("update",cP),Jg.registerBuiltInAnimate("state",oP),Jg.registerBuiltInAnimate("labelItemAppear",gP),Jg.registerBuiltInAnimate("labelItemDisappear",fP),Jg.registerBuiltInAnimate("poptipAppear",mP),Jg.registerBuiltInAnimate("poptipDisappear",vP),Jg.registerBuiltInAnimate("inputText",pP),Jg.registerBuiltInAnimate("inputRichText",EP),Jg.registerBuiltInAnimate("outputRichText",PP),Jg.registerBuiltInAnimate("slideRichText",RP),Jg.registerBuiltInAnimate("slideOutRichText",OP),Jg.registerBuiltInAnimate("slideIn",FP),Jg.registerBuiltInAnimate("growIn",UP),Jg.registerBuiltInAnimate("spinIn",NP),Jg.registerBuiltInAnimate("moveScaleIn",WP),Jg.registerBuiltInAnimate("moveRotateIn",HP),Jg.registerBuiltInAnimate("strokeIn",jP),Jg.registerBuiltInAnimate("slideOut",VP),Jg.registerBuiltInAnimate("growOut",GP),Jg.registerBuiltInAnimate("spinOut",YP),Jg.registerBuiltInAnimate("moveScaleOut",XP),Jg.registerBuiltInAnimate("moveRotateOut",KP),Jg.registerBuiltInAnimate("strokeOut",zP),Jg.registerBuiltInAnimate("pulse",$P),Jg.registerBuiltInAnimate("MotionPath",IP),Jg.registerBuiltInAnimate("streamLight",qP),Jg.registerBuiltInAnimate("dissolve",AP),Jg.registerBuiltInAnimate("grayscale",kP),Jg.registerBuiltInAnimate("distortion",CP),Jg.registerBuiltInAnimate("particle",MP),Jg.registerBuiltInAnimate("glitch",TP),Jg.registerBuiltInAnimate("gaussianBlur",wP),Jg.registerBuiltInAnimate("pixelation",BP)},function(){V(th,of),V(th,Nf)}],cO=[Lb,Wb,qb,fE,rx,iE,ox,fx,Cx,Rx,zx,Yx,iS,oS,fS,vS,wS,RS,_E,vE];function uO(){lO.forEach((t=>t())),hO.forEach((t=>t()))}function dO(t,e){if(!QP(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==Vg?void 0:Vg.env)?Vg.envParams:void 0}(e);return void 0===i?cE(t):aO(t,i),uE(t),pE(t),hB(),cO.forEach((t=>t())),nO(t),sO(t,Yv),uO(),t}function pO(t,e,i){if(!QP(t,e))return t;const n=oO[e];return n.installEnv(t,i),uE(t),function(t){pE(t)}(t),n.loadEnv(),cO.forEach((t=>t())),nO(t),sO(t,Yv),uO(),t}const gO=Symbol.for("visactor.vrender.sharedAppRegistry");function fO(){var t;const e=globalThis,i=null!==(t=e[gO])&&void 0!==t?t:new Map;return e[gO]=i,i}function mO(t,e){const i=fO(),n=i.get(t);if(n||!e)return n;const s=new Map;return i.set(t,s),s}function vO(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const n=fO(),s=n.get(t);(null==s?void 0:s.get(e))===i&&(s.delete(e),s.size||n.delete(t))}(t,e,i),i.releaseApp())}function yO(t,e,i,n=t){var s;const r=null!==(s=e.key)&&void 0!==s?s:"default",a=mO(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(vO(t,r,o),o=void 0),o||(o=function(t,e,i,n){const s=n(i),r=s.release.bind(s),a={app:s,refCount:0,released:!1,releaseApp:r};return s.release=()=>vO(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,n){let s=!1;return{app:n.app,env:e,key:i,release(){if(s)return;s=!0;const e=mO(t,!1);(null==e?void 0:e.get(i))!==n||n.released||(n.refCount-=1,n.refCount<=0&&vO(t,i,n))}}}(t,n,r,o)}const _O=y_,bO=[];function xO(t){bO.forEach((({module:e,options:i})=>{_O(e,Object.assign(Object.assign({},i),{app:t}))}))}var SO=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);st())),nO(t),sO(t,Cy),uO(),t):t}(Hy(SO(t,["envParams"])),e);return xO(i),i}var CO=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},PO={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},OO=(t,e)=>{const i=EO(t),n=PO[i];if(!n)return e;if(null==(s=e)||"object"!=typeof s&&"function"!=typeof s)return;var s;const r={};return n.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},RO=(t,e)=>{const i=yO((n=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,n,BO,n.env);var n;return{app:i.app,releaseAppRef:()=>i.release()}},IO="poptipForText";class DO{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,n,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterVRenderDraw)||void 0===s||s.call(n,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const n=i.findPluginsByName(t);if(n.length<=1)return;const s=n[0];i.uninstall?(i.uninstall(t),i.register(s)):n.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(IO))&&this._dedupeStagePlugin(IO)}initView(){var e,i,n,s,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:u,clickInterval:d,autoPreventDefault:f,background:m}=this._option,v=OO(l,h);Vg.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const n=EO(i.mode),s=OO(i.mode,i.modeParams);return RO(n,s)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=t.releaseAppRef,null===(e=this._option.runtimePluginInstallers)||void 0===e||e.forEach((e=>e(t.app)));try{this._stage=(_=t.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(n=this._container.canvas)&&void 0!==n?n:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,n;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(n=(i=this._option).beforeRender)||void 0===n||n.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:p(a)?a:!p(o)},null!==(s=this._option.renderHooks)&&void 0!==s?s:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=wh({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(p(c)?c:WS(l))&&!1!==u&&xw.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,g(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==u&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=ik.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),n=null==i?void 0:i.region;return!!_(n)&&n.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!zS(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:Vg.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(Vg.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=Vg.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>ak(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>ak(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,n,s,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{ak(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.beforeVRenderDraw)||void 0===s||s.call(n,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===ik.before;(e||i)&&(DS(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=ik.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=ik.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),DS(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:n=!1,animation:s={},enableExitAnimation:r=!1}=t,a=ok(this._rootMarks),{update:o,exit:l}=function(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):n.enter.push({next:[t]})}));const a=lk(s,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=lk(s,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=sk(s,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=sk(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}(this._cachedMarks,a,{morph:i,morphAll:n,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const n=t[i];_(n)?e[i]="disappear"===i?n.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:hk,customParameters:{callBack:t.callBack}}))):n.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{ak(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===tk.appear))?tk.appear:e.every((t=>t===tk.disappear))?tk.disappear:tk.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const n=this._width!==t||this._height!==e;this._width=t,this._height=e,n&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var n,s;if(!1!==this._option.interactive)if(t===NT.chart){const s=this.getRootGroup(),r=function(n){var r;const a=n.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=PT(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=PT(i.parent),i.context)return i;return null})(s,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,u=p(l.modelUserId)?l.modelUserId:null,d=p(l.markUserId)?l.markUserId:null,g={event:n,type:e,source:t,item:o,datum:RT(o),markId:h,modelId:c,markUserId:d,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(n=this._stage)||void 0===n||n.addEventListener(e,r)}else if(t===NT.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();null==s||s.addEventListener(e,n)}else if(t===NT.canvas){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._canvasListeners.set(i,{type:e,callback:n});const r=null===(s=this.getStage())||void 0===s?void 0:s.window;null==r||r.addEventListener(e,n)}}removeEventListener(t,e,i){var n,s,r,a,o;if(!1!==this._option.interactive)if(t===NT.chart){const t=null===(n=this._viewListeners.get(i))||void 0===n?void 0:n.callback;t&&(null===(s=this._stage)||void 0===s||s.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===NT.window){const t=this._getGlobalThis(),n=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;n&&(null==t||t.removeEventListener(e,n)),this._windowListeners.delete(i)}else if(t===NT.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,n=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&n&&(null==t||t.removeEventListener(e,n)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,n=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==n||n(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{ak(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=ok(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return zS(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{Vg.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{ak(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Vg.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){Vg.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function LO(t,e){var n;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(n=null==e?void 0:e.onError)&&void 0!==n?n:FS)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const FO={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}},UO={poptip:U({},FO)};function NO(t){t.crosshair=G(t.crosshair||{}).map((e=>mw({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function jO(t,e,i){var n;const{width:s,height:r}=t;if(p(s)&&p(r))return{width:s,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=Ee(l,i.width,i.height);a=t,o=e}else if(h&&zS(e.mode)){let t;t=y(h)?Vg.getElementById(h):h;const{width:e,height:n}=Ee(t,i.width,i.height);a=e,o=n}else if(HS(e.mode)&&(null===(n=e.modeParams)||void 0===n?void 0:n.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=s?s:a,o=null!=r?r:o,{width:a,height:o}}const zO=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function WO(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function HO(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function VO(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const n=t.effects;zO.forEach((t=>{i[t]&&(n[t]=n[t]||i[t])}))}))}(t,...e),t}function GO(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var YO,XO,KO,$O,qO,ZO;t.LayoutZIndex=void 0,(YO=t.LayoutZIndex||(t.LayoutZIndex={}))[YO.SeriesGroup=0]="SeriesGroup",YO[YO.Axis_Grid=50]="Axis_Grid",YO[YO.CrossHair_Grid=100]="CrossHair_Grid",YO[YO.Region=450]="Region",YO[YO.Mark=300]="Mark",YO[YO.Node=400]="Node",YO[YO.Axis=100]="Axis",YO[YO.MarkLine=500]="MarkLine",YO[YO.MarkArea=100]="MarkArea",YO[YO.MarkPoint=500]="MarkPoint",YO[YO.DataZoom=500]="DataZoom",YO[YO.ScrollBar=500]="ScrollBar",YO[YO.Player=500]="Player",YO[YO.Legend=500]="Legend",YO[YO.CrossHair=500]="CrossHair",YO[YO.Indicator=500]="Indicator",YO[YO.Title=500]="Title",YO[YO.Label=500]="Label",YO[YO.Brush=500]="Brush",YO[YO.CustomMark=500]="CustomMark",YO[YO.Interaction=700]="Interaction",t.LayoutLevel=void 0,(XO=t.LayoutLevel||(t.LayoutLevel={}))[XO.Indicator=10]="Indicator",XO[XO.Region=20]="Region",XO[XO.Axis=30]="Axis",XO[XO.DataZoom=40]="DataZoom",XO[XO.Player=40]="Player",XO[XO.ScrollBar=40]="ScrollBar",XO[XO.Legend=50]="Legend",XO[XO.Title=70]="Title",XO[XO.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(KO=t.AttributeLevel||(t.AttributeLevel={}))[KO.Default=0]="Default",KO[KO.Theme=1]="Theme",KO[KO.Chart=2]="Chart",KO[KO.Base_Series=3]="Base_Series",KO[KO.Series=4]="Series",KO[KO.Mark=5]="Mark",KO[KO.User_Chart=6]="User_Chart",KO[KO.User_Series=7]="User_Series",KO[KO.User_Mark=8]="User_Mark",KO[KO.User_SeriesStyle=9]="User_SeriesStyle",KO[KO.Built_In=99]="Built_In";class JO{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,U({},JO.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}JO.defaultMarkInfo={};class QO{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class tR{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const n=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(n.spec,e,i),n}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>mw({},i,n,t);return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class eR extends QO{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=tR,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new JO,this._lastLayoutRect=null,this.id=GS(),this.userId=t.id,this._spec=t,this.effect={},this.event=new DT(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:n}=e,s=Object.assign({},e);i&&(s.style=this._convertMarkStyle(i)),n&&(s.state={},Object.keys(n).forEach((t=>{s.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(s)}stateKeyToSignalName(t,e){let i=`${Vw}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},n){const{type:s,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=xw.createMark(s,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),n&&l.setMarkConfig(n)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return P(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class iR{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var n;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(n=null==e?void 0:e.getSpec)||void 0===n?void 0:n.call(e)}_setLayoutAttributeFromSpec(t,e){var i,n,s,r;if(this._spec&&!1!==this._spec.visible){let a=sw(aw(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:nw(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(n=this._maxHeight)&&void 0!==n?n:null:nw(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(s=this._minWidth)&&void 0!==s?s:null:nw(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:nw(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:nw(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:nw(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=nw(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=nw(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,n,s,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(n=t.layoutLevel)&&void 0!==n?n:this.layoutLevel,this.layoutOrient=null!==(s=t.orient)&&void 0!==s?s:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=nw(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};d(n)||(r.width-=n),d(s)||(r.width-=s),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(n)?d(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var n,s,r,a;A(t)&&(null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(rw(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class nR extends eR{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new iR(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&W(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=U(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=U(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(n=this._spec.orient)&&void 0!==n?n:this._orient,this.layoutLevel=null!==(s=this._spec.layoutLevel)&&void 0!==s?s:this.layoutLevel}}class sR extends tR{_initTheme(t,e){return{spec:t,theme:this._theme}}}class rR extends nR{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var n;super(e,i),this.transformerConstructor=sR,this.modelType="region",this.specKey="region",this.type=rR.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(n=e.coordinate)&&void 0!==n?n:"cartesian"}_getClipDefaultValue(){var t,e,i,n;const s=this._option.getChart().getSpec(),r=null===(e=null===(t=s.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(n=null===(i=s.scrollBar)||void 0===i?void 0:i.some)||void 0===n?void 0:n.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const n=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),n&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,n){var s,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:n});const o=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return W(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!p(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(n=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function aR(t){const e=[],i=[],n=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&n.push(t)})),{startItems:e,endItems:n,middleItems:i}}function oR(t,e,i){e?t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+s})}))})):t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+s,y:t.getLayoutStartPoint().y})}))}))}function lR(t,e,i,n){let s;t.forEach(((t,r)=>{t.length>1&&(s=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?s-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):s-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+n*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+n*a*r})})))}))}function hR(t,e,i,n,s,r){if(t.length){let a=0;const o="right"===s,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const u=[];let d=[];const p=[];t.forEach((t=>{const{rect:n}=pR(t,e,r),s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=s,c>i&&d.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+s,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),u.push(d),d=[t]):(a=Math.max(a,g),d.push(t))})),p.push(a),u.push(d),lR(u,!0,p,l),n&&oR(u,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function cR(t,e,i,n,s){if(t.length){let i=0;const r="right"===n,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{rect:n}=pR(t,e,s),d=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:n}=pR(t,e,r),s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&d.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=s,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),u.push(d),d=[t]):(l=Math.max(l,s),d.push(t))})),p.push(l),u.push(d),lR(u,!1,p,o),n&&oR(u,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function dR(t,e,i,n,s){if(t.length){const i="top"===n,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{layoutTag:n,layoutRect:u,rect:d}=pR(t,e,s),p=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-d.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),n=t.filter((t=>"region-relative-overlap"===t.layoutType)),s=i.concat(n),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return n.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:n,allRelatives:s,overlapItems:r}}layoutItems(t,e,i,n){var s,r,a;this._layoutInit(t,e,i,n);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(s=null==t?void 0:t.getSpec())||void 0===s?void 0:s.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:u,relativeOverlapItems:d,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,u,d,g,o,l),this._processAutoIndent(c,u,d,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},s,r,a,o=!1){if(s.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:u}=this._checkAutoIndent(s,r);(l||h||c||u)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-u,this.layoutRegionItems(t,e,i,n,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=pR(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),n=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=aR(t);s.length&&hR(s,e,i,!1,"left",n),r.length&&hR(r,e,i,!0,"left",n),a.length&&cR(a,e,0,"left",n)}(i,this,o,e),s.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=aR(t);s.length&&uR(s,e,i,!1,"top",n),r.length&&uR(r,e,i,!0,"top",n),a.length&&dR(a,e,0,"top",n)}(s,this,a,e),n.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=aR(t);s.length&&hR(s,e,i,!1,"right",n),r.length&&hR(r,e,i,!0,"right",n),a.length&&cR(a,e,0,"right",n)}(n,this,o,e),r.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=aR(t);s.length&&uR(s,e,i,!1,"bottom",n),r.length&&uR(r,e,i,!0,"bottom",n),a.length&&dR(a,e,0,"bottom",n)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:n}=pR(t,this,i);e.rect.width=Math.max(n.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(n.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{W(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=pR(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const n=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),s=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=n-t.layoutPaddingLeft-t.layoutPaddingRight,i=s-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:s,regionWidth:n}}layoutRegionItems(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},s,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),this._layoutRelativeOverlap("left",n.left,s),this._layoutRelativeOverlap("right",n.right,s),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),this._layoutRelativeOverlap("top",n.top,s),this._layoutRelativeOverlap("bottom",n.bottom,s),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:u}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+u-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.getModelId()===e));return n||(null!==(i=this._onError)&&void 0!==i?i:FS)("can not find target region item, invalid id"),n}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const n="left"===t.layoutOrient||"right"===t.layoutOrient,s=t.getLastComputeOutBounds(),r=this._getOutInLayout(s,t,e);n?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:n,y:s}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(n-t.x1),right:n+r+t.x2-i.right,top:i.top-(s-t.y1),bottom:s+a+t.y2-i.bottom}}}gR.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}($O||($O={})),t.STATE_VALUE_ENUM=void 0,(qO=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",qO.STATE_HOVER="hover",qO.STATE_HOVER_REVERSE="hover_reverse",qO.STATE_DIMENSION_HOVER="dimension_hover",qO.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",qO.STATE_SELECTED="selected",qO.STATE_SELECTED_REVERSE="selected_reverse",qO.STATE_SANKEY_EMPHASIS="selected",qO.STATE_SANKEY_EMPHASIS_REVERSE="blur",qO.STATE_HIGHLIGHT="highlight",qO.STATE_BLUR="blur",qO.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(ZO||(ZO={}));const fR=["linear","radial","conical"],mR={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const vR={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{vR[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class yR extends QO{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(U(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class _R extends yR{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];p(n.domain)&&(s.domain=n.domain),p(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,nk.includes(t));var t}checkOneState(t,e,i){var n;let s=!1,r=!1;if(p(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e),r=!0;else if(i.items)s=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:this._mark.type};s=i.filter(null==e?void 0:e[0],n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){var i;const n=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!vR[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const n=e[0];if(_(t.datums)){const e=this._isMultiMark(),s=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Vw)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?s.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])})):s.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(Vw))),s=this._isMultiMark();i=e.every((e=>{var i,r;return s?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var n;let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(n=e[0])||void 0===n?void 0:n[r];if(FA(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n){var s;const r=this._isMultiMark()?null===(s=i[0])||void 0===s?void 0:s[e]:i[e];return rt[t.length-1]}release(){}}class bR extends QO{constructor(){super(...arguments),this.id=GS(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=xw.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class xR extends bR{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const SR=1e3,AR="quadInOut",CR=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],wR=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=nl(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},TR=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?M_(t):[],s=M_(e);i&&n&&(i.fromTransform&&B_(n,i.fromTransform.clone().getInverse()),B_(n,i.toTransfrom));const[r,a]=k_(n,s);return t?T_(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},MR=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],BR=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!MR.includes(s))return;const r=e[s];if(!d(r)&&!d(t[s])&&r!==t[s]){if("fill"===s||"stroke"===s){const e=t=>"string"==typeof t?el.Get(t,tl.Color255):t;i.push({from:_(t[s])?t[s].map(e):e(t[s]),to:_(r)?r.map(e):e(r),key:s})}else i.push({from:t[s],to:r,key:s});n=!0}})),n?i:null};class ER extends Mf{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;TR(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&wR(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):bf(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const PR=(t,e,i,n)=>{var s,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=kR(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=BR(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const u=new ER({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:SR,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:AR);return c.play(u),c};class OR extends Mf{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;TR(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&wR(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const RR=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>CR.includes(t))(i)||(e[i]=t[i])})),e},IR=(t,e,i)=>{const n=RR(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{t.setAttributes({pickable:!1}),s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Ps.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});s.appendChild(i),e.push(i)}))}},DR=(t,e,i)=>{const n=[],s=i?null:RR(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:RR(t.attribute);if("rect"===t.type)O_(t,e).forEach((t=>{n.push(Ps.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)R_(t,e).forEach((t=>{n.push(Ps.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)I_(t,e).forEach((t=>{n.push(Ps.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=F_(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Ps.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?W_(t,e).forEach((t=>{n.push(Ps.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?L_(t,e).forEach((t=>{n.push(Ps.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&H_(t,e).forEach((t=>{"path"in t?n.push(Ps.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Ps.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&IR(t,n,e),n},FR=(t,e,i,n)=>"function"==typeof t?t(e,i,n):t,UR=(t,e,i,n,s)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=FR(l.delay,s,a,o),u=FR(l.duration,s,a,o),d=FR(l.oneByOne,s,a,o),p=FR(l.splitPath,s,a,o),g=A(d)&&d>0?t=>S(d)?t*d:!0===d?t*u:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?DR:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:LR)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);PR(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:u,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?DR:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:LR)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>kR(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>BR(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Wi.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const u=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),d=e.animate(Object.assign({},i,{onEnd:r}));d.wait(u),d.play(new ER({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:SR,null!==(l=i.easing)&&void 0!==l?l:AR))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Wi.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new OR({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:SR,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:AR))}})(t,e[0],{delay:c,duration:u,easing:h,onEnd:n,individualDelay:g,splitPath:p}):PR(t[0],e[0],{delay:c,duration:u,easing:h,onEnd:n})},NR=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))},jR=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,n;const s=null===(n=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===n?void 0:n[0];s&&(t.context.morphKey=s[e.morphElementKey])}))}},zR=(t,e,i)=>{var n;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const s=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,s)?null===(n=t.invalidateResolver)||void 0===n||n.call(t):s.length?t.useStates(s,i):t.clearStates(i)},WR=(t,e,i=!0,n)=>{var s;if(!e)return;const r=i&&null!==(s=t.currentStates)&&void 0!==s?s:[],a=i?Array.from(new Set([...r,e])):[e];zR(t,a,n)},HR=(t,e,i)=>{var n;const s=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!s.length)return;const r=(null!==(n=t.currentStates)&&void 0!==n?n:[]).filter((t=>!s.includes(t)));zR(t,r,i)},VR=Symbol("statesClearedBeforeReInit");class GR extends bR{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const n=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var s,r;const a="function"==typeof n?n(t,e,i):n;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(s=e.context.compiler.getChart())||void 0===s?void 0:s.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},n={};Object.keys(t).forEach((e=>{const s=t[e];_(s)?n[e]=s.map(i):p(s)&&(n[e]=i(s))})),this._animationConfig=n}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new xR(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=wh("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var n;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Xn)),i&&(u(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,n,s;const r=t.context.diffState===$O.enter||t.context.diffState===$O.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(n=t.effectiveStates)||void 0===n?void 0:n.length)||t.resolvedStatePatch||(null===(s=t.registeredActiveScopes)||void 0===s?void 0:s.size));((null==r?void 0:r.length)||a)&&zR(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new _R(i,this),this._attributeContext=i.attributeContext,null===(n=i.map)||void 0===n||n.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,n=i.range();return i.range(n.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,Nt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((s=>{let r=t[s];d(r)||(r=this._filterAttribute(s,r,e,i,n),this.setAttribute(s,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,n,s){let r=this._styleConvert(e);if(s)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var n;if(t)if(e&&i){const s=null!==(n=this.stateStyle[i])&&void 0!==n?n:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},s[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var n;(null===(n=this.stateStyle[i])||void 0===n?void 0:n[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const n={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(n[i]=this._computeAttribute(i,e)(t))})),n}}setAttribute(t,e,i="normal",n=0){var s;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:n,style:e,referer:void 0});const r=null===(s=this.stateStyle[i][t])||void 0===s?void 0:s.level;p(r)&&r<=n&&mw(this.stateStyle[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(UA(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=qC(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let n=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];n||(n=this.stateStyle.normal[t]);const s=this._computeStateAttribute(n,t,e),r=u(null==n?void 0:n.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=s(r);return a=n.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>n.postProcess(s(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return n=>i(t,n,e,s(n))}return s}_computeStateAttribute(t,e,i){var n;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):fR.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):UA(null===(n=t.style.scale)||void 0===n?void 0:n.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const n=i[e];if("style"in n){const i=n.style;let s={stateValue:e};"level"in n&&(s.level=n.level),"filter"in n&&(s=u(n.filter)?Object.assign({filter:n.filter},s):Object.assign(Object.assign({},n.filter),s)),this.state.addStateInfo(s),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(n,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,n,s,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let d=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(d=t),g||(g=e)}const f=zC(jC(this.model.getColorScheme(),"series"===this.model.modelType?null===(n=(i=this.model).getSpec)||void 0===n?void 0:n.call(i):void 0),null!==(a=null===(r=null===(s=this.model)||void 0===s?void 0:s.getDefaultColorDomain)||void 0===r?void 0:r.call(s))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},mR[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((n=>{const s=m[n];"stops"===n?e.stops=s.map((e=>{const{opacity:n,color:s,offset:r}=e;let a=null!=s?s:null==d?void 0:d.scale(t[g]);return u(s)&&(a=s(t,this._attributeContext,i)),p(n)&&(a=we.SetOpacity(a,n)),{offset:u(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):u(s)?e[n]=s(t,this._attributeContext,i):e[n]=s})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:n}=t,s=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(s).forEach((e=>{const i=s[e];u(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)fR.includes(null===(a=s.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(s.stroke)(t));else{const s=zC(jC(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=n;if(!(i&&n||"series"!==this.model.modelType)){const{scale:e,field:n}=this.model.getColorAttribute();i||(a=e),l||(l=n),o.stroke=(null==a?void 0:a.scale(t[l]))||s[0]}}return o}}_getDataByKey(t){return sk(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return xw.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=u(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[$w],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=sk(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===tk.appear))?tk.appear:t.every((t=>t===tk.disappear))?tk.disappear:t[0];return null!=e?e:tk.none}createAnimationStateList(t,e){var i;let n=e[t];return n&&Array.isArray(n)&&(n=1===n.length?n[0]:n),Array.isArray(n)?n.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):n?Object.assign(Object.assign({},n),{priority:"normal"===t?null!==(i=n.priority)&&void 0!==i?i:1/0:n.priority}):n}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const n=[],s=[];t.forEach((t=>{jR(t),n.push(...t.getGraphics())})),e.forEach((t=>{jR(t),s.push(...t.getGraphics())}));const r=t=>{var e,i,n;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(n=t.context)||void 0===n?void 0:n.key},a=new Map,o=new Map;if(n.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),s.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const u=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);UR([],e,i,u,{}),c+=1})),l.forEach((t=>{const e=a.get(t),n=o.get(t),s=Math.min(e.length,n.length);if(s>0){const t=NR(e,s),r=NR(n,s);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",n);if(s&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(n.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",n)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=n[e];if(i&&i.length>0){const n=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));n.forEach((e=>{e.animation.customParameters=t.context}));const s=[e];t.applyAnimationState(s,[1===n.length?n[0]:n])}"enter"===e&&n.normal&&(a=!0)})),a&&this._product&&(null===(i=n.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",n)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,n;const s=("component"===this.type?this.model.getAnimationStateCallback():null===(n=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===tk.exit?tk.exit:i===tk.update?tk.update:tk.appear}),r=s(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===$O.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,n=[],s=new Set(this._graphics.filter((t=>t.context.diffState===$O.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=$O.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=$O.enter,f.isExiting=!1,this._graphicMap.set(t,f),n.push(f)):(f=this._graphicMap.get(t),f&&(m=$O.update,n.push(f))),f&&(s.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=tk.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=tk.disappear}));s.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=n.length;n.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=n,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return rk(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=rk(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((n=>{this._unCompileChannel[n]||(this._option.noSeparateStyle||function(t,e,i){var n;const s=null===(n=e[t])||void 0===n?void 0:n.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,s);return!!r||(!!u(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(n,t,this._groupKey)?e[n]=t[n]:i[n]=t[n])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,n;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!s||s.referer||u(s.postProcess)||e in this._computeExChannel)return!1;const r=s.style;return!u(r)&&(!fR.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!UA(null===(n=null==r?void 0:r.scale)||void 0===n?void 0:n.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,n=new Map;i.forEach(((t,e)=>{n.set(t,e)}));const s={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=n.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),s[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==n?void 0:n.style)}:${this._getSharedStateDefinitionRefId(null==n?void 0:n.postProcess)}:${this._getSharedStateDefinitionRefId(null==n?void 0:n.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=s,this._product.sharedStateDefinitions=s)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const n=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);d(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const s=this._transformGraphicAttributes(t,i,null==n?void 0:n[t.context.groupKey]);t.context.finalAttrs=s}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,n;if(!e||!Object.keys(e).length)return;const s=t;null===(i=s.setFinalAttributes)||void 0===i||i.call(s,e),s._commitAnimationStaticAttributes?s._commitAnimationStaticAttributes(e):null===(n=s.commitInternalBaseAttributes)||void 0===n||n.call(s,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,n)=>{var s,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,IT(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?n:n+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(s=this.renderContext)||void 0===s?void 0:s.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:n}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,n)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:n,overflow:s}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(n)){const e=_(n)?n:n(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(s)||(t.overflow=s),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=xw.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const n=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=xw.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(n,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const n=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],s=this._runBeforeTransform(n);let r;if(null==s?void 0:s.progressive){this.renderContext={beforeTransformProgressive:s.progressive};const t=s.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(s),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===ik.before||(this._product||this._initProduct(),DS(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const n=i,s=n[VR],r=null==s?void 0:s.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?WR(i,t,!0,a):HR(i,t,a),r){const e=s.filter((e=>e!==t));e.length?n[VR]=e:delete n[VR]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===$O.exit&&!e.isExiting)if(e.context.animationState===$O.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const n=this.getAnimationConfig();if(n.exit&&n.exit.length){const s=n.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===s.length?s[0]:s],(()=>{e.context.diffState===$O.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((n=>{const s=this.renderContext.progressive.groupedData.get(n),r=this.renderContext.progressive.step,a=s.slice(t*r,(t+1)*r),o=[];a.forEach(((i,s)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$O.enter,data:[i],uniqueKey:`${n}_${null!=a?a:t*r+s}`,key:a,groupKey:n})};o.push(l),e.push(l)})),i[n]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=wh({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,n;if(this._attrsByGroup&&t){const s=t.parent;s&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&s.setTheme({common:this._attrsByGroup[null===(n=t.context)||void 0===n?void 0:n.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[VR]=t.currentStates.slice())}))}}var YR;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(YR||(YR={}));class XR extends GR{constructor(){super(...arguments),this.type=XR.type,this._marks=[],this._diffState=$O.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(LS("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?(LS("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return ak(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===$O.update){const t=this.hasAnimation(),e=IT(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=$O.update}render(){this._isCommited&&(DS(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}XR.type="group";const KR={measureText:Hw};class $R{static instance(){return $R.instance_||($R.instance_=new $R),$R.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 qR{constructor(){this.id=GS(),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))?LS("不要重复添加相同的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 ZR extends qR{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((n=>{n.onAfterModelSpecTransform&&n.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const JR=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},QR=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class tI extends l{constructor(t,e={}){var i,n,s,r,a,o,l,h,c,u;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=xi.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=xi.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||JR(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,u=QR(l[0],l[1]);n.scale=u/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const i=xi.now(),s=this.lastMoveTime;if(i-s<100){const t=s-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=QR(i,s),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=JR(i,s),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(u=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==u?u:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if("press"===e)return e;let s;return s=xi.now()-i>this.config.press.time&&QR(n[0],t){Ps.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n{var n,s;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(s=null===(n=t.points)||void 0===n?void 0:n.length)&&void 0!==s?s:0)})),i}return[]}onBind(){var t,e,i,n,s;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(n=l.finalAttrs)&&void 0!==n?n:{},c=null!==(s=l.diffAttrs)&&void 0!==s?s:{},u=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:u&&Object.prototype.hasOwnProperty.call(u,"points")&&(this.to.points=u.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:u&&Object.prototype.hasOwnProperty.call(u,"segments")&&(this.to.segments=u.segments),this.props=this.to;const d=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=d?Array.isArray(d)?d:[d]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=ut(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ft(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&Zg(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(yf(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const n=Hs(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));bf(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const n=t+this.segmentsCache[i],s=this.points.slice(t,n);return t=n,Object.assign(Object.assign({},e),{points:s})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const iI={type:"fadeIn"};function nI(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 iI;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const sI={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},rI={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},aI=()=>{xw.registerAnimation("scaleInOut",(()=>rI))},oI=(t,e)=>({appear:nI(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:eI,duration:sI.update.duration,easing:sI.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),lI=()=>{xw.registerAnimation("line",oI)},hI=()=>{Jg.registerBuiltInAnimate("growPointsIn",FE),Jg.registerBuiltInAnimate("growPointsOut",UE),Jg.registerBuiltInAnimate("growPointsXIn",jE),Jg.registerBuiltInAnimate("growPointsXOut",zE),Jg.registerBuiltInAnimate("growPointsYIn",HE),Jg.registerBuiltInAnimate("growPointsYOut",VE),Jg.registerBuiltInAnimate("clipIn",SE),Jg.registerBuiltInAnimate("clipOut",AE)},cI=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class uI{constructor(t){this._markSet=new JO,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const n=t.stateStyle;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const n=this.getMarkIdByState();return n&&n[e]&&n[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const dI={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class pI extends uI{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:n}=this.options;this._lastGraphic&&(n.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,n.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const n=t.item,s=n&&this._markSet.getMarkInId(n.context.markId);(this._resetType.includes("view")&&!s||this._resetType.includes("self")&&s)&&this.resetAll(t)},this.options=Object.assign({},dI,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:n,interaction:s}=this.options;if(this._lastGraphic===t)return;const r=s.updateStates(this,[t],s.getStatedGraphics(this),i,n);s.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&HR(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}pI.type="element-highlight",pI.defaultOptions=dI;const gI=()=>{xw.registerInteractionTrigger(pI.type,pI)},fI={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class mI extends uI{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:n}=this.options,s=n.getStatedGraphics(this);s&&s.length&&(n.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:s,options:this.options},t)),n.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const n=t.item,s=n&&this._markSet.getMarkInId(n.context.markId);(this._resetType.includes("view")&&!s||this._resetType.includes("self")&&s)&&this.resetAll(t)},this.options=Object.assign({},fI,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:n,resetType:s}=(t=>{const e=G(t),i=[],n=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(n.push(t.replace("view:","")),i.push("view")):(n.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:n,resetType:i}})(t);return n.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=s,i}start(t,e){const{state:i,reverseState:n,isMultiple:s,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const s=a&&a.filter((e=>e!==t));s&&s.length?r.setStatedGraphics(this,r.updateStates(this,s,a,i,n)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),WR(t,i,!0);const o=this.options.interaction.updateStates(this,s&&a?[...a,t]:[t],a,i,n);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&HR(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}mI.type="element-select",mI.defaultOptions=fI;const vI=()=>{xw.registerInteractionTrigger(mI.type,mI)};class yI extends qR{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const _I=(t,e=!0)=>{var i,n,s,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(s=(n=t).removeAllChild)||void 0===s||s.call(n,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},bI=t=>{var e,i;const n=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{n.push(...bI(t))})),n},xI=(t,e={})=>{var i,n;const{enableExitAnimation:s=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!s||!(null===(n=(i=t).releaseWithExitAnimation)||void 0===n?void 0:n.call(i,{removeFromParent:r,onComplete:a})))||(_I(t,r),!1)};class SI{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>xw.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>xw.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>xw.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return xw.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>xw.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){xw.registerTransform(t,e)}static registerFunction(t,e){t&&e&&$R.instance().registerFunction(t,e)}static unregisterFunction(t){t&&$R.instance().unregisterFunction(t)}static getFunction(t){return t?$R.instance().getFunction(t):null}static getFunctionList(){return $R.instance().getFunctionNameList()}static registerMap(t,e,i){const n=xw.getImplementInKey("registerMap");n&&n(t,e,i)}static unregisterMap(t){const e=xw.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,XT.get(e);var e}static registerSVG(t,e,i){const n=xw.getImplementInKey("registerSVG");n&&n(t,e,i)}static unregisterSVG(t){const e=xw.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){Dw.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 nt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,n){var s,r,a,o,l,h,c,u,d;this.id=GS(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=ck.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var n;if(this._isReleased)return;this._reSetRenderState();const s=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;W(s.theme,this._spec.theme)?W(this._spec.background,s.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(s);if(r.reSize=a,this._spec.type!==s.type)return null===(n=this._compiler)||void 0===n||n.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=VO(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,n)=>{if(1!==n||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const n="series"===t[0]?xw.getSeriesBuiltInTheme(e):xw.getComponentBuiltInTheme(e);i=i?mw({},n,i[e]):n}n===t.length-1&&p(i)&&(i=Nw({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},IA(n),this._option=Object.assign(Object.assign({},this._option),n),(null==n?void 0:n.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),n.optimize)),this._onError=null===(s=this._option)||void 0===s?void 0:s.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=zS(v);if(S?oM(wy):"node"===v&&hB(wy),S&&f&&(this._container=y(f)?Vg.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=Lw.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],C=[];if(!1!==b){const t=xw.getRuntimePluginInstaller("poptipForText");t&&(t(),C.push(t)),A.push("poptipForText")}"sankey"===i.type&&A.push("scrollbar");const w=new nt(null!==(a=this._option.logLevel)&&void 0!==a?a:it.Error);nt.setInstance(w),(null===(o=this._option)||void 0===o?void 0:o.onError)&&w.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new DO({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:C},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new VT(this,this._compiler),this._event=new DT(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),Dw.registerInstance(this),null===(d=null===(u=this._option.performanceHook)||void 0===u?void 0:u.afterCreateVChart)||void 0===d||d.call(u,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=mw({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=jw(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,n;SI.getFunctionList()&&SI.getFunctionList().length&&(t=zw(t,SI)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=xw.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(n=this._chartSpecTransformer)||void 0===n?void 0:n.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=xw.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,n,s;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(n=this._option)||void 0===n||n.onError("chart is already initialized"));const r=xw.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=mt(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,n;return jO(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:Gw,height:null!==(n=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==n?n:Yw})}_initDataSet(t){this._dataSet=t instanceof ui?t:new ui,YT(this._dataSet,"dataview",li),YT(this._dataSet,"array",n),GT(this._dataSet,"copyDataView",$T);for(const t in xw.transforms)GT(this._dataSet,t,xw.transforms[t]);for(const t in xw.dataParser)YT(this._dataSet,t,xw.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return u(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),WO(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,n,s,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(s=this._compiler)||void 0===s||s.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,n,s,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const n=e=>{var i;const n=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===n?tk.none:tk.appear:n};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(n)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(n)}))}}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(n=this._compiler)||void 0===n||n.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,Dw.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{_I(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,n,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,n,s)}))}_updateDataById(t,e,i){const n=this._spec.data.find((e=>e.name===t||e.id===t));n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,n){return this._isReleased?this:(this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==n?void 0:n.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const n=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:s,fields:r}=t,a=n.find((t=>t.name===e));if(a)a instanceof di?(a.setFields(I(r)),a.parse(i,I(s))):(a.values=i,p(s)&&(a.parser=s),p(r)&&(a.fields=r));else{const e=ZT(t,this._dataSet,n);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,n,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,s);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:n,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,n){const s=this._updateSpec(t,e,n);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const n=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(n,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,n=!1,s){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,n,s)}))}updateModelSpecSync(t,e,i=!1,n){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),u(t)||function(t,e,i,n){Object.keys(t).forEach((s=>{if(g(e))e.type===s&&(_(t[s])?t[s].length>=e.index&&(t[s][e.index]=n?mw({},t[s][e.index],i):i):t[s]=n?mw({},t[s],i):i);else if(_(t[s])){const r=t[s].findIndex((t=>t.id===e));r>=0&&(t[s][r]=n?mw({},t[s][r],i):i)}else t.id===e&&(t[s]=n?mw({},t[s],i):i)}))}(this._spec,t,e,i),this._chart){const s=this._chart.getModelInFilter(t);if(s)return this._updateModelSpec(s,e,!0,i,n)}return this}_updateModelSpec(t,e,i=!1,n=!1,s){n&&(e=mw({},t.getSpec(),e));const r=t.updateSpec(e),a=WO(r),o=HO(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:s,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,n;return this._beforeResize(t,e)?(null===(n=(i=this._compiler).resize)||void 0===n||n.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,n,s,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(n=this._event)||void 0===n||n.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const n=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));n>=0&&(this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,n;const s=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=Sw({},e,e.chart[t])),e};let l;if(E(s)&&E(r))l=Fw(this._currentThemeName),this._currentTheme=o(a,l);else{const t=Sw({},Fw(g(r)&&r.type?r.type:g(s)&&s.type?s.type:this._currentThemeName),Fw(s),Fw(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),U(UO.poptip,FO,h),null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let n=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(n=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(n=!0);const s=this._autoSize;return this._autoSize=!!zS(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==s&&(n=!0),n}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return Fw(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!Lw.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const n=this._getTooltipComponent();n&&(null===(i=null===(e=n.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),n.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const n=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==n?void 0:n.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);n&&n[t]&&n[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield LO(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,n;return i(this,void 0,void 0,(function*(){if(!zS(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(n=this._option)||void 0===n||n.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}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)?Vg.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,n){var s;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===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o){const e=Object.keys(t),s=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=s?o.dataToPosition(s,n):o.dataToPosition(t,n),a?ow(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||d(t)||E(e))return null;if(!_(t)){const{axisId:s,axisIndex:r}=e;let a;if(p(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):p(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return LS("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?ow(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(LS("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return $R.instance().getFunction(t)}registerFunction(t,e){t&&e&&$R.instance().registerFunction(t,e)}unregisterFunction(t){t&&$R.instance().unregisterFunction(t)}getFunctionList(){return $R.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);n&&n[t]&&n[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var n,s;const a=null===(n=this._chart)||void 0===n?void 0:n.getRegionsInQuerier(t)[0],o=null===(s=this._chart)||void 0===s?void 0:s.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=xw.getChartPlugins();t.length>0&&(this._chartPlugin=new ZR(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=xw.getVChartPlugins();e.length>0&&(this._vChartPlugin=new yI(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=ck.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=ck.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}SI.InstanceManager=Dw,SI.ThemeManager=Lw,SI.globalConfig={uniqueTooltip:!0},SI.Utils=KR,SI.vglobal=Vg;xw.registerRegion("region",rR),xw.registerLayout("base",gR),vS(),ox(),xw.registerMark(XR.type,XR),xw.registerStageEventPlugin("gesture",tI),gI(),vI(),Ew(gw.name,gw);const AI="monotone",CI="linear",wI="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class TI{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function kI(t,e){return e("component",t)}function MI(t,e,i,n){if(t)return{formatFunc:t,args:[i,n]};const s=xw.getFormatter();return e&&s?{formatFunc:s,args:[i,n,e]}:{}}const BI=(t,e,i,n)=>{if(d(t[e]))return;const s=_(t[e]),r=s?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||n&&!n(t)||a.push({spec:t,specPath:s?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},EI=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},PI=(t,e,i,n)=>{let s;if(s=u(t)?t(e,i):m(t)&&p(t.field)?P(e,t.field):t,n){const{formatFunc:i,args:r}=MI(void 0,n,t,e);i&&r&&(s=i(...r))}return s},OI=(t,e,i)=>d(t)?t:u(t)?t(e,i):t;const RI=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function II(t,i,n,s,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},s),n),i):Object.assign(Object.assign({},s),i),{key:h,keyFormatter:c,keyTimeFormat:u,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=LI(PI(h,r,a,c),u,g),o.value=LI(PI(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=PI(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function DI(t,e,i,n,s,r,a){if(u(e)){II(t,e(s,a),i,n,r,a)}else e&&II(t,e,i,n,r,a)}const LI=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const n=Oe.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?n.timeFormat:n.timeUTCFormat)(e,t)};class FI{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:p(s)?G(s):null!==(t=n.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=n.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=n.getMeasureField())&&void 0!==i?i:[],type:n.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const n=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[n]},this._getSeriesStyle=(t,e,i)=>{var n;for(const i of G(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let n=this._seriesCacheInfo.dimensionFields;return i[0]&&(n=n.filter((t=>t!==i[0]))),n.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var n,s,r,a,o,l,h,c,u,d,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(n=null==i?void 0:i.style)||void 0===n?void 0:n.shape),null==i?void 0:i[t]),null===(s=null==i?void 0:i[t])||void 0===s?void 0:s[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(u=m.shapeStroke)&&void 0!==u?u:this.shapeStrokeCallback,shapeHollow:null!==(d=m.shapeHollow)&&void 0!==d&&d,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,n,s,r){var a;return function(t,e,i,n,s,r){if(s&&s.length){const a=[];return s.forEach((s=>{_(t)?t.forEach((t=>{DI(a,t,e,i,n,s,r)})):u(t)?DI(a,t,e,i,n,s,r):t&&II(a,t,e,i,s,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,n,s,r)}getTitleResult(t,e,i,n,s){let r=u(e)?e(n,s):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(n),e={visible:PI(r.visible,t,s),value:LI(PI(r.value,t,s,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:PI(r.valueStyle,t,s),hasShape:r.hasShape};return Object.keys(i).forEach((n=>{e[n]=PI(i[n],t,s)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,n,s){var r,a;if(!(this.enableByType(t)&&RI(t,this.spec)&&("dimension"!==t||n&&n.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,n,s).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,n,s);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,s),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const UI={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},NI=(t,e)=>{var i,n;let s=e.fields;if(u(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return{};s=vT([],s);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(n=(i=t[0]).getFields)||void 0===n?void 0:n.call(i);return jI(a,s,o)},jI=(t,e,i)=>{const n={};let s=[],r=[];return e.forEach((e=>{const a=e.key;n[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;s.length=0,t&&t.forEach((t=>{t&&s.push(t[a])}));const u=s.length;if(h){r.length=0,s.forEach(((t,e)=>{YS(t)&&r.push(t)}));const t=s;s=r,r=t,c=s.length===u}else s=l.some((t=>"array-min"===t||"array-max"===t))?s.reduce(((t,e)=>(e&&e.forEach((e=>{YS(e)&&t.push(e)})),t)),[]):s.filter((t=>void 0!==t));e.filter&&(s=s.filter(e.filter)),l.forEach((t=>{if(e.customize)n[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(n[a][t]=o.domain.slice())}else if("allValid"===t)return;n[a][t]=UI[t](s),"array-max"===t&&(n[a].max=n[a][t]),"array-min"===t&&(n[a].min=n[a][t])}})),h&&(n[a].allValid=c)})),n},zI=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||s&&s.length&&t.forEach((t=>{s.forEach((e=>{YS(t[e])||(t[e]=0)}))})),t};function WI(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function HI(t,e,i){t&&(i.needDefaultSeriesField&&(t[qw]=i.defaultSeriesField),t[Kw]=e,t[$w]=i.getKey(t,e,i))}const VI={label:{name:"label",type:"text"}},GI=`${Vw}_rect_x`,YI=`${Vw}_rect_x1`,XI=`${Vw}_rect_y`,KI=`${Vw}_rect_y1`,$I={data:!0},qI={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},ZI=[...Object.keys(sI),"normal"];function JI(t={},e,i){const n={};for(let s=0;s{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var n;let s=t;return nD(s)&&delete s.type,s.oneByOne&&(s=tD(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:eD,null==i?void 0:i.dataCount)),s})):o.map(((t,e)=>{var n;let s=mw({},o[e],a);return nD(s)&&delete s.type,s.oneByOne&&(s=tD(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:eD,null==i?void 0:i.dataCount)),s})),n[r]=l):n[r]=o}return n}function QI(t,e,i){var n,s,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(n=e.animationAppear[t])&&void 0!==n?n:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(s=e.animationDisappear[t])&&void 0!==s?s:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),sD(t,(t=>{var i;if(u(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function tD(t,e,i){const{oneByOne:n,duration:s,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=u(s)?s(t,i,a):A(s)?s:0,h=u(r)?r(t,i,a):A(r)?r:0;let c=u(n)?n(t,i,a):n;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=u(s)?s(t,r,o):A(s)?s:0,c=u(a)?a(t,r,o):A(a)?a:0;let d=u(n)?n(t,r,o):n;if(!1===d)return c;return d=!0===d?0:d,c+((i?i():r.parent.count-1)-l)*(h+d)},delete t.oneByOne,t}function eD(t,e){var i;return null!==(i=null==t?void 0:t[Kw])&&void 0!==i?i:e.context.graphicIndex}function iD(t,e){var i,n,s,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(s=null===(n=t.animationAppear)||void 0===n?void 0:n[e])&&void 0!==s?s:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function nD(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function sD(t,e,i=[]){if(_(t))t.forEach(((n,s)=>{t[s]=e(t[s],s),sD(t[s],e,i)}));else if(g(t)&&"function"!=typeof t)for(const n in t)i.includes(n)||(t[n]=e(t[n],n),sD(t[n],e,i))}function rD(t){var e,i,n,s,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(n=o.animationThreshold)&&void 0!==n?n:Number.MAX_SAFE_INTEGER;return null===(s=t.getMarks())||void 0===s||s.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class aD extends tR{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,n,s;const r=FC(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=xw.getSeriesMarkMap(o)?function(t,e,i){const n=xw.getSeriesMarkMap(e);if(!n)return t;const s={};return Object.values(n).forEach((({type:e,name:n})=>{s[n]=mw({},i("mark",G(e)[0]),i("markByName",n),null==t?void 0:t[n])})),Object.assign(Object.assign({},t),s)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return mw({},l,h,(null!==(s=null!==(n=this.stack)&&void 0!==n?n:null==h?void 0:h.stack)&&void 0!==s?s:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const n=super.transformSpec(t,e,i);return this._transformLabelSpec(n.spec),Object.assign(Object.assign({},n),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",n="initLabelMarkStyle",s=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!s;this.addLabelSpec(u(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&d)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[n])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:n,innerRadius:s,direction:r}=t;return p(n)&&(i.outerRadius=n),p(s)&&(i.innerRadius=s),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>{const e=mw({},i,n,t),s=i.label;return s&&g(s)&&_(e.label)&&(e.label=e.label.map((t=>mw({},s,t)))),e};return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}}const oD=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(qI[e]||(t[e]=!0),t)),{}),lD={compileOnlyKeys:qI,dataRelatedKeys:oD,seriesOnlyKeys:{tooltip:!0}},hD={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},cD=t=>(t=>g(t)&&!_(t)&&!u(t))(t)?t:d(t)?{}:null,uD=(t,e,i)=>{const n=cD(t),s=cD(e);if(!n||!s)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(s),...Object.keys(n)]));for(const t of a)if(!W(n[t],s[t])){if(!i[t])return!1;r=!0}return r};function dD(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class pD extends eR{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${Vw}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var n;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=aD,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(n=this._spec)||void 0===n?void 0:n.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=rD(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(GT(this._rawData.dataSet,"invalidTravel",zI),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=ZT(n,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=qT(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=qT(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new xR(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,n,s;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(n=this._rawData.getFields())||void 0===n?void 0:n[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=jI(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=U(null!==(s=this._rawStatisticsCache[t])&&void 0!==s?s:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){GT(this._dataSet,"dimensionStatistics",NI);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new di(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&&vT(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){GT(this._dataSet,"dimensionStatistics",NI);const n=new di(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=vT(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&vT(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new di(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:n}=i,s=this._getSeriesDataKey(t);return void 0===n.get(s)?(n.set(s,0),s):(n.set(s,n.get(s)+1),`${s}_${n.get(s)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):u(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(GT(this._rawData.dataSet,"addVChartProperty",EI),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:WI.bind(this),call:HI}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,n,s){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${n}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),s.hasAnimation&&!1!==t.animation){const e=JI({},QI(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${n}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,s)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(n=this._option.mode)===t.RenderModeEnum["desktop-browser"]||n===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:WS(n)||HS(n)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var n;let s=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?s.enable=a:g(a)&&(s.enable=!0,s=mw(s,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=mw(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(s.enable){const t=cI(s,e);t.length&&l.push({trigger:this._defaultHoverConfig(s),marks:t})}if(r.enable){const t=cI(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,n=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:n,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=cI(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const n=null!==(e=this._seriesField)&&void 0!==e?e:qw;this.getMarksWithoutRoot().forEach((e=>{const s={},r={},a={};i.forEach((t=>{var i;const n=null===(i=t[e.name])||void 0===i?void 0:i.style;n&&(s[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(n).forEach((e=>{r[e]=!0,a[t.name][e]=n[e]})))})),e.state.addStateInfo({stateValue:Zw,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][n]]:!0===s[t[n]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var s,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(s=a[i[0][n]])||void 0===s?void 0:s[t]}return o=null===(r=a[i[n]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,Zw,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,n;(null===(n=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(xw.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new FI(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!W(e,t[i]))))&&(i.reCompile=!0,dD(i))}_getSpecUpdatePolicy(){return lD}_compareSpec(t,e,i){var n,s,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!W(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),u=null!==(n=c.compileOnlyKeys)&&void 0!==n?n:{},d=null!==(s=c.dataRelatedKeys)&&void 0!==s?s:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},u),d),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},$I),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(G(t.label),G(e.label),l),!l.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>uD(t[i],e[i],hD)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!W(t[i],e[i]))),_=h.filter((i=>g[i]&&!W(t[i],e[i]))),b=h.filter((i=>p[i]&&uD(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>d[t]))?dD(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&dD(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!W(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof di||JT(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();rD(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:void 0}}_getSeriesInfo(t,e){var i;const n=this.getDefaultShapeType(),s=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==s||s.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const s=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:s,style:this.getSeriesStyle(s),shapeType:n}}))}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:qw,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=this._getDataScheme();return null===(e=(t=(new KC).domain(i)).range)||void 0===e?void 0:e.call(t,n)}_getDataScheme(){return jC(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:qw}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var n,s,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:u={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=null!==(n=i.morph)&&void 0!==n&&n,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(s=e.morph)||void 0===s?void 0:s.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,mw({},u,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:$w}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),n=this.getDimensionField(),s=i?t[i]:void 0;let r,a=!1;for(let s=0;s0?"_":""}${d(l)?"":l}`,a||(a=o===i),r=l}return!i||a||n.length>1&&r===s||(e+=`_${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!==tT&&t!==iT&&t!==Qw&&t!==eT||(t=this.getStackValueField()),null!==(e=_T(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>YS(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),n=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=n?n:[]}_forEachStackGroup(t,e){var i,n;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(n=e.values)||void 0===n?void 0:n.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:qw]}}function gD(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();FA(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n.index(t[e])-n.index(i[e]))*(s?-1:1)))}function fD(t){return{dataIndex:e=>{var i,n;const s="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[s],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(n=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==n?n:[]).indexOf(r)||0},dataCount:()=>{var e,i,n;const s="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(n=(null!==(i=null===(e=null==s?void 0:s.domain)||void 0===e?void 0:e.call(s))&&void 0!==i?i:[]).length)&&void 0!==n?n:0}}}pD.mark=VI,pD.transformerConstructor=aD;class mD extends pD{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const n={key:i,operations:[]},s=e.axisHelper.getScale(0);FA(s.type)?(n.operations=["max","min"],"log"===s.type&&(n.filter=t=>t>0)):n.operations=["values"],t.push(n)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${Vw}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(tT),this.setFieldX2(Qw)):(this.setFieldY(tT),this.setFieldY2(Qw))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(iT),this.setFieldX2(eT)):(this.setFieldY(iT),this.setFieldY2(eT))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(sT),this.setFieldX2(nT)):(this.setFieldY(sT),this.setFieldY2(nT))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,n,s,r){const a=s();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,n);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),s()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(gD("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function vD(t){return"bottom"===t||"top"===t}function yD(t){return"left"===t||"right"===t}function _D(t){return"z"===t}function bD(t,e){return tw(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function xD(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?vD(t)?"linear":"band":vD(t)?"band":"linear"}(t.orient,e);return{axisType:n,componentName:`${r.cartesianAxis}-${n}`}}const SD=(t,e,i)=>{var n;const s=null!==(n="band"===e?kI("axisBand",i):["linear","log","symlog"].includes(e)?kI("axisLinear",i):{})&&void 0!==n?n:{},r=vD(t)?kI("axisX",i):yD(t)?kI("axisY",i):kI("axisZ",i);return mw({},kI("axis",i),s,r)};class AD{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,n;(null!==(n=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:FS)("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:FS)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n,s;const r=null!==(s=null===(n=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===n?void 0:n.call(i,this.chart,{x:t,y:e}))&&void 0!==s?s:[];return 0===r.length?null:r}dispatch(t,e){var i,n;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)))),r=s.filter((t=>NA(t.getScale().type))),a=r.length?r:s.filter((t=>{const e=t.getOrient();return vD(e)||"angle"===e})),o=[],l=null===(n=this.chart)||void 0===n?void 0:n.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class CD extends AD{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:n.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:NT.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const wD=(t,e)=>{var i,n;return t===e||!d(t)&&!d(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(n=e.axis)||void 0===n?void 0:n.id))},TD=(t,e)=>{const i=t.tooltipFilterRange,n="function"==typeof i?i({scale:e}):i;return A(n)?[-n,n]:n},kD=(t,e,i,n)=>{var s;const r=e.getScale(),a=NA(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(n(h)),l=null===(s=h.getViewData())||void 0===s?void 0:s.latestData;if(i&&l)if(a){const e=[],n=[];l.forEach(((s,r)=>{var a;(null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(s),n.push(r))})),o.push({series:h,datum:e,key:MD(h,n)})}else if(p(i[1])){const e=[],n=[];l.forEach(((s,r)=>{var a;((null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(s[i[0]])&&p(s[i[1]])&&t>=s[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=s[0]&&r<=s[1]&&(a.push(e),c.push(n))}}));else{let e=1/0,n=0;l.forEach(((s,r)=>{if(p(s[i[0]])){const o=Math.abs(s[i[0]]-t),l=Math.sign(s[i[0]]-t);o`${t.id}_${e.join("_")}`,BD=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&e(n)&&((t,e,i)=>{const n=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==n?void 0:n.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))})(t,n,i)));return n.length?n:null};class ED extends AD{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,n,s;if(!t||(null===(s=null===(n=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===n?void 0:n.disableDimensionHoverEvent)||void 0===s?void 0:s.call(n)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!wD(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,n,s;t&&!(null===(s=null===(n=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===n?void 0:n.disableDimensionHoverEvent)||void 0===s?void 0:s.call(n))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:NT.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:NT.canvas}),callback:this.onMouseOut}),WS(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:NT.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),WS(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var PD;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(PD||(PD={}));const OD={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},RD={sampling:!0,samplingFactor:!0};class ID{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,n=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(OD.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:wI,curveType:CI,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,o=a===AI?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(OD.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:iD(this._spec,OD.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new di(this._option.dataSet,{name:`${Vw}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(PD.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const n in this._symbolMark.stateStyle[i])"visible"!==n&&(this._symbolActiveMark.stateStyle[i][n]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const n=this._symbolActiveMark;n&&(this._initSymbolMark(n),n&&(null===(i=null===(e=this._spec[OD.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(n.setVisible(!0),this.event.on(PD.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(n,mw({},this._spec[OD.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var n,s,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(s=null===(n=e.stateStyle.normal)||void 0===n?void 0:n[i])||void 0===s?void 0:s.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const DD=Object.assign(Object.assign({},VI),OD),LD=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>LD(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},FD=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class UD extends GR{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return FD}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const n=this._getIgnoreAttributes(),s=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||n.includes(a))return;r&&s.includes(a)&&(UA(null==o?void 0:o.type)||(null==o?void 0:o.scale)||u(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let n=null;return t.forEach(((t,e)=>{n&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?LD(t,e):t===e))(n[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),n=t,i.push({attrs:n,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var n,s;const r=e.context.data,a=[],o=[],l={},h=null===(n=this.renderContext)||void 0===n?void 0:n.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var n;o[i]={},a[i]={},Object.keys(t).forEach((n=>{this._isValidPointChannel(n)?o[i][n]=t[n](e):this._segmentStyleKeys.includes(n)&&!h?a[i][n]=t[n](e):0!==i||h&&!c||(l[n]=t[n](e))})),o[i].context=null!==(n=this._keyGetter(e))&&void 0!==n?n:i})),h){const t=(null===(s=e.attribute)||void 0===s?void 0:s.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const n=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&n&&n.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,n)=>{const s=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=s.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$O.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[n].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[$w]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const ND=new Uint32Array(33),jD=new Uint32Array(33);jD[0]=0,ND[0]=~jD[0];for(let t=1;t<=32;++t)jD[t]=jD[t-1]<<1|1,ND[t]=~jD[t];function zD(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:n=0,left:s=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+s+r+o)/o),h=~~((e+n+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:({x1:n,y1:s,x2:r,y2:a})=>{if(r<0||a<0||n>t||s>e)return!0;let o,l,h,c,u=a;for(;u>=s;--u)if(o=u*t+n,l=u*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&ND[31&o]&jD[1+(31&l)])return!0}else{if(i[h]&ND[31&o])return!0;if(i[c]&jD[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||s>e)return;let o,l,h,c,u;for(;s<=a;++s)if(o=s*t+i,l=s*t+r,h=o>>>5,c=l>>>5,h===c)n(h,ND[31&o]&jD[1+(31&l)]);else for(n(h,ND[31&o]),n(c,jD[1+(31&l)]),u=h+1;u{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+n,l=a>>>5,h=o>>>5,l===h)s(l,jD[31&a]|ND[1+(31&o)]);else for(s(l,jD[31&a]),s(h,ND[1+(31&o)]),c=l+1;ci<0||n<0||r>=e||s>=t,toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(l,h),c.x=t=>~~((t+s)/o),c.y=t=>~~((t+n)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function WD(t,e){const{x1:i,x2:n,y1:s,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ut(i,-o,t.width+l),u=ut(n,-o,t.width+l),d=ut(s,-a,t.height+h),p=ut(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(u),y1:t.y(d),y2:t.y(p)}}function HD(t,e,i=!1){return i?WD(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function VD(t,e,i,n=!0,s=0){let r=i;s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=HD(t,r);const a=e.outOfBounds(r);return!(n&&a||(a&&(r=WD(t,r)),e.getRange(r)))}function GD(t,e,i,n=[],s=!0,r=0,a=!1){var o,l,h,c;const u=n.filter((t=>p(t))),d=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(s.AABBBounds,r,t,n.offset))),l=!1===i.restorePosition;return GD(t,e,s,o,h,c,l)}return!1}var d;if("moveY"===i.type){const n=(i.offset?u(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return GD(t,e,s,n,h,c)}if("moveX"===i.type){const n=(i.offset?u(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return GD(t,e,s,n,h,c)}return!1}const XD=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],KD=["top","inside-top","inside"];function $D(t,e,i,n={}){const{x1:s,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:u=0}=n,d=Math.min(s,r),p=Math.max(s,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+u;let y=0,_=0;return d<0-h?y=-d:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const qD={mode:"same-time",duration:300,easing:"linear"};function ZD(t){return 3===t||4===t}function JD(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}const QD=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 tL(t,e,i,n,s,r){return Math.abs(e/t)0?s:-s),y:n+e*s/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:n+(e>0?r:-r)}}class eL extends Bf{onBind(){const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:n,curText:s,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in s.attribute)n.attribute[t]!==s.attribute[t]&&(l[t]=s.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(n,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(n,{type:"increaseCount",to:{text:s.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class iL extends Bf{onBind(){const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:n,relatedGraphics:s,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?n.animates&&n.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?s&&s.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):n.animates&&n.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const nL=(t,e)=>Math.ceil(t)>Math.floor(e),sL=([t,e],[i,n])=>n>t&&e>i;function rL(t,e){const[i,n]=t,[s,r]=e,a=Math.max(i,s),o=Math.min(n,r);return Math.max(0,o-a)}const aL=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class oL extends Ch{constructor(t,e){super(t),this._skipRenderAttributes=aL,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,n){const s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);if(s)return this._setAttributes(s,i);m(this.attribute[t])&&m(e)&&!u(this.attribute[t])&&!u(e)?U(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{cL(t,e,i)})),e}function uL(t,e){e&&(null==t||t.onComplete.push(e))}function dL(t){t.forEach((t=>{t()}))}function pL(t,e,i){const n=t=>{const n=e();n&&!n.finalized&&n.pendingAnimates.has(t)&&(n.pendingAnimates.delete(t),n.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>n(t))),t.onRemove((()=>n(t)))}))}var gL=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(hA.hover,!0),KS(this,(t=>{t===e||E(t.states)||t.addState(hA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(KS(this,(t=>{E(t.states)||(t.removeState(hA.hoverReverse),t.removeState(hA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void KS(this,(t=>{E(t.states)||(t.removeState(hA.selectedReverse),t.removeState(hA.selected))}));E(e.states)||(e.addState(hA.selected,!0),KS(this,(t=>{t===e||E(t.states)||t.addState(hA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,n,s,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===Wi.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Wi.ANIMATE_UPDATE&&(null===(n=t.detail.animationState)||void 0===n?void 0:n.isFirstFrameOfStep)){const e=null!==(r=null===(s=t.target)||void 0===s?void 0:s.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,n){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if($t(t,e,!0))return;const i=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-n)/2,l=Math.abs(e.x2-s)/2,h=Math.abs(e.y2-r)/2,c=i+a,u=n+o,d=s+l,p=r+h,g=d-c,f=p-u;return[tL(g,f,c,u,a,o),tL(-g,-f,d,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const n=rA.line({points:i}),{line:s={}}=t.attribute;if(s.customShape){const i=s.customShape;n.pathProxy=n=>i({text:t,baseMark:e},n,new Xn)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&n.setAttribute("stroke",r.fill),this.attribute.line&&!E(this.attribute.line.style)&&n.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(n),n}}_finalizeExitRelease(){var t,e,i,n;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const r=this.parent,a=!!(null==s?void 0:s.removeFromParent),o=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(n=null!=r?r:this.parent)||void 0===n||n.removeChild(this)),dL(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,uL(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(qD),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const n=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&n.add(t.text),(null==t?void 0:t.labelLine)&&n.add(t.labelLine)})),!n.size)return!1;const s=cL(this);n.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=cL(this).filter((t=>!s.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},pL(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:s}=this.attribute;let r=this.attribute.data;if(u(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=u(n)?n(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!c(t)&&u(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}u(s)?a=s(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),u(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return mA(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let n;if(n=u(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),n.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:s}=this.attribute;if(s&&0!==s.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),s),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let n=0;nl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,s,h,c):this._overlapByStrategy(t,s,h,c)}_overlapGlobal(t,e,i,n){let s=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,u=t=>o.get(t).x,d=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let s=t.length-1;s>=0;s--){const r=t[s],a=t[s-1],l=t[s+1];if(a&&nL(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=n(r);l&&nL(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:n,x2:s}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:n,x2:s,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(n>=o&&s<=l)i.push(e),h=!0;else if(ot(r,u(i[0]),void 0,5)){const r={start:Math.min(o,n),end:Math.max(l,s)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(rL([o,l],[n,s])/(l-o)>.5){const r={start:Math.min(o,n),end:Math.max(l,s)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:n,end:s},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==s.enable){const{maxIterations:e=10,maxError:n=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:u=Number.MAX_VALUE}=s;for(let s=0;sl(t)-l(e)));let e=0;for(let n=0;n=o)continue;let r,v=n+1;for(;(r=t[v])&&!sL([d(s),p(s)],[d(r),p(r)]);)v+=1;if(r){const t=c(s),n=h(s),o=c(r),d=o-(t+n);if(di){const e=t-(a-d),i=l(s)-e;Math.abs(i)<=u&&(f(s,e),m(s,g(s)+1))}else if(t-n<0){const t=o+(a-d),e=l(r)-t;Math.abs(e)<=u&&(f(r,t),m(r,g(r)+1))}else{const e=t-n,i=l(s)-e,a=o+n,h=l(r)-a;Math.abs(i)<=u&&Math.abs(h)<=u&&(f(s,e),f(r,a),m(s,g(s)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(s,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&n.setRange(HD(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&n.setRange(HD(i,t.AABBBounds,!0))})):t.AABBBounds&&n.setRange(HD(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:n}=e;return{x1:i,x2:i,y1:n,y2:n}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:n=t,y1:s=i}=e;return{x1:(t+n)/2,x2:(t+n)/2,y1:(i+s)/2,y2:(i+s)/2}}const{x:n,y:s}=e;return{x1:n,x2:n,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,n=new Map,s=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,u=(null==s?void 0:s.get(c))?"update":"enter";let d;o&&(d=this._createLabelLine(t,h));const p=d?{text:t,labelLine:d}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u)r.push(t),n.set(c,p),this._addLabel(p,r,a,e);else if("update"===u){const t=s.get(c);s.delete(c),n.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(s),this._graphicToText=n}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:n}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var s;null===(s=e.setFinalAttributes)||void 0===s||s.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},n),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},n),{type:e===t?n.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:n}=t,{text:s,labelLine:r}=e;hL(i,null==s?void 0:s.attribute),hL(n,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:s,prevLabelLine:n,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,n){const{text:s,labelLine:r}=t,a=this.getRelatedGraphic(s.attribute);this._syncStateWithRelatedGraphic(a),s&&this.add(s),r&&this.add(r),this.runEnterAnimation(s,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:n,labelLine:s}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),i&&s&&t.labelLine.setAttributes(s.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,n,s,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:u,mode:d,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(n=l.brightColor)&&void 0!==n?n:"#ffffff",y=null!==(s=l.darkColor)&&void 0!==s?s:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{mL[t]=e};var yL=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),n&&0!==n.length||(n=[e]);const r="start"===i?0:n.length-1;return n[r]?{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}:void 0}labeling(t,e,i="end",n=0){return function(t,e,i="end",n=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:s,x2:r}=t,a=Math.abs(r-s),o=e.x1;let l=o;return"end"===i?l=o+a/2+n:"start"===i&&(l=o-a/2-n),{x:l,y:e.y1}}(t,e,i,n)}};_L.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const bL=()=>{vL("line",_L),vL("area",_L)};var xL=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,u=(e.y1+e.y2)/2;let d=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":d=-1;break;case"right":d=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":d=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":d=0,p=0}return{x:c+d*(n+g)+Math.sign(d)*(l/2),y:u+p*(n+f)+Math.sign(p)*(h/2)}})(t,e,i,n)}}SL.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const AL=()=>{vL("symbol",SL),vL("line-data",SL)};class CL extends UD{constructor(){super(...arguments),this.type=CL.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)===DC.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}CL.type="line";const wL=()=>{xw.registerMark(CL.type,CL),vS(),Cx(),bL(),AL(),hI(),xw.registerGraphicComponent("line",Ph)};class TL extends GR{constructor(){super(...arguments),this.type=TL.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var n,s,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(s=null!==(n=a.shape)&&void 0!==n?n:a.symbolType)&&void 0!==s?s:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}TL.type="symbol";const kL=()=>{xw.registerMark(TL.type,TL),vS(),wS(),AL(),xw.registerGraphicComponent("symbol",mc)};class ML extends aD{_transformLabelSpec(t){var e,i,n;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function BL(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function EL(t,e){var i;const n=Y(e)-e[0],s=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===n?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=n,a/=n);const o=t.getDomainSpec(),l={total:n,negative:r,positive:a,includeZero:s,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let n,s;0===i?(n=t._break.scope[i],s=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,s=[e[e.length-2],e[e.length-1]]):(n=t._break.scope[i-1],s=[e[i-1],e[i]],l.negative=n[0]+(0-s[0])/(s[1]-s[0])*(n[1]-n[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=s}return l}function PL(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:u}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),u[0]=-u[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),u[1]=-u[0]*t}return!0}function OL(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function RL(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function IL(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}const DL=t=>t.map(((t,e)=>({index:e,value:t}))),LL=(t,e,i,n)=>it?Math.min(t-e/2,i-e):i{var n,s,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let u=null!==(n=a.angle)&&void 0!==n?n:0;"vertical"===a.direction&&(u+=Nt(90));const d=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;d||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=dA(a),y=t.range();let _=[];for(let i=0;i{var i,n,s,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(n=null==e?void 0:e.currentAxis)||void 0===n?void 0:n.call(e);if(!l)return t;const h=null===(s=l.getTickData())||void 0===s?void 0:s.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const u=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==u?void 0:u.length))return t;const d=o.getScale();if(!d)return t;const p=d.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=u.map((t=>function(t,e,i,n,s){const r=Lt(t,e),a=Math.max(Dt(i),Dt(r));return s*(Math.round(r*10**a)/Math.round(i*10**a))+n}(t.value,p[0],g,f[0],m)));return DL(v)};class NL{constructor(t){this.id=GS(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class jL extends NL{constructor(){super(jL.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!FA(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const n=this._checkEnableSync(i);if(!n)return;if(!n.zeroAlign)return;const s=this._getTargetAxis(i,n);s&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===s.id},(()=>{((t,e)=>{var i,n,s,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(s=null===(n=(i=t).getDomainAfterSpec)||void 0===n?void 0:n.call(i))&&void 0!==s?s:[0,1],u=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&u&&BL(c)&&BL(u)))return;const d=EL(t,c),p=EL(e,u);if(!0===d.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=d,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!OL(d,p))return}else if(0===_&&0===b){if(!OL(p,d))return}else if(y||A)if(y&&!A){if(!PL(d,p))return}else if(A&&!y){if(!PL(p,d))return}else{if(f===b)return;if(f>b){if(!RL(d,p))return}else if(!RL(p,d))return}else{if(0===f&&0===_){if(!IL(d,p))return}else if(0===b&&0===g&&!IL(p,d))return;if(0===f&&0===b)if(0===c[0]&&u[0]>0){if(!x)return;u[0]=0}else{if(!(0===u[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&u[1]>0){if(!S)return;u[1]=0}else{if(!(0===u[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(u)})(s,i)}))}onDidCompile(t,e){var i;const n=this._checkEnableSync(e);if(!n)return;const s=this._getTargetAxis(e,n);if(s&&n.tickAlign){GT(e.getOption().dataSet,"tickAlign",UL);const t={targetAxis:()=>s,currentAxis:()=>e},n=null===(i=s.getTickData())||void 0===i?void 0:i.getDataView();n&&n.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}jL.pluginType="component",jL.type="AxisSyncPlugin";const zL={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function WL(t,e){var i,n,s,r,a,o;return{min:null!==(s=null!==(i=t.min)&&void 0!==i?i:null===(n=t.range)||void 0===n?void 0:n.min)&&void 0!==s?s:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function HL(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const VL=t=>"band"===t||"ordinal"===t||"point"===t;function GL(t,e){return{id:t,label:t,value:e,rawValue:t}}function YL(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class XL extends qR{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const KL=`${Vw}_ARC_TRANSFORM_VALUE`,$L=`${Vw}_ARC_RATIO`,qL=`${Vw}_ARC_START_ANGLE`,ZL=`${Vw}_ARC_END_ANGLE`,JL=`${Vw}_ARC_K`,QL=`${Vw}_ARC_MIDDLE_ANGLE`,tF=`${Vw}_ARC_QUADRANT`,eF=`${Vw}_ARC_RADIAN`,iF=-Math.PI/2,nF=3*Math.PI/2,sF=(t,e,i)=>{var n;const s=null!==(n="band"===e?kI("axisBand",i):"linear"===e?kI("axisLinear",i):{})&&void 0!==n?n:{},r=kI("angle"===t?"axisAngle":"axisRadius",i);return mw({},kI("axis",i),s,r)};function rF(t,e,i,n){switch(t){case r.cartesianBandAxis:return SD(bD(i,["z"]),"band",e);case r.cartesianLinearAxis:return SD(bD(i,["z"]),"linear",e);case r.cartesianLogAxis:return SD(bD(i,["z"]),"log",e);case r.cartesianSymlogAxis:return SD(bD(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return SD(bD(i),void 0,e);case r.polarBandAxis:return sF(i.orient,"band",e);case r.polarLinearAxis:return sF(i.orient,"linear",e);case r.polarAxis:return sF(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,n;const s=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:u}=null!==(n=kI(r.crosshair,t))&&void 0!==n?n:{},d=s.find((t=>vD(t.orient)));let g;g=p(d)?mw({},VL(d.type)?a:o,l):l;const f=s.find((t=>yD(t.orient)));let m;return m=p(f)?mw({},NA(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:u}})(e,n);case r.polarCrosshair:return((t,e)=>{var i,n;const s=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:u}=null!==(n=kI(r.crosshair,t))&&void 0!==n?n:{},d=s.find((t=>"angle"===t.orient));let g;g=p(d)?mw({},VL(d.type)?a:o,l):l;const f=s.find((t=>"radius"===t.orient));let m;return m=p(f)?mw({},NA(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:u}})(e,n);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return aF(i,kI(t,e));default:return kI(t,e)}}const aF=(t,e)=>{var i;const n=e[function(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}(null!==(i=t.orient)&&void 0!==i?i:e.orient)],s=mw({},e,n);return delete s.horizontal,delete s.vertical,s};class oF extends tR{getTheme(t,e){return rF(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:n}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:n}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:n}=t;i&&e&&n&&(t.padding=Object.assign(Object.assign({},aw(e)),{[n]:0}))}}class lF extends nR{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=oF,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,n=null,s=null)=>{var r,a;e instanceof bi||this.event.emit(i,{model:this,node:t,event:e,item:n,datum:s,source:NT.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]);return new this(n,Object.assign(Object.assign({},i),s))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new XL(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!W(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,n;_I(t),null===(n=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===n||n.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=bI(t),n=xI(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,n,s;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(s=null===(n=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===s||s.call(n,t)}))}});return n?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,n;this._exitingVRenderComponents.add(t),null===(n=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===n||n.call(i,t)}))):void 0}_I(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var hF,cF;lF.transformerConstructor=oF,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(hF||(hF={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(cF||(cF={}));class uF extends GR{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,n,s,r;null===(r=null===(s=null===(n=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.globalInstance)||void 0===s?void 0:s._registerExitingVRenderComponent)||void 0===r||r.call(s,t)}_unregisterExitingComponent(t){var e,i,n,s,r;null===(r=null===(s=null===(n=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===r||r.call(s,t)}_releaseComponentWithExitAnimation(t,e){var i,n;const s=this._product;if(!t||(null===(n=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===n?void 0:n.call(i)))return!1;const r=xI(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&s?this._removeProductAfterExit(t,s):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?s:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?_I(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(_I(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=xw.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(LT.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}uF.type="component";const dF=()=>{xw.registerMark(uF.type,uF)};var pF,gF;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(pF||(pF={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(gF||(gF={}));const fF={[gF.selectedReverse]:{},[gF.selected]:{},[gF.hover]:{},[gF.hoverReverse]:{}},mF=t=>t,vF={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class yF extends lF{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,n;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(n=t.hideWhenEmpty)&&void 0!==n&&n,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,n,s,r,a,o,l,h,c,u,d,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?hF.circleAxis:hF.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?cF.circleAxisGrid:cF.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(s=null===(n=this._spec.grid)||void 0===n?void 0:n.style)||void 0===s?void 0:s.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=JI(null===(h=xw.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(u=null!==(c=this._spec.animationAppear)&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==u?u:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b: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||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new xR(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&OA(this._regions,(n=>{var s;let a=this.collectSeriesField(t,n);if(a=_(a)?FA(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=n.getFieldAlias(a[0])),a){const t=n.getViewData();if(e)a.forEach((t=>{i.push(n.getRawDataStatisticsByField(t,!!FA(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(s=n.getViewDataStatistics)||void 0===s?void 0:s.call(n),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((n=>{var s;(null===(s=null==e?void 0:e.latestData)||void 0===s?void 0:s[n])&&(o?i.push(Object.assign(Object.assign({},e.latestData[n]),{values:t.latestData.map((t=>t[n]))})):i.push(e.latestData[n]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return OA(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;p(t)&&(this._seriesUserId=G(t)),p(i)&&(this._regionUserId=G(i)),p(e)&&(this._seriesIndex=G(e)),p(n)&&(this._regionIndex=G(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),OA(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,n,s,r,a,o,l,h,c,u;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(s=null===(n=this._axisMark)||void 0===n?void 0:n.getComponent)||void 0===s?void 0:s.call(n))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(u=this._spec.grid)||void 0===u?void 0:u.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&W(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):OA(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(OA(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;tW(null==e?void 0:e[i],null==t?void 0:t[i])||vF[i]))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var n;if(t.domainLine&&t.domainLine.visible?i.line=((n=MT(n=t.domainLine)).startSymbol=MT(n.startSymbol),n.endSymbol=MT(n.endSymbol),n):i.line={visible:!1},t.label&&t.label.visible){const e=N(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=u(t.label.style)?(e,i,n,s)=>{var r;const a=t.label.style(e.rawValue,i,e,n,s);return ET(mw({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:ET(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,n,s,r)=>ET(t[i](e.rawValue,n,e,s,r)):E(t[i])||(e[i]=ET(t[i]))})),e}(t.label.state)),u(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:u(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=u(t.tick.style)?(e,i,n,s)=>{var r;const a=t.tick.style(e,i,n,s);return ET(mw({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:ET(t.tick.style)),t.tick.state&&(i.tick.state=BT(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=u(t.subTick.style)?(e,i,n,s)=>{var r;const a=t.subTick.style(e,i,n,s);return ET(mw({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:ET(t.subTick.style)),t.subTick.state&&(i.subTick.state=BT(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const n=t.title,{autoRotate:s,angle:r,style:a={},background:o,state:l,shape:h}=n,c=e(n,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==t.orient&&"right"!==t.orient||s&&d(p)&&(p="left"===t.orient?-90:90,u=zL[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Nt(p):null,textStyle:mw({},u,ET(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:ET(h.style)}),h.state&&(i.title.state.shape=BT(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:ET(o.style)}),o.state&&(i.title.state.background=BT(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=BT(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=ET(t.background.style)),t.background.state&&(i.panel.state=BT(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:Ww(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:u(t.grid.style)?(e,i)=>{var n,s;const r=t.grid.style(null===(n=e.datum)||void 0===n?void 0:n.rawValue,i,e.datum);return ET(mw({},null===(s=this._theme.grid)||void 0===s?void 0:s.style,r))}:ET(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:Ww(t.subGrid.alternateColor),style:ET(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=MI(t,e);return i?(t,n,s)=>i(n.rawValue,n,e):null}_initTickDataSet(t,e=0){YT(this._option.dataSet,"scale",mF);const i=this.registerTicksTransform();return new di(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:n,tickStep:s,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:n,tickStep:s,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var n;null===(n=null==i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===pF.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}yF.specKey="axes";const _F=()=>{dF(),xw.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},bF=[jL];class xF extends yF{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,n){super(i,n),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),OA(this._regions,(t=>{const e=this.getOrient();vD(e)?YL(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):yD(e)?YL(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):_D(e)&&YL(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:n}=i,s=e(i,["grid"]),r=mw({x:t.x,y:t.y},this._axisStyle,s);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(mw({x:t.x,y:t.y},this._getGridAttributes(),n)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),n=vD(this.getOrient()),s=t=>{var e;return(n?!vD(t.getOrient()):vD(t.getOrient()))&&FA(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>s(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);n?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=bD(i,["z"]),_D(this._orient)&&(this.layoutType="absolute"),this._dataSet=n.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!HL(e))return null;const{axisType:t,componentName:n}=xD(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:n}]}const n=e.filter((t=>"z"===t.orient))[0];let s=!0;if(n){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>yD(t.orient)))[0];s=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));s||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!HL(t))return;const{axisType:n,componentName:s}=xD(t,i);t.type=n,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:s})})),a}static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]),r=xw.getComponentInKey(s.type);return r?new r(n,Object.assign(Object.assign({},i),s)):(i.onError(`Component ${s.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:n,top:s,bottom:r}=this._innerOffset;let a=[];return vD(this.getOrient())?A(t)&&(a=this._inverse?[t-n,i]:[i,t-n]):_D(this.getOrient())?A(t)&&(a=this._inverse?[t-n,i]:[i,t-n],this._scale.range(a)):A(e)&&(a=this._inverse?[s,e-r]:[e-r,s]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(bF.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){vD(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&&!vD(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!_D(this.getOrient())&&this._spec.innerOffset){const t=this._spec;yD(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=nw(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=nw(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=vD(this.getOrient())?t.fieldX:_D(this.getOrient())?t.fieldZ:t.fieldY,FA(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,n;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(n=this._spec.label)||void 0===n?void 0:n.flush})}axisHelper(){return{isContinuous:FA(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(LT.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(vD(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=vD(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return OA(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,n;let s;return s=t>0?null===(n=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===n?void 0:n[t]:vD(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:_D(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,s}updateSeriesScale(){const t=this.getOrient();OA(this._regions,(e=>{vD(t)?YL(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):yD(t)?YL(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):_D(t)&&YL(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=vD(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const n={skipLayout:!1},s=vD(this.getOrient());this.pluginService&&(s?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),n=mw(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(n);a&&!a.empty()||(a=(new ce).set(n.x,n.y,n.x,n.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,s)}return i}positionToData(t,e){const i=vD(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?ut(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):ut(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const n=this._scale.range();return(t-n[0])*(t-Y(n))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,n,s,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=a.style)||void 0===s?void 0:s.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),n=e+t[0].getLayoutRect().width,s=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return GL(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,n=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:FA(this._scale.type)?i>=n[0]&&i<=Y(n):n.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let n=0,s=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;n=Math.max(n,e)}else if(e===a){const e=t.getLayoutRect().width;s=Math.max(s,e)}})),{left:n,right:s}}}}xF.type=r.cartesianAxis,xF.specKey="axes";const SF=(t,e,i,n)=>{const s=FL(t,e,i);return s&&s.map((t=>n?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},AF=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,CF=(t,e)=>t[1]{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?DL([n[n.length-1]]):DL([n[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(s)){const e=u(s)?s({axisLength:f,labelStyle:h}):s;m=t.ticks(e)}else if(e.sampling){const s=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=X(g);if(n.length<=f/s){const i=SF(t,n,e,c);if(i){const s=Math.min(...i.map((t=>t[2]))),l=(a-r)/n.length,h=TF(n,i,o,e.labelLastVisible,Math.floor(s/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(n[n.length-1]))}}else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],s=SF(t,i,e,c);if(s){let i=null;s.forEach((t=>{i?i[2]0?Math.ceil(n.length*(o+i[2])/(a-r-o)):n.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===n[n.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(n[n.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=n=>{let s=!0,r=0;do{r+n{let n=t,s=e;for(;n=0?s=t:n=t+1}return n})(s,t.length,(t=>c(t)?1:-1));let d=u;do{if(d>u&&!r&&!c(d))d++;else{if(!n){o=d;break}{const n=t.length-1;let s,r=0;s=t.length%d>0?t.length-t.length%d+d:t.length;do{if(s-=d,s!==n&&!AF(e[s],e[n],i))break;r++}while(s>0);if(s===n){o=d,a=r;break}{const i=Math.floor(t.length/d)-r+1;if(i=0?CF(e[s-d],e[s]):t,u=Math.abs(t-c);if(u{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function MF(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=TA(t,!!s),o=TA(r,!!s);const h=Ut.distancePP(n,l),c=Ut.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=kF(e,t,!1,!!s),o=kF(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=TA(t,!!s),o=TA(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class BF extends oL{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&CA(this._innerView),this.removeAllChild(!0),this._innerView=rA.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 wA(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=U({},this.attribute,this.getGridAttribute(t)),{type:n,items:s,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${pF.grid}-sub`:`${pF.grid}`;if(s.forEach(((t,i)=>{const{id:s,points:o}=t;let c="";if("line"===n||"polygon"===n)c=TA(o,!!a);else if("circle"===n){const{center:t}=this.attribute;c=kF(t,o,!1,!!a)}const d=rA.path(Object.assign({path:c,z:l},u(r)?U({},this.skipDefault?null:BF.defaultAttributes.style,r(t,i)):r));d.name=`${h}-line`,d.id=this._getNodeId(`${h}-path-${s}`),e.add(d)})),l&&"line"===n&&s.forEach(((t,i)=>{const{id:n,points:s}=t,o=[];o.push(s[0]);const c=s[1].x-s[0].x,d=s[1].y-s[0].y,p=Math.sqrt(c*c+d*d),g=l/p;o.push({x:s[0].x+c*g,y:s[0].y+d*g});const f=TA(o,!!a),m=Ct(o[0].x-o[1].x),v=Ct(o[0].y-o[1].y),y=rA.path(Object.assign({path:f,z:0,alpha:m>v?(s[1].x-s[0].x>0?-1:1)*bt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},u(r)?U({},this.skipDefault?null:BF.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${n}`),e.add(y)})),s.length>1&&o){const t=_(o)?o:[o,"transparent"],n=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!ot(a.value,0)&&!ot(l.value,0),u=!ot(a.value,1)&&!ot(l.value,1),d=[],p=a.value>l.value;(p&&u||!p&&c)&&d.push(this.getGridPointsByValue(p?1:0)),s.forEach((t=>{d.push(t.points)})),(p&&c||!p&&u)&&d.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,n=[];return i>=2&&this.data.forEach((i=>{let s=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;s=e}n.push({value:s})})),n}release(){super.release(),this._prevInnerView=null,this._innerView=null}}BF.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class EF{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:n=1}=this.attribute,s=iA(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([s[1],-1*s[0]],t*(e?1:-1)*n)}}class PF extends Bf{onBind(){var t;const e=dP(this.target);this._animator=e;const i=this.duration,n=this.easing,{config:s,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),s=this.target.attribute.x,h=this.target.attribute.y;hL(this.target,{x:s,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:s,y:h},duration:i,easing:n})}e.animate(this.target,{type:null!==(t=s.type)&&void 0!==t?t:"fadeIn",to:s.to,duration:i*o,easing:n}),this.completeBind(e)}}class OF extends Bf{onBind(){const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:n}=this.params;hL(this.target,Object.assign({},n)),t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function RF(){ox(),Cx(),fS(),RS(),Jg.registerBuiltInAnimate("axisEnter",PF),Jg.registerBuiltInAnimate("axisUpdate",OF)}ox(),Rx();class IF extends BF{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},BF.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n=6,startAngle:s=aA,endAngle:r=oA}=this.attribute;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2){const s=this._getPointsOfSubGrid(n,i);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})}}V(IF,EF),ox(),Cx(),zx(),wS();class DF extends oL{getStartAngle(){return Wt(this._startAngle)}getEndAngle(){return Wt(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},DF.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:n,visible:s=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!s)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(q(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var s,r;const a=rA.line(Object.assign(Object.assign({points:t},_(i)?null!==(s=i[e])&&void 0!==s?s:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),E(null==n?void 0:n.line)||(a.states=_(n.line)?null!==(r=n.line[e])&&void 0!==r?r:n.line[n.line.length-1]:n.line),this.add(a),this.lines.push(a)}))}else{let t=rA.line;G(i)[0].cornerRadius&&(t=rA.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==n?void 0:n.line)||(e.states=[].concat(n.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:n=!0}=t;let s;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:u=0,refAngle:d=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+u*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+u*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+u*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+u*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),s=rA.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:n?v+d:0,strokeBoundsBuffer:0}),p)),s.name=`${this.name}-${i}-symbol`,s.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(s.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(s.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(s.states=o.endSymbol),this.add(s)}return s}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let n;return n=e?A(i)?t[i]:q(t):t,this._mainSegmentPoints=n,n}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let n=t;if(e.visible){const i=e.clip?e.size||10:0;n=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...n.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,s={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};n=[...n.slice(0,n.length-1),s]}return n}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],n=t[t.length-2],s=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[s.x-n.x,s.y-n.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}function LF(){ox(),iS(),wS(),fS(),RS()}DF.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}}};var FF=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),C=0,w=0;let j=0;"left"===U||"start"===U?j=1:"right"===U||"end"===U?j=-1:"center"===U&&(j=0),j?j<0?(C-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-B)):j>0&&x.setAttribute("x",b[3]):(C-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-B/2));const z="right"===_||"end"===_,W="left"===_||"start"===_,H=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:G(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+B,i=1===j?(t-e)/2+B+I/2:b[0]+B-(T/2+e/2-B)+I/2;if(H(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(W&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+B/2:-T+b[3]+b[1]+B;if(H(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(z&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+B/2:t;if(H(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===N?(w-=k/2,A&&A.setAttribute("y",0)):"bottom"===N?(w-=k,A&&A.setAttribute("y",-D/2),x.setAttribute("y",-b[2])):"top"===N&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",D/2)),E(null==m?void 0:m.text)||(R.states=m.text);const{visible:V}=a,Y=FF(a,["visible"]);if(f&&c(V)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:V&&!!n,width:T,height:k,x:C,y:w}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Xn)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:U({},UF.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(s=null===(n=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===n?void 0:n.slice())&&void 0!==s?s:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(u=this._bgRect)||void 0===u||u.clearStates(),null===(d=this._symbol)||void 0===d||d.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}UF.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const NF={type:"default",duration:300,easing:"linear"};class jF extends lL{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=((t,e,i)=>{const n=t.target;return n!==i&&n.name&&!E(n.states)?(n.addState(hA.hover,!0),KS(e,(t=>{t!==n&&t.name&&!E(t.states)&&t.addState(hA.hoverReverse,!0)})),n):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(KS(e,(t=>{t.name&&!E(t.states)&&(t.removeState(hA.hoverReverse),t.removeState(hA.hover))})),null):i)(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=((t,e,i)=>{const n=t.target;return i===n&&n.hasState(hA.selected)?(KS(e,(t=>{t.name&&!E(t.states)&&(t.removeState(hA.selectedReverse),t.removeState(hA.selected))})),null):n.name&&!E(n.states)?(n.addState(hA.selected,!0),KS(e,(t=>{t!==n&&t.name&&!E(t.states)&&t.addState(hA.selectedReverse,!0)})),n):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=rA.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const n=this.parent,s=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),s&&(null===(e=null!=n?n:this.parent)||void 0===e||e.removeChild(this)),dL(r)}_runExitAnimationBeforeRelease(t={}){var e,i,n;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,uL(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=new Set;if(KS(this._innerView,(t=>{"group"!==t.type&&s.add(t)})),!s.size)return!1;const r=cL(this),{delay:a=0,duration:o=NF.duration,easing:l=NF.easing}=this._animationConfig.exit;s.forEach((t=>{var e,i,n;const s={opacity:0,fillOpacity:0,strokeOpacity:0};hL(t,s,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.attribute.strokeOpacity)&&void 0!==n?n:1}),t.animate().wait(a).to(s,o,l)}));const h=cL(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(n=(i=this._innerView).removeAllEventListeners)||void 0===n||n.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},pL(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&CA(this._innerView),this.removeAllChild(!0),this._innerView=rA.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(NF)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,items:r}=this.attribute,a=rA.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=pF.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),s&&s.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),n&&n.visible&&this.renderTicks(a),i&&i.visible)){const t=rA.group({x:0,y:0,pickable:!1});t.name=pF.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,r.length),this.handleLabelsOverlap(s,e,n,i,r.length),this.afterLabelsOverlap(s,e,n,i,r.length);let a=0,o=0,l="center",h="middle",c=0;s.forEach(((t,e)=>{var i;const n=t.attribute,s=null!==(i=n.angle)&&void 0!==i?i:0,r=t.AABBBounds;let u=r.width(),d=r.height();s&&(u=Math.abs(u*Math.cos(s)),d=Math.abs(d*Math.sin(s))),a=Math.max(a,u),o=Math.max(o,d),l=n.textAlign,h=n.textBaseline,0===e&&(c=n.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=rA.group({x:0,y:0,pickable:!1});i.name=pF.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=rA.line(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=pF.tick,r.id=this._getNodeId(t.id),E(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=cA;else{const t=this.data[n],e=U({},cA,this.attribute.tick.state);Object.keys(e).forEach((i=>{u(e[i])&&(e[i]=e[i](t.rawValue,n,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:n}=this.attribute;if(n&&n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=rA.line(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=pF.subTick,r.id=this._getNodeId(`${s}`),E(n.state))r.states=cA;else{const i=U({},cA,n.state);Object.keys(i).forEach((n=>{u(i[n])&&(i[n]=i[n](t.value,s,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&u(n)&&(e=n(e,i));const s=this._transformItems(e),r=rA.group({x:0,y:0,pickable:!1});return r.name=`${pF.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),s.forEach(((t,e)=>{var n;const a=mA(this._getLabelAttribute(t,e,s,i));if(a.name=pF.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(n=this.attribute.label)||void 0===n?void 0:n.state))a.states=cA;else{const n=U({},cA,this.attribute.label.state);Object.keys(n).forEach((r=>{u(n[r])&&(n[r]=n[r](t,e,s,i))})),a.states=n}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new UF(Object.assign({},e));i.name=pF.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return wA(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&u(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;Ct(n[0])>Ct(n[1])?o=bt/2*(l.x>e.x?1:-1):h=bt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?d+=(this.axisLabelLayerSize[n-1].height+P(this.attribute,"label.space",4))*n:d+=(this.axisLabelLayerSize[n-1].width+P(this.attribute,"label.space",4))*n);const f=this.getVerticalCoord(t.point,d,o),m=this.getVerticalVector(d||1,o,f),v=l?l(`${t.label}`,t,e,i,n):t.label;let{style:y}=this.attribute.label;y=u(y)?U({},yA.label.style,y(t,e,i,n)):y;y=U(this.getLabelAlign(m,o,y.angle),y),u(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:n}));let _=y.react;return u(_)&&(_=_(t,e,i,n)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,n){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const n=this._animationConfig;this._newElementAttrMap={},KS(e,(e=>{var s;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=I(r.attribute),a=I(e.attribute),o=__(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(s=a.opacity)&&void 0!==s?s:1,l=!0),n.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},hL(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},n.update),{type:"axisUpdate",customParameters:{config:n.update,diffAttrs:o,lastScale:t}})}]))}else n.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},n.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:n.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const zF={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,n)=>n&&kA(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function WF(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function HF(t,e,i,n,s=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;t{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},XF(t,e.attribute.angle)),{angle:YF(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({},KF(t,e.attribute.angle)),{angle:YF(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Jt({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),n=i.x-e.centerX,s=i.y-e.centerY;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}function YF(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function XF(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=YF(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function KF(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],n=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const s=(e=YF(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function $F(t,e){const{limitLength:i,verticalLimitLength:n,ellipsis:s="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,p=c?Math.sin(h):0,f=AA(h),m=SA(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=n)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=n)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=n)return}}let r=null;if(f||m)r=v?f?n:i:"vertical"===y||m?n:i;else if(v){const{x1:e,x2:n}=t.AABBBounds,s=p/u,l=Math.abs(i/p);if(_&&s>0&&e<=a+o.right&&i/s+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&s<0&&n>=-o.left&&i/s+n<-o.left){const t=(n+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:s})}))}function qF(t,e,i){let n;return A(e)&&(n=Math.abs(e-t)),A(i)&&(n=A(n)?Math.min(Math.abs(t-i),n):Math.abs(t-i)),n}var ZF=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const{startPoint:n,endPoint:s,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=rA.group({zIndex:999});e.name=pF.axisBreak,e.id=this._getNodeId(`${pF.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:n={},angle:s=.5*Math.PI}=t,r=U({},_A,n),a=null!==(e=r.size)&&void 0!==e?e:_A.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(s)} L ${a/2} ${-a*Math.sin(s)}`,symbolSize:a})}(r),l=rA.symbol(Object.assign({x:n.x,y:n.y},o));l.name=pF.axisBreakSymbol;const h=rA.symbol(Object.assign({x:s.x,y:s.y},o));h.name=pF.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,n=t.AABBBounds,s=rA.rect(Object.assign({x:n.x1,y:n.y1,width:n.width(),height:n.height()},i.style));s.name=pF.background,s.id=this._getNodeId("background"),s.states=U({},fF,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(s,t.firstChild)}const{labelHoverOnAxis:n}=this.attribute;n&&n.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new UF(Object.assign({},t));e.name=pF.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:n}=this.attribute,s=n,{startSymbol:r,endSymbol:a,style:o,state:l}=s,h=ZF(s,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let n=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:s}=e;t.push([n,i]),n=s})),t.push([n,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:U({},fF,l),symbol:U({},fF,l)});const u=new DF(c);u.name=pF.line,u.id=this._getNodeId("line"),t.add(u)}getTextAlign(t){let e="center";return ot(t[0],0)?ot(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const n=this.attribute.title,{position:s="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=n,p=ZF(n,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===s?g=0:"end"===s&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,n=this.axisLabelsContainer.AABBBounds;_+=(1===m?n.x2>i?Math.min(n.x2-i,n.width()):0:n.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),C=this.getVerticalCoord(v,S,!1),w=this.getVerticalVector(S,!1,{x:0,y:0});let T,k,{angle:M}=p;if(T="start"===s?"start":"end"===s?"end":"center",d(M)&&o){M=nA(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;k=1==-1*t?"bottom":"top"}else T=this.getTextAlign(w),k=this.getTextBaseline(w,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,n=Math.min(t||1/0,e||1/0);if(A(n))if("bottom"===i||"top"===i)if(M!==Math.PI/2){const t=Math.abs(Math.cos(null!=M?M:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=n-S;else if(M&&0!==M){const t=Math.abs(Math.sin(M));B=t<1e-6?1/0:this.attribute.end.y/t}else B=n-S}const E=Object.assign(Object.assign(Object.assign({},C),p),{maxWidth:B,textStyle:Object.assign({textAlign:T,textBaseline:k},a),state:{text:U({},fF,c.text),shape:U({},fF,c.shape),panel:U({},fF,c.background)}});return E.angle=M,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,n=this.attribute.labelHoverOnAxis,{position:s=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=n,p=ZF(n,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=s:g.y=s;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=nA(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,C=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return C.angle=b,l&&l.visible&&(C.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),C}getTextBaseline(t,e){let i="middle";const{verticalFactor:n=1}=this.attribute,s=(e?1:-1)*n;return ot(t[1],0)?i=!ot(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===s?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(["top","bottom","right","left"].includes(n)||0===t[0]&&0===t[1]){if("top"===n||"bottom"===n)return XF(e?"bottom"===n?"top":"bottom":n,i);if("left"===n||"right"===n)return KF(e?"left"===n?"right":"left":n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,h=t[0],c=Y(t),u=s?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-d}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=u?c:h,e=u?h:c,s=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,d=n.y;rd&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+d-s}):t.setAttributes({y:d,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,n,s){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,s),{layoutFunc:h,autoRotate:c,autoRotateAngle:d,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(u(h))h(t,e,n,this);else{if(c)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0,a=n;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);s{t.attribute.angle=Nt(e)})),GF(i,t),!VF(t))break}}(t,{labelRotateAngle:d,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:n,ellipsis:s="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=AA(a),l=SA(a),h="top"===r||"bottom"===r;let c=n/t.length;t.forEach(((e,n)=>{var r,a,u,d,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=qF(e.attribute.x,null===(r=t[n+1])||void 0===r?void 0:r.attribute.x,null===(a=t[n-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Mt(c,i))}}else{if(l){const i=qF(e.attribute.y,null===(u=t[n+1])||void 0===u?void 0:u.attribute.y,null===(d=t[n-1])||void 0===d?void 0:d.attribute.y);A(i)&&(c=Mt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:s,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);$F(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&function(t,e){if(E(t))return;const i=t.filter(WF);if(E(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=u(s)?s:zF[s]||zF.parity;if(n.length>=3&&MA(n,r)){do{n=a(n,r)}while(n.length>=3&&MA(n,r));const t=(t,e,i=!0)=>i&&t<3||e,s=t(n.length,e.firstVisible,!1);let o=t(n.length,e.lastVisible);const l=i[0],h=Y(i);kA(l,h,r)&&s&&o&&(h.setAttribute("opacity",0),o=!1),HF(l,n,s,(t=>kA(t,l,r))),HF(h,n,o,(t=>kA(t,h,r)||!(!s||t===l)&&kA(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,s);let e,n;h=Math.max(h,t),"left"===a?(e=l.x2-h,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-h):"bottom"===a&&(e=l.x1,n=l.y1);const r=rA.rect({x:e,y:n,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=pF.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){"left"===n||"right"===n?"left"===s?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===s?t.forEach((t=>{var n;t.setAttributes({dx:(null!==(n=t.attribute.dx)&&void 0!==n?n:0)+e+i-t.AABBBounds.x2})})):"center"===s&&t.forEach((t=>{var n;t.setAttributes({dx:(null!==(n=t.attribute.dx)&&void 0!==n?n:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==n&&"top"!==n||("top"===s?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===s?t.forEach((t=>{var n;t.setAttributes({dy:(null!==(n=t.attribute.dy)&&void 0!==n?n:0)+e+i-t.AABBBounds.y2})})):"middle"===s&&t.forEach((t=>{var n;t.setAttributes({dy:(null!==(n=t.attribute.dy)&&void 0!==n?n:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,u=null!==(i=o.space)&&void 0!==i?i:4;let d=t,p=0,g=0;const f=h&&h.visible?null!==(n=h.style.lineWidth)&&void 0!==n?n:1:0,m=c&&c.visible?null!==(s=c.length)&&void 0!==s?s:4:0;if(l&&l.visible&&"string"==typeof l.text){p=pA(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=Be(l.padding);g=l.space+t[0]+t[2]}return d&&(d=(d-u-g-p-f-m)/e),d}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const n=this.axisContainer.AABBBounds,s=n.width(),r=n.height(),a=n.x1,o=n.y1,l=n.x2,h=n.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,n=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",n),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,n=i.width()-s,c=i.height()-r;n>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-n,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}JF.defaultAttributes=yA,V(JF,EF);const QF={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}}},tU={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}}},eU={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}}};class iU extends xF{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new aC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return GT(this._option.dataSet,t,wF),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=ZA(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:n,bandSizeLevel:s=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};s=Math.min(s,this._scales.length-1);for(let t=s;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),u=e=>{const i=t===s?a:0;if(d(r)||t1)for(let e=0;e{this._onTickDataChange(n)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=n}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new xR(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const n=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},s=this._tickDataMap[t],r=null==s?void 0:s.getDataView().transformsArr.find((t=>t.type===n));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===n));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,n;if(0===t.length||0===this._scales.length)return 0;const{position:s,bandScale:r}=this.getPosition(t);return s+r.bandwidth()*(null!==(n=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==n?n:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((n,s)=>{var r;const a=this._tickDataMap[s],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):n.domain();if(l&&l.length)if(i&&i.length){const n=[],s=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(s.push(r),o){const e=GL(i,this._getNormalizedValue(r,t));n.push(e)}}))})),o&&e.push(n.filter((t=>t.value>=0&&t.value<=1))),i=s}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>GL(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}});const nU=()=>{xw.registerGraphicComponent(hF.lineAxis,((t,e)=>new JF(t,e))),xw.registerGraphicComponent(cF.lineAxisGrid,((t,e)=>new IF(t,e))),_F(),xw.registerComponent(iU.type,iU,!1)},sU=(t,e,i)=>i.reduce(((t,n,s)=>(t.push([n,i.length===s+1?e:i[s+1]]),t)),[[t,i[0]]]);function rU(t,e){const i=t[0],n=t[t.length-1],s=e.filter((t=>t>i&&tt-e,oU=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let n=0,s=0;for(;n{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(s);return i[n]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function lU(t,e,i="count"){const n=oU(t,e),s="count"===i?t.length:n.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return n.forEach(((t,e)=>{if(0===s)r.push([0,e/n.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===n.length-1?1:Math.min((a+l)/s,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const hU=Math.sqrt(50),cU=Math.sqrt(10),uU=Math.sqrt(2);class dU{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=WL(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(u(i.tickCount)){const t=this._scale.range();let n=Math.abs(Y(t)-t[0]);if(1===n&&this._option){n=vD(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=n,e=i.tickCount({axisLength:n,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:n,max:s}=null!==(t=this._domain)&&void 0!==t?t:{};return d(n)&&d(s)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(p(n)||p(this._softMinValue))&&d(s)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(n)||!d(this._softMinValue)||!p(s)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!u(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(Y(e)-e[0]);i<=1||A(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let n,s,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;n=void 0===n?e:Math.min(n,e),s=void 0===s?a:Math.max(s,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?s:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:n,scope:s}=function(t,e,i){return t.sort(aU),e.sort(aU),{domain:rU(t,e),scope:lU(t,e,i)}}(r,IS(t),this._spec.breaks[0].scopeType);e=IS(n),this._break={domain:n,scope:s,breakDomains:t,breaks:i}}else e=[n,s]}else e=[n,s]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=WL(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=hU?10:s>=cU?5:s>=uU?2:1)*Math.pow(10,n),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,n=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*n)/n:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function pU(t,e,i,n){let s;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();s=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||s.push(e)}));e.domain(a)}else s=n(i);return s}function gU(t,e,i,n,s=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){s?e.push(t):e.unshift(t);for(let t=0;t{var i,n,s,r;if(!FA(t.type))return DL(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return DL([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:d=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=pU(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const n=null!==(i=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=pU(e,t,n,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:d}):t.d3Ticks(e,{noDecimals:d})))}else{const i=null!==(n=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==n?n:5,s=u(e.tickMode)?e.tickMode:void 0;m=pU(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:d,customTicks:s}):t.ticks(e,{noDecimals:d,customTicks:s})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e,a=6;let l;if(m.length*a>o){const i=[],n=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%n!=0&&e!==m.length-1||i.push(t)})),l=null===(s=FL(t,i,e))||void 0===s?void 0:s.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=FL(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],s=Y(l),r=f&&f()?mU.greedy:mU.parity;for(;l.length>=3&&MA(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;kA(t,s,i)&&l.includes(s)&&l.length>1&&a&&o&&(l.splice(l.indexOf(s),1),o=!1),gU(t,l,a,(e=>kA(e,t,i))),gU(s,l,o,(e=>kA(e,s,i)||!(!a||e===t)&&kA(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&n&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return DL(m)},mU={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>!(n&&kA(i,t,e)||(i=t,0))))}},vU={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class yU extends xF{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new kC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const n=super._getUpdateAttribute(t);if(!_D(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=vD(this._orient),s=i?t:e;n.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:n,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/s;let o;o=ew(r)?Number(r.substring(0,r.length-1))/100:r/s;const l=A(null==n?void 0:n.angle)?n.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},n),{angle:l*Math.PI/180}),rawRange:e}}))}return n}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=IS(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return GT(this._option.dataSet,t,fU),t}}yU.type=r.cartesianLinearAxis,yU.specKey="axes",yU.builtInTheme={axis:QF,axisLinear:vU,axisX:tU,axisY:eU},V(yU,dU);const _U=()=>{xw.registerGraphicComponent(hF.lineAxis,((t,e)=>new JF(t,e))),xw.registerGraphicComponent(cF.lineAxisGrid,((t,e)=>new IF(t,e))),_F(),xw.registerComponent(yU.type,yU)},bU=`${Vw}_hide_`;function xU(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const SU=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:n,deltaMul:s=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[bU]&&(xU(t,!0),t[bU]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let n=-1/0,s=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+s)*i),r=(-1/0-l)**2+(n-h)**2,r<(o+s+e)**2?t.context.finalAttrs.forceShow||(t[bU]=!0,xU(t,!1)):n=h,s=e}))}(r,n,s):1===i?function(t,e,i){let n=-1/0,s=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+s)*i),Math.abs(o-n){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+s)*i),Math.abs(o-n){var i,n;const s=null===(n=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===n?void 0:n[r];return t[s]?t[s].push(e):t[s]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},AU=()=>{xw.registerGrammarTransform("symbolOverlap",{transform:SU,runType:"afterEncode"})},CU={min:K,max:X,average:function(t,e){let i=0,n=0;return t.forEach((t=>{const s=e?+t[e]:+t;A(s)&&(i+=s,n++)})),i/n},sum:BA};function wU(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,u=0;r[u++]=c;for(let t=1;to&&(o=l,h=t))}r[u++]=h,c=h}r[u-1]!==a-1&&(r[u++]=a-1);return r.map((t=>i?e[t].i:t))}function TU(t,e,i,n,s){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][s]=e[l][s];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function kU(t,e,i,n){return TU(t,e,i,"min",n)}function MU(t,e,i,n){return TU(t,e,i,"max",n)}function BU(t,e,i,n){return TU(t,e,i,"average",n)}function EU(t,e,i,n){return TU(t,e,i,"sum",n)}const PU=(t,e)=>{let i=u(t.size)?t.size():t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:s,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=wU;if("min"===s?l=kU:"max"===s?l=MU:"average"===s?l=BU:"sum"===s&&(l=EU),e.length){const t={};if(a){for(let i=0,n=e.length;i{const r=t[s];if(r.length<=i){const t=r.map((t=>t.i));n=n.concat(t)}else{const t=l(i,r,!0,o);n=n.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},OU=()=>{xw.registerGrammarTransform("dataSampling",{transform:PU})};class RU extends mD{constructor(){super(...arguments),this.type=DC.line,this.transformerConstructor=ML,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),RD)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(JI(null===(i=xw.getAnimationInKey("line"))||void 0===i?void 0:i(s,r),QI("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=fD(this);this._symbolMark.setAnimationConfig(JI(null===(n=xw.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),QI("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var n,s;return i&&"fill"===e&&(e="stroke"),null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}RU.type=DC.line,RU.mark=DD,RU.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},RU.transformerConstructor=ML,V(RU,ID);class IU{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(n,((t,e)=>{JT(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof di)return;const n=this.getSeriesData(t.id,i);n&&e(t,n,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];LS(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];LS(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class DU{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{XS(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{vT(e,[{key:t,operations:FA(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&vT(e,[{key:i.field,operations:FA(s.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?qC("colorOrdinal"):qC(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(XS(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(W(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;if(!W(r.specified,n.specified)){if("color"!==n.id)return e.reMake=!0,e;const t=s;if(t.setSpecified)t.setSpecified(n.specified);else{if(!n.specified||!t.specified)return e.reMake=!0,e;t.specified(n.specified)}e.reRender=!0}n.range&&!W(n.range,s.range())&&(s.range(n.range),e.reRender=!0),XS(n.domain)?e.reRender=!0:W(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!XS(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,n.domain().slice());let s;s=FA(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const n=FA(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,n);e&&(n?(d(s[0])?s[0]=e.min:s[0]=Math.min(e.min,s[0]),d(s[1])?s[1]=e.max:s[1]=Math.max(e.max,s[1])):e.values.forEach((t=>{s.add(t)})))}))}));const r=s;FA(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(FA(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const n=this._getSeriesBySeriesId(t.seriesId),s=FA(e.type),r=n.getRawDataStatisticsByField(t.field,s);if(!E(r))return"expand"===t.changeDomain?(s?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(s?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));FA(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:s})),s}}class LU{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,n,s;const r=null!==(n=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==n?n:e.get(t.context.markId);return!!(null===(s=null==r?void 0:r.hasAnimationByState)||void 0===s?void 0:s.call(r,"state"))}updateStates(t,e,i,n,s){return this._disableTriggerEvent?[]:e&&e.length?(n&&s?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,s),this.toggleStateOfGraphics(t,e,i,n)):this.addBothStateOfGraphics(t,e,n,s):n&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,n):this.addStateOfGraphics(t,e,n)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,n,s),[])}toggleReverseStateOfGraphics(t,e,i,n){const s=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(n&&s[n]&&s[n].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);WR(t,n,!0,e)}})),e.forEach((t=>{if(n&&s[n]&&s[n].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);HR(t,n,e)}}))}toggleStateOfGraphics(t,e,i,n){const s=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(n&&s[n]&&s[n].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);HR(t,n,e)}})),e.forEach((t=>{if(n&&s[n]&&s[n].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);WR(t,n,!0,e)}}))}addBothStateOfGraphics(t,e,i,n){const s=t.getMarks(),r=t.getMarkIdByState();s.forEach((t=>{var s;const a=n&&r[n]&&r[n].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)?o&&WR(t,i,!0,l):a&&WR(t,n,!0,l)}))}))}addStateOfGraphics(t,e,i){const n=t.getMarks(),s=t.getMarkIdByState();n.forEach((t=>{var n;const r=i&&s[i]&&s[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)&&r&&WR(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const n=this.getStatedGraphics(t);if(!n||!n.length)return;const s=t.getMarks(),r=t.getMarkIdByState();s.forEach((t=>{if(t){const s=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");s&&s.length&&(i&&r[i]&&r[i].includes(t.id)&&s.forEach((t=>{HR(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&s.forEach((t=>{n.includes(t)&&HR(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const FU={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},UU={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class NU extends QO{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const n=this.getCompiler();return n&&(n.updateLayoutTag(),t&&i&&n.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,n,s,r;super(e),this.type="chart",this.id=GS(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:Gw,height:Yw},this._viewRect={width:Gw,height:Yw},this._viewBox={x1:0,y1:0,x2:Gw,y2:Yw},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(UU).some((t=>!d(e[t])))},this._paddingSpec=aw(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new DT(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new IU(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(s=this._option)||void 0===s?void 0:s.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new LU;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const n=t.getInteractionTriggers();if(n&&n.length){const s=t.getRegion().id;n.forEach((({trigger:t,marks:n})=>{const r=i.find((e=>e.regionId===s&&W(e.config,t)));if(r)r.trigger.marks.push(...n);else{const r=Object.assign(Object.assign({},t),{marks:[...n]});i.push({regionId:s,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=xw.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(JI({},QI("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const n={width:t,height:e};this._canvasRect=n,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=N(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=xw.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]),r=new t(n,Object.assign(Object.assign({},this._modelOption),s));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]);let r;if(p(n.regionId)?r=this.getRegionsInUserId(n.regionId):p(n.regionIndex)&&(r=this.getRegionsInIndex([n.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(n,Object.assign(Object.assign(Object.assign({},this._modelOption),s),{type:n.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(u(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var n;if((null!==(n=i.specKey)&&void 0!==n?n:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const n=xw.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,n,s;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===s||s.call(n,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof eR)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const n=this.getComponentByUserId(t);return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof GR))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof GR)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&(s.markRunning(),s.parseNewData(e,n)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&JT(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=jO(this._spec,this._option,{width:Gw,height:Yw})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const n=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=jC(n),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new DU(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){VO(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=jC(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),n=new Set(e),s=[...t.filter((t=>!n.has(t))),...e.filter((t=>!i.has(t)))];return s.length>0&&s.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const n={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return n.reMake=!0,this.setLayoutTag(!0,null,!1),n;const s=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!W(s,r)&&!this._canChangeSpecKeysWithoutRemake(s,r))return n.reMake=!0,this.setLayoutTag(!0,null,!1),n;const a=Array.from(new Set([...s,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=n.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),n):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(n),n.reMake||(this.reInit(),u&&this._canSkipChartDataStages(n)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),n))}updateChartConfig(t,e){var i,n;this._paddingSpec=aw(null!==(i=this._spec.padding)&&void 0!==i?i:null===(n=this._option)||void 0===n?void 0:n.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{VO(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const n={},s={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));s[l.type]&&(s[l.type]=!1);const u=l.specKey||l.type,d=null!==(h=this._spec[u])&&void 0!==h?h:{};if(_(d)){if(n[u]=n[u]||{specCount:d.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(u,[l.getSpec()],d))return void a.push(l);n[u].componentCount++;const s=null!==(c=d[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(s,d);HO(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):W(r,s)||(i=!0),VO(t,o)}else{const n=l.getSpec(),s=l.updateSpec(d);HO(s)||this._isComponentScaleDomainOnlyUpdate(s)?e.push(l):W(n,d)||(i=!0),VO(t,s)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,n);for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const i=n[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(s).forEach((e=>{if(s[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(FU[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return FU[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let n=!1;const s=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(n=!0,!0):W(t[i],e[i])));return n&&s}_isComponentSpecKey(t){return!!FU[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let n=!1;const s=t,r=e,a=i.every((t=>!!W(s[t],r[t])||!!this._isComponentSpecKey(t)&&(n=!0,!0)));return n&&a}_isOnlySeriesSpecsChanged(t,e,i){var n,s;let r=!1;const a=t,o=e,l=null!==(s=null===(n=this._specTransformer)||void 0===n?void 0:n.getSeriesRelatedSpecKeys())&&void 0!==s?s:{},h=i.every((t=>!!W(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var n,s;let r=!1;const a=t,o=e,l=null!==(s=null===(n=this._specTransformer)||void 0===n?void 0:n.getSeriesRelatedSpecKeys())&&void 0!==s?s:{},h=i.every((t=>!!W(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],n=i[i.length-1];return"number"==typeof n?n:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let n=0,s=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;FU[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,n++,s=s||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),n&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),s?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,n=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],n)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];VO(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:n=0,x2:s,y2:r}=e;i={width:s-t,height:r-n}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=sw(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===n||n.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===n||n.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(E(t[n]))continue;const s=t[n];let r={stateValue:n};r=u(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r),s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(e,i,n){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,n)}setHovered(e,i,n){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,n)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(LT.AFTER_MARK_RENDER_END,e)};this._event.on(LT.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const n=(t=t?G(t):null)?Object.keys(t[0]):null,s=[],r=null!==(i=e.getDatum)&&void 0!==i?i:RT;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||u(e.filter)&&e.filter(o,l))){if(OT(l.type))h.filter((h=>{const c=r(h,l,o,i),u=c&&t.every(((t,e)=>n.every((i=>t[i]==c[e][i]))));u&&(a.push(h),s.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),u=h&&c.findIndex((t=>n.every((e=>t[e]==h[e]))));u>=0&&(c.splice(u,1),a.push(t),s.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const s=r(e,l,o,i);return s&&n.every((e=>t[0][e]==s[e]))}));c&&(a.push(c),s.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),s}_setStateInDatum(t,e,i,n){if(!e)return void this._interaction.clearByState(t);const s=this.filterGraphicsByDatum(e,{filter:i,region:n});this._interaction.updateStateOfGraphics(t,s)}setDimensionIndex(t,e){var i,n;let s=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:r}=i;if(n===PD.dimensionHover||n===PD.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(s=i)}}));const a=d(t)||!s||s.every((t=>NA(t.axis.getScale().type)&&d(t.index))),o=a||s.every((t=>NA(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};s.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{var e,s,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(s=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===s?void 0:s[o])&&void 0!==a?a:n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(s))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const n=this.getComponentsByKey("axes"),s=[];n.forEach((e=>{const i=t(e);!1!==i&&s.push({axis:e,value:i})})),i.showCrosshair(s)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const jU=(t,e)=>{var i;const n=t.spec,{regionId:s,regionIndex:r}=n;if(p(s)){const t=G(s);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},zU={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class WU{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},zU),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,n,s)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=n,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,s),u=Object.assign(Object.assign({},n),c);e?u.theme=h.getTheme(r,t):fw(t,a,c.spec),fw(s,null!=o?o:a,u)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,n;e||(e=this.generateTransform(t,!0));const s={};return this.forEachRegionInSpec(t,e,s),this.forEachSeriesInSpec(t,e,s),null===(i=s.series)||void 0===i||i.forEach(((t,e)=>{var i,n;const r=(null!==(n=null!==(i=jU(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,s),Object.values(null!==(n=s.component)&&void 0!==n?n:{}).forEach((t=>t.forEach(((t,e)=>{var i,n,r;if(t){if(!t.regionIndexes){const e=null!==(n=null!==(i=jU(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const n=t.spec,{seriesId:s,seriesIndex:r}=n;if(p(s)){const t=G(s);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,s);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,n;const r=null===(i=s.region)||void 0===i?void 0:i[t];null===(n=null==r?void 0:r.seriesIndexes)||void 0===n||n.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),s}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var n,s,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(n=t.animation)&&void 0!==n?n:null===(s=this._option.globalInstance)||void 0===s?void 0:s.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var n;return(null!==(n=t.region)&&void 0!==n?n:[]).map(((t,n)=>e(xw.getRegionInType("region"),{spec:t,specPath:["region",n],type:"region",regionIndexes:[n]},i)))}forEachSeriesInSpec(t,e,i){var n;return(null!==(n=t.series)&&void 0!==n?n:[]).map(((t,n)=>e(xw.getSeriesInType(t.type),{spec:t,specPath:["series",n],type:t.type,seriesIndexes:[n]},i)))}forEachComponentInSpec(t,e,i){var n,s,a;const o=[],l=xw.getComponents();let h,c,u,d;const p=[];for(let e=0;e0&&(g=!0,n.forEach((t=>{const n=xw.getComponentInKey(t.type);o.push(e(n,t,i))})))}if(c&&!g){const n=c.getSpecInfo(t,i);(null==n?void 0:n.length)>0&&(g=!0,n.forEach((t=>{const n=xw.getComponentInKey(t.type);o.push(e(n,t,i))})))}return u&&!g&&(null===(s=u.getSpecInfo(t,i))||void 0===s||s.forEach((t=>{o.push(e(u,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:n})=>{var s;null===(s=n.getSpecInfo?n.getSpecInfo(t,i):BI(t,n.specKey,n.type))||void 0===s||s.forEach((t=>{o.push(e(n,t,i))}))})),d&&(null===(a=BI(t,d.specKey,d.type))||void 0===a||a.forEach((t=>{o.push(e(d,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const n="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!n.includes(i.orient))return!1;if(p(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:n,barMinWidth:s,barWidth:r,barGapInGroup:a}=i;let o=!1;S(s)?(t.minBandSize=s,o=!0):S(r)?(t.minBandSize=r,o=!0):S(n)&&(t.minBandSize=n,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class HU extends WU{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:n}=i;let s=null;"top"!==n&&"bottom"!==n||(e.x=!0,s=this._setDefaultXAxisSpec(t)),"left"!==n&&"right"!==n||(e.y=!0,s=this._setDefaultYAxisSpec(t)),"z"===n&&(e.z=!0,s=this._setDefaultZAxisSpec(t)),s&&Object.keys(s).forEach((t=>{d(i[t])&&(i[t]=s[t])})),P(i,"trimPadding")&&mw(i,GO(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class VU extends HU{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),NO(t)}}const GU=(t,e)=>{const i={nodes:{}},{fields:n}=u(e)?e():e;if(!(null==n?void 0:n.length))return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),n=i.some((t=>t.getStack()));if(!n)return;const s=i.some((t=>{var e,i,n,s;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(s=null===(n=t.getSpec())||void 0===n?void 0:n.totalLabel)||void 0===s?void 0:s.visible)})),r=s||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=bT(t,!0);for(const e in o)for(const i in o[e].nodes)CT(o[e].nodes[i],t.getStackInverse(),r,s);if(a)for(const t in o)for(const e in o[t].nodes)AT(o[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),n=t.getStackValueField();e&&n&&ST(o[i],n)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class XU{_beforeInit(){this._dataSet&>(this._dataSet,"stackSplit",GU)}_initStack(){this._stack=new YU(this),this._stack.init()}}const KU={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:PD.dimensionHover};class $U extends uI{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,n=i.getStatedGraphics(this);n&&n.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:n,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},KU,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),n=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{i.filter((e=>e.model===t.series&&e.getVisible())).forEach((i=>{const s=i.getGraphics();if(!s||!s.length)return;const r=s.filter((i=>{const n=RT(i);let s;return s=_(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s}));n.push(...r)}))}))})),n}}$U.type="dimension-hover",$U.defaultOptions=KU;const qU=()=>{xw.registerInteractionTrigger($U.type,$U)},ZU=()=>{xw.registerComposedEvent(PD.dimensionHover,ED),xw.registerComposedEvent(PD.dimensionClick,CD)},JU=t=>t.fieldX[0],QU=t=>t.fieldY[0],tN=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},eN=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},iN=(t,e)=>t?e?JU:tN:e?QU:eN,nN=(t,e,i)=>{var n,s;if(!t)return null;const{x:r,y:a}=e,o=null!==(n=BD(t,(t=>vD(t.getOrient())),e))&&void 0!==n?n:[],l=null!==(s=BD(t,(t=>yD(t.getOrient())),e))&&void 0!==s?s:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,u=new Set;[o,l].forEach((t=>t.forEach((t=>{NA(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&u.add(t)}))));const d=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(u.size>0){if(u.has(t)){const n=sN(t,i,iN(e,NA(t.getScale().type)));n&&d.push(n)}}else{const n=h.size>0;if((n?h:c).has(t)){const s=sN(t,i,iN(e,n));s&&d.push(s)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===d.length&&p("x")):(p("x"),0===d.length&&p("y")),d.length?d:null},sN=(t,e,i)=>{const n=t.positionToData(e,!0);return d(n)?null:rN(t,n,i)},rN=(t,e,i)=>{const n=t.getScale();if(d(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=kD(e,t,"cartesian",null!=i?i:vD(t.getOrient())?JU:QU);return{index:s,value:e,position:n.scale(e),axis:t,data:r}},aN=(t,e,i,n=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((s=>{var r,a,o,l,h,c;const{currentValue:u,cacheInfo:d,labelsComp:g,attributes:f,coordKey:m}=t[s];let v=null,y=0,_=null;if(u.size){const t=Array.from(u.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!u.size&&Number.isFinite(y)&&!Number.isNaN(y),x=n&&!b&&p(d),S=x?d:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let C=0;if(f&&u.forEach((({axis:t,datum:i=""})=>{var n,r,a,o,l,h,c,u,d,p;let g=null;const m=t.getScale();if(NA(m.type))A=m.bandwidth(),0===A&&m.step&&(C=m.step());else if(FA(m.type)){const n="xField"===s?e.fieldX[0]:e.fieldY[0],r="xField"===s?e.fieldX2:e.fieldY2,a=function(t,e,i,n){for(let s=0,r=t.length;s=e)return r}}return null}(e.getViewData().latestData,+i,n,r);if(a){const t="xField"===s?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===s?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[n]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(n=f.label)||void 0===n?void 0:n.visible)&&!x){const e=function(t){let e=0;return P(t,"tick.visible")&&(e+=P(t,"tick.tickSize")),P(t,"label.visible")&&(e+=P(t,"label.space")),e}(t.getSpec()),n=t.getOrient(),s=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[n]&&(S.labels[n].visible=!0,S.labels[n].text=i,"left"===n?(S.labels[n].dx=-e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:s&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===n?(S.labels[n].dx=e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:s&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===n?(S.labels[n].y=0,S.labels[n].dy=-e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:s&&_&&null!==(u=_.attribute.textBaseline)&&void 0!==u?u:"bottom"}):"bottom"===n&&(S.labels[n].dy=e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(d=_.attribute.textAlign)&&void 0!==d?d:"center",textBaseline:s&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[n].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};lN(t,u),"xField"===s?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&oN(S.labels[t],t,f.label)}))}t[s].bandSize=null!=A?A:0,t[s].offsetSize=C,t[s].cacheInfo=S})),t),oN=(t,e,i)=>{const{formatMethod:n,formatter:s}=i,{formatFunc:r,args:a}=MI(n,s,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},lN=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:n}=e.getLayoutStartPoint(),{width:s,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,n),t.x2=Math.max(t.x2,i+s),t.y2=Math.max(t.y2,n+r)}))}))},hN=t=>{const{cacheInfo:e,attributes:i,bandSize:n,offsetSize:s,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+n/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=cN(i,n,s,e.axis),{coordRange:u}=e;c={visible:!0,start:{[r]:Math.max(o+t,u[0]),[a]:l[0]},end:{[r]:Math.min(o+h,u[1]),[a]:l[1]}}}return c},cN=(t,e,i,n)=>{var s,r,a;const o=0===e?i:e;let l=o;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=n.getLayoutRect();l=t.style.size(e,n)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},uN=(t,e)=>{var i;const n=new Map,s=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?s:n).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:n,attributes:{visible:!!n.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:s,attributes:{visible:!!s.size,type:"rect"}}};return aN(c,r,e),c.xField.cacheInfo?hN(c.xField):c.yField.cacheInfo?hN(c.yField):void 0},dN=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],pN=(t,e,i,n,s)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&dN.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,n,n[0].datum,s)))}break;case"dimension":if(null==n?void 0:n.length){if(gN(n).every((t=>{var e;return!RI("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return n.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,n,r.datum,s);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},gN=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},fN={dom:`${Vw}_TOOLTIP_HANDLER_DOM`,canvas:`${Vw}_TOOLTIP_HANDLER_CANVAS`},mN={key:"其他",value:"..."};var vN;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(vN||(vN={}));class yN{constructor(e){this._showTooltipByHandler=(e,i)=>{var n,s,r;if(d(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(d(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=d(null==o?void 0:o.key)&&d(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(n=a.handler)||void 0===n?void 0:n.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,n,s,r,a,o,l,h,c;const{changePositionOnly:u,model:g}=e;if(!u||!this._cacheActiveSpec){const u=this.component.getSpec();if(this._cacheActiveSpec=pN(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&p(u.handler)&&(this._cacheActiveSpec.handler=u.handler);const g=null!==(i=u[this.activeType])&&void 0!==i?i:{},f=null!==(n=this._cacheActiveSpec.updateTitle)&&void 0!==n?n:g.updateTitle,m=null!==(s=this._cacheActiveSpec.updateContent)&&void 0!==s?s:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},mN),t):mN;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,n;return!!this.component.enable&&(!d(e)&&RI(this.activeType,null===(n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===n?void 0:n.spec))}clearCache(){this._cacheActiveSpec=void 0}}class _N extends yN{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,n)}_getDimensionInfo(t){var e,i,n;let s;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),s=null!==(n=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==n?n:[],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(!NA(i.getScale().type))return!1;let n;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){n=e;break}if(p(n))break}return p(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const bN=()=>{xw.registerTooltipProcessor("dimension",_N)};class xN extends yN{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var n,s,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,u=null===(n=o.getSpec())||void 0===n?void 0:n.tooltip,d=null===(s=null==u?void 0:u.mark)||void 0===s?void 0:s.checkOverlap;let p=!1;if(!0===d||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==d){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),n={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},n),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(n.x,n.y,zi.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(RT(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,n;const s=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===s){const e=t.model,s=e.tooltipHelper,r=null==s?void 0:s.activeTriggerSet.mark,a=null==s?void 0:s.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(n=!0)}else if("component"===s){const e=t.model,s=t.node;if("label"===e.name&&s){const t=e.getLabelInfoByTextGraphic(s),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:s.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(n=!0)}}return{tooltipInfo:i,ignore:n}}}const SN=()=>{xw.registerTooltipProcessor("mark",xN)};class AN extends yN{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:G(n),series:s}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let n;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,s=e.tooltipHelper,r=null==s?void 0:s.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const s=this.component.getSpec()[this.activeType];((null==s?void 0:s.triggerMark)?G(s.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(n={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:n,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:n}=t,s=e;if(["line","area"].includes(i.type))return G(n);const r=s.getViewData().latestData,a=s.getSeriesField();if(!a)return r;const o=G(n)[0][a];return r.filter((t=>t[a]===o))}}const CN=()=>{xw.registerTooltipProcessor("group",AN)};class wN extends NU{constructor(){super(...arguments),this.transformerConstructor=VU,this.type="line",this.seriesType=DC.line}_setModelOption(){this._modelOption.getDimensionInfo=nN,this._modelOption.getDimensionInfoByValue=rN,this._modelOption.getRectByDimensionData=uN}}wN.type="line",wN.seriesType=DC.line,wN.transformerConstructor=VU,V(wN,XU);function TN(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const kN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:TN(t,e)}),MN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:TN(t,e)}),BN={type:"fadeIn"},EN={type:"growCenterIn"};function PN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return BN;case"scaleIn":return EN;default:return kN(t)}}var ON=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=s.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=u(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=u(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===s[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:s[t].attribute.width:e.maxLineWidth=null!==(n=r.labelLimit)&&void 0!==n?n:s[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),s[t].setAttributes(e)}}return s}layoutArcLabels(t,e,i,n,s,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),n.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(n[i])&&!d(s[i])){const t=n[i]?n[i]:null,r=s[i]?s[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=Vt(h.endAngle-d/2),g=zt(c,h.outerRadius,o),f=zt(c,a+e.line.line1MinLength,o),m=new DN(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=zt(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):ZD(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var n,s;const r=e,a=r.spaceWidth,o=null!==(n=r.position)&&void 0!==n?n:"inside",l=null!==(s=r.offsetRadius)&&void 0!==s?s:-a;return t.forEach((t=>{var i,n,s;const{labelSize:h,radian:c}=t,u=t.innerRadius,d=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(d,h.height))p=0;else{let t;t=c>=Math.PI?u:Math.max(u,h.height/2/Math.tan(c/2)),p=d-t-a}!0!==r.rotate&&(p=d-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?u-l+y:"inside-center"===o?u+(d-u)/2:d+l-y,t.labelPosition=zt(t.circleCenter,v,t.middleAngle),t.labelLimit=f,lt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle;let a=null!==(s=r.offsetAngle)&&void 0!==s?s:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var n,s,r;const a=null!==(n=i[0].attribute.x)&&void 0!==n?n:0,o=2*(null!==(s=i[0].attribute.y)&&void 0!==s?s:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ZD(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=ZD(n.quadrant)?{x:t.x+s.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-s.width/2-this._line2MinLength-h,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const n=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:n}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-s),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const n of t)this._computePointB(n,h,e,i),this._computeX(n,e,i)}const c=2*a;return t.forEach((t=>{var i,n;t.labelVisible&&(ht(t.pointB.x,this._line2MinLength+h)||lt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var n;const s=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(n=e.layout)||void 0===n?void 0:n.align,c=e.spaceWidth,{labelPosition:u,quadrant:d,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=ZD(d)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+s.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):u.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,n,s,r,a,o;const l=e,h=null!==(n=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=l.textStyle)||void 0===s?void 0:s.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?ZD(t.quadrant)?"left":"right":ZD(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,n){var s;n[0].attribute.x;const r=2*(null!==(s=n[0].attribute.y)&&void 0!==s?s:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,d)}else if(-1!==u&&-1===d){const i=p.labelPosition.y;cn?(e.labelPosition.y=n-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,s[h].originIndex)):c=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computePointB(t,e,i,n){const s=i;let r=0;n.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=s.line.line1MinLength;if("none"===s.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const n=t.circleCenter,s=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(s+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(n.y-r.y)**2)-h;A(c)?t.pointB={x:n.x+c*(ZD(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const n=t.circleCenter,s={width:2*n.x,height:2*n.y};let r=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=s,c=this.computeRadius(a,e.width,e.height),u=this._computeLayoutRadius(h/2,e,i),d=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(ot(l/2,d))g=0,f=1,m=-p;else if(ot(h/2,p))g=1,f=0,m=-d;else{const t=-1/(p/d);g=t,f=-1,m=p-t*d}const v=function(t,e,i,n,s,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-s)**2;return a<0?[]:0===a?[{x:n,y:t}]:[{x:Math.sqrt(a)+n,y:t},{x:-Math.sqrt(a)+n,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-n)**2;return a<0?[]:0===a?[{x:e,y:s}]:[{x:e,y:Math.sqrt(a)+s},{x:e,y:-Math.sqrt(a)+s}]}const a=(e/t)**2+1,o=2*((i/t+n)*(e/t)-s),l=o**2-4*a*((i/t+n)**2+s**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),u=-(e*h+i)/t;return 0===l?[{x:u,y:h}]:[{x:u,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-u,0,u);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?ot(v[0].y,v[1].y)?lt(t.middleAngle,-Math.PI)&&ht(t.middleAngle,0)||lt(t.middleAngle,Math.PI)&&ht(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-s;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let n=-1,s=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const s=this.parent,r=!!(null==n?void 0:n.removeFromParent),a=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=s?s:this.parent)||void 0===i||i.removeChild(this)),dL(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,uL(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},n=[],s=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?n.push(t):(i.pendingCount-=1,s.push(t))})),n.length?(s.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}UN.defaultAttributes={pickable:!1};class NN extends GR{constructor(){super(...arguments),this.type=NN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}NN.type="rect";const jN=()=>{vS(),iS(),vL("rect",RN),xw.registerMark(NN.type,NN),Jg.registerBuiltInAnimate("growHeightIn",RE),Jg.registerBuiltInAnimate("growHeightOut",IE),Jg.registerBuiltInAnimate("growWidthIn",qE),Jg.registerBuiltInAnimate("growWidthOut",ZE),Jg.registerBuiltInAnimate("growCenterIn",EE),Jg.registerBuiltInAnimate("growCenterOut",PE),xw.registerGraphicComponent("rect",zh)},zN=Object.assign(Object.assign({},VI),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function WN(t,e,i){var n,s;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:n,width:s,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===n){const t=i-this._viewPosition.y,e=ut(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ut(t-o/2,l,h);c=t/s,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:n,y:s}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?n:s,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=YN(),a="browser"===Vg.env?Vg:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:n}=this.stage.eventPointTransform(t);let s,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:u}=this.attribute,d=ut(u[1]-u[0],0,1);return"vertical"===e?(s=n,a=s-this._prePos):(s=i,a=s-this._prePos),r=c>0&&d<1?a/c*(1-d):0,[s,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[n,s]=this._computeScrollValue(t);this.setScrollRange([i[0]+s,i[1]+s],!0),this._prePos=n},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:XN[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,n=this.getScrollRange(),[s,r]=this._computeScrollValue(t),a=[n[0]+r,n[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:dt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:n=[0,1],range:s,realTime:r=!0}=this.attribute,a=dt(t,n[0],n[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:s,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",XN[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===Vg.env?Vg:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),u=this._getSliderPos(dt(n,s[0],s[1])),d=u[1]-u[0];let p;this._sliderSize=d,p="horizontal"===t?{x:u[0],y:c.y1,width:d,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:d};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Be(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,s,r,a]=Be(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:Math.max(0,t-(a+s)),height:Math.max(0,e-(n+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:n,height:s,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?n:s,l="horizontal"===e?r:a,h=ut(t[0],0,1),c=ut(t[1],0,1),u=ut(c-h,0,1),d=Math.max(u*o,i),p=Math.max(o-d,0),g=l+h/Math.max(1-u,1e-12)*p;return[g,g+d]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_clearDragEvents(){const t=YN(),e="browser"===Vg.env?Vg:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===Vg.env?Vg:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}KN.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class $N extends oL{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}ox(),Cx();class qN extends $N{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},qN.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}qN.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},ox(),iS();class ZN extends $N{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},ZN.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}function JN(){ox(),wS(),RS()}ZN.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};const QN={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};JN();class tj extends oL{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},tj.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(aj.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,n,s;const r=t.target;if(r&&r.name&&r.name.startsWith(aj.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aj.focus||"focus"===o){const n=a.hasState(sj.focus);a.toggleState(sj.focus),n?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[sj.unSelected,sj.unSelectedHover,sj.focus],t),this._setLegendItemState(e,sj.selected,t)})):(this._setLegendItemState(a,sj.selected,t),this._removeLegendItemState(a,[sj.unSelected,sj.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[sj.selected,sj.selectedHover,sj.focus],t),this._setLegendItemState(e,sj.unSelected,t))})))}else{null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((t=>{t.removeState(sj.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(sj.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rj.legendItemClick,a,t);i?(this._removeLegendItemState(a,[sj.selected,sj.selectedHover],t),this._setLegendItemState(a,sj.unSelected,t)):(this._setLegendItemState(a,sj.selected,t),this._removeLegendItemState(a,[sj.unSelected,sj.unSelectedHover],t))}else this._setLegendItemState(a,sj.selected,t),this._removeLegendItemState(a,[sj.unSelected,sj.unSelectedHover],t),null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[sj.selected,sj.selectedHover],t),this._setLegendItemState(e,sj.unSelected,t))}))}this._dispatchLegendEvent(rj.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,sj.selected),this._removeLegendItemState(e,[sj.unSelected,sj.unSelectedHover])):(this._removeLegendItemState(e,[sj.selected,sj.selectedHover]),this._setLegendItemState(e,sj.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:n,defaultSelected:s,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=ej,spaceRow:l=ij,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:u,isHorizontal:d,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:d?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:C}=this._itemContext,w=0,T=0;const k=[];for(let t=g,e=u.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=u[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(s)&&(e=s.includes(y.label));const i=this._renderEachItem(y,e,t,u),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),d?(p(n)&&(f&&a?(C=Math.ceil((S+g)/n),b=C>1):S+g>n&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||k.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),C+=1,S=0,A+=T+l,T=0,k.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),k.push(i)):(p(v)&&(f&&a?(C=Math.ceil((A+m)/v),b=C>1):v<=m?(C+=1,b=!0,A=0,t>0&&(S+=w+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=C,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=C),r||(this._itemContext.startIndex=u.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:n,maxHeight:s}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,s-this._parsedPadding[0]-this._parsedPadding[2]);const a=rA.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:u,height:d}=t,g=[];p(c)&&g.push(c),p(u)&&g.push(u),g.length&&(p(n)&&g.push(n),this._itemWidthByUser=K(g)),p(d)&&(this._itemHeightByUser=d);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,n){var s,r;const{label:a,value:o}=this.attribute.item,l=n.AABBBounds,h=i.AABBBounds,c=l.width(),u=h.width();let d=!1;"labelFirst"===t?u>e?d=!0:n.setAttribute("maxLineWidth",e-u):"valueFirst"===t?c>e?d=!0:i.setAttribute("maxLineWidth",e-c):c+u>e&&(d=!0),d&&(n.setAttribute("maxLineWidth",Math.max(e*(null!==(s=a.widthRatio)&&void 0!==s?s:.5),e-u)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,n){var s,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:u,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,n),A=this._handleStyle(y,t,e,i,n),C=this._handleStyle(b,t,e,i,n),w=this._handleStyle(x,t,e,i,n),T=Be(c);let k;!1===x.visible?(k=rA.group({x:0,y:0,cursor:null===(s=w.style)||void 0===s?void 0:s.cursor}),this._appendDataToShape(k,aj.item,t,k)):(k=rA.group(Object.assign({x:0,y:0},w.style)),this._appendDataToShape(k,aj.item,t,k,w.state)),k.id=`${null!=a?a:o}-${i}`,k.addState(e?sj.selected:sj.unSelected);const M=rA.group({x:0,y:0,pickable:!1});k.add(M);let B,E=0,O=0,R=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);O=_(i)?i[0]||0:i,R=P(v,"space",8);const n=rA.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(n,aj.itemShape,t,k,S.state),n.addState(e?sj.selected:sj.unSelected),M.add(n)}let I=0;if(u){const e=P(g,"size",10);B=rA.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,aj.focus,t,k),I=e}const D=y.formatMethod?y.formatMethod(o,t,i):o,L=mA(Object.assign(Object.assign({x:O/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:D,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(L,aj.itemLabel,t,k,A.state),L.addState(e?sj.selected:sj.unSelected),M.add(L);const F=P(y,"space",8);if(p(l)){const n=P(b,"space",u?8:0),s=b.formatMethod?b.formatMethod(l,t,i):l,r=mA(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:C.style.fontSize},C.style),{text:s,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,aj.itemValue,t,k,C.state),r.addState(e?sj.selected:sj.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-O-R-F-I-n;this._autoEllipsis(m,t,L,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-T[1]-T[3]-I-n}):r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2))}else r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2));E=n+(r.AABBBounds.empty()?0:r.AABBBounds.x2),M.add(r)}else this._itemWidthByUser?(L.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-O-R-I),E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2)):E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2);B&&(B.setAttribute("x",E),M.add(B));const U=M.AABBBounds,N=U.width();if("right"===f){const t=U.x2,e=U.x1;M.forEachChildren(((i,n)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=U.height(),z=p(this.attribute.item.width)?this.attribute.item.width:N+T[1]+T[3],W=this._itemHeightByUser||j+T[0]+T[2];return k.setAttributes({width:z,height:W}),B&&B.setAttribute("visible",!1),M.translateTo(-U.x1+T[3],-U.y1+T[0]),k}_createPager(t){var e,i;const{disableTriggerEvent:n,maxRow:s}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new tj(Object.assign(Object.assign({layout:1===s?"horizontal":"vertical",total:r(this._itemContext.pages)},U({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:n})):new tj(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:n,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new KN(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new KN(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:n}=this.attribute,{totalPage:s,isHorizontal:r}=this._itemContext,a=n&&n.position||"middle";if(this._pagerComponent.setTotal(s),r){let n;n="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:n})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,n=e.AABBBounds;let s,r;return t?(r=n.width(),s=r/i.width()):(r=n.height(),s=r/i.height()),s}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:n,currentPage:s,totalPage:r}=this._itemContext,a=(s-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),n?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:n=!0,animationDuration:s=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:n}=e.attribute,{width:s,height:r}=e.getSliderRenderBounds(),a="vertical"===n?t.deltaY/r:t.deltaX/s;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",mt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:n=2,item:s={},pager:r={}}=this.attribute,{spaceCol:a=ej,spaceRow:o=ij}=s,l=this._itemsContainer,{space:h=nj,defaultCurrent:c=1}=r,u=lj(r,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(d){if(m=(n-1)*o+this._itemHeight*n,f=e,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;v<_+i&&e>0&&(_=0,b+=n+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+n}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(d?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=rA.group({x:0,y:t,width:d?v:f,height:d?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(d?m+o:f+a,d?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:n={},pager:s={}}=this.attribute,{spaceCol:r=ej,spaceRow:a=ij}=n,o=this._itemsContainer,{space:l=nj,defaultCurrent:h=1}=s,c=lj(s,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,d=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(u)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=d-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],n=f,s=Math.floor(n/(a+e));f=s*(a+e),v=Math.ceil(t.length/s)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,n=v,s=m;v=Math.floor((m+i)/f)+1,m+=a+i,n!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=s+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(u){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=rA.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=s.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(u?g:f,u?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:n=16,gradientStops:s}=e;if(!i||!s)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=s.map((t=>({offset:n*t.offset/o,color:t.color}))),h=s.map((t=>({offset:(o-n*t.offset)/o,color:t.color}))),c=rA.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];ot(ut(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ot(ut(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(sj.selected)?this._setLegendItemState(t,sj.selectedHover,e):this._setLegendItemState(t,sj.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aj.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rj.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(sj.unSelectedHover)||t.hasState(sj.selectedHover))&&(i=!0),t.removeState(sj.unSelectedHover),t.removeState(sj.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(sj.unSelectedHover)&&!t.hasState(sj.selectedHover)||(i=!0),t.removeState(sj.unSelectedHover),t.removeState(sj.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===aj.focus),!1);n&&n.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rj.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rj.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let n=!1;t.hasState(e)||(n=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==aj.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,!0))})),n&&this._dispatchLegendEvent(rj.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let n=!1;e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==aj.focus&&e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)}))})),n&&this._dispatchLegendEvent(rj.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(sj.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n,s={}){t.name=e,t.data=i,t.delegate=n,t.states=U({},hj,s)}_dispatchLegendEvent(t,e,i){const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(sj.selected),currentSelectedItems:n,currentSelected:s,event:i})}_handleStyle(t,e,i,n,s){const r={};return t.style&&(u(t.style)?r.style=t.style(e,i,n,s):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(u(t.state[a])?r.state[a]=t.state[a](e,i,n,s):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};cj.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:ej,spaceRow:ij,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:nj,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const uj=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],n=[t.key,...e.map((t=>null==t?void 0:t.key))],s=[t.value,...e.map((t=>null==t?void 0:t.value))];return U(t,...e,{shape:i.every(d)?void 0:U({},...i),key:n.every(d)?void 0:U({},...n),value:s.every(d)?void 0:U({},...s)})},dj=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},pj={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:lA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:lA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:lA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new ue).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},gj=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];ox(),iS(),wS(),RS(),fS();let fj=class t extends oL{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:U({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:n,panel:s,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const u=Be(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},s),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:u[3],y:u[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",U({symbolType:"circle"},d.shape,{visible:$S(d)&&$S(d.shape)}),"symbol"),"object"!=typeof d.value.text||null===d.value.text||"rich"!==d.value.text.type&&"html"!==d.value.text.type?d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:$S(d)&&$S(d.value)},dj(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=d.value.text)&&void 0!==e?e:"",visible:$S(d)&&$S(d.value)},d.value),"text"):"rich"===d.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:$S(d)&&$S(d.value)},dj(d.value)),"richtext"):"html"===d.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:d.value.text.text},uA),d.value),visible:$S(d)&&$S(d.value),width:d.value.width,height:d.value.height,wordBreak:d.value.wordBreak,textAlign:d.value.textAlign,textBaseline:d.value.textBaseline,singleLine:!1,textConfig:[]},d.value),"richtext"));const g=$S(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:f,textBaseline:m}=d.value,v=s.width-u[3]-u[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",d.height):"middle"===m?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const y=$S(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),n&&n.length){this._tooltipContent.setAttribute("x",u[3]),this._tooltipContent.setAttribute("y",u[0]+y);let e=0;n.forEach(((i,n)=>{const s=t.getContentAttr(this.attribute,n);if(!$S(s))return;const l=`tooltip-content-${n}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),u=s.shape.size+s.shape.spacing;let d="right"===c?(o?u:0)+($S(s.key)?r+s.key.spacing:0)+($S(s.value)?a:0):0;this._createShape("right"===c?d-s.shape.size/2:d+s.shape.size/2,s,h,l),o&&("right"===c?d-=u:d+=u);const g=this._createKey(s,h,l);g&&(vA(c,g,s.key.textAlign,d,r),g.setAttribute("y",0),"right"===c?d-=r+s.key.spacing:d+=r+s.key.spacing);const f=this._createValue(s,h,l);if(f){let t="right";p(s.value.textAlign)?t=s.value.textAlign:$S(s.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),vA(c,f,t,d,a),f.setAttribute("y",0)}e+=s.height+s.spaceRow}))}}_createShape(t,e,i,n){var s;if($S(e.shape))return i.createOrUpdateChild(`${n}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(s=$s(e.key.lineHeight,e.key.fontSize))&&void 0!==s?s:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var n;if($S(t.key)){let s;return s=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},dj(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.key.text)&&void 0!==n?n:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},dj(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},uA),t.key)},"richtext"),s}}_createValue(t,e,i){var n;if($S(t.value)){let s;return s=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},dj(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.value.text)&&void 0!==n?n:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},dj(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),s}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>gj.includes(t)))?(this._mergeAttributes(e,n),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,u=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?u-=i+s:"middle"===l?u-=i/2:u+=s,c+e>h.x2&&(c-=e+n),u+i>h.y2&&(u-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&$S(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach((([e,i],a)=>{var c;const{key:u,value:d,shape:p,spaceRow:g}=i,f=$S(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=dA(u),y=dA(d);let _=0;if($S(u)){const{width:t,height:e}=v.quickMeasure(u.text);l.push(t),_=Math.max(_,e)}if($S(d)){const{width:t,height:e}=y.quickMeasure(d.text);h.push(t),_=Math.max(_,e)}f&&ta[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=u,e.valueWidth=d}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return uj({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return uj({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};fj.defaultAttributes=pj;class mj extends yU{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),OA(this._regions,(t=>{vD(this.getOrient())?YL(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):YL(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=mw({},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 di(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new xR(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,n,s,r,a,o;const l=Oe.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(n=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===n?void 0:n.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,u=(null===(r=null===(s=this._spec.layers)||void 0===s?void 0:s[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",d="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?d(u,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const n=[],s=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();s&&s.length&&n.push(s.map((e=>GL(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&n.push(r.map((e=>GL(e.value,this._getNormalizedValue([e.value],t))))),n}registerTicksTransform(){const t=`${this.type}-ticks`;return GT(this._option.dataSet,t,fU),t}transformScaleDomain(){}}mj.type=r.cartesianTimeAxis,mj.specKey="axes",mj.builtInTheme={axis:QF,axisX:tU,axisY:eU};class vj extends yU{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new PC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return GT(this._option.dataSet,t,fU),t}transformScaleDomain(){}}vj.type=r.cartesianLogAxis,vj.specKey="axes",vj.builtInTheme={axis:QF,axisLinear:vU,axisX:tU,axisY:eU},V(vj,dU);class yj extends yU{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new OC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return GT(this._option.dataSet,t,fU),t}transformScaleDomain(){}}yj.type=r.cartesianSymlogAxis,yj.specKey="axes",yj.builtInTheme={axis:QF,axisLinear:vU,axisX:tU,axisY:eU},V(yj,dU);const _j={barWidth:!0,barMinWidth:!0,barMaxWidth:!0,barGapInGroup:!0,barMinHeight:!0,stackCornerRadius:!0};class bj extends mD{constructor(){super(...arguments),this.type=DC.bar,this._barMarkName="bar",this._barMarkType="rect",this.transformerConstructor=VN,this._bandPosition=0,this._getLinearBarRange=(t,e)=>{let[i,n]=[t,e].sort(((t,e)=>t-e));const s=n-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,n=n-t}const r=n-i,a=lw(this._spec.barMinWidth||2,s);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[GI]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):ZC(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[YI]):ZC(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const n=ZC(this._dataToPosX(t),e,i),s=ZC(this._dataToPosX1(t),e,i);return this._getLinearBarRange(n,s)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[XI]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):ZC(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[KI]):ZC(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const n=ZC(this._dataToPosY(t),e,i),s=ZC(this._dataToPosY1(t),e,i);return this._getLinearBarRange(n,s)},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)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),_j)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},bj.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:iD(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(bj.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const n=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let s;if(GT(this._option.dataSet,"addVChartProperty",EI),n){const t=([t],{scaleDepth:e})=>{var i,n;let s=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[n,s]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[n]}-${t[s]}`;r[e]||(r[e]={[n]:t[n],[s]:t[s]},i.push(r[e]))})),i};GT(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();s=new di(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:WI.bind(this),call:HI}},!1),null==e||e.target.addListener("change",s.reRunAllTransform)}this._barBackgroundViewData=new xR(this._option,s)}init(t){super.init(t),this.initRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,n,s,r,a;e._bar_series_position_calculated=!0,t?(i=KI,n=XI,s="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=YI,n=GI,s="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=bT(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)WN(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:n,startMethod:s,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var n,s;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(s=(n=this[o]).getScale)||void 0===s?void 0:s.call(n,0),h=this[o].isInverse(),c=this._spec.barMinHeight,u=ZC(this[r](t),l,i),d=ZC(this[a](t),l,i);let p=Math.abs(u-d);p<=0&&!JC(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,n;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&d(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let n=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,d=1/0,g=-1/0;i.values.forEach((e=>{const i=e[Qw],s=e[tT],r=e[eT],u=e[iT];if(n=Math.min(n,i,s),o=Math.max(o,i,s),t){const t=e[a?XI:GI],i=e[a?KI:YI];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(u)&&(c=!0,d=Math.min(d,r,u),g=Math.max(g,r,u))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[Qw]:n,[tT]:o}),c?{[eT]:d,[iT]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,s),x1:t?h:this._getBarXEnd(f,s),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(zh(Object.assign(Object.assign({},m),{cornerRadius:u(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,n,s;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>ZC(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>ZC(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,n,s,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=d(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),n=X(t);return n<0?e.scale(n):i>0?e.scale(i):e.scale(0)}}},n=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,s=fD(this);this._barMark.setAnimationConfig(JI(null===(e=xw.getAnimationInKey("bar"))||void 0===e?void 0:e(i,n),QI(this._barMarkName,this._spec,this._markAttributeContext),s))}_getBarWidth(t,e){var i,n;const s=this._groups?this._groups.fields.length:1,r=d(e)?s:Math.min(s,e),a=null!==(n=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==n?n:6,o=p(this._spec.barWidth)&&r===s,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=lw(this._spec.barWidth,a)),l&&(c=Math.max(c,lw(this._spec.barMinWidth,a))),h&&(c=Math.min(c,lw(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,n){var s,r,a,o,l;let h,c,u;"horizontal"===t?(h=this.getYAxisHelper(),c="height",u="barBackground"===n?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",u="barBackground"===n?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(s=h.getBandwidth)||void 0===s?void 0:s.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const c=t[r],u=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],d=u.length,p=lw(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=u.indexOf(e[c]);r===t.length-1?(n+=d*y+(d-1)*p,s+=g*(y+p)):(s+=g*(n+p),n+=n+(d-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-n/2+s}const _=FA(g.type||"band");return u(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,n=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._barBackgroundViewData)||void 0===n||n.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}bj.type=DC.bar,bj.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},bj.mark=zN,bj.transformerConstructor=VN;const xj=()=>{OU(),jN(),xw.registerAnimation("bar",((t,e)=>({appear:PN(t,e),enter:kN(t,!1),exit:MN(t,!1),disappear:{duration:sI.disappear.duration}}))),nU(),_U(),xw.registerSeries(bj.type,bj)};class Sj extends HU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),NO(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const n=t.series.some((t=>"horizontal"===t.direction)),s=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(n?["left","right"]:["top","bottom"]).includes(t.orient)));if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(s,e,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class Aj extends NU{constructor(){super(...arguments),this.transformerConstructor=Sj,this.type="bar",this.seriesType=DC.bar}_setModelOption(){this._modelOption.getDimensionInfo=nN,this._modelOption.getDimensionInfoByValue=rN,this._modelOption.getRectByDimensionData=uN}}Aj.type="bar",Aj.seriesType=DC.bar,Aj.transformerConstructor=Sj,V(Aj,XU);const Cj=[...FD,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class wj extends UD{constructor(){super(...arguments),this.type=wj.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return Cj}_getIgnoreAttributes(){return[]}}wj.type="area";class Tj extends FI{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of G(e)){let e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const kj=Object.assign(Object.assign(Object.assign({},VI),OD),{area:{name:"area",type:"area"}}),Mj=()=>{xw.registerAnimation("area",oI),lI(),aI()};class Bj extends ML{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,n;const s=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!s||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,u=!1!==l.visible&&!1!==(null===(n=l.style)||void 0===n?void 0:n.visible),d=!1!==h.visible&&!1!==(null===(s=h.style)||void 0===s?void 0:s.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||d&&!u)&&(g=h,f=l),l.style=mw({},f.style,g.style),l.state=mw({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class Ej extends mD{constructor(){super(...arguments),this.type=DC.area,this.transformerConstructor=Bj,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),RD)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(Ej.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,n,s,r;const a=null!==(n=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==n?n:null===(r=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.curveType,o=a===AI?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return ZC(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return ZC(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[tT]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(JI(null===(e=xw.getAnimationInKey("line"))||void 0===e?void 0:e(s,r),QI("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(JI(null===(i=xw.getAnimationInKey("area"))||void 0===i?void 0:i(s,r),QI("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=fD(this);this._symbolMark.setAnimationConfig(JI(null===(n=xw.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),QI("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new Tj(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,n,s,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}Ej.type=DC.area,Ej.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},Ej.mark=kj,Ej.transformerConstructor=Bj,V(Ej,ID);const Pj=()=>{OU(),AU(),wL(),xw.registerMark(wj.type,wj),vS(),qb(),bL(),AL(),hI(),xw.registerGraphicComponent("area",vh),kL(),Mj(),nU(),_U(),xw.registerSeries(Ej.type,Ej)};class Oj extends HU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),NO(t)}}class Rj extends NU{constructor(){super(...arguments),this.transformerConstructor=Oj,this.type="area",this.seriesType=DC.area}_setModelOption(){this._modelOption.getDimensionInfo=nN,this._modelOption.getDimensionInfoByValue=rN,this._modelOption.getRectByDimensionData=uN}}Rj.type="area",Rj.seriesType=DC.area,Rj.transformerConstructor=Oj,V(Rj,XU);class Ij extends pD{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const n=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:n,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};FA(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:[]};FA(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)&&gD(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Dj(t){return YS(t)?Number.parseFloat(t):0}const Lj=(t,e)=>{const{asStartAngle:i,asEndAngle:n,asMiddleAngle:s,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:u}=e,d=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&u&&Fj(m,d,c))return[];const v=(t,e,a)=>{t[i]=e,t[n]=e+a,t[s]=e+a/2,t[r]=a,t[o]=Vt(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[d]))),S=g-p;let A=p,C=S,w=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const n=Math.pow(10,e),s=t.map((t=>(isNaN(t)?0:t)/i*n*100)),r=100*n,a=s.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=s.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/n))}(x);if(m.forEach(((t,e)=>{const i=t[KL],n=y?i/y:0;let s=n*S;s{v(e,p+i*t,t)}))}else{const t=C/w;A=p,m.forEach((e=>{const i=e[r]===f?f:e[KL]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][n]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},Fj=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===Dj(t[e])))||!i&&0===t.reduce(((t,i)=>t+Dj(i[e])),0)));function Uj(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const Nj=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Uj(t,!0,tk.appear)}),jj={type:"fadeIn"},zj=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Uj(t,!0,tk.enter)}),Wj=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Uj(t,!0,tk.exit)});function Hj(t,e){if(!1===e)return{};switch(e){case"fadeIn":return jj;case"growRadius":return Nj(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Nj(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Vj extends GR{constructor(t,e){super(t,e),this.type=Gj.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n)=>{var s;return n+(null!==(s=this.getAttribute("radiusOffset",e,i))&&void 0!==s?s:0)},this.computeCenter=(t,e,i="normal",n)=>zt({x:0,y:0},this.getAttribute("centerOffset",e,i),e[QL])[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 Gj extends Vj{constructor(){super(...arguments),this.type=Gj.type}}Gj.type="arc";const Yj=()=>{vS(),Lb(),vL("arc",LN),Jg.registerBuiltInAnimate("growRadiusIn",XE),Jg.registerBuiltInAnimate("growRadiusOut",KE),Jg.registerBuiltInAnimate("growAngleIn",ME),Jg.registerBuiltInAnimate("growAngleOut",BE),xw.registerGraphicComponent("arc",gh),xw.registerMark(Gj.type,Gj)},Xj=Object.assign(Object.assign({},VI),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Kj extends aD{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let n=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);n=mw({},this._theme,i,t);const s=(t,e)=>mw({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(n.label)?n.label=n.label.map((t=>s(t.position,t))):n.label=s(n.label.position,n.label)}return{spec:n,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:n,centerY:s}=t;return p(n)&&(i.centerX=n),p(s)&&(i.centerY=s),Object.keys(i).length>0?i:void 0}}const $j=`${Vw}_LABEL_VISIBLE`,qj={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},Zj={outerRadius:!0};class Jj extends Ij{constructor(){super(...arguments),this.transformerConstructor=Kj,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:nw(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:nw(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=iF,this._endAngle=nF,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[QL];if(d(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t);return zt(this.computeCenter(t),(i+n)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,n,s,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,n=2*Math.PI;const s=p(t),r=p(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(p(this._spec.startAngle)?Nt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?Nt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?Nt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(n=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==n&&n,this._showAllZero=null!==(s=this._spec.showAllZero)&&void 0!==s&&s,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;GT(this._dataSet,"pie",Lj),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?Nt(this._spec.minAngle):0,asStartAngle:qL,asEndAngle:ZL,asRatio:$L,asMiddleAngle:QL,asRadian:eF,asQuadrant:tF,asK:JL,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new di(this._dataSet,{name:`${Vw}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new xR(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Jj.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:$w,groupKey:this._seriesField,isSeriesMark:!0},{morph:iD(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return RA(qL)(t)}endAngleScale(t){return RA(ZL)(t)}_computeLayoutRadius(){return((t,e,i,n)=>{const s=t();if(S(s))return s;if(u(s))return s(e(),i());const r=e();if("auto"===s&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=n();return Ht(r,i(),t,e)}return Math.min(r.width/2,r.height/2)})((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:QC(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:QC(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const n=this._emptyArcMark;n&&this.setMarkStyle(n,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const n in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[n]),n,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:RA($j).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===n?void 0:n.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===n?void 0:n.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Zj),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const n=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];n.forEach((t=>{i[t]=!0}));const s=super._compareSpec(t,e,i);return t=null!=t?t:{},n.some((i=>t[i]!==e[i]))&&(s.reRender=!0,s.change=!0),s}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[QL];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const n=this.computeDatumRadius(t);return zt(this.computeCenter(t),n,i)}initAnimation(){var t,e,i;const n={growFrom:(t,e,i)=>{var n,s;if(i===tk.appear)return this._startAngle;if(i===tk.disappear)return this._endAngle;const r=[tk.disappear,tk.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[Kw];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Kw]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Kw])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Kw])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+zt({x:0,y:0},a,e[QL]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+zt({x:0,y:0},a,e[QL]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+zt({x:0,y:0},a,e[QL]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+zt({x:0,y:0},a,e[QL]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=JI(null===(i=xw.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(n,null!=s?s:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Jj.transformerConstructor=Kj,Jj.mark=Xj,Jj.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class Qj extends Jj{constructor(){super(...arguments),this.type=DC.pie}}Qj.type=DC.pie;const tz=()=>{Yj(),xw.registerAnimation("pie",((t,e)=>({appear:Hj(t,e),enter:zj(t),exit:Wj(t),disappear:{duration:sI.disappear.duration}}))),xw.registerAnimation("emptyCircle",((t,e)=>({appear:Hj(t,e)}))),xw.registerSeries(Qj.type,Qj)};class ez extends WU{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,n;const s=G(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(n=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===n?void 0:n.innerRadius;return p(r)&&s.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),s}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class iz extends ez{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class nz extends NU{constructor(){super(...arguments),this.transformerConstructor=iz}}nz.transformerConstructor=iz;class sz extends nz{constructor(){super(...arguments),this.transformerConstructor=iz,this.type="pie",this.seriesType=DC.pie}}sz.type="pie",sz.seriesType=DC.pie,sz.transformerConstructor=iz;class rz extends WU{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var n;if("bar"===e.type){const s=this._findBandAxisBySeries(e,i,t.axes);if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize){const t=g(e.autoBandSize)&&null!==(n=e.autoBandSize.extend)&&void 0!==n?n:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(s,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{P(e,"trimPadding")&&mw(e,GO(this.type,t))})),this._transformAxisSpec(t)}}const az=(t,e)=>{if(!t)return null;const i=BD(t,(t=>"angle"===t.getOrient()),e),n=BD(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||n&&n.length))return null;const s=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&NA(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=EA({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,n=K(e),s=X(e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,h);const g=PA(u),f=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=kD(v,t,"polar",r);s.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),n&&n.forEach((t=>{var e;const n=t.getScale(),l=null==n?void 0:n.range();if(n&&NA(n.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=EA({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=PA(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=n.invert(p);if(d(m))return;let v=n.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=kD(m,t,"polar",r);s.push({index:v,value:m,position:n.scale(m),axis:t,data:y})}})),s.length?s:null};class oz extends NU{constructor(){super(...arguments),this.transformerConstructor=rz,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var n,s;return[...null!==(n=nN(t,e,i))&&void 0!==n?n:[],...null!==(s=az(t,e))&&void 0!==s?s:[]]},this._modelOption.getDimensionInfoByValue=rN,this._modelOption.getRectByDimensionData=uN}}oz.type="common",oz.transformerConstructor=rz,V(oz,XU);const lz={rect:gz,symbol:dz,arc:mz,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=dz(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:function(t,e,i){const n=t.series,s=t.labelSpec||{},r=n.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=s.position||"withChange",o=s.offset||0,l=e?e(r.data):r.data,h=cz(t,l,s.formatMethod);return h.x=function(t,e,i,n){if("horizontal"===e.direction)return"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-n:e.totalPositionX(t,"end")+(t.end>=t.start?n:-n);return e.totalPositionX(t,"index",.5)}(l,n,a,o),h.y=function(t,e,i,n){if("horizontal"===e.direction)return e.totalPositionY(t,"index",.5);if("middle"===i)return.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start"));if("max"===i)return e.totalPositionY(t,t.end>=t.start?"end":"start")-n;if("min"===i)return e.totalPositionY(t,t.end>=t.start?"start":"end")+n;return e.totalPositionY(t,"end")+(t.end>=t.start?-n:n)}(l,n,a,o),"horizontal"===n.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Ac(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const s=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[n.getDimensionField()[0]])}));s&&(s.data=i,e.push(s))})),e},overlap:{strategy:[]}}},line:vz,area:vz,rect3d:gz,arc3d:mz,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,n)=>{for(let s=0;s"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function hz(t,e){var i;const{labelSpec:n}=e;n.overlap&&!g(n.overlap)&&(n.overlap={});const s=null!==(i=lz[t])&&void 0!==i?i:lz.point;return e.series.type===DC.sankey?function(t){var e,i,n;const{series:s,labelSpec:r={}}=t,a=null!==(e=uz(r.position))&&void 0!==e?e:"outside",o=s.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(n=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==n?n:yz(s)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):s(e)}function cz(t,e,i,n){var s,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(s=h.text)&&void 0!==s?s:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==DC.sankey){const{formatFunc:t,args:s}=MI(i,n,h.text,e);t&&(h._originText=h.text,h.text=t(...s,{series:o}))}return h}function uz(t){return u(t)?e=>t(e.data):t}function dz(t){var e,i,n;const{series:s,labelSpec:r}=t,a="horizontal"===s.direction?"right":"top",o=null!==(e=uz(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(n=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==n?n:pz(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function pz(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function gz(t){var e,i,n,s,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=uz(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",u="horizontal"===o.direction?null===(n=o.getXAxisHelper())||void 0===n?void 0:n.isInverse():null===(s=o.getYAxisHelper())||void 0===s?void 0:s.isInverse();let d,p=h;p=t=>{var e;const{data:i}=t,n=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===n){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},n=(null==i?void 0:i[t])>=0&&u||(null==i?void 0:i[t])<0&&!u?1:0;return e[c][n]}return n},d=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:fz(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:d,smartInvert:g}}function fz(t){const e=[{type:"position",position:e=>{var i,n;const{data:s}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function mz(t){var e;const{labelSpec:i}=t,n=null!==(e=uz(i.position))&&void 0!==e?e:"outside",s=n;let r;return r=i.smartInvert?i.smartInvert:y(n)&&n.includes("inside"),{position:s,smartInvert:r}}function vz(t){var e,i,n,s;const{labelSpec:r,series:a}=t,o=null===(n=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===n?void 0:n.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[qw]:a.getSeriesKeys()[0]}];return{position:null!==(s=r.position)&&void 0!==s?s:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function yz(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class _z extends lF{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,W(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:n})=>{const s=i(),r=HC({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=n(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:s}=t.context;s!==$O.exit&&e.forEach(((t,{})=>{const e=n(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},s)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:s}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}_z.type=r.label;class bz extends GR{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=bz.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const n=super._transformGraphicAttributes(t,e,i),{text:s}=n;return g(s)&&p(s.text)&&("rich"===this._textType||"rich"===s.type)&&(n.textConfig=s.text),n}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?uc(t):Ac(t)}}bz.type="text";class xz extends bz{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}xz.type="text",xz.constructorType="label";const Sz=()=>{xw.registerMark(bz.type,bz),vS(),RS(),fS(),xw.registerGraphicComponent("text",Ac),xw.registerGraphicComponent("richtext",uc),xw.registerMark(xz.constructorType,xz)};class Az extends oF{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Cz extends _z{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=Az,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],n=(null==e?void 0:e.region)||[];return n.forEach(((n,s)=>{(n.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:n={}}=i;return Object.values(n).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,s],regionIndexes:[s]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(LT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(LT.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),OA(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),n=t.getRegion();this._labelInfoMap.get(n)||this._labelInfoMap.set(n,[]);for(let s=0;s{var s,o,l;if(e.visible){const h=this._labelInfoMap.get(n),c=this._createMark({type:"label",name:`${null!==(s=t.userId)&&void 0!==s?s:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let n=!1;const s=`${i.getGroupMark().name}-label-component`;let r=t[s];r||(n=!0,r=this._createMark({type:"component",name:s},{componentType:"label"},{support3d:this._spec.support3d})),r&&(n&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[s]=null)}else e.forEach(((e,n)=>{var s;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(s=e.baseMark.getData())||void 0===s||s.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[n])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,n;const{labelMark:s,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(s,r),u(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,s,r)}(null===(n=null===(i=s.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&s.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const n=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,s;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),u=null!==(s=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==s?s:0;let d=mw({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:n.map((t=>t.getMarks()[0].getProductId()))}},hz(h,r),Object.assign(Object.assign(Object.assign({},N(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:u}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[lT])):t=>t.filter((t=>t.data[oT]))}:{});return l&&l.parseLabelStyle&&(d=l.parseLabelStyle(d,a,o)),"line"!==h&&"area"!==h||(d.type=h),d},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?cz(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,n=null==i?void 0:i.parent;if(n){const t=n.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,s)=>{s.getComponent()===n&&(e=G(i())[t])}))}return e}}Cz.type=r.label,Cz.specKey="label",Cz.transformerConstructor=Az;var wz;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(wz||(wz={}));const Tz={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},kz={labelZIndex:!0,gridZIndex:!0},Mz={xField:!0,yField:!0,categoryField:!0,valueField:!0},Bz={visible:!0,width:!0,style:!0};class Ez extends lF{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=mt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:n}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,n,e,t.activeType);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let n=!1;if(t.forEach((t=>{NA(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!this.enable)return!1;const{currentValue:s}=this._stateByField[i];return t.forEach(((t,i)=>{const n=t.axis;s.set(i,{datum:this._getDatumAtPoint(n,e),axis:n})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:n=0,datum:s}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===n));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(n,{axis:r,datum:s}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!W(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>W(null==e?void 0:e[i],null==t?void 0:t[i])||kz[i]||Mz[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>W(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>W(null==t?void 0:t[i],null==e?void 0:e[i])||Bz[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var n;if(!1===(null===(n=this._option.componentShowContent)||void 0===n?void 0:n.crosshair))return;const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:jT.chart}:{source:NT.chart};_(t)?t.forEach((t=>{this.event.on(t,r,s)})):this.event.on(t,r,s)}_eventOff(t,e,i){const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,n)})):this.event.off(t,n)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),n={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},n),{x:n.x-this.getLayoutStartPoint().x,y:n.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:WS(e)||HS(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=G(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const n=[];return t.forEach((t=>{n.push({click:"click"===t,in:i[t],out:e(t)})})),n}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:NT.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:NT.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:NT.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const n=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=P(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{Tz[t].includes(e.getOrient())&&s.push(i)}))),!s.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:u}=this.getLayoutStartPoint();return s.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const s=n.find((e=>e.getSpecIndex()===t));if(!s)return;const d=(null===(i=(e=s).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};s.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+d.left),o=Math.min(o,i-u+d.top),l=Math.max(l,e+t.getLayoutRect().width-c-d.right),h=Math.max(h,i+t.getLayoutRect().height-u-d.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:s})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:n}=this._stateByField[t].attributes,s="rect"===n?"rectStyle":"lineStyle";i.setAttributes({[s]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:n}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==n&&(this.gridZIndex=n)}_parseField(t,i){var n,s,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:u,fillOpacity:d,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?u:d;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=P(o,"width",h||2);else{a.style.fill=l||r,(null===(s=null===(n=null==t?void 0:t.line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.stroke)&&(a.style.stroke=t.line.style.stroke);const e=P(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,n=l.style||{},s=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:u}=s,d=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},n),{fill:n.fill||"#fff",stroke:P(n,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},u)},d):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((n=>{const s=n.axis;var r,a,o;if(a=e,o=i,((r=n).x1>a||r.x2o||r.y2a||os&&(d=s-l),h>r&&(p=r-h),d&&t.setAttribute("dx",d+c),p&&t.setAttribute("dy",p+u)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:n}=this._stateByField[e];return i&&t.push(i),n&&Object.keys(n).forEach((e=>{n[e]&&t.push(n[e])})),t}),[])}}Ez.specKey="crosshair";const Pz={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class Oz extends Ez{static getSpecInfo(t){return BI(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}_getDatumAtPoint(t,e){const i=vD(t.getOrient())?"x":"y",n=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(n)}setAxisValue(t,e){vD(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,n){var s;let r=t,a=e;if(i&&i.length)if("dimension"===n){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let n;if(e>-1){const i=t.data[e];n=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:yD(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.getOrient()))?a=null==n?void 0:n.y:r=null==n?void 0:n.x}else if("mark"===n){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=((t,e)=>{for(let i=0;i{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:n,bandSize:s,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=hN(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,u,d;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+s/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(u=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==u?u:0,textStyle:Object.assign(Object.assign({},null===(d=i.label)||void 0===d?void 0:d.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(n[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,n[l]=e}))}else n[l]&&n[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:n}=this._stateByField[t];let{crosshairComp:s}=this._stateByField[t];if(s)s.setAttributes(e);else{const r=n.style;"line"===n.type?s=new qN(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===n.type&&(s=new ZN(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(s),this._stateByField[t].crosshairComp=s}}}Oz.specKey="crosshair",Oz.builtInTheme={crosshair:Pz},Oz.type=r.cartesianCrosshair;const Rz=(t,e)=>p(e)?t.map((t=>e[t])):void 0,Iz=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),Dz=t=>!d(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function Lz(t,e,i){var n,s,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),u=i.getOption(),g=u.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=Fz(t,g),m=null!==(n=c.activeType)&&void 0!==n?n:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=u.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>Iz(i,n)(t)&&Iz(s,r)(t)&&(d(a)||Iz([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),s=null!==(e=c.x)&&void 0!==e?e:v.x+n.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+n.y,a={x:0,y:0};S.transformPoint({x:s,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const n=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(s=u.globalInstance.getChart())&&void 0!==s?s:void 0,datum:void 0,model:void 0,source:NT.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=u.globalInstance;return SI.globalConfig.uniqueTooltip&&SI.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const n=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),s=[{datum:[n],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:n[e.data.dimensionFields[0]],data:s}],chart:null!==(h=u.globalInstance.getChart())&&void 0!==h?h:void 0,datum:n,model:e.series,source:NT.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:n,mark:null,series:e.series},r,!1);const a=u.globalInstance;return SI.globalConfig.uniqueTooltip&&SI.hideTooltip(a.id),m}return"none"}const Fz=(t,e)=>{const i=e.getSeries(),n=[];return i.forEach((e=>{var i,s,r,a,o,l,h;const c=e.getDimensionField(),u=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(s=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=Rz(c,t);let y=Rz(u,t);const _=Dz(y),b=!_&&p(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(Iz(c,v));if(!_&&(y=Rz(u,i),!Dz(y)))return;const s=e.type===DC.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(s)||isNaN(s.x)||isNaN(s.y)||n.push({pos:s,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=NA(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",s=c.map(((t,e)=>[t,e])).filter((([,t])=>d(null==v?void 0:v[t])));let r=[null!=v?v:[]];s.length>0&&s.forEach((([t,i])=>{var n,s,a,o;const l=null!==(o=null===(a=null===(s=null===(n=e.getViewDataStatistics)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var n;const s=null!==(n=null==t?void 0:t.slice())&&void 0!==n?n:[];s[i]=e,h.push(s)}))})),r=h})),r.forEach((s=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(Iz(c,s));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=Rz(u,o),!Dz(y))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||n.push({pos:l,data:{dimensionFields:c,dimensionData:s,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(Iz(c,s));if(!_&&(y=Rz(u,r),!Dz(y)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;n.push({pos:o,data:{dimensionFields:c,dimensionData:s,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===DC.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(Iz(c,v))).find((t=>t[g]===f));m.forEach((s=>{if(y=Rz(u,i),!Dz(y))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||n.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:s},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,s,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(Iz(c,v));const o=e.getNameMap(),l=null===(r=null===(s=e.getMapViewData)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=Rz(u,a),h=y,!Dz(y)&&!a)return;Dz(y)||(y=[null])}const p=e.dataToPosition(a);d(p)||isNaN(p.x)||isNaN(p.y)||n.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),n},Uz=t=>p(t)&&!_(t),Nz=t=>p(t)&&_(t),jz=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class zz extends oF{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:n}=super._initTheme(t,e),s=mw({},...jz.map((t=>void 0!==(null==n?void 0:n[t])?{[t]:n[t]}:void 0)),null==n?void 0:n.style),r=mw({},n);jz.forEach((t=>{delete r[t]})),delete r.style;const a=mw({},r,i);return a.style=mw({},s,a.style),{spec:a,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(n=t.visible)||void 0===n||n,t.activeType=(t=>{var e,i,n;if(!1===(null==t?void 0:t.visible))return[];const s={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(n=null==t?void 0:t.group)||void 0===n?void 0:n.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(s).forEach((e=>{var i;s[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(s).filter((t=>s[t]))})(t),t.renderMode=null!==(s=t.renderMode)&&void 0!==s?s:HS(this._option.mode)||!zS(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=Vg.getElementById(t.parentElement)):zS(this._option.mode)&&(t.parentElement=null==jS?void 0:jS.body)}}const Wz={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class Hz extends lF{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=zz,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,n,s,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return;const o=zS(null===(s=this._option)||void 0===s?void 0:s.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,n,s,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(s=this._spec)||void 0===s?void 0:s.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:n},ignore:{mark:s}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let n=0,s=a.length;n!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(s&&Uz(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(n)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(n)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,n,s)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),s)o=!a.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],s=this._isSameAsCache(n,i,t);o=!a.showTooltip(n,i,s),o&&(this._cacheInfo=n,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,n&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&SI.globalConfig.uniqueTooltip&&l&&SI.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e},this._hideTooltipByHandler=e=>{var i,n,s;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:NT.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:NT.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!W(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s,this._enterable=!1;else{const t="canvas"===n?fN.canvas:fN.dom,s=xw.getComponentPluginInType(t);s||FS("Can not find tooltip handler: "+t);const r=new s;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===n&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,n;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const s=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);s&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===s[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(n=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==n?n:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=xw.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),n=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(WS(n)||HS(n))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,mt(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,n;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",s=this._spec.enterable&&"html"===t;s&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=s,null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===n||n.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const n=Lz(t,e,this);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=n),n}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(Nz(t)){if(Uz(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>wD(t,e[i])))}if(Nz(this._cacheInfo))return!1;const n=this._cacheInfo;if(!((null==t?void 0:t.datum)===n.datum&&(null==t?void 0:t.mark)===n.mark&&(null==t?void 0:t.series)===n.series))return!1;const s=this._cacheParams;return!d(s)&&!d(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:n,y:s}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return n>=a&&n<=a+l&&s>=o&&s<=o+h}getVisible(){return!1!==this._spec.visible}}Hz.type=r.tooltip,Hz.transformerConstructor=zz,Hz.builtInTheme={tooltip:Wz},Hz.specKey="tooltip";function Vz(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(u(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else E(t.style)||(t.style=e(t.style));return E(t.state)||Object.keys(t.state).forEach((i=>{if(u(t.state[i])){const n=t.state[i];t.state[i]=(...t)=>e(n(...t))}else E(t.state[i])||(t.state[i]=e(t.state[i]))})),t}function Gz(t,i,n){const{title:s={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:d,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:C={},pager:w={},background:T={}}=t;A=I(A),C=I(C),w=I(w),T=I(T);const k=S;if(u(k.maxRow)||u(k.maxCol)){const t=tw(n)?n:tw(d)?d:"left";u(k.maxRow)&&(k.maxRow=k.maxRow({rect:i,orient:t,id:h})),u(k.maxCol)&&(k.maxCol=k.maxCol({rect:i,orient:t,id:h}))}return A.visible?k.title=function(t){var e,i;const n=Object.assign({},t);return E(t.style)||(n.textStyle=ET(t.style)),E(t.textStyle)||mw(n.textStyle,ET(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&ET(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&ET(n.background.style),n}(A):k.title={visible:!1},E(C.focusIconStyle)||ET(C.focusIconStyle),C.shape&&(C.shape=Vz(MT(C.shape))),C.label&&(C.label=MT(C.label)),C.value&&(C.value=MT(C.value)),C.background&&(C.background=MT(C.background)),ew(C.maxWidth)&&(C.maxWidth=Number(C.maxWidth.substring(0,C.maxWidth.length-1))*i.width/100),ew(C.width)&&(C.width=Number(C.width.substring(0,C.width.length-1))*i.width/100),ew(C.height)&&(C.height=Number(C.height.substring(0,C.height.length-1))*i.width/100),k.item=C,"scrollbar"===w.type?(E(w.railStyle)||ET(w.railStyle),E(w.sliderStyle)||ET(w.sliderStyle)):(E(w.textStyle)||ET(w.textStyle),w.handler&&MT(w.handler)),k.pager=w,T.visible&&!E(T.style)&&(mw(k,T.style),p(T.padding)&&(k.padding=T.padding)),k}const Yz=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},Xz=(t,e)=>{var i,n,s;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),u=l();if(0===c.length&&u.length)return[];if(c.length===u.length)return t;const d={};c.forEach((t=>{d[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:qw;return h?h(t,c,g):(_(t)&&(null===(n=t[0])||void 0===n?void 0:n.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(s=t[0])||void 0===s?void 0:s.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(g)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,g)]))),t)},Kz={position:!0,item:!0,title:!0,pager:!0,background:!0};class $z extends lF{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:()=>{OA(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),OA(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=tw(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:n,seriesIndex:s}=this._spec;p(n)&&(this._seriesUserId=G(n)),p(e)&&(this._regionUserId=G(e)),p(s)&&(this._seriesIndex=G(s)),p(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const n=!W(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):n&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(n&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,n=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>W(null==i?void 0:i[t],null==n?void 0:n[t])||Kz[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new xR(this._option,e),this._initSelectedData(),OA(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,n,s;const r=this._selectedData;d(e)||JSON.stringify(r)===JSON.stringify(e)||(OA(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(n=(i=this.effect).onSelectedDataChange)||void 0===n||n.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(n.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)W(n,this._cacheAttrs)||this._legendComponent.setAttributes(mw({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(mw({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:n,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(n-s)/2:"end"===i&&(o=n-s):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+s,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());W(t,this._cacheAttrs)||this._legendComponent.setAttributes(mw({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}$z.specKey="legends";class qz extends $z{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return BI(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),OA(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){GT(this._option.dataSet,"discreteLegendFilter",Xz),GT(this._option.dataSet,"discreteLegendDataMake",Yz);const t=new di(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return OA(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,n;const s=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return s;if(!t.getRawData())return s;const a=this._option.globalScale.getScaleSpec(r);if(!a)return s;if(this._spec.field)return this._spec.field;if(!XS(a.domain))return s;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(n=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==n?n:s}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return u(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!e)return;t.title.text=_T(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=Object.assign(Object.assign({layout:e,items:this._getLegendItems(),zIndex:this.layoutZIndex},Gz(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return cj}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(rj.legendItemClick,(i=>{const n=P(i,"detail.currentSelected");e&&this.setSelectedData(n),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:n,event:i})})),this._legendComponent.addEventListener(rj.legendItemHover,(e=>{const i=P(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rj.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 n=t.style("fillOpacity"),s=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,datum:t.datum,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(n)?n:1,strokeOpacity:A(s)?s:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return u(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,n,s;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(s=null===(n=this._spec.item)||void 0===n?void 0:n.value)&&void 0!==s?s:{},{formatFunc:h}=MI(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=MI(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}qz.specKey="legends",qz.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},qz.type=r.discreteLegend;const Zz="vchart-tooltip",Jz=`${Zz}-container`,Qz=`${Zz}-title`,tW=`${Zz}-content-box`,eW={offsetX:10,offsetY:10},iW="99999999999999";function nW(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const sW=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,rW=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?nW(t):"",aW=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(u(t)){const n=t(e);S(n)&&(i=n)}return i},oW={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},lW=(t,e,i=2)=>{var n,s;return null!==(s=null===(n=oW[t])||void 0===n?void 0:n["x"===e?0:1])&&void 0!==s?s:i};class hW extends NL{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:n}=i;return n?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,n,s,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const u=h.activeType;if(h.handler)return null!==(s=null===(n=(i=h.handler).showTooltip)||void 0===n?void 0:n.call(i,u,e,t))&&void 0!==s?s:0;const d=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[u])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==d?void 0:d.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var n,s,r,a,o,l,h,c,d;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(s=null===(n=b[0])||void 0===n?void 0:n.data)||void 0===s?void 0:s[0]:null==b?void 0:b[0],{offsetX:C,offsetY:w}=this._option,T=m[_],k=OI(null==T?void 0:T.position,b,e),M=null!==(r=OI(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,O=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==O?void 0:O.width)&&void 0!==o?o:Gw,I=null!==(l=null==O?void 0:O.height)&&void 0!==l?l:Yw;let D=!1;const L={width:0,height:0};let F,U={x:0,y:0},N={x:0,y:0},j=1,z=1;const W=zS(this._env);if(W&&!m.confine?(L.width=window.innerWidth,L.height=window.innerHeight):(L.width=R,L.height=I),W&&!P){const t=this._getParentElement(m);N=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(d=this._compiler.getCanvas())&&void 0!==d?d:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),U={x:F.x-N.x,y:F.y-N.y},j=sW(e,F),z=sW(t,N)}const H=z/j,V={},G={x:k,y:k},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:n},s)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=n?n:"x"===s?C:w;if("mark"===i){D=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===s?i.x1:i.y1)+h[s],o=("x"===s?i.x2:i.y2)+h[s])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){D=!0;const t=f(x,h);t&&(a=t.start[s],o=t.end[s])}else G[s]=t;if(D){const e=Y[s][0],i="x"===s?B:E;switch(lW(t,s)){case-2:V[e]=a-i*H-c;break;case-1.5:V[e]=a+c;break;case 0:V[e]=(a+o)/2-i*H/2;break;case-1:V[e]=(a+o)/2-i*H-c;break;case 1:V[e]=(a+o)/2+c;break;case 1.5:V[e]=o-i*H-c;break;case 2:V[e]=o+c}}},K=["x","y"];if(g(k))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(k)){const{left:t,right:e,top:i,bottom:n}=k;V.left=aW(t,y),V.top=aW(i,y),V.right=aW(e,y),V.bottom=aW(n,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(k)&&K.forEach((t=>{const e=k[t];S(e)||u(e)?V[Y[t][0]]=aW(e,y):X(e,t)}));else p(k)&&(X({orient:k,mode:M},"x"),X({orient:k,mode:M},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?B:E,n="x"===t?R:I,s="x"===t?C:w,r=lW(G[t],t);if(A(V[Y[t][0]]))$[t]=V[Y[t][0]];else if(A(V[Y[t][1]]))$[t]=n-i*H-V[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+s:0===r?e-i*H/2:e-i*H-s}$[t]*=j,W&&($[t]+=U[t]),$[t]/=z;const a="x"===t?L.width:L.height,o=m.confine?-(N[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/z:-N[t]/z,l=a/z+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(D?$[t]=l:($[t]-=0===r?s+i/2:2*s+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",uW=(t={},e={})=>{var i,n;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const s=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(s)&&(e.color=s),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=cW(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=cW(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(n=t.wordBreak)&&void 0!==n?n:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},dW=(t={})=>{const{lineHeight:e}=t;return t.fontSize?nw(e,t.fontSize):0},pW=t=>{var e;const{backgroundColor:i,border:n,shadow:s,padding:r}=t,a={borderWidth:`${null!==(e=null==n?void 0:n.width)&&void 0!==e?e:0}px`};let o=null;(null==n?void 0:n.color)&&(a.borderColor=n.color),i&&(a.backgroundColor=i),a.boxShadow=s?`${s.x}px ${s.y}px ${s.blur}px ${s.spread}px ${s.color}`:"initial";const{radius:l}=null!=n?n:{};return p(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),p(r)&&(o=Be(r),a.padding=cW(o)),{panelStyle:a,panelPadding:o}};function gW(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const fW=t=>!!t&&1===t.nodeType&&"function"==typeof t.appendChild&&!!t.children;class mW extends hW{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(mW.type),this.type=fN.dom,this._tooltipContainer=null==jS?void 0:jS.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}_getTooltipParentElement(t){return fW(t.parentElement)?t.parentElement:fW(this._chartContainer)?this._chartContainer:fW(null==jS?void 0:jS.body)?jS.body:void 0}initEl(){const t=this._component.getSpec(),e=this._getTooltipParentElement(t);if(jS&&e){for(let t=0;t{var e,i,n,s;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=pW(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:cW(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=uW(h),x=uW(u),S=uW(p),C="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[C]=cW(null!==(i=c.spacing)&&void 0!==i?i:8),x[C]=cW(null!==(n=u.spacing)&&void 0!==n?n:26),S[C]=cW(null!==(s=p.spacing)&&void 0!==s?s:0);const w=Math.max(dW(p),dW(u));return y.lineHeight=w>0?`${w}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:n}=t,s=n&&n.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(Qz))),l=a.find((t=>t.className.includes(tW)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(Qz),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(gW(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),s?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&s&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${Zz}-column`),e.classList.add(`${Zz}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(tW),this._rootDom.appendChild(l)),l&&s){const t=[...l.children];gW(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&n.every((t=>!t.hasShape||!t.shapeType));gW(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const s=[...t.children];s.slice(n.length).forEach((t=>{t.parentNode.removeChild(t)})),n.forEach(((e,a)=>{let o=s[a];o||(o=document.createElement("div"),o.classList.add(`${Zz}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===n.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=rW(e.key),e.keyStyle&&uW(e.keyStyle,l)):"value"===i?(o.innerHTML=rW(e.value),e.valueStyle&&uW(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,n,s,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:u=!1,shapeFill:d}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?nW(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?nW(c):m,_=p,b=t=>new fc({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,C;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;C=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(C=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new ce));let w=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,n]=w.split(" ").map((t=>Number(t))),s=Number(f.slice(0,-2));w=`${t-s/2} ${e-s/2} ${i+s} ${n+s}`}const T=Mo.IsGradientStr(d);if(!d||y(d)&&!T||u)return m=u?"none":d?nW(d):"currentColor",`\n \n \n \n `;const k=T?Mo.Parse(d):g(d)?d:null;if(k){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(n=k.stops)&&void 0!==n?n:[]).map((t=>``)).join("");return"radial"===k.gradient?t=`\n ${i}\n `:"linear"===k.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),gW(o,l)}))}}))}else l&&!s&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,n,s,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(tW))),h=[...o.children].find((t=>t.className.includes(Qz)));if(l){const o=this._component.getSpec(),c={},u=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(u&&u.autoWidth&&!1!==u.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(n=null==o?void 0:o.style)||void 0===n?void 0:n.maxContentHeight)){const t=h&&h.className.includes(Qz)?h.getBoundingClientRect().height+(null!==(s=o.style.spaceRow)&&void 0!==s?s:0):0,e=this._chartOption.getChartViewRect(),i=nw(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,gW(l,c))}const d=l.children,g=[];if(d){for(let i=0;i{var i;let n,s;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(n=t.split("\n"),n=n.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(s=t.text,n=t);const r=Nd({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:s});return{width:r.width(),height:r.height(),text:n}};function _W(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:vW),{fill:null!==(n=t.fill)&&void 0!==n?n:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(s=t.fontFamily)&&void 0!==s?s:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const bW=t=>{var e;const{backgroundColor:i,border:n,shadow:s}=t,r={lineWidth:null!==(e=null==n?void 0:n.width)&&void 0!==e?e:0,shadow:!!s};(null==n?void 0:n.color)&&(r.stroke=n.color),i&&(r.fill=i),s&&(r.shadowColor=s.color,r.shadowBlur=s.blur,r.shadowOffsetX=s.x,r.shadowOffsetY=s.y,r.shadowSpread=s.spread);const{radius:a}=null!=n?n:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class xW extends hW{constructor(){super(xW.type),this.type=fN.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new fj({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,n;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var n,s,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:u={},titleLabel:d,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=Be(u.padding),b=aw(u.padding),x=_W(Object.assign({textAlign:"right"===y?"right":"left"},d),i),S=_W(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=_W(m,i),C={fill:!0,size:null!==(n=null==g?void 0:g.size)&&void 0!==n?n:8,spacing:null!==(s=null==g?void 0:g.spacing)&&void 0!==s?s:6},w={panel:bW(u),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:C,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:k=[]}=t;let M=b.left+b.right,B=b.top+b.bottom,E=0;const P=!!k.length;let O=0,R=0,I=0,D=0;if(P){const t=[],e=[],i=[],n=[];let s=0;w.content=k.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:u,shapeStroke:d,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:w}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=mw({},S,_W(b,void 0,{})),{width:n,height:s,text:r}=yW(h,i);T.key=Object.assign(Object.assign({width:n,height:s},i),{text:r}),y?e.push(n):t.push(n),o=Math.max(o,s)}if(p(m)){const t=mw({},A,_W(x,void 0,{})),{width:e,height:n,text:s}=yW(m,t);T.value=Object.assign(Object.assign({width:e,height:n},t),{text:s}),i.push(e),o=Math.max(o,n)}if(l){const t={visible:!0,symbolType:c};w?t.stroke=u:t.fill=u,t.stroke=null!=d?d:u,t.lineWidth=g,T.shape=t;const e=null!=f?f:C.size;o=Math.max(e,o),n.push(e)}else T.shape={visible:!1};return T.height=o,s+=o,aH.autoWidth&&!1!==H.multiLine;if(N){H=mw({},x,_W(z,void 0,{})),V()&&(H.multiLine=null===(r=H.multiLine)||void 0===r||r,H.maxWidth=null!==(a=H.maxWidth)&&void 0!==a?a:P?Math.ceil(E):void 0);const{text:t,width:e,height:i}=yW(j,H);w.title.value=Object.assign(Object.assign({width:V()?Math.min(e,null!==(o=H.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},H),{text:t}),L=w.title.value.width,F=w.title.value.height,U=F+(P?w.title.spaceRow:0)}return B+=U,w.title.width=L,w.title.height=F,V()?M+=E||L:M+=Math.max(L,E),P&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=M-b.left-b.right-D-O-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=M,w.panel.height=B,w})(t,this._component.getSpec(),e)}const{panel:s}=null!==(n=this._attributes)&&void 0!==n?n:{};return{width:s.width+s.lineWidth,height:s.height+s.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:n}=e,s=n.position;e.changePositionOnly?p(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),s)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}xW.type=fN.canvas;const SW=/\{([^}]+)\}/,AW=/\{([^}]+)\}/g,CW=/:/;class wW extends NL{constructor(){super(wW.type),this.type="formatterPlugin",this._timeModeFormat={utc:Oe.getInstance().timeUTCFormat,local:Oe.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=je.getInstance().format,this._numericSpecifier=je.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:n}=t;if(!n)return;this._spec=null!==(i=null==e?void 0:e[wW.specKey])&&void 0!==i?i:{};const{timeMode:s,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;u(r)?this._formatter=r:(this._formatter=this._format.bind(this),u(o)?this._timeFormatter=o:s&&this._timeModeFormat[s]&&(this._timeFormatter=this._timeModeFormat[s]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),xw.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,n)=>{const s=_(i)?i[n]:i;return s?this._formatSingleLine(t,e,s):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let n;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?n=this._isNumericFormatterCache.get(i):(n=SW.test(i),this._isNumericFormatterCache.set(i,n))),n){return i.replace(AW,((t,i)=>{if(!CW.test(i)){const n=e[i.trim()];return void 0!==n?n:t}const n=i.split(":"),s=e[n.shift()],r=n.join(":");return this._formatSingleText(s,r)}))}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Fe.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}wW.pluginType="chart",wW.specKey="formatter",wW.type="formatterPlugin";SI.useRegisters([()=>{bN(),SN(),CN(),ZU(),qU(),OU(),AU(),wL(),kL(),lI(),aI(),nU(),_U(),xw.registerSeries(RU.type,RU),xw.registerChart(wN.type,wN)},()=>{bN(),SN(),CN(),qU(),Pj(),ZU(),xw.registerChart(Rj.type,Rj)},()=>{bN(),SN(),CN(),qU(),xj(),ZU(),xw.registerChart(Aj.type,Aj)},()=>{SN(),tz(),xw.registerChart(sz.type,sz)},()=>{bN(),SN(),CN(),ZU(),xw.registerChart(oz.type,oz),qU()},_U,nU,()=>{xw.registerComponent(qz.type,qz)},()=>{xw.registerComponent(Hz.type,Hz)},()=>{xw.registerComponent(Oz.type,Oz)},()=>{xw.registerGraphicComponent(Cz.type,(t=>new UN(t))),Sz(),dF(),xw.registerComponent(Cz.type,Cz,!0,1/0)},()=>{var t;t=xW,xw.registerComponentPlugin(t.type,t)},()=>{var t;t=wW,xw.registerChartPlugin(t.type,t)},gI,vI]),SI.useRegisters([()=>{EB(wy)}]),t.DEFAULT_CHART_HEIGHT=Yw,t.DEFAULT_CHART_WIDTH=Gw,t.DEFAULT_CLOSE_STROKE_JOIN=wI,t.DEFAULT_DATA_INDEX=Kw,t.DEFAULT_DATA_KEY=$w,t.DEFAULT_DATA_SERIES_FIELD=qw,t.DEFAULT_KEY=fT,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=CI,t.DEFAULT_MAP_LOOK_UP_KEY=mT,t.DEFAULT_MEASURE_CANVAS_ID=Xw,t.DEFAULT_SERIES_STYLE_NAME=Zw,t.DEFAULT_SMOOTH_INTERPOLATE=AI,t.Factory=xw,t.MOSAIC_CAT_END_PERCENT=dT,t.MOSAIC_CAT_START_PERCENT=uT,t.MOSAIC_VALUE_END_PERCENT=cT,t.MOSAIC_VALUE_START_PERCENT=hT,t.ManualTicker=class extends Uf{constructor(t){super(t),this.lastFrameTime=0,this.status=Jn.RUNNING}setupTickHandler(){const t=new TI;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Jn.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Jn.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Jn.RUNNING,!0}},t.PREFIX=Vw,t.SEGMENT_FIELD_END=gT,t.SEGMENT_FIELD_START=pT,t.STACK_FIELD_END=tT,t.STACK_FIELD_END_OffsetSilhouette=sT,t.STACK_FIELD_END_PERCENT=iT,t.STACK_FIELD_KEY=Jw,t.STACK_FIELD_START=Qw,t.STACK_FIELD_START_OffsetSilhouette=nT,t.STACK_FIELD_START_PERCENT=eT,t.STACK_FIELD_TOTAL=rT,t.STACK_FIELD_TOTAL_BOTTOM=lT,t.STACK_FIELD_TOTAL_PERCENT=aT,t.STACK_FIELD_TOTAL_TOP=oT,t.StreamLight=qP,t.ThemeManager=Lw,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=SI,t.boundsInRect=rw,t.builtinThemes=ww,t.calcLayoutNumber=nw,t.calcPadding=sw,t.computeActualDataScheme=zC,t.convertPoint=ow,t.createArc=gh,t.createArea=vh,t.createGroup=wh,t.createLine=Ph,t.createRect=zh,t.createRichText=uc,t.createSymbol=mc,t.createText=Ac,t.darkTheme=gw,t.dataScheme=hw,t.default=SI,t.defaultThemeName=Tw,t.getActualColor=HC,t.getActualNumValue=lw,t.getColorSchemeBySeries=XC,t.getDataScheme=jC,t.getFunnelTheme=Cw,t.getMergedTheme=Iw,t.getSpecInfo=BI,t.getTheme=Pw,t.hasThemeMerged=Bw,t.isColorKey=VC,t.isPercent=ew,t.isPercentOffset=iw,t.isProgressiveDataColorScheme=GC,t.isTokenKey=uw,t.isValidOrient=tw,t.lightTheme=pw,t.lookup=(t,e)=>{var i;const n=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!n)return t;const s=(r=e.fields,u(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[s],c=n.reduce((function(t,e){return e[s]&&t.set(`${e[s]}`,e),t}),new Map);let g;if(u(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(d(i))for(let i=0;i(g(t),t)))},t.measureText=Hw,t.normalizeLayoutPaddingSpec=aw,t.queryColorFromColorScheme=WC,t.queryToken=cw,t.registerDataSetInstanceParser=YT,t.registerDataSetInstanceTransform=GT,t.registerTheme=Ew,t.removeTheme=Ow,t.themeExist=Rw,t.themes=kw,t.token=dw,t.transformColorSchemeToStandardStruct=YC,t.transformToGraphic=ET,t.version="2.1.3",t.vglobal=Vg,t.warn=LS,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);st;var s,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(s=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",s["mobile-browser"]="mobile-browser",s.node="node",s.worker="worker",s.miniApp="miniApp",s.wx="wx",s.tt="tt",s.harmony="harmony",s["desktop-miniApp"]="desktop-miniApp",s.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new s(n,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,a=new Array(r);sObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var u=t=>"function"==typeof t;var d=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var C=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const k=Object.prototype;var M=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||k)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(M(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const n=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function I(t,e,i){let n;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const s=_(t),r=t.length;n=s?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=s?void 0:Object.keys(Object(t));let o=-1;if(n)for(;++o<(a||t).length;){const s=a?a[o]:o,r=t[s];i&&i.includes(s.toString())?n[s]=r:n[s]=I(r,e,i)}return n}function D(t,e,i=!1,n=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const s=Object(e),r=[];for(const t in s)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(s[a])||"object"!=typeof s[a]||n&&_(t[a])?F(t,a,s[a]):L(t,e,a,i,n)}}}}function L(t,e,i,n=!1,s=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(n)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const s=t[n];let r=!1;e.forEach((t=>{(y(t)&&t===n||t instanceof RegExp&&n.match(t))&&(r=!0)})),r||(i[n]=s)})),i}function j(t){return Object.prototype.toString.call(t)}function z(t){return Object.keys(t)}function W(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(j(t)!==j(e))return!1;if(u(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let n=t.length-1;n>=0;n--)if(!W(t[n],e[n],i))return!1;return!0}if(!m(t))return!1;const n=z(t),s=z(e);if(n.length!==s.length)return!1;n.sort(),s.sort();for(let t=n.length-1;t>=0;t--)if(n[t]!=s[t])return!1;for(let s=n.length-1;s>=0;s--){const r=n[s];if(!W(t[r],e[r],i))return!1}return!0}function H(t,e,i){const n=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let s=0;s{var i;if(0===t.length)return;let n=t[0];for(let s=1;s0&&(n=r)}return n},K=(t,e)=>{var i;if(0===t.length)return;let n=t[0];for(let s=1;se?1:t>=e?0:NaN}function J(t){return Number(t)}const Q="undefined"!=typeof console;function et(t,e,i){const n=[e].concat([].slice.call(i));Q&&console[t].apply(console,n)}var it;!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"}(it||(it={}));class nt{static getInstance(t,e){return nt._instance&&S(t)?nt._instance.level(t):nt._instance||(nt._instance=new nt(t,e)),nt._instance}static setInstance(t){return nt._instance=t}static setInstanceLevel(t){nt._instance?nt._instance.level(t):nt._instance=new nt(t)}static clearInstance(){nt._instance=null}constructor(t=it.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=it.Info}canLogDebug(){return this._level>=it.Debug}canLogError(){return this._level>=it.Error}canLogWarn(){return this._level>=it.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=it.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):et(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=it.Warn&&et(this._method||"warn","WARN",t),this}info(...t){return this._level>=it.Info&&et(this._method||"log","INFO",t),this}debug(...t){return this._level>=it.Debug&&et(this._method||"log","DEBUG",t),this}}function st(t,e,i=0,n){for(d(n)&&(n=t.length);i>>1;Z(t[s],e)>0?n=s:i=s+1}return i}nt._instance=null;const rt=1e-10,at=1e-10;function ot(t,e,i=at,n=rt){const s=n,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(s,r)}function lt(t,e,i,n){return t>e&&!ot(t,e,i,n)}function ht(t,e,i,n){return t{let e=null,i=null;return(...n)=>(e&&n.every(((t,i)=>t===e[i]))||(e=n,i=t(...n)),i)};var ut=function(t,e,i){return ti?i:t};var dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function pt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let gt=!1;try{gt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){gt=!1}function ft(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,d=!0;const p=!e&&0!==e&>if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function _(t){return o=void 0,d&&n?f(t):(n=s=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(n=t,s=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(u)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,u="maxWait"in i,u&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),d="trailing"in i?!!i.trailing:d),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,n=l=s=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function mt(t,e,i){let n=!0,s=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),ft(t,e,{leading:n,trailing:s,maxWait:e})}function vt(t,e){return i=>t*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}gt=!1;const _t=1e-12,bt=Math.PI,xt=bt/2,St=2*bt,At=2*Math.PI,Ct=Math.abs,wt=Math.atan2,Tt=Math.cos,kt=Math.max,Mt=Math.min,Bt=Math.sin,Et=Math.sqrt,Pt=Math.pow;function Ot(t){return t>=1?xt:t<=-1?-xt:Math.asin(t)}function Rt(t,e,i,n,s){let r=i,a=n;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function It(t,e){return t[0]*e[1]-t[1]*e[0]}function Dt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Lt(t,e){return function(t,e=10){return Math.round(t*e)/e}(t-e,10**Math.max(Dt(t),Dt(e)))}class Ft{constructor(t=0,e=0,i,n){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ft(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 Ut{static distancePP(t,e){return Et(Pt(t.x-e.x,2)+Pt(t.y-e.y,2))}static distanceNN(t,e,i,n){return Et(Pt(t-i,2)+Pt(e-n,2))}static distancePN(t,e,i){return Et(Pt(e-t.x,2)+Pt(i-t.y,2))}static pointAtPP(t,e,i){return new Ft((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t){return t*(Math.PI/180)}const jt=(t=0)=>{if(t<0)for(;t<-St;)t+=St;else if(t>0)for(;t>St;)t-=St;return t};function zt(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 Wt(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Ht(t,e,i,n){const{x:s,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const n=Wt(Math.min(t,e)),s=n+i,r=[n,s];let a=Math.floor(n/Math.PI)*Math.PI/2;for(;an&&r.push(a),a+=Math.PI/2;return r}(i,n),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-s):-1===i?h.push(s):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-s)/i)):h.push(Math.abs(s/i)))})),Math.min.apply(null,h)}function Vt(t){return(t=Wt(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 Gt(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function Yt(t,e,i,n){if(!function(t,e,i,n){let s=t[0],r=e[0],a=i[0],o=n[0];return r=0&&h<=1&&[t[0]+s[0]*h,t[1]+s[1]*h]}var Xt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Xt||(Xt={}));const Kt=(t,e,i)=>{let n=t.x1,s=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(n>s&&([n,s]=[s,n]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function $t(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2e.y2||t.y2l||sc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let n=e.x1,s=e.x2,r=e.y1,a=e.y2;return n>s&&([n,s]=[s,n]),r>a&&([r,a]=[a,r]),t.x>=n&&t.x<=s&&t.y>=r&&t.y<=a}function Zt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Jt({x:t,y:e},i,n={x:0,y:0}){return{x:(t-n.x)*Math.cos(i)-(e-n.y)*Math.sin(i)+n.x,y:(t-n.x)*Math.sin(i)+(e-n.y)*Math.cos(i)+n.y}}function Qt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function te(t,e){const i=e?Nt(t.angle):t.angle,n=Qt(t);return[Jt({x:t.x1,y:t.y1},i,n),Jt({x:t.x2,y:t.y1},i,n),Jt({x:t.x2,y:t.y2},i,n),Jt({x:t.x1,y:t.y2},i,n)]}function ee(t,e,i=!1){const n=te(t,i),s=te(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Qt(t),Qt(e)),o=r(n[0],n[1]),l=r(n[1],n[2]),h=r(s[0],s[1]),c=r(s[1],s[2]),u=i?Nt(t.angle):t.angle;let d=i?Nt(90-t.angle):t.angle+xt;const p=i?Nt(e.angle):e.angle;let g=i?Nt(90-e.angle):e.angle+xt;d>At&&(d-=At),g>At&&(g-=At);const f=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Zt(s,i)+Zt(s,n))/2>Zt(s,a)};return f((t.x2-t.x1)/2,u,h,c)&&f((t.y2-t.y1)/2,d,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}function ie(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}const ne=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};function se(t,e={},i){i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class re{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=se(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:u,textBaseline:d=(null!=u?u:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:d,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(d(t))return{width:0,height:0};if(d(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:n,lineHeight:s}=this.textSpec;return{width:i.width,height:null!==(e=s)&&void 0!==e?e:n,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=s)&&void 0!==i?i:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(d(this._numberCharSize)){const t=this._standardMethod(re.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/re.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(re.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(re.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/re.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}re.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",re.NUMBERS_CHAR_SET="0123456789",re.FULL_SIZE_CHAR="字";const ae=(t,e)=>{const{x1:i,x2:n,y1:s,y2:r}=t,a=Math.abs(n-i),o=Math.abs(r-s);let l=(i+n)/2,h=(s+r)/2,c=0,u=0;switch(e){case"top":case"inside-top":u=-.5;break;case"bottom":case"inside-bottom":u=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,u=-.5;break;case"top-left":c=-.5,u=-.5;break;case"bottom-right":c=.5,u=.5;break;case"bottom-left":c=-.5,u=.5}return l+=c*a,h+=u*o,{x:l,y:h}},oe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),le=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function n(t,e,i){const n=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...n),max:Math.max(...n)}}let s=0;for(const r of i){const i=n(t,r.x,r.y),a=n(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(t=0,e=0,i=0,n=0){const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return he(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*s+h,l*n+o*s+c,o*n-l*a+h,l*n+o*a+c,o*r-l*s+h,l*r+o*s+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,n){const{x1:s,y1:r,x2:a,y2:o}=this;return[t*s+(1-t)*i,e*r+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class ue extends ce{}class de extends ce{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return ee(this,t)}setValue(t=0,e=0,i=0,n=0,s=0){return super.setValue(t,e,i,n),this.angle=s,this}clone(){return new de(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Jt({x:this.x1,y:this.y1},this.angle,t),Jt({x:this.x2,y:this.y1},this.angle,t),Jt({x:this.x1,y:this.y2},this.angle,t),Jt({x:this.x2,y:this.y2},this.angle,t)]}}class pe{constructor(t=1,e=0,i=0,n=1,s=0,r=0){this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new pe,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,u=n*this.e-s*this.f+r,d=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,u=o*t+h*e,d=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new pe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,u=-s/l,d=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*u+p,e.y=f*c+m*d+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new pe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,s=t*n-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotateDeg=180*r.rotateDeg/Math.PI,r}}class ge{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:s=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=s)););if(in;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>i;)t.timestamp.shift()}}function fe(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function me(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const ve=/^#([0-9a-f]{3,8})$/,ye={transparent:4294967040},_e={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function be(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function xe(t){return S(t)?new Te(t>>16,t>>8&255,255&t,1):_(t)?new Te(t[0],t[1],t[2]):new Te(255,255,255)}function Se(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ae(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Ce=(t,e)=>{const i=ve.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Te((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?xe(t):8===e?new Te(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class we{static Brighter(t,e=1){return 1===e?t:new we(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new we(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof we?t:new we(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(ye[t]))return function(t){return S(t)?new Te(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new Te(t[0],t[1],t[2],t[3]):new Te(255,255,255,1)}(ye[t]);if(p(_e[t]))return xe(_e[t]);const e=`${t}`.trim().toLowerCase(),i=Ce(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Te(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=fe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Te(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=we.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Te(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}add(t){const{r:e,g:i,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=me(this.color.r,this.color.g,this.color.b),r=fe(d(t)?s.h:ut(t,0,360),d(e)?s.s:e>=0&&e<=1?100*e:e,d(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new Te(r.r,r.g,r.b,n),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Ce(e,!0);return null!=i?i:this}setColorName(t){const e=_e[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let n,s,r;return n=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),s=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*s+.0722*r}clone(){return new we(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Se(t.color.r),this.color.g=Se(t.color.g),this.color.b=Se(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Ae(t.color.r),this.color.g=Ae(t.color.g),this.color.b=Ae(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Te{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),p(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${be(this.r)+be(this.g)+be(this.b)+(1===this.opacity?"":be(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=me(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ke(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),u=Math.round(a*(1-t)+o*t);return new Te(e,c,u,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:me});function Be(t){if(A(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,n]=t;return[e,i,n,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:n=0,left:s=0}=t;return[e,i,n,s]}return[0,0,0,0]}function Ee(t,e=0,i=0){if(!t)return{width:e,height:i};let n;try{n=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){n=()=>({})}const s=n(t);if(/^(\d*\.?\d+)(px)$/.exec(s.width)){const n=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,r=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:n<=0?e:n,height:r<=0?i:r}}return{width:e,height:i}}const Pe=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();class Oe{static getInstance(){return Oe.instance||(Oe.instance=new Oe),Oe.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1},this.parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1},this.parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1},this.parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1},this.parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(r=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++r1?s[0]+s.slice(2):s,+i.slice(n+1)]}let Ie;function De(t,e){const i=Re(t,e);if(!i)return t+"";const n=i[0],s=i[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}class Le{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Fe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ue(t){let e;if(e=Fe.exec(t))return new Le({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]});nt.getInstance().error("invalid format: "+t)}const Ne=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class je{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,n){let s=t.length;const r=[];let a=0,o=e[0],l=0;for(;s>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),r.push(t.substring(s-=o,s+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return je.instance||(je.instance=new je),je.instance}newFormat(t){const e=Ue(t);let i=e.fill,n=e.align;const s=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,u=e.type;"n"===u?(l=!0,u="g"):ze[u]||(void 0===h&&(h=12),c=!0,u="g"),(a||"0"===i&&"="===n)&&(a=!0,i="0",n="=");const d="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(u)?"0"+u.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(u)?this.percent:"",g=ze[u],f=/[defgprstz%]/.test(u);h=void 0===h?6:/[gprs]/.test(u)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=d,A=p,C=t;if("c"===u)A=g(C)+A,C="";else{C=+C;let t=C<0||1/C<0;if(C=isNaN(C)?m:g(Math.abs(C),h),c&&(C=function(t){const e=t.length;let i,n=-1;t:for(let s=1;s0&&(n=0)}return n>0?t.slice(0,n)+t.slice(i+1):t}(C)),t&&0==+C&&"+"!==s&&(t=!1),S=(t?"("===s?s:v:"-"===s||"("===s?"":s)+S,A=("s"===u?Ne[8+Ie/3]:"")+A+(t&&"("===s?")":""),f)for(e=-1,r=C.length;++ex||x>57){A=(46===x?y+C.slice(e+1):C.slice(e))+A,C=C.slice(0,e);break}}l&&!a&&(C=_(C,1/0));let w=S.length+C.length+A.length,T=w>1)+S+C+A+T.slice(w);break;default:C=T+S+C+A}return b(C)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Ue(t);i.type="f";const n=this.newFormat(i.toString()),s=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=Re(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-s),a=Ne[8+s/3];return function(t){return n(r*t)+a}}}const ze={"%":(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)=>De(100*t,e),r:De,s:function(t,e){const i=Re(t,e);if(!i)return t+"";const n=i[0],s=i[1],r=s-(Ie=3*Math.max(-8,Math.min(8,Math.floor(s/3))))+1,a=n.length;return r===a?n:r>a?n+new Array(r-a+1).join("0"):r>0?n.slice(0,r)+"."+n.slice(r):"0."+new Array(1-r).join("0")+Re(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};const We=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},He=function(t,...e){return function(t,...e){t||(t={});let i=-1;const n=e.length;for(;++i{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},Ke=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(l.sort&&(A(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(n=l.domain)||void 0===n?void 0:n.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let n=0;n9999?"+"+Qe(e,6):Qe(e,4))+"-"+Qe(t.getUTCMonth()+1,2)+"-"+Qe(t.getUTCDate(),2)+(r?"T"+Qe(i,2)+":"+Qe(n,2)+":"+Qe(s,2)+"."+Qe(r,3)+"Z":s?"T"+Qe(i,2)+":"+Qe(n,2)+":"+Qe(s,2)+"Z":n||i?"T"+Qe(i,2)+":"+Qe(n,2)+"Z":"")}function ei(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return qe;if(h)return h=!1,$e;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a{i.type=Ye.DSV;const n=He(si,e),{delimiter:s}=n;if(!y(s))throw new TypeError("Invalid delimiter: must be a string!");return ei(s).parse(t)},ai=(t,e={},i)=>(i.type=Ye.DSV,ii(t)),oi=(t,e={},i)=>(i.type=Ye.DSV,ni(t)),li=(t,e,i)=>{const n=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let hi=0;function ci(t="dataset"){return hi>1e8&&(hi=0),t+"_"+hi++}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:ci("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:nt.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class di{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&W(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ci("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const s=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(s,e.options,this);this.rawData=s,this.parserData=t,this.history&&this.historyData.push(s,t),this.latestData=t}else this.parserData=s,this.rawData=s,this.history&&this.historyData.push(s),this.latestData=s;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:n,skipEqual:s}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===n||s&&W(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof di||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?U({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ke),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class pi{static GenAutoIncrementId(){return pi.auto_increment_id++}}pi.auto_increment_id=0;var gi=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class fi 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=pi.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return gi(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&nt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof yi))return void nt.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(Si(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof yi))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=Si(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let n=o;for(;n&&n!==this.rootTarget;)i.add(n),n=n.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursorTarget=s.target,this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof yi))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Si(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof yi))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Si(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(s),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof yi))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=xi.now(),s=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(s,"pointerup"),"touch"===s.pointerType)this.dispatchEvent(s,"touchend");else if(Si(s.pointerType)){const t=2===s.button;this.dispatchEvent(s,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!s.composedPath().includes(a)){let e=a;for(;e&&!s.composedPath().includes(e);){if(s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType)this.notifyTarget(s,"touchendoutside");else if(Si(s.pointerType)){const t=2===s.button;this.notifyTarget(s,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(s,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:n});const a=r.clicksByButton[t.button];a.target===e.target&&n-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=n,e.detail=a.clickCount,Si(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(s)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof yi))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):Si(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof _i))return void nt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,n,s,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===n?void 0:n.stage)&&(null===(r=null===(s=this._prePointTargetCache)||void 0===s?void 0:s[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=xi.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let n=0,s=i.length;n{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:s,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=s.supportsTouchEvents,supportsPointerEvents:l=s.supportsPointerEvents}=t;this.manager=new Ai(n,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=s,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new yi,this.rootWheelEvent=new _i,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];s?"string"==typeof s&&i?n.style.cursor=s:"function"==typeof s?s(t):"object"==typeof s&&i&&Object.assign(n.style,s):i&&y(t)&&!R(this.cursorStyles,t)&&(n.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const n=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(n)return n;let s=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0}else s=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:s-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const ki=St-1e-8;class Mi{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>ki)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),lu&&(u=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=St)<0&&(n+=St),(s%=St)<0&&(s+=St),ss;++o,a-=xt)g(a);else for(a=n-n%xt+xt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Ei=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Pi={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},Oi={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Ri,Ii,Di,Li,Fi,Ui;function Ni(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tUi){let t,e=Di;for(let n=1,r=i.length;n1&&(g=Math.sqrt(g),i*=g,n*=g);const f=u/i,m=c/i,v=-c/n,y=u/n,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let C=Math.sqrt(A);r===s&&(C=-C);const w=.5*(_+x)-C*(S-b),T=.5*(b+S)+C*(x-_),k=Math.atan2(b-T,_-w);let M=Math.atan2(S-T,x-w)-k;M<0&&1===r?M+=St:M>0&&0===r&&(M-=St);const B=Math.ceil(Math.abs(M/(xt+.001))),E=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,u=(i%l+l)%l;o?(u>=h&&(u-=l),c=u-h):(u<=h&&(u+=l),c=u-h);const d=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/d;for(let e=0;ee.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function Zi(t,e,i=0,n=0,s=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i,this.p3.x*n+e,this.p3.y*s+i);else if(r>0){const[a]=on(this,r);t.bezierCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i,a.p3.x*n+e,a.p3.y*s+i)}}includeX(t){const e=Mt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Mt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function hn(t,e){const{p0:i,p1:n}=t,s=Ut.pointAtPP(i,n,e);return[new cn(i,s),new cn(s,n)]}class cn extends Ji{constructor(t,e){super(),this.type=Vi.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return Ut.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?Ut.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Hi.ROW?Ct(this.p0.x-this.p1.x):t===Hi.COLUMN?Ct(this.p0.y-this.p1.y):0}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.lineTo(this.p1.x*n+e,this.p1.y*s+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*n+e,a.y*s+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const n=(t-e.x)/(i.x-e.x);return e.y+n*(i.y-e.y)}return 1/0}}class un{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,n,s,r,a,o){const l=new ln(new Ft(this._lastX,this._lastY),new Ft(t,e),new Ft(i,n),new Ft(s,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=s,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,n){const s=this.addLinearCurve(t,e,i,this._lastOriginP,n);this.curves.push(s),this._lastX=t,this._lastY=e,this._lastOriginP=n}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,n){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,n,s){const r=new cn(new Ft(this._lastX,this._lastY),new Ft(t,e));return r.originP1=n,r.originP2=s,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Hi.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],n=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ct(t.p0.y-n.y)}if(t===Hi.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],n=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ct(t.p0.x-n.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class dn extends un{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function pn(t,e,i=1){let n=!1;for(let i=0,s=e.length;i<=s;i++)i>=s===n&&((n=!n)?t.lineStart():t.lineEnd()),n&&t.point(e[i])}function gn(t,e,i){const n=null!=e?e:Ct(i[i.length-1].x-i[0].x)>Ct(i[i.length-1].y-i[0].y)?Hi.ROW:Hi.COLUMN;return"monotoneY"===t?new dn(t,n):new un(t,n)}class fn{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 mn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=gn("linear",i,t);return vn(new fn(s,n),t),s}function vn(t,e){return pn(t,e,1)}function yn(t,e,i,n,s){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,n,t.lastPoint1)}class _n{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&&yn(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:yn(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 bn(t,e){return pn(t,e,2)}function xn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return mn(t,e);const s=gn("basis",i,t);return bn(new _n(s,n),t),s}function Sn(t){return t<0?-1:1}function An(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Sn(r)+Sn(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Cn(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function wn(t,e,i,n,s){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,n,t.lastPoint1)}class Tn{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:wn(this,this._t0,Cn(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,wn(this,Cn(this,e=An(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:wn(this,this._t0,e=An(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class kn extends Tn{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Mn(t,e){return pn(t,e,2)}function Bn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return mn(t,e);const s=gn("monotoneX",i,t);return Mn(new Tn(s,n),t),s}function En(t,e){return pn(t,e,2)}function Pn(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return mn(t,e);const s=gn("monotoneY",i,t);return En(new kn(s,n),t),s}let On=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(n,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Rn extends On{lineEnd(){this.context.closePath()}}function In(t,e,i={}){const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new un("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?Hi.ROW:Hi.COLUMN);return Dn(new On(r,e,s),t),r}function Dn(t,e){return pn(t,e,1)}function Ln(t,e,i={}){const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new un("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?Hi.ROW:Hi.COLUMN);return Dn(new Rn(r,e,s),t),r}class Fn extends fn{lineEnd(){this.context.closePath()}}function Un(t,e={}){const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=gn("linear",i,t);return Nn(new Fn(s,n),t),s}function Nn(t,e){return pn(t,e,1)}function jn(t,e,i,n,s){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>_t){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>_t){const n=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*n+t._x1*t._l23_2a-e*t._l12_2a)/s,l=(l*n+t._y1*t._l23_2a-i*t._l12_2a)/s}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,n,t.lastPoint1)}function zn(t,e){return function(i,n,s={}){const{direction:r,startPoint:a}=s;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return mn(i,s);const o=gn(t,r,i);return pn(new e(o,n,a),i,2),o}}const Wn=zn("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:jn(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Hn=zn("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:jn(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Vn extends Ji{constructor(t,e,i){super(),this.type=Vi.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return rn(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?an(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===Hi.ROW?Ct(this.p0.x-this.p2.x):t===Hi.COLUMN?Ct(this.p0.y-this.p2.y):0}getAngleAt(t){const e=kt(t-.01,0),i=Mt(t+.01,1),n=this.getPointAt(e),s=this.getPointAt(i);return wt(s.y-n.y,s.x-n.x)}draw(t,e,i,n,s,r){if(t.moveTo(this.p0.x*n+e,this.p0.y*s+i),r>=1)t.quadraticCurveTo(this.p1.x*n+e,this.p1.y*s+i,this.p2.x*n+e,this.p2.y*s+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:n,p2:s}=t,r=rn(i,n,s,e),a=Ut.pointAtPP(i,n,e),o=Ut.pointAtPP(n,s,e);return[new Vn(i,a,r),new Vn(r,o,s)]}(this,r);t.quadraticCurveTo(a.p1.x*n+e,a.p1.y*s+i,a.p2.x*n+e,a.p2.y*s+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Gn{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new cn(new Ft(this._lastX,this._lastY),new Ft(t,e))}quadraticCurveTo(t,e,i,n){const s=new Vn(new Ft(this._lastX,this._lastY),new Ft(t,e),new Ft(i,n));this.path.addCurve(s),this._lastX=i,this._lastY=n}bezierCurveTo(t,e,i,n,s,r){const a=new ln(new Ft(this._lastX,this._lastY),new Ft(t,e),new Ft(i,n),new Ft(s,r));this.path.addCurve(a),this._lastX=s,this._lastY=r}arcTo(t,e,i,n,s){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,n,s,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,n){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,n,s,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Yn(t,e,i){var n,s;switch(e){case"linear":default:return mn(t,i);case"basis":return xn(t,i);case"monotoneX":return Bn(t,i);case"monotoneY":return Pn(t,i);case"step":return In(t,.5,i);case"stepClosed":return Ln(t,.5,i);case"stepBefore":return In(t,0,i);case"stepAfter":return In(t,1,i);case"catmullRom":return Wn(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return Hn(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"linearClosed":return Un(t,i)}}class Xn extends Bi{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Mi(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Oi.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Oi.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([Oi.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([Oi.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([Oi.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([Oi.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([Oi.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([Oi.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([Oi.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Gn(this);Zi(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Oi.M]=t=>`M${t[1]} ${t[2]}`,t[Oi.L]=t=>`L${t[1]} ${t[2]}`,t[Oi.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Oi.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Oi.A]=t=>{const e=[],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6];$i(e,r,a,i,n,s,s,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Oi.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=Ni(t);return this._runCommandStrList(r,e,i,n,s),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:n}=t.attribute;if(!e)return;const s=Yn(e,i);"x"===n?this.direction=Hi.ROW:"y"===n?this.direction=Hi.COLUMN:"auto"===n&&(this.direction=s.direction),this._curves=s.curves}fromCustomPath2D(t,e,i,n,s){return this.clear(),this._runCommandList(t.commandList,e,i,n,s),this._updateBounds(),this}transform(t,e,i,n){const s=this.commandList;if(!this.transformCbList){const t=[];t[Oi.M]=this.moveToTransform,t[Oi.L]=this.lineToTransform,t[Oi.Q]=this.quadraticCurveToTransform,t[Oi.C]=this.bezierCurveToTransform,t[Oi.AT]=this.arcToTransform,t[Oi.E]=this.ellipseTransform,t[Oi.R]=this.rectTransform,t[Oi.A]=this.arcTransform,t[Oi.Z]=this.closePathTransform,this.transformCbList=t}s.forEach((s=>{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,n=1,s=1){let r,a,o,l,h,c=null,u=0,d=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Zi(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Hi.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ct(t.p0.y-e.p1.y)}if(this.direction===Hi.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ct(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}drawWithClipRange(t,e,i,n,s){this.tryBuildCurves();const r=this.getLength()*s;let a=0;for(let s=0;s{nt.getInstance().warn("空函数")}}),_s=Object.assign(Object.assign({},us),{points:[],cornerRadius:0,closePath:!0}),bs=Object.assign(Object.assign({},us),{width:100,height:100,spikes:5,thickness:.5}),xs=Object.assign(Object.assign({},us),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Ss=Object.assign(Object.assign({},us),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),As=Object.assign(Object.assign({},us),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Cs=Object.assign(Object.assign(Object.assign({},us),as),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ws=Object.assign(Object.assign(Object.assign({},us),as),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Ts=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},us),{fill:!0,cornerRadius:0,cornerType:"round"}),ks=Object.assign(Object.assign({},Ts),{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});class Ms{}const Bs=Symbol.for("@visactor/vrender-core/application-state");function Es(){const t=globalThis;return t[Bs]||(t[Bs]={application:new Ms}),t[Bs]}const Ps=Es().application;class Os{static GetImage(t,e){var i;const n=Os.cache.get(t);n?"fail"===n.loadState?Ps.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):Os.loadImage(t,e)}static GetSvg(t,e){var i;let n=Os.cache.get(t);n?"fail"===n.loadState?Ps.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},Os.cache.set(t,n),n.dataPromise=Ps.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))})),n.waitingMark&&(n.waitingMark=[])})).catch((()=>{var e;n.loadState="fail",null===(e=n.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),n.waitingMark&&(n.waitingMark=[])}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Os.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Os.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ps.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ps.global.loadBlob(t):"json"===e&&(i.dataPromise=Ps.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Os.isLoading&&Os.toLoadAueue.length){Os.isLoading=!0;const t=Os.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,s={type:"image",loadState:"init"};if(Os.cache.set(i,s),s.dataPromise=Ps.global.loadImage(i),s.dataPromise){s.waitingMark=n;const t=s.dataPromise.then((t=>{var e;s.loadState=(null==t?void 0:t.data)?"success":"fail",s.data=null==t?void 0:t.data,null===(e=s.waitingMark)||void 0===e||e.map(((e,n)=>{(null==t?void 0:t.data)?(s.loadState="success",s.data=t.data,e.imageLoadSuccess(i,t.data)):(s.loadState="fail",e.imageLoadFail(i))})),s.waitingMark&&(s.waitingMark=[])}));e.push(t)}else s.loadState="fail",n.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Os.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Os.loading()})).catch((t=>{console.error(t),Os.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Os.loading()}))}}),0)}static loadImage(t,e){const i=Rs(t,Os.toLoadAueue);if(-1!==i)return Os.toLoadAueue[i].marks.push(e),void Os.loading();Os.toLoadAueue.push({url:t,marks:[e]}),Os.loading()}static improveImageLoading(t){const e=Rs(t,Os.toLoadAueue);if(-1!==e){const t=Os.toLoadAueue.splice(e,1);Os.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Rs(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let n=0;n<4;n++)Ds[n]=t,i&&(i=!(null!==(e=Ds[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Ds[e]=!!t[e],i&&(i=!!Ds[e]);else Ds[0]=!1,Ds[1]=!1,Ds[2]=!1,Ds[3]=!1;return{isFullStroke:i,stroke:Ds}},Fs=[0,0,0,0],Us=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Fs[0]=t[0],Fs[2]=t[0],Fs[1]=t[1],Fs[3]=t[1],Fs):t:t:0,Ns=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],js=[1,2,3,0,1,2,3,0];function zs(t,e,i,n){for(;t>=At;)t-=At;for(;t<0;)t+=At;for(;t>e;)e+=At;Ns[0].x=i,Ns[1].y=i,Ns[2].x=-i,Ns[3].y=-i;const s=Math.ceil(t/xt)%4,r=Math.ceil(e/xt)%4;if(n.add(Tt(t)*i,Bt(t)*i),n.add(Tt(e)*i,Bt(e)*i),s!==r||e-t>bt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ft(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ft(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{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)}}Ys.TimeOut=1e3/60;const Xs=new Ys,Ks=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,$s=(t,e)=>{const i=Ks(t,e);return isNaN(i)?i:Math.max(e,i)};class qs{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Zs(t,e,i,n,s){return s?t.arc(i,n,e,0,St,!1,s):t.arc(i,n,e,0,St),!1}var Js=new class extends qs{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,n,s){return Zs(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return Zs(t,this.parseSize(e)/2+s,i,n,r)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} a ${s},${s} 0 1,0 ${2*s},0 a ${s},${s} 0 1,0 -${2*s},0`}};var Qs=new class extends qs{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,n,s){return function(t,e,i,n,s){return t.moveTo(-3*e+i,-e+n,s),t.lineTo(-e+i,-e+n,s),t.lineTo(-e+i,-3*e+n,s),t.lineTo(e+i,-3*e+n,s),t.lineTo(e+i,-e+n,s),t.lineTo(3*e+i,-e+n,s),t.lineTo(3*e+i,e+n,s),t.lineTo(e+i,e+n,s),t.lineTo(e+i,3*e+n,s),t.lineTo(-e+i,3*e+n,s),t.lineTo(-e+i,e+n,s),t.lineTo(-3*e+i,e+n,s),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s)}drawOffset(t,e,i,n,s,r){return function(t,e,i,n,s,r){return t.moveTo(-3*e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-e+n-s,r),t.lineTo(-e+i-s,-3*e+n-s,r),t.lineTo(e+i+s,-3*e+n-s,r),t.lineTo(e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,-e+n-s,r),t.lineTo(3*e+i+s,e+n+s,r),t.lineTo(e+i+s,e+n+s,r),t.lineTo(e+i+s,3*e+n+s,r),t.lineTo(-e+i-s,3*e+n+s,r),t.lineTo(-e+i-s,e+n+s,r),t.lineTo(-3*e+i-s,e+n+s,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,s,r)}};function tr(t,e,i,n,s){return t.moveTo(i,n-e,s),t.lineTo(e+i,n,s),t.lineTo(i,n+e,s),t.lineTo(i-e,n,s),t.closePath(),!0}var er=new class extends qs{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,s){return tr(t,this.parseSize(e)/2,i,n,s)}drawFitDir(t,e,i,n,s){return tr(t,this.parseSize(e)/2,i,n,s)}drawOffset(t,e,i,n,s,r){return tr(t,this.parseSize(e)/2+s,i,n,r)}};function ir(t,e,i,n){const s=2*e;return t.rect(i-e,n-e,s,s),!1}var nr=new class extends qs{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return ir(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return ir(t,this.parseSize(e)/2+s,i,n)}};function sr(t,e,i,n,s=0){return t.moveTo(i+e+2*s,e+n+s),t.lineTo(i-e-2*s,e+n+s),t.lineTo(i,n-e-2*s),t.closePath(),!0}class rr extends qs{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,n){return sr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return sr(t,this.parseSize(e)/2,i,n,s)}}var ar=new rr;var or=new class extends rr{constructor(){super(...arguments),this.type="triangle"}};const lr=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),hr=Math.sin(St/10)*lr,cr=-Math.cos(St/10)*lr;function ur(t,e,i,n){const s=hr*e,r=cr*e;t.moveTo(i,-e+n),t.lineTo(s+i,r+n);for(let a=1;a<5;++a){const o=St*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+n),t.lineTo(l*s-h*r+i,h*s+l*r+n)}return t.closePath(),!0}var dr=new class extends qs{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,n){return ur(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return ur(t,this.parseSize(e)/2+s,i,n)}};const pr=Et(3);function gr(t,e,i,n){const s=e,r=s/pr,a=r/5,o=e;return t.moveTo(0+i,-s+n),t.lineTo(r/2+i,n),t.lineTo(a/2+i,n),t.lineTo(a/2+i,o+n),t.lineTo(-a/2+i,o+n),t.lineTo(-a/2+i,n),t.lineTo(-r/2+i,n),t.closePath(),!0}var fr=new class extends qs{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,n){return gr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return gr(t,this.parseSize(e)/2+s,i,n)}};function mr(t,e,i,n){const s=2*e;return t.moveTo(i,-e+n),t.lineTo(s/3/2+i,e+n),t.lineTo(-s/3/2+i,e+n),t.closePath(),!0}var vr=new class extends qs{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return mr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return mr(t,this.parseSize(e)/2+s,i,n)}};function yr(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var _r=new class extends qs{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,n){return yr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return yr(t,this.parseSize(e)/2+s,i,n)}};const br=-.5,xr=Et(3)/2,Sr=1/Et(12);function Ar(t,e,i,n){const s=e/2,r=e*Sr,a=s,o=e*Sr+e,l=-a,h=o;return t.moveTo(s+i,r+n),t.lineTo(a+i,o+n),t.lineTo(l+i,h+n),t.lineTo(br*s-xr*r+i,xr*s+br*r+n),t.lineTo(br*a-xr*o+i,xr*a+br*o+n),t.lineTo(br*l-xr*h+i,xr*l+br*h+n),t.lineTo(br*s+xr*r+i,br*r-xr*s+n),t.lineTo(br*a+xr*o+i,br*o-xr*a+n),t.lineTo(br*l+xr*h+i,br*h-xr*l+n),t.closePath(),!1}var Cr=new class extends qs{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,n){return Ar(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Ar(t,this.parseSize(e)/2+s,i,n)}};function wr(t,e,i,n,s){return t.moveTo(-e+i-2*s,n),t.lineTo(e+i+s,e+n+2*s),t.lineTo(e+i+s,n-e-2*s),t.closePath(),!0}var Tr=new class extends qs{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,n){return wr(t,this.parseSize(e)/2,i,n,0)}drawOffset(t,e,i,n,s){return wr(t,this.parseSize(e)/2,i,n,s)}};function kr(t,e,i,n,s=0){return t.moveTo(i-e-s,e+n+2*s),t.lineTo(e+i+2*s,n),t.lineTo(i-e-s,n-e-2*s),t.closePath(),!0}var Mr=new class extends qs{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,n){return kr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return kr(t,this.parseSize(e)/2,i,n,s)}};function Br(t,e,i,n,s=0){return t.moveTo(i-e-2*s,n-e-s),t.lineTo(i+e+2*s,n-e-s),t.lineTo(i,n+e+2*s),t.closePath(),!0}var Er=new class extends qs{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,n){return Br(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s){return Br(t,this.parseSize(e)/2,i,n,s)}};const Pr=Et(3);function Or(t,e,i,n){const s=e*Pr;return t.moveTo(i,n+-s/3*2),t.lineTo(e+i,n+s),t.lineTo(i-e,n+s),t.closePath(),!0}var Rr=new class extends qs{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return Or(t,this.parseSize(e)/2/Pr,i,n)}drawOffset(t,e,i,n,s){return Or(t,this.parseSize(e)/2/Pr+s,i,n)}};function Ir(t,e,i,n){const s=2*e;return t.moveTo(e+i,n-s),t.lineTo(i-e,n),t.lineTo(e+i,s+n),!0}var Dr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,n){return Ir(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Ir(t,this.parseSize(e)/4+s,i,n)}};function Lr(t,e,i,n){const s=2*e;return t.moveTo(i-e,n-s),t.lineTo(i+e,n),t.lineTo(i-e,s+n),!0}var Fr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,n){return Lr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Lr(t,this.parseSize(e)/4+s,i,n)}};function Ur(t,e,i,n){const s=2*e;return t.moveTo(i-s,n+e),t.lineTo(i,n-e),t.lineTo(i+s,n+e),!0}var Nr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,n){return Ur(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return Ur(t,this.parseSize(e)/4+s,i,n)}};function jr(t,e,i,n){const s=2*e;return t.moveTo(i-s,n-e),t.lineTo(i,n+e),t.lineTo(i+s,n-e),!0}var zr=new class extends qs{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,n){return jr(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,s){return jr(t,this.parseSize(e)/4+s,i,n)}};function Wr(t,e,i,n,s){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var Hr=new class extends qs{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,s){return Wr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Wr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e}, ${i-s} L ${e},${i+s}`}};function Vr(t,e,i,n,s){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var Gr=new class extends qs{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,s){return Vr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Vr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i} L ${e+s},${i}`}};function Yr(t,e,i,n,s){return t.moveTo(i-e,n-e),t.lineTo(i+e,n+e),t.moveTo(i+e,n-e),t.lineTo(i-e,n+e),!0}var Xr=new class extends qs{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,n,s){return Yr(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,s,r){return Yr(t,this.parseSize(e)/2+s,i,n)}drawToSvgPath(t,e,i,n){const s=this.parseSize(t)/2;return`M ${e-s}, ${i-s} L ${e+s},${i+s} M ${e+s}, ${i-s} L ${e-s},${i+s}`}};function Kr(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function $r(t,e,i,n){const s=e,r=e/2;return t.rect(i-s/2,n-r/2,s,r),!1}var qr=new class extends qs{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,n){return S(e)?$r(t,e,i,n):Kr(t,e,i,n)}drawWithClipRange(t,e,i,n,s,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*s,l=[{x:i+e[0]/2,y:n-e[1]/2},{x:i+e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n+e[1]/2},{x:i-e[0]/2,y:n-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/n,s=(i.y-c.y)*(o-h)/n;t.lineTo(c.x+e,c.y+s);break}t.lineTo(i.x,i.y),c=i,h+=n}return!1}drawOffset(t,e,i,n,s){return S(e)?$r(t,e+2*s,i,n):Kr(t,[e[0]+2*s,e[1]+2*s],i,n)}};const Zr=new ue;class Jr{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((s=>{t.beginPath(),Zi(s.path.commandList,t,i,n,e,e),a&&a(s.path,s.attribute)})),!1):(Zi(this.path.commandList,t,i,n,e+s,e+s),!1)}draw(t,e,i,n,s,r){return e=this.parseSize(e),this.drawOffset(t,e,i,n,0,s,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,n,s,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,n,s),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,n,s),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Zr.x1=i.bounds.x1*t,Zr.y1=i.bounds.y1*t,Zr.x2=i.bounds.x2*t,Zr.y2=i.bounds.y2*t,e.union(Zr)}))}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 Qr=[Js,Qs,er,nr,Rr,or,dr,fr,vr,_r,Cr,Tr,Mr,ar,Er,Dr,Fr,Nr,zr,qr,Hr,Gr,Xr],ta={};Qr.forEach((t=>{ta[t.type]=t}));const ea={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class ia{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 na(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function sa(t,e,i,n=">"){const s=function(t,e,i=">"){let n,s="";for(let r=e;r",r,"Closing Tag is not closed."),a=s.lastIndexOf(".");s=s.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",r=e}else if("?"===t[r+1])r=sa(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=na(t,"--\x3e",r+4,"Comment is not closed.");else{const a=sa(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(s+=s?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),s=s.substr(0,s.length-1),l=o):l=l.substr(0,l.length-1);const t=new ia(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),s=s.substr(0,s.lastIndexOf("."))}else{const t=new ia(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,s,o)),this.addChild(i,t,s),i=t}n="",r=c}else n+=t[r];return e.child}}function oa(t,e){return la(t)}function la(t,e){const i={};for(let e=0;eba.set(t,!0)));const xa=new Map;function Sa(t){if(ba.has(t))return!0;if(xa.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Aa(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>xa.set(t,!0)));const Ca=va(),wa=va(),Ta=va(),ka=va(),Ma=va(),Ba=va(),Ea=va(),Pa=va(),Oa=va(),Ra=va(),Ia=va(),Da=va(),La=va(),Fa=va(),Ua=va(),Na=va(),ja=va(),za=Symbol.for("GraphicService"),Wa=Symbol.for("GraphicCreator"),Ha={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},Va=Object.keys(Ha),Ga={"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"},Ya=Object.keys(Ga),Xa={duration:200,easing:"cubicOut"},Ka=Symbol.for("CanvasFactory"),$a=Symbol.for("Context2dFactory");function qa(t){return function(){var t,e;const i=null===(t=Ps.global)||void 0===t?void 0:t.env,n=i?null===(e=Ps.canvasFactory)||void 0===e?void 0:e.call(Ps,i):void 0;if(!n)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return n}()(t)}const Za=1e-4,Ja=Math.sqrt(3),Qa=1/3;function to(t){return t>-fo&&tfo||t<-fo}function io(t){return"number"==typeof t&&Number.isFinite(t)}const no=[0,0],so=[0,0],ro=[0,0];function ao(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function oo(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function lo(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function ho(t){return(t%=At)<0&&(t+=At),t}function co(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+u&&c>n+u&&c>r+u&&c>o+u||ct+u&&h>i+u&&h>s+u&&h>a+u||h=0&&pi||c+hs&&(s+=At);let u=Math.atan2(l,o);return u<0&&(u+=At),u>=n&&u<=s||u+At>=n&&u+At<=s}function go(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(to(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const vo=[-1,-1,-1],yo=[-1,-1];function _o(){const t=yo[0];yo[0]=yo[1],yo[1]=t}function bo(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=u*u-4*c*d;if(to(t)){const t=u/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-u+e),n=c*o+1.5*a*(-u-e);i=i<0?-Math.pow(-i,Qa):Math.pow(i,Qa),n=n<0?-Math.pow(-n,Qa):Math.pow(n,Qa);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*u)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+Ja*Math.sin(e)))/(3*a),h=(-o+i*(n-Ja*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,vo);if(0===c)return 0;let u=0,d=-1,p=0,g=0;for(let h=0;h1&&_o(),p=lo(e,n,r,o,yo[0]),d>1&&(g=lo(e,n,r,o,yo[1]))),2===d?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(to(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,vo);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=oo(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);vo[0]=-l,vo[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=At-1e-4){n=0,s=At;const e=r?1:-1;return a>=vo[0]+t&&a<=vo[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=At,s+=At);let c=0;for(let e=0;e<2;e++){const i=vo[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=At+t),(t>=n&&t<=s||t+At>=n&&t+At<=s)&&(t>bt/2&&t<1.5*bt&&(e=-e),c+=e)}}return c}function Ao(t){return Math.round(t/bt*1e8)/1e8%2*bt}function Co(t,e){let i=Ao(t[0]);i<0&&(i+=At);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=At?s=i+At:e&&i-s>=At?s=i-At:!e&&i>s?s=i+(At-Ao(i-s)):e&&i1&&(i||(h+=ie(c,u,d,p,n,s))),g&&(c=a[1],u=a[2],d=c,p=u);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;wo[0]=S,wo[1]=A,Co(wo,Boolean(a[6])),S=wo[0],A=wo[1];const C=S,w=A-S,T=!!(1-(a[6]?0:1)),k=(n-m)*y/y+m;switch(f){case Oi.M:d=m,p=v,c=d,u=p;break;case Oi.L:if(i){if(go(c,u,m,v,e,n,s))return!0}else h+=ie(c,u,m,v,n,s)||0;c=m,u=v;break;case Oi.C:if(i){if(uo(c,u,m,v,y,_,b,x,e,n,s))return!0}else h+=bo(c,u,m,v,y,_,b,x,n,s)||0;c=b,u=x;break;case Oi.Q:if(i){if(co(c,u,m,v,y,_,e,n,s))return!0}else h+=xo(c,u,m,v,y,_,n,s)||0;c=y,u=_;break;case Oi.A:if(o=Math.cos(C)*y+m,l=Math.sin(C)*y+v,g?(d=o,p=l):h+=ie(c,u,o,l,n,s),i){if(po(m,v,y,C,C+w,T,e,k,s))return!0}else h+=So(m,v,y,C,C+w,T,k,s);c=Math.cos(C+w)*y+m,u=Math.sin(C+w)*y+v;break;case Oi.R:if(d=c=m,p=u=v,o=d+y,l=p+_,i){if(go(d,p,o,p,e,n,s)||go(o,p,o,l,e,n,s)||go(o,l,d,l,e,n,s)||go(d,l,d,p,e,n,s))return!0}else h+=ie(o,p,o,l,n,s),h+=ie(d,l,d,p,n,s);break;case Oi.Z:if(i){if(go(c,u,d,p,e,n,s))return!0}else h+=ie(c,u,d,p,n,s);c=d,u=p}}return i||(g=u,f=p,Math.abs(g-f)0&&i("Invalid input not EOF"),t}()}}();class Mo{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Mo.IsGradientStr(t))try{const e=ko(t)[0];if(e){if("linear"===e.type)return Mo.ParseLinear(e);if("radial"===e.type)return Mo.ParseRadial(e);if("conic"===e.type)return Mo.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const n=t.length>1?i/(t.length-1):0;return{color:e.value,offset:n}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=bt/2,s=parseFloat(e.value)/180*bt-n;return{gradient:"conical",x:.5,y:.5,startAngle:s,endAngle:s+At,stops:Mo.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:Mo.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=bt/2;let s="angular"===e.type?parseFloat(e.value)/180*bt:0;for(;s<0;)s+=At;for(;s>=At;)s-=At;let r=0,a=0,o=0,l=0;return s{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,u,d):"conical"===c.gradient?h=function(t,e,i,n,s,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*s,n+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(s+i,r+n,void 0):l}(t,c,p,g,u,d):"radial"===c.gradient&&(h=function(t,e,i,n,s,r){var a,o,l,h,c,u;const d=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*s,n+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(s,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*s,n+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(s,r)*(null!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,c,p,g,u,d))}return h||"orange"}function Po(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Oo(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+u*n,t[7]=l*s+d*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=u*s-o*n,t[11]=d*s-l*n,t}function Ro(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],u=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-u*n,t[3]=l*s-d*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+u*s,t[11]=l*n+d*s,t}function Io(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+u*n,t[3]=l*s+d*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=u*s-o*n,t[7]=d*s-l*n,t}function Do(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,u,d,p,g,f,m,v;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],u=e[5],d=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=u,t[6]=d,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+u*s+f*r+e[13],t[14]=l*n+d*s+m*r+e[14],t[15]=h*n+p*s+v*r+e[15]),t}function Lo(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 Fo(t,e,i){const n=i[0],s=i[1],r=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Uo(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*u+S*f,t[1]=_*s+b*l+x*d+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*u+S*f,t[5]=_*s+b*l+x*d+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*u+S*f,t[9]=_*s+b*l+x*d+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*u+S*f,t[13]=_*s+b*l+x*d+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function No(t,e,i,n){let s,r,a,o,l,h,c,u,d,p;const g=e[0],f=e[1],m=e[2],v=n[0],y=n[1],_=n[2],b=i[0],x=i[1],S=i[2];return Math.abs(g-b)<_t&&Math.abs(f-x)<_t&&Math.abs(m-S)<_t?Po(t):(c=g-b,u=f-x,d=m-S,p=1/Math.hypot(c,u,d),c*=p,u*=p,d*=p,s=y*d-_*u,r=_*c-v*d,a=v*u-y*c,p=Math.hypot(s,r,a),p?(p=1/p,s*=p,r*=p,a*=p):(s=0,r=0,a=0),o=u*a-d*r,l=d*s-c*a,h=c*r-u*s,p=Math.hypot(o,l,h),p?(p=1/p,o*=p,l*=p,h*=p):(o=0,l=0,h=0),t[0]=s,t[1]=o,t[2]=c,t[3]=0,t[4]=r,t[5]=l,t[6]=u,t[7]=0,t[8]=a,t[9]=h,t[10]=d,t[11]=0,t[12]=-(s*g+r*f+a*m),t[13]=-(o*g+l*f+h*m),t[14]=-(c*g+u*f+d*m),t[15]=1,t)}function jo(t,e,i,n,s,r,a){const o=1/(e-i),l=1/(n-s),h=1/(r-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*o,t[13]=(s+n)*l,t[14]=(a+r)*h,t[15]=1,t}function zo(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}const Wo=Symbol.for("MatrixAllocate"),Ho=Symbol.for("Mat4Allocate");function Vo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}class Go{constructor(){this.pools=[]}allocate(t,e,i,n,s,r){if(!this.pools.length)return new pe(t,e,i,n,s,r);const a=this.pools.pop();return a.a=t,a.b=e,a.c=i,a.d=n,a.e=s,a.f=r,a}allocateByObj(t){if(!this.pools.length)return new pe(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}class Yo{constructor(){this.pools=[]}static identity(t){return Po(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 Yo.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;i0&&(Xo.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Xo.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n,s=!0){this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r,a=!0){this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},qo),function(t,e,i){return To(t,0,!1,e,i)}(this.path.commandList,qo.x,qo.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},qo);const i=Bo(this,this.lineWidth,this.dpr);return function(t,e,i,n){return To(t,e,!0,i,n)}(this.path.commandList,i,qo.x,qo.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix($o,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Xo.free(t))),this.stack.length=0}}const Jo={WIDTH:500,HEIGHT:500,DPR:1};class Qo{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:n=Jo.WIDTH,height:s=Jo.HEIGHT,dpr:r=Jo.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=n*r,this._pixelHeight=s*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=n,this._displayHeight=s,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var tl;Qo.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(tl||(tl={}));class el{static Get(t,e=tl.Color1,i=[0,0,0,1]){if(e===tl.Color1){const e=el.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const n=we.parseColorString(t);if(n){const e=[n.r/255,n.g/255,n.b/255,n.opacity];el.store1[t]=e,el.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const n=el.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;const s=we.parseColorString(t);return s&&(el.store1[t]=[s.r/255,s.g/255,s.b/255,s.opacity],el.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=s.r,i[1]=s.g,i[2]=s.b,i[3]=s.opacity),i}static Set(t,e,i){if(e===tl.Color1){if(el.store1[t])return;el.store1[t]=i,el.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(el.store255[t])return;el.store255[t]=i,el.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function il(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function nl(t,e,i,n,s){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((s,r)=>{var a,o;return sl(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,n)})):sl(t,e,i,n,s)}function sl(t,e,i,n,s){if(!t||!e)return t&&il(t)||e&&il(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=el.Get(t,tl.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=el.Get(e,tl.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:il(a)})))});return o?nl(r,l,i,n,s):nl(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return rl(n,s,i);if("radial"===n.gradient)return al(n,s,i);if("conical"===n.gradient)return ol(n,s,i)}return!1}return s&&s(r,a),il(ll(r,a,i),n)}function rl(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:dl(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}function al(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:dl(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}function ol(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:dl(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}function ll(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]}function hl(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}el.store255={},el.store1={};const cl=[0,0,0,0],ul=[0,0,0,0];function dl(t,e,i){return el.Get(t,tl.Color255,cl),el.Get(e,tl.Color255,ul),`rgba(${Math.round(cl[0]+(ul[0]-cl[0])*i)},${Math.round(cl[1]+(ul[1]-cl[1])*i)},${Math.round(cl[2]+(ul[2]-cl[2])*i)},${cl[3]+(ul[3]-cl[3])*i})`}class pl{static GetCanvas(){try{return pl.canvas||(pl.canvas=Ps.global.createCanvas({})),pl.canvas}catch(t){return null}}static GetCtx(){if(!pl.ctx){const t=pl.GetCanvas();pl.ctx=t.getContext("2d")}return pl.ctx}}class gl extends ge{static getInstance(){return gl._instance||(gl._instance=new gl),gl._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=pl.GetCanvas(),n=pl.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,n,s=[],r=100){let a=`${t}${e}${i}${n}`;s.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new gl(s,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class fl{static GetSize(t){for(let e=0;e=t)return fl.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=fl.GenKey(t,e,i,n,s),l=fl.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,s,r,a,o){const l=fl.GenKey(t,e,i,n,s);fl.cache[l]?fl.cache[l].push({width:a,height:o,pattern:r}):fl.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}function ml(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=At;for(;i>At;)i-=At;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),nl(o.color,l.color,h,!1)}function vl(t,e,i,n,s,r,a,o,l){const h=Math.floor(180*s/Math.PI),c=pl.GetCanvas(),u=pl.GetCtx();if(!u)return null;const d=fl.GetSize(o),p=fl.GetSize(l);let g=fl.Get(e,i,n,r,a,d,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(n,2),Math.pow(d-i,2)+Math.pow(n,2)),Math.max(Math.pow(d-i,2)+Math.pow(p-n,2),Math.pow(i,2)+Math.pow(p-n,2)))),m=h+1,v=s/Math.max(1,m-1),y=gl.getInstance().GetOrCreate(i,n,d,p,e,m),_=2*Math.PI*f/360;c.width=d,c.height=p,u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,d,p),u.translate(i,n),u.rotate(r);for(let t=0,e=m-1;ta);t++){const e=y.getColor(t);u.beginPath(),u.rotate(v),u.moveTo(0,0),u.lineTo(f,-2*_),u.lineTo(f,0),u.fillStyle=e,u.closePath(),u.fill()}const b=u.getImageData(0,0,d,p);return c.width=b.width,c.height=b.height,u.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&fl.Set(e,i,n,r,a,g,d,p),g}fl.cache={},fl.ImageSize=[20,40,80,160,320,640,1280,2560];const yl=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function _l(t){return null==t?void 0:t}class bl{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,n;const s=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(n=e.priority)&&void 0!==n?n:0;return s!==r?s-r:t.name.localeCompare(e.name)})),n=new Map;i.forEach(((t,e)=>{n.set(t.name,e)}));const s=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),s.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=n.get(t.name))&&void 0!==i?i:0,patch:_l(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(s,"exclude"),this.expandRelationClosure(s,"suppress"),s}normalizeDefinition(t,e){var i,n;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>yl.has(t)))){const s=e;return{name:null!==(i=s.name)&&void 0!==i?i:t,priority:null!==(n=s.priority)&&void 0!==n?n:0,patch:_l(s.patch),resolver:s.resolver,declaredAffectedKeys:s.declaredAffectedKeys,exclude:s.exclude,suppress:s.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,n)=>{i.set(n,new Set(t[e]))})),t.forEach(((t,n)=>{const s=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===n||e.has(t)||s.has(t)||(s.add(t),e.add(t),r(t,e),e.delete(t))}))};r(n,new Set([n])),t[e]=s}))}}function xl(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Sl(t){if(!xl(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Sl(t[i])})),e}function Al(t,e){var i;const n=null!==(i=Sl(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],s=n[t];xl(s)&&xl(i)?n[t]=Al(s,i):n[t]=Sl(i)})),n}class Cl{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),n=this.adjudicate(i),s=n.active,r=s.filter((t=>!n.suppressedSet.has(t))),a=s.filter((t=>n.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,s)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=s,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),n=this.compiledDefinitions.get(e);return i&&n?i.priority!==n.priority?i.priority-n.priority:i.rank-n.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const n=e[t],s=this.compiledDefinitions.get(n);s&&(s.exclude.forEach((i=>{const n=e.indexOf(i);-1!==n&&(e.splice(n,1),n{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},n=this.resolverCacheValid&&this.resolverCacheKey===e;n||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const s=this.compiledDefinitions.get(t);if(s&&(s.patch&&this.mergeInto(i,s.patch),s.hasResolver)){const r=n?this.resolverPatchCache.get(t):null===(e=s.resolver)||void 0===e?void 0:e.call(s,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(n||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),n||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Sl(e[i])})):Object.keys(e).forEach((i=>{var n;const s=e[i],r=t[i],a=null===(n=this.baseAttributes)||void 0===n?void 0:n[i];xl(r)&&xl(s)?t[i]=Al(r,s):!xl(r)&&xl(a)&&xl(s)?t[i]=Al(a,s):t[i]=Sl(s)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?wl.PAINT|wl.BOUNDS|wl.PICK:wl.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),n=Number(null!=e?e:0);return i!==n&&(i>0||n>0)?wl.PAINT|wl.BOUNDS:wl.PAINT}};class Ml{analyzeTransition(t,e,i={}){var n,s;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(n=i.noWorkAnimateAttr)&&void 0!==n?n:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(s=i.animateConfig)||void 0===s?void 0:s.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const u=i.extraAnimateAttrs;if(u)for(const e in u){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(u,e)||i&&void 0!==t[e]||c(e,u[e])}return r}applyTransition(t,e,i,n={}){var s,r,a;if(i){const i=null!==(s=n.animateConfig)&&void 0!==s?s:Xa;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:Wi.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:Wi.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:Wi.STATE}),e}applyClearTransition(t,e,i,n={}){var s;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(s=n.shouldSkipDefaultAttribute)&&void 0!==s?s:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:n.animateConfig,extraAnimateAttrs:n.extraAnimateAttrs});return this.applyTransition(t,r,i,n)}}const Bl=new bl;function El(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,Pl(t),!0)}function Pl(t,e=t.revision+1){var i;const n=(s=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},s?s.effectiveSourceDefinitions:a,r));var s,r,a;return t.effectiveSourceDefinitions=n,t.effectiveCompiledDefinitions=Bl.compile(n),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function Ol(t){if(t)return t.parentScope&&Ol(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&Pl(t),t}function Rl(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function Il(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function Dl(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var n;i.sharedStateDirty=!0,Il(null!==(n=null!=e?e:i.stage)&&void 0!==n?n:t.ownerStage,i)})),Rl(null!=e?e:t.ownerStage))}const Ll=new ue,Fl=new pe,Ul=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Nl=["x","y"],jl=["scaleX","scaleY"],zl=["angle"],Wl=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),Hl=new Ft,Vl=[],Gl=wl.PAINT|wl.SHAPE|wl.BOUNDS|wl.TRANSFORM|wl.LAYOUT;function Yl(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Xl(t){if(!Yl(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const n=e[t];i[t]=Yl(n)?Xl(n):n})),i}function Kl(t,e){return t===e||!!(Yl(t)||Yl(e)||Array.isArray(t)||Array.isArray(e))&&W(t,e)}function $l(t,e){var i;const n=null!==(i=Xl(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],s=n[t];Yl(s)&&Yl(i)?n[t]=$l(s,i):n[t]=Xl(i)})),n}const ql={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Zl extends fi{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,Il(this.stage,this),Rl(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&Ol(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Wi.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(Ol(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new bl).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),n=this.resolveUseStatesTransition(this.currentStates,i),s=null!==(e=n.effectiveStates)&&void 0!==e?e:n.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=n.states,this.effectiveStates=[...s],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Xl(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const n=i[t],s=e[t];"deep"===this.stateMergeMode&&Yl(s)&&Yl(n)?e[t]=$l(s,n):e[t]=Xl(n)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const n=this.buildStaticAttributeSnapshot(),s=n;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,s)||(i[e]=void 0===t?t:Xl(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,s));else if(Object.prototype.hasOwnProperty.call(n,e)){const t=n[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,s):t)}else a(this.getStateTransitionDefaultAttribute(e,s))})),i}syncObjectToSnapshot(t,e,i){const n=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((s=>{if(!0===(null==i?void 0:i[s]))return;const r=Object.prototype.hasOwnProperty.call(e,s),a=t[s];if(!r)return void(Object.prototype.hasOwnProperty.call(t,s)&&(n.set(s,{prev:a,next:void 0}),delete t[s]));const o=e[s];Kl(a,o)||(n.set(s,{prev:a,next:o}),t[s]=Xl(o))})),n}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,n){var s;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var n;const s=kl[t];return s?s(e,i):null!==(n=Tl[t])&&void 0!==n?n:wl.PAINT}(e,i,n):null!==(s=Tl[e])&&void 0!==s?s:wl.PAINT;return r&wl.PICK&&(r|=wl.BOUNDS),r===wl.PAINT&&this.needUpdateTag(e)&&(r=wl.SHAPE|wl.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&Gl)!==Gl?(t&wl.SHAPE?this.addUpdateShapeAndBoundsTag():t&wl.BOUNDS&&this.addUpdateBoundTag(),t&wl.PAINT&&this.addUpdatePaintTag(),t&wl.TRANSFORM&&this.addUpdatePositionTag(),t&wl.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=wl.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,n,s;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(n=this.resolverEpoch)&&void 0!==n?n:0)+1,null===(s=this.stateEngine)||void 0===s||s.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!Yl(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const n=e[t];i[t]=Yl(n)?Object.assign({},n):n})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const n=t,s=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r=!0,s[t]=n[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=s,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,n){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(n)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&ji.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const n=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&n.clear(),n}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new de),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=ta[t];if(e)return e;if(e=th.userSymbolMap[t],e)return e;if(!0===ua(t=ea[t]||t)){const e=new pa,{svg:i}=e.parse(t);if(!i)return null;const n=_(i.path)?i.path:[i.path];Ll.clear();const s=[];n.forEach((t=>{const e=(new Xn).fromString(t.d),i={};Ya.forEach((e=>{t[e]&&(i[Ga[e]]=t[e])})),s.push({path:e,attribute:i}),Ll.union(e.bounds)}));const r=Ll.width(),a=Ll.height(),o=1/kt(r,a);s.forEach((t=>t.path.transform(0,0,o,o)));const l=new Jr(t,s,!0);return th.userSymbolMap[t]=l,l}const i=(new Xn).fromString(t),n=i.bounds.width(),s=i.bounds.height(),r=1/kt(n,s);i.transform(0,0,r,r);const a=new Jr(t,i);return th.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const n=this.attribute,s=this.updateAABBBounds(n,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=n,a=Us(r);return a&&s.expand(a),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Mi(t);return Zi(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new pe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&ji.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&ji.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ji.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ji.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&ji.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&ji.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=ji.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===zi.GLOBAL){const i=new Ft(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,n){if(!t)return;const s=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,s,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||n)&&t.preventAttrs(s)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===Wi.STATE||null!=i&&i>=Wi.ANIMATE_BIND&&i<=Wi.ANIMATE_END)return;const n=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,s=this.setFinalAttributes;n&&"function"==typeof s&&s.call(this,n)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var n,s;const r=this.context,a=null!==(n=null==r?void 0:r.diffAttrs)&&void 0!==n?n:t,o=null==i?void 0:i.type;if(!e.length||!a||o===Wi.STATE||null!=o&&o>=Wi.ANIMATE_BIND&&o<=Wi.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(s=this.transientFromAttrsBeforePreventAnimate)&&void 0!==s?s:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),s=this.sortLocalStates(t);return{changed:n,states:n?s:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const n=this.ensureStateEngine();if(n)return this.toGraphicStateTransition(n.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const s=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(s)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,n=this.currentStates.filter(i);return n.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(n)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const n=this.getStateResolveBaseAttrs(),s=this.ensureStateEngine(n);e&&(null==s||s.invalidateResolverCache());const r=s?this.toGraphicStateTransition(s.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},n=null!=e?e:{},s=new Set([...Object.keys(i),...Object.keys(n)]);for(const t of s){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(n,t))return!1;if(!Kl(i[t],n[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var n;const s=null!==(n=this.currentStates)&&void 0!==n?n:Vl,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,s,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Wi.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:Wi.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,n;return null!==(n=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==n?n:Xa}applyStateAttrs(t,e,i,n,s,r){const a=i?this.resolveStateAnimateConfig(s):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(n)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,n;const s=null!==(e=this.currentStates)&&void 0!==e?e:Vl,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===s.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Xl(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(n=this.baseAttributes)&&void 0!==n?n:{};a.changed&&!this.beforeStateUpdate(o,s,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Wi.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:Wi.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const n=this.resolveAddStateTransition(t,e);n.changed&&this.useStates(n.states,i)}setStates(t,e){var i,n,s;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:Vl,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(n=this.effectiveStates)||void 0===n?void 0:n.length)||this.resolvedStatePatch||(null===(s=this.registeredActiveScopes)||void 0===s?void 0:s.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const n=null!==(i=this.currentStates)&&void 0!==i?i:Vl,s=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(n,r.states)||this.beforeStateUpdate(o,n,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,s))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:Wi.STATE}):this.restoreAttributeFromStatePatchDelta(s,this.resolvedStatePatch,{type:Wi.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),n=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=n,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:Wi.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],n=null!=e?e:[];if(i.length!==n.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=s();n[0]=i.x1+(i.x2-i.x1)*e}else n[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=s();n[1]=i.y1+(i.y2-i.y1)*e}else n[1]=t[1];return n}doUpdateLocalMatrix(){const{x:t=is.x,y:e=is.y,scaleX:i=is.scaleX,scaleY:n=is.scaleY,angle:s=is.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&s&&(l=this.getAnchor(a,h)),!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,u=e.d,d=e.e,p=e.f,g=Tt(a),f=Bt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=n);const y=m-i,_=v-n,b=l*g+c*f,x=h*g+u*f,S=c*g-l*f,A=u*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*A,t.e=d+l*m+c*v-b*y-S*_,t.f=p+h*m+u*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h,!0),Ps.transformUtil.fromMatrix(a,a).scale(i,n,{x:l[0],y:l[1]})}const c=this.getOffsetXY(is);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Fl.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){var i,n,s,r,a,o,l,h,c,u;const d=null!==(s=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(n=this.stage)||void 0===n?void 0:n.graphicService)&&void 0!==s?s:Ps.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),n=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),n.push(t)))})),n.length&&(n.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:Wi.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==d?void 0:d.onSetStage)||void 0===h||h.call(d,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(u=this.registeredActiveScopes)||void 0===u?void 0:u.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:Wi.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,n;return t&&(t.shadowHost=this),this.shadowRoot=null!==(n=null!=t?t:null===(i=(e=Ps.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==n?n:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Xn).fromString(t):this.pathProxy=new Xn,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,n;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const s=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:Ps.graphicService;null===(n=null==s?void 0:s.onRelease)||void 0===n||n.call(s,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,n;if(this.hasCustomEvent(t)){const s=new bi(t,e);s.bubbles=!1;const r=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager;return r?(s.manager=r,this.dispatchEvent(s)):fi.prototype.dispatchEvent.call(this,s)}return!0}beforeStateUpdate(t,e,i,n,s){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:Wi.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!n,isClear:!!s})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:Wi.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const n=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ps.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(n){const t=new Zo(null,1);return n.drawShape(this,t,0,0,{},{}),t.path}return null}}Zl.userSymbolMap={};const Jl=Symbol.for("@visactor/vrender-core/graphic-class");function Ql(){var t;const e=globalThis;return null!==(t=e[Jl])&&void 0!==t||(e[Jl]={Graphic:Zl}),e[Jl]}const th=Ql().Graphic;function eh(t){return!!t&&("string"==typeof t?!Wl.has(t)&&(t.startsWith("{t[i]=e[i]}))}const ah=sh();class oh{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},nh.forEach((t=>{this._defaultTheme[t]=Object.create(ah[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0)}this.userTheme?this.doCombine(n&&n.theme.combinedTheme):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,nt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;nh.forEach((n=>{const s=Object.create(ah[n]);t&&t[n]&&rh(s,t[n]),i[n]&&rh(s,i[n]),e[n]&&rh(s,e[n]),this.combinedTheme[n]=s})),e.common&&nh.forEach((t=>{rh(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 lh=new oh;function hh(t,e){return t.glyphHost?hh(t.glyphHost):e?(t.isContainer,e):ch(t)||t.attachedThemeGraphic&&hh(t.attachedThemeGraphic)||lh.getTheme()}function ch(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)):lh.getTheme()}return null}const uh=(t,e,i)=>{const{outerBorder:n,shadowBlur:s=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(r+(s+a)/2)}return i},dh=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...Ul];class ph extends th{constructor(t){super(t),this.type="arc",this.numberType=Ca}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:n=t.outerPadding}=this.attribute;let{outerRadius:s=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(s+=n,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(s-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap,clipRange:s=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(s,1)),e=jt(e),i=e+a,n&&Ct(a)>_t&&Ct(a)_t&&o>_t)return{startAngle:e-r*d*s,endAngle:i+r*d*a,sc:r*d*s,ec:r*d*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:n=i.innerPadding,outerPadding:s=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=s,o-=n;const{padRadius:l=Et(a*a+o*o)}=this.attribute,h=Ct(e-t);let c=t,u=e,d=t,p=e;const g=r/2;let f=h,m=h;if(g>_t&&l>_t){const i=e>t?1:-1;let n=Ot(Number(l)/o*Bt(g)),s=Ot(Number(l)/a*Bt(g));return(f-=2*n)>_t?(n*=i,d+=n,p-=n):(f=0,d=p=(t+e)/2),(m-=2*s)>_t?(s*=i,c+=s,u-=s):(m=0,c=u=(t+e)/2),{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return hh(this).arc}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=Ps.graphicService.updateTempAABBBounds(i);uh(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:n=e.outerRadius,innerRadius:s=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return n+=r,s-=a,no){const t=l;l=o,o=t}return n<=_t?i.set(0,0,0,0):Math.abs(o-l)>At-_t?i.set(-n,-n,n,n):(zs(l,o,n,i),zs(l,o,s,i)),i}needUpdateTags(t){return super.needUpdateTags(t,dh)}needUpdateTag(t){return super.needUpdateTag(t,dh)}toCustomPath(){var t,e,i,n;let s=super.toCustomPath();if(s)return s;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(n=r.outerPadding)&&void 0!==n?n:0);const c=Ct(o-a),u=o>a;if(h=At-_t)s.moveTo(0+h*Tt(a),0+h*Bt(a)),s.arc(0,0,h,a,o,!u),l>_t&&(s.moveTo(0+l*Tt(o),0+l*Bt(o)),s.arc(0,0,l,o,a,u));else{const t=h*Tt(a),e=h*Bt(a),i=l*Tt(o),n=l*Bt(o);s.moveTo(0+t,0+e),s.arc(0,0,h,a,o,!u),s.lineTo(0+i,0+n),s.arc(0,0,l,o,a,u),s.closePath()}return s}clone(){return new ph(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ph.NOWORK_ANIMATE_ATTR}}function gh(t){return new ph(t)}ph.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},ql);const fh=["segments","points","curveType","curveTension",...Ul];class mh extends th{constructor(t){super(t),this.type="area",this.numberType=Ta}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return hh(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ps.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:n=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Vs(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,fh)}needUpdateTag(t){return super.needUpdateTag(t,fh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Xn;const e=this.attribute,i=e.segments,n=e=>{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new mh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mh.NOWORK_ANIMATE_ATTR}}function vh(t){return new mh(t)}mh.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ql);const yh=["radius","startAngle","endAngle",...Ul];class _h extends th{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=ka}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return hh(this).circle}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=Ps.graphicService.updateTempAABBBounds(i);return uh(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:n=e.startAngle,endAngle:s=e.endAngle,radius:r=e.radius}=t;return s-n>At-_t?i.set(-r,-r,r,r):zs(n,s,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,yh)}needUpdateTag(t){return super.needUpdateTag(t,yh)}toCustomPath(){var t,e,i;let n=super.toCustomPath();if(n)return n;const s=this.attribute,r=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return n=new Xn,n.arc(0,0,r,a,o),n}clone(){return new _h(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return _h.NOWORK_ANIMATE_ATTR}}function bh(t){return new _h(t)}_h.NOWORK_ANIMATE_ATTR=ql;class xh extends th{constructor(t){super(t),this.type="glyph",this.numberType=Ma,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,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return hh(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const n=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const s={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(s,i.attributes)})),this.beforeStateUpdate(s,n,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(s,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new xh(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return xh.NOWORK_ANIMATE_ATTR}}function Sh(t){return new xh(t)}var Ah;xh.NOWORK_ANIMATE_ATTR=ql,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Ah||(Ah={}));class Ch extends th{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ba,this._childUpdateTag=ji.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(El(this.sharedStateScope,t),Dl(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new oh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new oh)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===zi.GLOBAL){const i=new Ft(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&ji.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=is.x,y:e=is.y,dx:i=is.dx,dy:n=is.dy,scaleX:s=is.scaleX,scaleY:r=is.scaleY,angle:a=is.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==n||1!==s||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return hh(this).group}updateAABBBounds(t,e,i){const n=i;i=i.clone();const{width:s,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,Math.max(0,s),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:n=0}=t;i.translate(e,n)}return Ps.graphicService.updateTempAABBBounds(i),Ps.graphicService.transformAABBBounds(t,i,e,!1,this),n.copy(i),n}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=ji.CLEAR_BOUNDS,this._childUpdateTag&=ji.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=ji.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&ji.UPDATE_BOUNDS||(this._childUpdateTag|=ji.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,n,s,r,a,o;const l=null!==(s=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(n=this.stage)||void 0===n?void 0:n.graphicService)&&void 0!==s?s:Ps.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&ji.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=Ps.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new Ch(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ch.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const n=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,n),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&El(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return Pl({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,n,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}}function wh(t){return new Ch(t)}Ch.NOWORK_ANIMATE_ATTR=ql;const Th=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...Ul];class kh extends th{constructor(t){super(t),this.type="image",this.numberType=Ea,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,n)}getGraphicTheme(){return hh(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:n=e.maxWidth,maxHeight:s=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>n/s?(r=n,a=n/t):(a=s,r=s*t)}}else r=n,a=s}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:n,tb2:s}=Ps.graphicService.updateTempAABBBounds(i);return uh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Ts[t]}needUpdateTags(t){return super.needUpdateTags(t,Th)}needUpdateTag(t){return super.needUpdateTag(t,Th)}clone(){return new kh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kh.NOWORK_ANIMATE_ATTR}}function Mh(t){return new kh(t)}kh.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},ql);const Bh=["segments","points","curveType","curveTension",...Ul];let Eh=class t extends th{constructor(t={}){super(t),this.type="line",this.numberType=Pa}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Vs(i,n,e))}getGraphicTheme(){return hh(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ps.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points,connectedType:r}=t,a=i;return s.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments,connectedType:r}=t,a=i;return s.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bh)}needUpdateTag(t){return super.needUpdateTag(t,Bh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Xn;const i=e.segments,n=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):e.points&&n(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Ph(t){return new Eh(t)}Eh.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ql);const Oh=["path","customPath",...Ul];class Rh extends th{constructor(t){super(t),this.type="path",this.numberType=Oa}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Xn?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Xn?this.cache:t.path)}getGraphicTheme(){return hh(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:n,tb2:s}=Ps.graphicService.updateTempAABBBounds(i);uh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Xn).fromString(t.path):t.customPath&&(this.cache=new Xn,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Oh)}needUpdateTag(t){return super.needUpdateTag(t,Oh)}toCustomPath(){return(new Xn).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Rh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rh.NOWORK_ANIMATE_ATTR}}function Ih(t){return new Rh(t)}Rh.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},ql);const Dh=["points","cornerRadius",...Ul];class Lh extends th{constructor(t){super(t),this.type="polygon",this.numberType=Ra}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return hh(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ps.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:n=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,n,s){"points"===t&&(s.points=Vs(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,Dh)}needUpdateTag(t){return super.needUpdateTag(t,Dh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Xn,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new Lh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Lh.NOWORK_ANIMATE_ATTR}}function Fh(t){return new Lh(t)}Lh.NOWORK_ANIMATE_ATTR=ql;const Uh=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(t.height)?t.y1-t.y:t.height,n=0,s=0;return e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(s=i,i=-i):Number.isNaN(i)&&(i=0),{x:n,y:s,width:e,height:i}},Nh=["width","x1","y1","height","cornerRadius",...Ul];class jh extends th{constructor(t){super(t),this.type="rect",this.numberType=Da}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return hh(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:n}=t;const{x1:s,y1:r,x:a,y:o}=t;e=null!=e?e:s-a,n=null!=n?n:r-o,(isFinite(e)||isFinite(n)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,n||0)}const{tb1:n,tb2:s}=Ps.graphicService.updateTempAABBBounds(i);return uh(t,e,n),i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Nh)}needUpdateTag(t){return super.needUpdateTag(t,Nh)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const n=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,s=t=>null!=n[t],r=t=>null==n[t];switch(t){case"width":return r("width")&&s("x")&&s("x1");case"height":return r("height")&&s("y")&&s("y1");case"x1":return r("x1")&&s("x")&&s("width");case"y1":return r("y1")&&s("y")&&s("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const n=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,s=t=>{const e=n[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=s("x"),a=s("y"),o=s("x1"),l=s("y1"),h=s("width"),c=s("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:n,width:s,height:r}=Uh(e);return t=new Xn,t.moveTo(i,n),t.rect(i,n,s,r),t}clone(){return new jh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jh.NOWORK_ANIMATE_ATTR}}function zh(t){return new jh(t)}jh.NOWORK_ANIMATE_ATTR=ql;const Wh=Symbol.for("EnvContribution"),Hh=Symbol.for("VGlobal"),Vh="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",Gh={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Yh=!0,Xh=!1,Kh=/\w|\(|\)|-/,$h=/[.?!,;:/,。?!、;:]/,qh=/\S/,Zh=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Jh(t,e,i,n,s){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ps.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return s&&(a=Qh(t,a)),a}function Qh(t,e,i=!1){let n=e;for(;Kh.test(t[n-1])&&Kh.test(t[n])||$h.test(t[n]);)if(n--,n<=0)return i?tc(t,e):e;return n}function tc(t,e){let i=e;for(;Kh.test(t[i+1])&&Kh.test(t[i])||$h.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function ec(t,e,i="actual"){var n;if(""===t)return{ascent:0,height:0,descent:0,width:0};const s=Ps.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?s.actualBoundingBoxAscent:s.fontBoundingBoxAscent,o="actual"===i?s.actualBoundingBoxDescent:s.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(s.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(s.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(n=e.space)&&void 0!==n?n:0;return r.width+=l,r}class ic{constructor(t,e,i,n,s,r,a,o,l,h,c,u,d,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Gh[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=u,this.singleLine=d,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-s:"center"===this.globalAlign&&(o=-s/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((s-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+s||at&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=!0===this.ellipsis?"...":this.ellipsis||"",s=this.lines[i].getWidthWithEllips(n);s>t&&(t=s),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function nc(t,e,i,n){const s=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(n);return{left:t>s?s:s-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>n?o:o+.5}}class sc{constructor(t,e,i,n){var s,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=n;const a=$s(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=ec(t,i,this.ascentDescentMode);let u=0,d=0,p=0;this.height>l&&(u=(this.height-l)/2,d=Math.ceil(u),p=Math.floor(u)),"top"===this.textBaseline?(this.ascent=u,this.descent=l-u):"bottom"===this.textBaseline?(this.ascent=l-u,this.descent=u):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+d,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(s=i.dx)&&void 0!==s?s:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=ec(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,n,s,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+n;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Jh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=ec(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const u=nc(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},u),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,n,s,r,a){var o;let l=e+i,h=this.text,c=this.left+n+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let u=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,u="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Jh(h,("vertical"===u?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===u);else{const{width:e}=ec(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===u&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:d=1}=this.character;if(this.character.stroke&&d&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=nc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===u&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Jh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:n}=ec(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-n}return i}}class rc extends kh{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=Us(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Us(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=Ts.width,height:e=Ts.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class ac{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof rc?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Gh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof sc){const e=qh.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,n=this.height;let s=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const n=this.paragraphs[e];if(n.overflow)t=t&&""===n.text;else if(t){i=!0;break}}let n=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof rc)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===s?"...":s||"";i.ellipsisStr=r;const{width:a}=ec(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+n){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+n+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+n;break}i.ellipsis="hide",n+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,s)=>{if(e instanceof rc)return;const r=e.drawBackground(t,n,this.ascent,i,0===s,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],n=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,n.right-i.left,n.bottom-i.top)})),this.paragraphs.forEach(((e,s)=>{if(e instanceof rc)return e.setAttributes({x:i+e._x,y:n+e._y}),void r(e,t,i+e._x,n+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Xh;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:n=1,opacity:s=1}=e;t.globalAlpha=n*s,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Zh(t,e)})(t,e.character),function(t,e,i){const n=e&&e.fill||Yh;if(!n)return void(t.globalAlpha=0);const{fillOpacity:s=1,opacity:r=1}=e;t.globalAlpha=s*r,t.fillStyle=i?Eo(t,n,{AABBBounds:i}):n,Zh(t,e)}(t,e.character,a),e.draw(t,n,this.ascent,i,0===s,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n instanceof rc)break;const{width:s}=ec(t,n.character,n.ascentDescentMode),r=s||0;if(r<=this.blankWidth+e){n.ellipsis="add",n.ellipsisWidth=r;break}if(r<=this.blankWidth+e+n.width){n.ellipsis="replace",n.ellipsisWidth=r,n.ellipsisOtherParagraphWidth=this.blankWidth+e;break}n.ellipsis="hide",e+=n.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof rc?t.width:t.getWidthWithEllips(this.direction)})),i}}class oc{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=Gh[this.direction]}store(t){if(t instanceof rc){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 ac(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof rc?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,n=Math.ceil(i/t[this.directionKey.width]*t.length)||0,s=Jh(t.text,i,t.character,n,"break-word"===this.frame.wordBreak);if(0!==s){const[i,n]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new sc(i,t.newLine,t.character,t.ascentDescentMode),new sc(n,!0,t.character,t.ascentDescentMode)]}(t,s);this.store(i),e?this.send():this.deal(n)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let lc=!1;try{lc=Intl&&"function"==typeof Intl.Segmenter}catch(t){lc=!1}const hc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Ul];class cc extends th{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Fa,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const n=this._frameCache.icons.get(t[i]);this.updateHoverIconState(n)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:ws.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:ws.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:ws.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:ws.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:ws.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:ws.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:ws.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:ws.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return hh(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&cc.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&cc.splitText(t.text).length>1)))}static splitText(t){if(lc){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:n}of e.segment(t))i.push(n);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=cc.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let n=0;n0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:n}=t.getActualSize();let s=o||e||0,r=l||n||0;r="number"==typeof c&&r>c?c:r||0,s="number"==typeof h&&s>h?h:s||0,i.set(0,0,s,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(d){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(u){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ps.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ps.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ps.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,hc)}needUpdateTag(t){return super.needUpdateTag(t,hc)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!cc.AllSingleCharacter(y)&&(y=cc.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let n=0;n0,A="number"==typeof n&&Number.isFinite(n)&&n>0,C="number"==typeof s&&Number.isFinite(s)&&s>0&&(!x||s<=i),w="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=n),T=new ic(0,0,(C?s:x?i:0)||0,(w?r:A?n:0)||0,a,o,l,h,c,u||"horizontal",!C&&x,!w&&A,d||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),k=new oc(T);if(k.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const n=_[i];e?(n.overflow=!0,n.left=1/0,n.top=1/0,!n.newLine&&T.lines[T.lines.length-1].paragraphs.push(n)):k.deal(n,!0),T.lines.length!==t&&(t=T.lines.length,k.lineBuffer.length=0,n.overflow=!0,n.left=1e3,n.top=1e3,T.lines[T.lines.length-1].paragraphs.push(n),e=!0),n.newLine&&(e=!1,k.lineWidth=0),k.send()}}else for(let t=0;t<_.length;t++)k.deal(_[t]);if(k.send(),!("horizontal"===T.layoutDirection?C:w)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:n)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new cc(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,n,s,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(a=s.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],s.globalY=(null!==(o=s.attribute.y)&&void 0!==o?o:0)+n+e._marginArray[0])})),s}getNoWorkAnimateAttr(){return cc.NOWORK_ANIMATE_ATTR}}function uc(t){return new cc(t)}cc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},ql);class dc extends Ch{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function pc(t){return new dc(t)}const gc=["symbolType","size",...Ul];let fc=class t extends th{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Na}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let n=null;try{n=new Path2D}catch(t){return null}const s=this.getParsedPath();if(!s)return null;s.draw(n,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return hh(this).symbol}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:s,tb2:r}=Ps.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:n,shadowBlur:s=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=n;fa(i,a+(s+o)/2,!0,r)}})(t,e,s),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ps.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:n=e.size}=t;if(_(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){const{size:n=e.size}=t,s=this.getParsedPath();return s?(s.bounds(n,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,gc)}needUpdateTag(t){return super.needUpdateTag(t,gc)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Xn).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Xn).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function mc(t){return new fc(t)}function vc(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function yc(t,e,i,n=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?n-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function _c(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[Pe(i)]=t[i])})),["fontSize","lineHeight"].forEach((n=>{const s=Pe(n);d(t[n])||(e[s]=i(t[n]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}fc.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},ql);class bc{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,n){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===n.length){const t=n[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,n,s="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=qn.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const u=[],d=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,n=t.length;io){const n=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,s,r,l);a=n.str,e=n.width}else e=n.width;u.push({str:a,width:e,ascent:n.ascent,descent:n.descent,keepCenterInLine:c})}d[0]=o}else{let e,i,n=0;for(let s=0,r=t.length;sMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(p,e,i,u),this.layoutWithBBox(p,u,e,i,n)}layoutWithBBox(t,e,i,n,s){const r=[0,0],a=e.length*s;"top"===n||("middle"===n?r[1]=(t.height-a)/2:"bottom"===n&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===s.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=ja}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return hh(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Sc({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const n=this.obbText.AABBBounds,{x:s,y:r}=e,a={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},o=Jt(a,i,{x:s,y:r});return this._OBBBounds.copy(n),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:n=e.text}=this.attribute;Array.isArray(n)?this.updateMultilineAABBBounds(n):this.updateSingallineAABBBounds(n);const{tb1:s}=Ps.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){fa(s,o/Math.abs(r+a),!0,l),i.union(s)}return Ps.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ps.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,he(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:n=e.underlineOffset}=this.attribute,s="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&n&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+n),s}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const n=this.getGraphicTheme(),s=this.attribute,{fontFamily:r=n.fontFamily,textAlign:a=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,fontWeight:h=n.fontWeight,ellipsis:c=n.ellipsis,maxLineWidth:u,stroke:d=n.stroke,wrap:p=n.wrap,measureMode:g=n.measureMode,lineWidth:f=n.lineWidth,whiteSpace:m=n.whiteSpace,suffixPosition:v=n.suffixPosition,ignoreBuf:y=n.ignoreBuf,keepCenterInLine:_=n.keepCenterInLine}=s,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(s,n,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Ps.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new bc(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?n.ellipsis:c||void 0,!1,{lineWidth:u,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:C}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(C.xOffset,C.yOffset,C.xOffset+C.width,C.yOffset+C.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,n,s;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:u,stroke:d=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),C=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const w=Ps.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:C},k=new bc(a,T,w),M=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/C),1)),x&&(P=Math.min(P,x)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let n=0,s=M.length;n{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const t=vc(y,a),e=this.cache.verticalList.length*v,i=yc(_,e,u);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>_a(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?s.ellipsis:h,n=r.clipTextWithSuffixVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,i,!1,m);b[e]=n.verticalList,a=n.width}else{const i=r.clipTextVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===ya.HORIZONTAL?u:r.measureTextWidth(t.text,{fontSize:u,fontWeight:d,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const S=vc(y,a),A=x.verticalList.length*v,C=yc(_,A,u);return this._AABBBounds.set(C,S,C+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const n=this.attribute;return null!==(i=null!==(e=n.maxLineWidth)&&void 0!==e?e:n.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var n;return null!==(n=$s(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==n?n:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=xc){return super.needUpdateTags(t,e)}needUpdateTag(t,e=xc){return super.needUpdateTag(t,e)}_interpolate(t,e,i,n,s){"text"===t&&(s.text=n)}clone(){return new Sc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Sc.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Sc.baselineMapAlign}getAlignMapBaseline(){return Sc.alignMapBaseline}}function Ac(t){return new Sc(t)}Sc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},ql),Sc.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Sc.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Cc=["heightLimit","lineClamp"];class wc extends Sc{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n,s,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:u=a.ellipsis,maxLineWidth:d,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=$s(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=Ps.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(n=this.stage)||void 0===n?void 0:n.textMeasureId)),C=new bc(o,{fontSize:c,fontWeight:m,fontFamily:o},A),w=t.map((t=>t.toString())),T=[],k=[0,0];let M=1/0;if(y>0&&(M=Math.max(Math.floor(y/x),1)),b&&(M=Math.min(M,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),k[0]=t}else{let t,e,i=0;for(let n=0,s=w.length;n!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class Lc extends Dc{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let Fc=0;class Uc{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ps.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Fc,t),this.tryRunAnimationFrameNextFrame(),Fc}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class Nc{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const n=this._resolveCapture(i),s=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(n))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),s&&this._deleteListenerRecord(t,e,n)};a.set(n,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var n,s;if(!e)return;const r=this._resolveCapture(i),a=null===(s=null===(n=this._listenerMap.get(t))||void 0===n?void 0:n.get(e))||void 0===s?void 0:s.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const n=this._listenerMap.get(t);if(!n)return;const s=n.get(e);s&&(s.delete(i),0===s.size&&n.delete(e),0===n.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var jc=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class zc extends Nc{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=pi.GenAutoIncrementId(),this.hooks={onSetEnv:new Lc(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Uc);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Uc),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return jc(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class Wc{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=qa(Object.assign({nativeCanvas:Ps.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=qa(Object.assign({nativeCanvas:Ps.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const Hc=new Wc,Vc=Symbol.for("VWindow"),Gc=Symbol.for("WindowHandlerContribution");function Yc(t){const e=Ps.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Xc extends Nc{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(t=Ps.global,e=Yc){super(),this.handlerFactory=e,this.hooks={onChange:new Lc(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=pi.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const n=this._handler.getWH();this._width=n.width,this._height=n.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,n,s,r){this._handler.setViewBoxTransform(t,e,i,n,s,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),n={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},n),n.x-=i.x1,n.y-=i.y1,n}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&ot(this.width,t.width())&&ot(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)}}class Kc{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Ps.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Hc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:as.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new re(Object.assign({defaultFontParams:{fontFamily:as.fontFamily,fontSize:as.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+re.ALPHABET_CHAR_SET+re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var n,s;if(!e.defaultLayer)return null;const r=null!==(s=null===(n=Ps.windowFactory)||void 0===n?void 0:n.call(Ps))&&void 0!==s?s:new Xc(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const u=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=u;const d=r.getNativeHandler();return d.nativeCanvas?d.nativeCanvas:null}}var $c;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}($c||($c={}));const qc=new pe;class Zc{constructor(){this.matrix=new pe}init(t){return this.mode=$c.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=$c.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(qc.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(qc.a,qc.b,qc.c,qc.d,qc.e,qc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(qc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:n}=e;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(qc.a,qc.b,qc.c,qc.d,qc.e,qc.f),this}scale(t,e,i){return this.mode===$c.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===$c.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return qc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(qc.a,qc.b,qc.c,qc.d,qc.e,qc.f),this}translate(t,e){return this.mode===$c.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===$c.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const Jc=Symbol.for("@visactor/vrender-core/factory-state");function Qc(){const t=globalThis;return t[Jc]||(t[Jc]={pluginClasses:{}}),t[Jc]}class tu{constructor(){this.global=Ps.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new pe(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new Ft(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,n);a&&(s.graphic=a.graphic,s.params=a.params)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i,n){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var eu=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function iu(t,e,i){const n={},s=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;n[i]?n[i].push(t):(n[i]=[t],s.push(i))}),i),s.sort(((t,e)=>i?e-t:t-e)),{childMap:n,zIdxArray:s}}function nu(t,e,i,n=!1,s=!1){let r=!1;if(s)r=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return r=!0,!0;return!1}),n)}if(r){const{childMap:r,zIdxArray:a}=iu(t,e,n);let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return s=!0,!0;return!1}),n);let r=null,a=!1;if(s){const{childMap:s,zIdxArray:o}=iu(t,i,n);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),n);return r}const au=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new ue)}allocate(t,e,i,n){if(!this.pools.length)return(new ue).setValue(t,e,i,n);const s=this.pools.pop();return s.x1=t,s.y1=e,s.x2=i,s.y2=n,s}allocateByObj(t){if(!this.pools.length)return new ue(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class ou{constructor(){this.time=Gi.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:C=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const s=t.resources.get(cu(g));if(!s||"success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=hh(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,this.doDrawImage(e,s.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:C}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n){yu(t,e,i,n)}}const lu=new ou,hu=new Set(["top","center","bottom"]);function cu(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function uu({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const du={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function pu({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const n=du[t];return n?{backgroundRepeatMode:"no-repeat",backgroundSizing:n}:{backgroundRepeatMode:t,backgroundSizing:uu({backgroundFit:e,backgroundKeepAspectRatio:i})}}function gu(t,e,i,n,s){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===n)return e/2;if(r===s)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function fu(t,e,i){const[n,s]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const n=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===n.length)return["left","top"];if(1===n.length){const t=n[0];return"center"===t?["center","center"]:hu.has(t)?["center",t]:[t,"center"]}let s,r;const a=[];for(let t=0;t<2;t++){const e=n[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:s=e}return null==s&&a.length&&(s=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=s?s:"left",null!=r?r:"top"]}(t);return{x:gu(n,e,"left","center","right"),y:gu(s,i,"top","center","bottom")}}function mu(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function vu(t){if(!t)return null;const e=mu(t.naturalWidth,t.videoWidth,t.width),i=mu(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function yu(t,e,i,n){var s,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:u=0,backgroundPosition:d="top-left"}=n,p=i.width(),g=i.height(),f=vu(e),{backgroundRepeatMode:m,backgroundSizing:v}=pu({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let n=null!==(s=null==f?void 0:f.width)&&void 0!==s?s:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(n=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);n=f.width*t,a=f.height*t}n*=h,a*=h;const{x:o,y:l}=fu(d,p-n,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+u,n,a)}if(o&&"repeat"!==m&&f){const i=f.width,n=f.height;"repeat-x"===m?(y=i*(g/n),_=g):"repeat-y"===m&&(_=n*(p/i),y=p);const s=t.dpr,r=Hc.allocate({width:y,height:_,dpr:s}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),Hc.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class _u{constructor(t){this.subRenderContribitions=t,this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}}class bu{constructor(){this.time=Gi.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||u),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,n+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const xu=new bu;class Su{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||u||e.restore())}}const Au=new Su,Cu={getContributions:()=>[]};class wu{constructor(t=[],e=Cu,i={}){var n,s,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,n)=>{var s;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,n):this.renderItem(t,i))})):nu(e,us.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,n):this.renderItem(t,i))}),!1,!!(null===(s=i.context)||void 0===s?void 0:s.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new ce,this.backupDirtyBounds=new ce,this.global=null!==(n=i.global)&&void 0!==n?n:Ps.global,this.layerService=null!==(s=i.layerService)&&void 0!==s?s:Ps.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:Cu,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:n,stage:s,viewBox:r,transMatrix:a}=e;if(!n)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=function(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:n,x12:s,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=Kt(t,e,i);return n>=l||s<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(n,o),y1:Math.max(r,h),x2:Math.min(s,l),y2:Math.min(a,c)}}(o,s.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=n.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*n.dpr)/n.dpr,o.y1=Math.floor(o.y1*n.dpr)/n.dpr,o.x2=Math.ceil(o.x2*n.dpr)/n.dpr,o.y2=Math.ceil(o.y2*n.dpr)/n.dpr),this.backupDirtyBounds.copy(o),n.reset(!1),n.save(),n.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),n.clearMatrix(!1),n.translate(r.x1,r.y1,!0),n.beginPath(),n.rect(o.x1,o.y1,o.width(),o.height()),n.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,n,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:us.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:us.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Xo.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),n.restore(),n.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=ru(e,i,us.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,n){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!$t(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let s,r=i;if(this.useDirtyBounds){s=au.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Xo.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:n,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(s),au.free(s),Xo.free(r))}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||function(){const t=Ps.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class ku{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class Mu{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Bu{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class Eu{constructor(){this.entries=new Map}register(t,e){var i;const n=null!==(i=this.entries.get(t))&&void 0!==i?i:[];n.push(e),this.entries.set(t,n)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const n=i.filter((t=>t!==e));n.length?this.entries.set(t,n):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const Pu={getContributions:()=>[]};class Ou{constructor(t=Pu,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new Bu}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class Ru{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class Iu{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ps.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ps.global.getRequestAnimationFrame();this.rafId=t((()=>{Ps.global.devicePixelRatio!==this.dpr&&(this.dpr=Ps.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ps.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Du{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ps.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Lu=new ue;class Fu{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const n=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(n._updateTag&ji.UPDATE_PAINT)||n._updateTag&ji.UPDATE_BOUNDS)return;const s=this.ensurePaintDirtyBoundsCache(n);s&&!s.empty()&&i.dirty(s),n.clearUpdatePaintTag();const r=n.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(Lu.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(Lu,t.parent&&t.parent.globalTransMatrix)))})),t.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Uu;function Nu(){if(null==Uu)try{const t=document.createElement("canvas"),e=t.getContext("2d");Uu=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Uu&&(Uu=!!document.createElement)}catch(t){Uu=!1}}function ju(){Nu();const t=Ps.global&&Ps.global.env;return t?"browser"===t:Uu}function zu(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:u=i.scaleY,scaleZ:d=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(n=m[2])&&void 0!==n?n:0}if(Po(t),Do(t,t,[s+o,r+l,a+h]),Do(t,t,[y[0],y[1],y[2]]),Oo(t,t,g),Ro(t,t,p),Do(t,t,[-y[0],-y[1],y[2]]),Fo(t,t,[c,u,d]),f){const i=Ko.allocate(),n=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=m[1]}Do(i,i,[n[0],n[1],0]),Io(i,i,f),Do(i,i,[-n[0],-n[1],0]),Uo(t,t,i)}}function Wu(t){const{alpha:e,beta:i}=t.attribute;return e||i}class Hu{constructor(t=Oc){this.creator=t,this.hooks={onAttributeUpdate:new Lc(["graphic"]),onSetStage:new Lc(["graphic","stage"]),onRemove:new Lc(["graphic"]),onRelease:new Lc(["graphic"]),onAddIncremental:new Lc(["graphic","group","stage"]),onClearIncremental:new Lc(["graphic","group","stage"]),beforeUpdateAABBBounds:new Lc(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Lc(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new Lc(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new ue,this.tempAABBBounds2=new ue,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updateHTMLTextAABBBounds(t,e,i,n){const{textAlign:s,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),n=yc(r,e,e);i.set(i.x1,n,i.x2,n+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),n=vc(s,e);i.set(n,i.y1,n+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){if(!e.empty()){const{scaleX:s=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(a&&l){fa(u,(l+h)/Math.abs(s+r),n,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(o){const{shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;fa(u,o/Math.abs(s+r)*2,!1,c+1),u.translate(n,a),e.union(u)}}if(this.combindShadowAABBBounds(e,s),e.empty())return;let r=!0;const a=s.transMatrix;s&&s.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&he(e,e,a)}validCheck(t,e,i,n){if(!n)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(n.shadowRoot||n.isContainer)return!0;const{visible:s=e.visible}=t;return!(!n.valid||!s)||(i.empty()||(n.parent&&i.transformWithMatrix(n.parent.globalTransMatrix),this.clearAABBBounds(n,n.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const Vu="white";class Gu extends Ch{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:Vu}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new oh,this.hooks={beforeRender:new Lc(["stage"]),afterRender:new Lc(["stage"]),afterClearScreen:new Lc(["stage"]),afterClearRect:new Lc(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:Ps.global,!this.global.env&&ju()&&this.global.setEnv("browser"),this.windowFactory=null!==(s=null!==(n=e.windowFactory)&&void 0!==n?n:Ps.windowFactory)&&void 0!==s?s:()=>new Xc(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=Ps.pickerServiceFactory)&&void 0!==a?a:()=>new tu,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(u=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=Ps.renderServiceFactory)||void 0===h?void 0:h.call(Ps))&&void 0!==c?c:Ps.renderService)&&void 0!==u?u:new Tu,this.pluginService=null!==(f=null!==(g=null!==(d=e.pluginService)&&void 0!==d?d:null===(p=Ps.pluginServiceFactory)||void 0===p?void 0:p.call(Ps))&&void 0!==g?g:Ps.pluginService)&&void 0!==f?f:new Ou,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:Ps.layerService)&&void 0!==v?v:new Zu(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:Ps.graphicService)&&void 0!==b?b:new Hu,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:Vu,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var n,s;i&&(s=e,(n=i).themeStateDefinitions!==s&&(n.themeStateDefinitions=s,Pl(n)),Dl(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Ti(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:u,beta:d,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(u)+y,S=Math.sin(d)+_,A=Math.cos(u)*Math.cos(d)*1);const C=$u.getPlugin("DirectionalLight");C&&(this.light=new C(f,m,v));const w={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=w;else{const t=$u.getPlugin("OrthoCamera");t&&(this.camera=new t(w))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=$u.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new Ru))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new Iu))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Du))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new ce;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Fu,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=$u.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=$u.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=$u.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return Pl({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Ft(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),n=e?-e.x1:0,s=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:n,y1:s,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class Yu{constructor(t=Gu,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Xu extends Ch{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new oh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Ps.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=>{Ps.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)))}}class Ku{constructor(t=Xu){this.LayerCtor=t}create({stage:t,global:e,window:i,params:n}){return new this.LayerCtor(t,e,i,n)}}let $u=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function qu(t){const e=Ps.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}$u._pluginClasses=Qc().pluginClasses;class Zu{static GenerateLayerId(){return`${Zu.idprefix}_${Zu.prefix_count++}`}constructor(t=Ps.global,e=new Ku,i=qu){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let n=this.getRecommendedLayerType(e.layerMode);n=e.main||e.canvasId?"static":n;const s=this.getLayerHandler(n),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Zu.GenerateLayerId(),layerHandler:s})}),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}}Zu.idprefix="visactor_layer",Zu.prefix_count=0;const Ju=Symbol.for("TransformUtil"),Qu=Symbol.for("GraphicUtil"),td=Symbol.for("LayerService"),ed=Symbol.for("StaticLayerHandlerContribution"),id=Symbol.for("DynamicLayerHandlerContribution"),nd=Symbol.for("VirtualLayerHandlerContribution"),sd=Symbol.for("@visactor/vrender-core/contribution-store-state");function rd(){const t=globalThis;return t[sd]||(t[sd]={store:new Map}),t[sd]}const ad=Symbol("ContributionProvider");class od{constructor(t,e){this.serviceIdentifier=t,this.container=e,ud.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function ld(t,e){return new od(t,e)}function hd(t,e){t(ad).toDynamicValue((({container:t})=>ld(e,t))).inSingletonScope().whenTargetNamed(e)}function cd(t,e){t(ad).toDynamicValue((({container:t})=>ld(e,t))).whenTargetNamed(e)}class ud{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}ud.store=rd().store;class dd{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:n}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=n,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=n}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:n}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=n}return t}estimate(t,{fontSize:e=Cs.fontSize}){let i=0,n=0;for(let e=0;e{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(n&&a.str!==t){let i=Qh(t,a.str.length,s);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,n,s,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,n,s),a&&(o.result=a+o.str);else if("middle"===r){const n=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:n.width,result:n.left+a+n.right}}else o=this._clipTextEnd(t,e,i,n,s),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,n,s){if(n===s){nt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${n}, ${s}`);const i=t.substring(0,s+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextEnd(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,s)}return{str:a,width:o}}_clipTextStart(t,e,i,n,s){const r=Math.ceil((n+s)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(r,t.length);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,n,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,n,s,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:n,right:s,width:r+a};const c=t.substring(t.length-o,t.length),u=this.measureTextWidth(c,e);return h+u>i?{left:l,right:s,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,u,o+1)}clipTextWithSuffixVertical(t,e,i,n,s,r){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,s);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(n,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,s);const a=this.revertVerticalList(l.verticalList);a.unshift({text:n,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,s),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,s);r.verticalList.push({text:n,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,s),l.verticalList.push({text:n,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,n,s,r,a=!1){if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(n,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+n,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,n);if(s&&h.str!==t){const i=Qh(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+n);return h.str=h.result,h.width+=l,h}}const pd=Symbol.for("TextMeasureContribution");class gd extends dd{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function fd({bind:t}){t(Hh).toDynamicValue((({container:t})=>new zc(ld(Wh,t)))).inSingletonScope(),t(Vc).to(Xc),t(Qu).toDynamicValue((({container:t})=>new Kc(ld(pd,t)))).inSingletonScope(),t(Ju).to(Zc).inSingletonScope(),t(td).to(Zu).inSingletonScope()}const md=Symbol.for("RenderService"),vd=Symbol.for("BeforeRenderConstribution");function yd({bind:t}){t(md).to(Tu)}const _d=Symbol.for("GraphicPicker"),bd=Symbol.for("PickerService"),xd=Symbol.for("BoundsPicker"),Sd=Symbol.for("GlobalPickerService"),Ad=Symbol.for("PickItemInterceptor"),Cd=Symbol.for("PickServiceInterceptor"),wd=(t,e,i,n)=>{let s,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===wa,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=At;for(;o<0;)o+=At;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),n.hack_pieFace="outside",s=i(r,a),s&&s.graphic||(n.hack_pieFace="inside",s=i(r,a)),s&&s.graphic||(n.hack_pieFace="top",s=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const n=e.getChildren(),o=n.map((e=>({ave_z:e.findFace().vertices.map((i=>{var n;return t.view(i[0],i[1],null!==(n=i[2]+e.attribute.z)&&void 0!==n?n:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),s=i(r,a),e.removeAllChild(),n.forEach((t=>{t._next=null,t._prev=null})),e.update(),n.forEach((t=>{e.add(t)}))}else s=i(r,a);return s},Td=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class kd extends jh{constructor(t){super(t),this.type="rect3d",this.numberType=La}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:n,x:s,y:r,length:a=Mt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-s,l=null!=l?l:n-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return hh(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:n=0}=t;(isFinite(e)||isFinite(n))&&i.set(0,0,e,n)}const{tb1:n,tb2:s}=Ps.graphicService.updateTempAABBBounds(i);return i.union(n),n.setValue(s.x1,s.y1,s.x2,s.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:n=e.height,spikes:s=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(s)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,n)/2,c=h*(1-o),u=i/2,d=n/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,s=Math.PI/a*t,r=i/(2*h),o=n/(2*h);l.push({x:u+Math.sin(s)*e*r,y:d-Math.cos(s)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,n,s){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(s[t]=i+(n-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,Bd)}needUpdateTag(t){return super.needUpdateTag(t,Bd)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Xn,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new Ed(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ed.NOWORK_ANIMATE_ATTR}}function Pd(t){return new Ed(t)}Ed.NOWORK_ANIMATE_ATTR=ql;class Od extends ph{constructor(t){super(t),this.type="arc3d",this.numberType=wa}updateAABBBounds(t,e,i){const n=this.stage;if(!n||!n.camera)return i;const{outerRadius:s=e.outerRadius,height:r=0}=t,a=s+r;return i.setValue(-a,-a,a,a),Ps.graphicService.updateTempAABBBounds(i),Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Od.NOWORK_ANIMATE_ATTR}}function Rd(t){return new Od(t)}Od.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},ql);class Id extends Lh{constructor(t){super(t),this.type="pyramid3d",this.numberType=Ia}updateAABBBounds(t,e,i){const n=this.stage;return n&&n.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)})),Ps.graphicService.updateTempAABBBounds(i),Ps.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return Id.NOWORK_ANIMATE_ATTR}}function Dd(t){return new Id(t)}let Ld,Fd;function Ud(t){return Ld||(Ld=Ic("text",{})),Ld.initAttributes(t),Ld.AABBBounds}function Nd(t){return Fd||(Fd=Ic("richtext",{})),Fd.setAttributes(t),Fd.AABBBounds}Id.NOWORK_ANIMATE_ATTR=ql;class jd{constructor(){this.order=1}afterPickItem(t,e,i,n,s){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class zd{constructor(){this.order=1}afterPickItem(t,e,i,n,s){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,n,s):null}beforePickItem(t,e,i,n,s){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,n,s):null}_pickItem(t,e,i,n,s){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=s||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=hh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=Xo.allocateByObj(a),d=new Ft(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),p=e.pickGroup(c,d,u,n);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class Wd{constructor(){this.order=1}beforePickItem(t,e,i,n,s){const r=t.baseGraphic;if(r&&r.parent){const t=new Ft(i.x,i.y),s=e.pickContext;s.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,n):e.pickItem(r,t.clone(),a,n);return s.highPerformanceRestore(),o}return null}}class Hd{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=wd(r,t,(()=>e.pickGroup(t,i,s.parentMatrix,n)),n);return r.camera=null,n.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function Vd({bind:t,isBound:e}){e(bd)||(t(Sd).toSelf(),t(bd).toService(Sd)),t(Hd).toSelf().inSingletonScope(),t(Ad).toService(Hd),t(zd).toSelf().inSingletonScope(),t(Ad).toService(zd),t(Wd).toSelf().inSingletonScope(),t(Ad).toService(Wd),hd(t,Ad),t(jd).toSelf().inSingletonScope(),t(Cd).toService(jd),hd(t,Cd)}function Gd({bind:t}){t(za).to(Hu),t(Wa).toConstantValue(Oc)}const Yd=Symbol.for("AutoEnablePlugins"),Xd=Symbol.for("PluginService");class Kd{constructor(){this.type="static",this.offscreen=!1,this.global=Ps.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=qa({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}}function $d(t){(function({bind:t}){hd(t,Wh)})({bind:t.bind}),function({bind:t}){t(pd).to(gd).inSingletonScope(),hd(t,pd)}({bind:t.bind}),function({bind:t}){t(Kd).toSelf(),t(ed).toService(Kd)}({bind:t.bind})}const qd=bt/2;function Zd(t,e,i,n,s,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),n<0&&(e+=n,n=-n),s<0&&(i+=s,s=-s),S(r,!0))l=[r=Ct(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ct(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ct(t[0]),i=Ct(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ct(l[0]),l[1]=Ct(l[1]),l[2]=Ct(l[2]),l[3]=Ct(l[3])}}else l=[0,0,0,0];if(n<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,n,s);const[h,c,u,d]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],p=Math.min(n/2,s/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[u[0]-g[2],u[1]],b=[u[0],u[1]-g[2]],x=[d[0]+g[3],d[1]],A=[d[0],d[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!$(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-qd,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!$(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,qd,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!$(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],qd,bt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!$(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],bt,bt+qd,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function Jd(t,e){return!(!t&&!e)}function Qd(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function tp(t,e,i){return i&&t*e>0}function ep(t,e,i,n,s){return s&&t*e>0&&0!==i&&0!==n}function ip(t,e){return t*e>0}function np(t,e,i,n,s){return s?t*e>0:t*e>0&&0!==i&&0!==n}function sp(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,u=o-r;let d=u*l-c*h;return d*d<_t?[]:(d=(c*(e-r)-u*(t-s))/d,[t+d*l,e+d*h])}function rp(t,e,i,n,s,r,a){const o=t-i,l=e-n,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,u=-h*o,d=t+c,p=e+u,g=i+c,f=n+u,m=(d+g)/2,v=(p+f)/2,y=g-d,_=f-p,b=y*y+_*_,x=s-r,S=d*f-g*p,A=(_<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let C=(S*_-y*A)/b,w=(-S*y-_*A)/b;const T=(S*_+y*A)/b,k=(-S*y+_*A)/b,M=C-m,B=w-v,E=T-m,P=k-v;return M*M+B*B>E*E+P*P&&(C=T,w=k),{cx:C,cy:w,x01:-c,y01:-u,x11:C*(s/x-1),y11:w*(s/x-1)}}function ap(t,e,i,n,s){const r=Ct(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:u,innerEndAngle:d,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=s*Tt(c),C=s*Bt(c),w=n*Tt(d),T=n*Bt(d);let k,M,B,E;if((b>_t||y>_t)&&(k=s*Tt(u),M=s*Bt(u),B=n*Tt(p),E=n*Bt(p),r1?0:P<-1?bt:Math.acos(P))/2),l=Et(t[0]*t[0]+t[1]*t[1]);S=Mt(b,(n-l)/(o-1)),x=Mt(y,(s-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:C,xirs:B,yirs:E,xore:k,yore:M,xire:w,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:u,innerDeltaAngle:h,innerEndAngle:d,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function op(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let u=!1;if(s=At-_t)e.moveTo(i+s*Tt(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>_t&&(e.moveTo(i+r*Tt(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const{outerDeltaAngle:h,xors:d,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:C,outerEndAngle:w,limitedIcr:T,innerDeltaAngle:k,innerEndAngle:M,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:O}=ap(t,o,l,r,s);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+d,n+p),u=!0;else if(m>_t){const t=Mt(v,m),r=Mt(y,m),o=rp(g,f,d,p,s,t,Number(c)),l=rp(b,x,S,A,s,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),e.arc(i+o.cx,n+o.cy,m,wt(o.y01,o.x01),wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Tt(wt(l.y01,l.x01)),n+o.cy+m*Bt(wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),t>0&&e.arc(i+o.cx,n+o.cy,t,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,n,s,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Tt(wt(l.y01,l.x01)),n+l.cy+r*Bt(wt(l.y01,l.x01))):e.moveTo(i+b,n+s*Bt(w))}else!a||a[0]?(e.moveTo(i+d,n+p),e.arc(i,n,s,C,w,!c)):e.moveTo(i+s*Tt(w),n+s*Bt(w));if(!(r>_t)||k<.001)!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),u=!0;else if(T>_t){const t=Mt(E,T),s=Mt(P,T),o=rp(S,A,b,x,r,-s,Number(c)),l=rp(d,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),T0&&e.arc(i+o.cx,n+o.cy,s,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,n,r,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Tt(wt(l.y01,l.x01)),n+l.cy+t*Bt(wt(l.y01,l.x01))):e.moveTo(i+g,n+f)}else!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),!a||a[2]?e.arc(i,n,r,M,B,c):e.moveTo(i+r*Tt(B),n+r*Bt(B))}return a?a[3]&&e.lineTo(i+s*Tt(o),n+s*Bt(o)):e.closePath(),u}const lp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class hp{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=n.dpr,o=Hc.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),s(r,l);const h=n.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Hc.free(o),h}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,At),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,n,l,g,f,m)}drawTexture(t,e,i,n,s,r,a,o,l){var h,c,u,d,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:u}=m,d=e.AABBBounds;n=d.x1,s=d.y1;const p=i;let g;if(u){g=Hc.allocate({width:d.width(),height:d.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,d.width(),d.height()),n=0,s=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,n,s,r),p.clip();const v=d.width(),y=d.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,C=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=mc({}));const w=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[w-A,T-C],symbolType:t});const k=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:lp.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${n}|dpr:${s}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${s}`}createResourcePattern(t,e,i,n,s){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(n>0||s>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*n,a=e+2*n,l=Hc.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),s>0){const i=Math.max(0,Math.min(s,Math.min(t,e)/2)),r=n,a=n,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,n,n,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),Hc.free(l),c}Hc.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const cp=new hp;class up{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{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:C=l.scaleY,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:k=l.outerRadius}=t.attribute;k+=v,T-=m;const M=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=w?o:Bo(e,o,e.dpr),c=o/k,d="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:k+d*h,innerRadius:T-d*h,startAngle:y-d*c,endAngle:_+d*c}),e.beginPath(),op(t,e,i,n,k+d*h,T-d*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,s,(x-i)/A,(S-n)/C,l[r]),l[r].opacity=a,e.stroke()}};g&&M(d,"outerBorder"),f&&M(p,"innerBorder"),t.setAttributes({outerRadius:k,innerRadius:T,startAngle:y,endAngle:_})}}const dp=new up,pp=cp,gp=lu;class fp{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute,w=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=C?o:Bo(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,n,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,s,(b-i)/S,(x-n)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&w(d,"outerBorder"),f&&w(p,"innerBorder")}}const mp=new fp,vp=cp,yp=lu;class _p extends ou{constructor(){super(...arguments),this.time=Gi.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{background:d,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const i=t.resources.get(cu(d));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,n,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=d,e.fill(),e.highPerformanceRestore()}}const bp=new _p;function xp(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Sp{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:C,y1:w,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:k,height:M}=t.attribute;k=(null!=k?k:C-i)||0,M=(null!=M?M:w-n)||0;const B=(s,r)=>{const a=!(!s||!s.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=s,c=T?h:Bo(e,h,e.dpr),d=i+o*c,p=n+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(d,p,k-o*g,M-o*g)):(e.beginPath(),Zd(e,d,p,k-o*g,M-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,s,(b-i)/S,(x-n)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(d,"outerBorder"),f&&B(p,"innerBorder")}}class Ap{constructor(){this.time=Gi.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;xp(p)&&(d.doStroke=!1)}}class Cp{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const{x1:d,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:d-g)||0,x=(null!=x?x:p-f)||0,xp(m)){if(e.setStrokeStyle(t,t.attribute,i,n,l),!(0===v||_(v)&&v.every((t=>0===t)))){let s,r=0;return Zd(e,i,n,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,u)=>{m[o]&&(r===o-1&&m[o]===s||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,n,l),e.beginPath(),e.moveTo(a,h),s=m[o]),r=o,e.lineTo(c,u),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,n),m[0]?e.lineTo(i+b,n):e.moveTo(i+b,n),m[1]?e.lineTo(i+b,n+x):e.moveTo(i+b,n+x),m[2]?e.lineTo(i,n+x):e.moveTo(i,n+x),m[3]){const t=m[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}}const wp=new Sp,Tp=cp,kp=lu;class Mp extends Sp{constructor(){super(...arguments),this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){return super.drawShape(t,e,i,n,s,r,a,o,l,h,c,u)}}const Bp=new Mp,Ep=lu;class Pp{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){const d=t.getParsedPath();if(!d)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,C=(s,r)=>{const a=!(!s||!s.stroke),{distance:o=l[r].distance}=s,h=A?o:Bo(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===d.drawOffset(e,v,i,n,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,s,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,s,(_-i)/x,(b-n)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&C(p,"outerBorder"),m&&C(g,"innerBorder")}}class Op{constructor(){this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,n,p,m,((s,r)=>{var a,h,c,d;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(d=r.lineWidth)&&void 0!==d?d:t.attribute.lineWidth,r=e}r.stroke&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-n)/_,l),e.stroke()))})),r&&!b.isSvg&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-n)/_,l),e.stroke())))}}const Rp=new Pp,Ip=new Op,Dp=cp,Lp=lu,Fp=cp,Up=lu;class Np extends hp{constructor(){super(...arguments),this.time=Gi.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=d||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:Gs(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Gs(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Gs(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Gs(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,n,l,_,b,x)}}class jp{constructor(t){this.groupRenderContribitions=t,this.numberType=Ba}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(bp)}drawShape(t,e,i,n,s,r,a,o,l){const{clip:h,fill:c,stroke:u,background:d}=t.attribute;if(!(h||c||u||d))return;l=null!=l?l:hh(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:C=l.cornerType,x:w=l.x,y:T=l.y}=t.attribute,k=ep(p,m,g,f,c),M=np(p,v,g,f),B=Jd(c,d),E=Qd(u,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(k||M||a||o||d))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,n,g,f)):(e.beginPath(),Zd(e,i,n,g,f,y,"bevel"!==C));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(bp));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Gi.beforeFillStroke&&r.drawShape(t,e,i,n,B,E,k,M,l,s,a,o,P)})),h&&e.clip();const O=()=>{P.doFill&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,w-i,T-n,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,w-i,T-n,l),e.stroke()))};A?(R(),O()):(O(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Gi.afterFillStroke&&r.drawShape(t,e,i,n,B,E,k,M,l,s,a,o)}))}draw(t,e,i,n){var s,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,u=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:n,height:s}=t.attribute,r=a.canvas,o=Ps.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,n,s),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const d=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=hh(t,null==n?void 0:n.theme).group,i=Ko.allocate(),s=Ko.allocate();zu(s,t,e),Uo(i,p||i,s),a.modelMatrix=i,Ko.free(s),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),n.skipDraw?this.drawShape(t,a,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),n&&n.renderInGroup&&(m=n.renderInGroup(null===(s=n.renderInGroupParams)||void 0===s?void 0:s.skipSort,t,i,null===(r=n.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Ko.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=d,h>0){const{x:e,y:i,width:n,height:s}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,n,s),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=u,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var zp,Wp=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(zp||(zp={}));class Hp extends wu{constructor(t,e,i,n){super(t,n),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=n,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=zp.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Lc([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Wp(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,viewBox:s}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s.x1,s.y1,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:us.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:us.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Wp(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Wp(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Wp(this,void 0,void 0,(function*(){if(2!==t.count)yield su(t,us.zIndex,((i,n)=>{if(this.status===zp.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Wp(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Wp(this,void 0,void 0,(function*(){this.rendering&&(this.status=zp.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=zp.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 Wp(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:()=>Wp(this,void 0,void 0,(function*(){yield su(t,us.zIndex,(t=>Wp(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const Vp=Symbol.for("IncrementalDrawContribution"),Gp=Symbol.for("ArcRender"),Yp=Symbol.for("Arc3dRender"),Xp=Symbol.for("AreaRender"),Kp=Symbol.for("CircleRender"),$p=Symbol.for("GraphicRender"),qp=Symbol.for("GroupRender"),Zp=Symbol.for("LineRender"),Jp=Symbol.for("PathRender"),Qp=Symbol.for("PolygonRender"),tg=Symbol.for("RectRender"),eg=Symbol.for("Rect3DRender"),ig=Symbol.for("SymbolRender"),ng=Symbol.for("TextRender"),sg=Symbol.for("RichTextRender"),rg=Symbol.for("Pyramid3dRender"),ag=Symbol.for("GlyphRender"),og=Symbol.for("ImageRender"),lg=Symbol.for("RenderSelector"),hg=Symbol.for("DrawContribution"),cg=Symbol.for("StarRender"),ug=Symbol.for("DrawItemInterceptor"),dg=new ue,pg=new ue;class gg{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,n,s),!1}beforeDrawItem(t,e,i,n,s){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){dg.copy(n.dirtyBounds),pg.copy(n.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e),n.backupDirtyBounds.copy(n.dirtyBounds)}return n.renderGroup(t.shadowRoot,i,Xo.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&(n.dirtyBounds.copy(dg),n.backupDirtyBounds.copy(pg)),!0}}class fg{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,s),!1}drawItem(t,e,i,n,s){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}class mg{constructor(){this.order=1,this.interceptors=[new gg,new yg,new vg,new fg]}afterDrawItem(t,e,i,n,s){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rn.renderGroup(t,i,t.parent.globalTransMatrix,!e&&s)),i):n.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Ko.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const _g=Symbol.for("ArcRenderContribution"),bg=Symbol.for("AreaRenderContribution"),xg=Symbol.for("CircleRenderContribution"),Sg=Symbol.for("GroupRenderContribution"),Ag=Symbol.for("ImageRenderContribution"),Cg=Symbol.for("PathRenderContribution"),wg=Symbol.for("PolygonRenderContribution"),Tg=Symbol.for("RectRenderContribution"),kg=Symbol.for("SymbolRenderContribution"),Mg=Symbol.for("TextRenderContribution"),Bg=Symbol.for("StarRenderContribution"),Eg=Symbol.for("CommonRenderContribution"),Pg=Symbol.for("InteractiveSubRenderContribution");function Og(t){!function({bind:t}){t(ou).toSelf().inSingletonScope(),t(hp).toSelf().inSingletonScope(),t(hg).to(wu),t(Vp).to(Hp),t(qp).toDynamicValue((({container:t})=>new jp(ld(Sg,t)))).inSingletonScope(),t($p).toService(qp),hd(t,Sg),hd(t,Pg),t(_u).toDynamicValue((({container:t})=>new _u(ld(Pg,t)))).inSingletonScope(),hd(t,$p),t(mg).toSelf().inSingletonScope(),t(ug).toService(mg),hd(t,ug)}({bind:t.bind})}class Rg{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class Ig{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new Rg(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const n=i.find((t=>t.named===e));return n?this.resolveBinding(n):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function Dg(){return new Ig}const Lg=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const Fg=function(){const t=globalThis;return t[Lg]||(t[Lg]={legacyBindingContext:Dg(),preloaded:!1}),t[Lg]}(),Ug=Fg.legacyBindingContext;function Ng(){Fg.preloaded||(Fg.preloaded=!0,fd({bind:Ug.bind}),Gd({bind:Ug.bind}),yd({bind:Ug.bind}),Vd({bind:Ug.bind,isBound:Ug.isBound}),function({bind:t}){t(Xd).to(Ou),cd(t,Yd)}({bind:Ug.bind}),$d(Ug),Og(Ug))}function jg(){return Ug}function zg(t){Ng();const[e]=Ug.getAll(t);return e}function Wg(t,e){return Ng(),Ug.getNamed(t,e)}function Hg(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const n=e()[i];return"function"==typeof n?n.bind(e()):n},set:(t,i,n)=>(e()[i]=n,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const n=Object.getOwnPropertyDescriptor(e(),i);if(n)return Object.assign(Object.assign({},n),{configurable:!0})}})}const Vg=Hg((()=>zg(Hh)));Ps.global=Vg;class Gg{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let n;return n=e?"string"==typeof e?Ps.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:Ps.global.createDom(Object.assign({tagName:"div",parent:n},i)),nativeContainer:n}}parseDefaultStyleFromGraphic(t){return _c("text"===t.type&&t.attribute?t.attribute:hh(t).text)}getTransformOfText(t){const e=hh(t).text,{textAlign:i=e.textAlign,textBaseline:n=e.textBaseline}=t.attribute,s=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:r,scaleX:a,scaleY:o}=s,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[n]}) rotate(${r}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[n]}`}}updateStyleOfWrapContainer(t,e,i,n,s){const{pointerEvents:r,penetrateEventList:a=[]}=s;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",n.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=s.anchorType;if(d(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ae(c,p);l=t.x,h=t.y}const f=Ps.global.getElementTopLeft(n,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),u(s.style)){const e=s.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(s.style)?o=Object.assign(Object.assign({},o),s.style):y(s.style)&&s.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),n=i[1].trim();t&&n&&(e[t]=n)}}})),e})(s.style)));Ps.global.updateDom(i,{width:s.width,height:s.height,style:o})}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"===Ps.global.env&&(t.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:us.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:us.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&&Ps.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const{dom:s,container:r}=i;if(!s)return;const a=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&r&&r!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof s?this.htmlMap[a].wrapContainer.innerHTML=s:s!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(s));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,r);t&&("string"==typeof s?t.innerHTML=s:t.appendChild(s),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:r,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,n,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===Ps.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 Yg=()=>{$u.registerPlugin("HtmlAttributePlugin",Gg)};class Xg extends Gg{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:n}=this.htmlMap[t];e?Ps.global.getRequestAnimationFrame()((()=>{e.unmount()})):n&&n(),i&&Ps.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const s=n.params.ReactDOM,{element:r,container:a}=i;if(!r||!s||!s.createRoot&&!s.render)return;const o=d(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])s.createRoot?this.htmlMap[o].root.render(r):s.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,a);if(t)if(this.htmlMap||(this.htmlMap={}),s.createRoot){const i=s.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else s.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{s.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,n,l,h,i),this.htmlMap[o].renderId=this.renderId}}const Kg=()=>{$u.registerPlugin("ReactAttributePlugin",Xg)};class $g{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return $g.instance||($g.instance=new $g),$g.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var n,s,r,a;let o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get(e);return o?o(i,t):(o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let n=this.transitions.get(t);n||(n=new Map,this.transitions.set(t,n)),n.set(e,i)}}function qg(t){if(!t||!u(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function Zg(t,e,i,n){const s=function(t,e,i,n){var s;const r=t,a=null===(s=r.context)||void 0===s?void 0:s.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var n,s;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const n=this.resolveValue(t.delay,i,0),s=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=n+r+s,Object.assign(Object.assign({},t),{delay:n,delayAfter:s,duration:r})}));let n=0;l&&(n="number"==typeof l?l:l?e:0),o.oneByOneDelay=n;let s=1;if(r){const t=e+n*(this._target.count-2);s=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*s,delayAfter:t.delayAfter*s,duration:t.duration*s,effects:e.map((t=>{var e,i;const n=null!==(e=t.custom)&&void 0!==e?e:Jg.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],s=qg(n);return Object.assign(Object.assign({},t),{custom:n,customType:s})}))})})),o.oneByOneDelay=n*s,o.startTime=a*s}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(n=t.custom)&&void 0!==n?n:Jg.builtInAnimateMap[null!==(s=t.type)&&void 0!==s?s:"fromTo"];const d=qg(o.custom);o.customType=d;const p=e+h+c+u*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=u*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,n;return t.partitioner(null===(n=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===n?void 0:n[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var n,s,r,a;return t.sort(null===(s=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===s?void 0:s[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const n=e?(i,n,s)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,n,s);a&&this._trackAnimation(a)}:(i,n,s)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,n,s);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>n(t,e,i.length))):this._target.count<=1?n(this._target,0,1):this._target.forEachChildren(((t,e)=>n(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,n){var s,r,a,o,l,h,c,d;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:C=0,options:w,custom:T,customType:k,controlOptions:M}=t,B=e.animate();B.priority=C;const E=u(v)?v(null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],O=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&O&&(i=null!==(h=P[O])&&void 0!==h?h:i),B.startAt(b);const R=i*x+E;R>0&&B.wait(R);let I=null,D=t.to,L=t.from;const F=this.shouldCommitAttrOutChannel(p);D||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=I.props),L||(I||(I=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,T,k,L,D,_,m,f,M,w,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(B,e,p,D);let U=0;x&&(U=x*(n-i-1));const N=u(y)?y(null===(d=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===d?void 0:d[0],e,{}):y;return N>0&&(U+=N),U>0&&B.wait(U),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,n,s,r,a,o,l,h,c,d){var p,g,f,m,v,y,_,b;if(e&&i){i=qg(e);let c=this.resolveValue(o,d);"function"==typeof c&&(c=c(null===(g=null===(p=d.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],d,{})),c=Object.assign({width:(null===(f=d.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=d.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=u(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=d.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],d,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,n,s,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,s,r,a,c)}else"to"===c?t.to(s,r,a):"from"===c&&t.from(s,r,a)}executeTimelineItem(t,e,i,n){var s,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:u,oneByOneDelay:d,priority:p,controlOptions:g}=t,f=null===(r=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*d),c&&c>0&&v.loop(c),u&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),d&&v.wait(d*(n-i-1)),v}applyTimeSliceToAnimate(t,e,i,n){var s,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:d=0}=t,p=u(c)?c(null===(r=null===(s=i.context)||void 0===s?void 0:s.data)||void 0===r?void 0:r[0],i,{}):c,g=u(d)?d(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):d;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var s;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let u=null,d=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);d||(u||(u=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),d=u.props),p||(u||(u=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=u.from),u.attrOutChannel&&i.setAttributes(u.attrOutChannel);const f=null!==(s=t.custom)&&void 0!==s?s:Jg.builtInAnimateMap[r],m=t.custom?t.customType:qg(f);this._handleRunAnimate(e,f,m,p,d,h,l,o,n,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,n,s,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,n,s,a,o)=>{e(s,i,n,a,o,t.target,r)},t.to(i,n,s)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,n){if("update"===i||!n||!this.isUpdateDiffContext(e))return;const s=this.collectAnimatedUpdateDiffAttrKeys(e,n);(null==s?void 0:s.length)&&t.onEnd((()=>{Zg(e,s,t,n)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const n=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!n)return null;let s=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(n,t)&&void 0!==n[t]&&(null!=s||(s=[]),s.push(t));return s}createCustomAnimation(t,e,i,n,s,r,a){const o=new e(i,n,s,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,n){var s;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(s=e.context)||void 0===s?void 0:s.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var n,s,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(s=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===s?void 0:s[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==n?void 0:n[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var n,s;return void 0===t?i:"function"==typeof t&&e?t(null===(s=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===s?void 0:s[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,n=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!n)return null;let s=null;for(let e=0;ethis._executeItem(t,e,i,n))).filter(Boolean)}finally{this._activeConfigList=s}}return[this._executeItem(t,e,i,n)].filter(Boolean)}_executeItem(t,e,i=0,n=1){if(!e)return null;const s="timeSlices"in t;let r=null;const a=this.parseParams(t,s);return r=s?this.executeTimelineItem(a,e,i,n):this.executeTypeConfigItem(a,e,i,n),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=ts.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}Jg.builtInAnimateMap={};const Qg="appear",tf="disappear",ef="update",nf="highlight",sf="unhighlight";class rf{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class af{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const n={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);n.allowTransition=n.allowTransition&&i.allowTransition})),n.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new Jg(this.graphic)}),r.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new Jg(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var s;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(s=this.stateList)&&void 0!==s?s:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==n)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([Qg],[{name:Qg,animation:t}],e)}applyDisappearState(t,e){this.applyState([tf],[{name:tf,animation:t}],e)}applyUpdateState(t,e){this.applyState([ef],[{name:ef,animation:t}],e)}applyHighlightState(t,e){this.applyState([nf],[{name:nf,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([sf],[{name:sf,animation:t}],e)}stopState(t,e){var i;const n=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));n&&n.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class of{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new af(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new rf(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((n=>{n.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class lf{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-lf.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*lf.bounceIn(2*t):.5*lf.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/At*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*At/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/At*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*At/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/At*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*At/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*At/e)*.5+1}}static registerFunc(t,e){lf[t]=e}}function hf(t,e){const i=1/e;let n=1;for(;t>i;)t-=i,n*=-1;const s=n*t/i;return s>0?s:1+s}lf.quadIn=lf.getPowIn(2),lf.quadOut=lf.getPowOut(2),lf.quadInOut=lf.getPowInOut(2),lf.cubicIn=lf.getPowIn(3),lf.cubicOut=lf.getPowOut(3),lf.cubicInOut=lf.getPowInOut(3),lf.quartIn=lf.getPowIn(4),lf.quartOut=lf.getPowOut(4),lf.quartInOut=lf.getPowInOut(4),lf.quintIn=lf.getPowIn(5),lf.quintOut=lf.getPowOut(5),lf.quintInOut=lf.getPowInOut(5),lf.backIn=lf.getBackIn(1.7),lf.backOut=lf.getBackOut(1.7),lf.backInOut=lf.getBackInOut(1.7),lf.elasticIn=lf.getElasticIn(1,.3),lf.elasticOut=lf.getElasticOut(1,.3),lf.elasticInOut=lf.getElasticInOut(1,.3*1.5),lf.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),lf.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},lf.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)lf[`flicker${t}`]=e=>hf(e,t);for(let t=2;t<10;t++)lf[`aIn${t}`]=e=>t*e*e+(1-t)*e;function cf(t,e,i){return t+(e-t)*i}const uf=new class{constructor(){this.opacity=(t,e,i,n,s,r)=>{r.attribute.opacity=cf(e,i,n)},this.baseOpacity=(t,e,i,n,s,r)=>{r.attribute.baseOpacity=cf(e,i,n)},this.fillOpacity=(t,e,i,n,s,r)=>{r.attribute.fillOpacity=cf(e,i,n)},this.strokeOpacity=(t,e,i,n,s,r)=>{r.attribute.strokeOpacity=cf(e,i,n)},this.zIndex=(t,e,i,n,s,r)=>{r.attribute.zIndex=cf(e,i,n)},this.backgroundOpacity=(t,e,i,n,s,r)=>{r.attribute.backgroundOpacity=cf(e,i,n)},this.shadowOffsetX=(t,e,i,n,s,r)=>{r.attribute.shadowOffsetX=cf(e,i,n)},this.shadowOffsetY=(t,e,i,n,s,r)=>{r.attribute.shadowOffsetY=cf(e,i,n)},this.shadowBlur=(t,e,i,n,s,r)=>{r.attribute.shadowBlur=cf(e,i,n)},this.fill=(t,e,i,n,s,r)=>{r.attribute.fill=nl(e,i,n,!1)},this.fillPure=(t,e,i,n,s,r)=>{r.attribute.fill=s.fromParsedProps.fill?hl(s.fromParsedProps.fill,s.toParsedProps.fill,n):s.toParsedProps.fill},this.stroke=(t,e,i,n,s,r)=>{r.attribute.stroke=nl(e,i,n,!1)},this.strokePure=(t,e,i,n,s,r)=>{r.attribute.stroke=s.fromParsedProps.stroke?hl(s.fromParsedProps.stroke,s.toParsedProps.stroke,n):s.toParsedProps.stroke},this.width=(t,e,i,n,s,r)=>{r.attribute.width=cf(e,i,n),r.addUpdateBoundTag()},this.height=(t,e,i,n,s,r)=>{r.attribute.height=cf(e,i,n),r.addUpdateBoundTag()},this.x=(t,e,i,n,s,r)=>{r.attribute.x=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,n,s,r)=>{r.attribute.y=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,n,s,r)=>{r.attribute.dx=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,n,s,r)=>{r.attribute.dy=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,n,s,r)=>{r.attribute.angle=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,n,s,r)=>{r.attribute.scaleX=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,n,s,r)=>{r.attribute.scaleY=cf(e,i,n),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,n,s,r)=>{r.attribute.lineWidth=cf(e,i,n),r.addUpdateBoundTag()},this.startAngle=(t,e,i,n,s,r)=>{r.attribute.startAngle=cf(e,i,n),r.addUpdateBoundTag()},this.endAngle=(t,e,i,n,s,r)=>{r.attribute.endAngle=cf(e,i,n),r.addUpdateBoundTag()},this.radius=(t,e,i,n,s,r)=>{r.attribute.radius=cf(e,i,n),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,n,s,r)=>{r.attribute.outerRadius=cf(e,i,n),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,n,s,r)=>{r.attribute.innerRadius=cf(e,i,n),r.addUpdateBoundTag()},this.size=(t,e,i,n,s,r)=>{r.attribute.size=cf(e,i,n),r.addUpdateBoundTag()},this.points=(t,e,i,n,s,r)=>{r.attribute.points=Vs(e,i,n),r.addUpdateBoundTag()}}};function df(t,e,i,n,s,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*n,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const s=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:Wi.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=n?"function"==typeof n?n:null!==(s=lf[n])&&void 0!==s?s:lf.linear:lf.linear,"wait"===t&&(this.onUpdate=Sf),this.id=pi.GenAutoIncrementId(),this.syncAttributeUpdate=Sf}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],n=this.props[e];if(y(i)&&y(n)){const s=el.Get(i,tl.Color255),r=el.Get(n,tl.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=s,this.toParsedProps[e]=r,t.push(uf["fill"===e?"fillPure":"strokePure"])}else uf[e]?t.push(uf[e]):t.push(df)}else uf[e]?t.push(uf[e]):t.push(df)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const n=this.interpolateUpdateFunctions,s=this.propKeys;if(n&&s)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const n=e.getStartProps();let s=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,n),this.onUpdate(t,n,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class wf extends Cf{constructor(t,e,i,n){super(t,e,i,n)}onStart(){super.onStart();const t=this.getFromProps();bf(this.target,t,Wi.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class Tf extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=pi.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const n=e.next;t(e.animate,i),i++,e=n}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===ts.END?this.removeAnimate(t,!0):t.status!==ts.RUNNING&&t.status!==ts.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const kf=new Tf;kf.isGlobal=!0;class Mf extends Cf{constructor(t,e,i,n,s){super("customAnimate",null!=e?e:{},i,n),this.type="customAnimate",this.customFrom=t,this.params=s,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.onUpdate(t,n,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Bf extends Mf{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Ef extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===ts.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,n=i.getContext("2d");return!!n&&(n.clearRect(0,0,i.width,i.height),n.drawImage(e,0,0),i)}}class Pf extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.from=null!=t?t:{}}applyTransientFromAttributes(){bf(this.target,this.from,Wi.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.from,this.props,n),this.onUpdate(t,n,i),this.syncAttributeUpdate()}}function Of(t,e){for(let i=0;i{var i;if(t===e||t.status===ts.END)return;const n=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(n)for(const t in n)!Object.prototype.hasOwnProperty.call(n,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class Df{constructor(t=pi.GenAutoIncrementId(),e=kf,i){this.id=t,this.status=ts.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(If(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const n=new Cf(Qn.to,t,e,i);return n.bind(this.target,this),this.updateStepAfterAppend(n),this}wait(t){const e=new wf(Qn.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const n=new Pf(t,{},e,i);return n.bind(this.target,this),this.updateStepAfterAppend(n),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===ts.RUNNING&&(this.status=ts.PAUSED)}resume(){this.status===ts.PAUSED&&(this.status=ts.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,n;if(this.status===ts.END)return void console.warn("aaa 动画已经结束,不能推进");const s=this.currentTime+t;if(s=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=ts.END;const t=this.target;return t.restoreStaticAttribute(If(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=ts.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=s;let r=s-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(s-this._startTime)%this._duration;const t=Math.floor((s-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&bf(this.target,this._startProps,Wi.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(n=this.lastRunStep)||void 0===n||n.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const Lf=new Uc;class Ff{constructor(){this.released=!1}tick(t,e){Lf.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class Uf extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const n=t.getTime();this._lastTickTime=n,this.lastFrameTime<0&&(this.lastFrameTime=n-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const s=n-this.lastFrameTime,r=this.checkSkip(s);return r||(this._handlerTick(s),this.lastFrameTime=n,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Jn.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Jn.INITIAL,Ps.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ps.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new Ff;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Jn.INITIAL&&(this.status=Jn.PAUSE,!0)}resume(){return this.status!==Jn.INITIAL&&(this.status=Jn.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Jn.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Jn.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Jn.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Jn.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Jn.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Jn.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ps.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,n;return"performance"!==(null===(n=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===n?void 0:n.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function jf(){Rc("arc",gh)}function zf(){Rc("arc3d",Rd)}function Wf(){Rc("area",vh)}function Hf(){Rc("circle",bh)}function Vf(){Rc("glyph",Sh)}function Gf(){Rc("group",wh)}function Yf(){Rc("image",Mh)}function Xf(){Rc("line",Ph)}function Kf(){Rc("path",Ih)}function $f(){Rc("polygon",Fh)}function qf(){Rc("pyramid3d",Dd)}function Zf(){Rc("rect",zh)}function Jf(){Rc("rect3d",Md)}function Qf(){Rc("richtext",uc)}function tm(){Rc("shadowRoot",pc)}function em(){Rc("star",Pd)}function im(){Rc("symbol",mc)}function nm(){Rc("text",Ac)}function sm(){Rc("wrapText",Tc)}function rm(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const am={x:0,y:0,z:0,lastModelMatrix:null};class om{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(xu),e(Au),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Gi.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Gi.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,n,s,r,a,o,l,h,c,u,d){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}afterRenderStep(t,e,i,n,s,r,a,o,l,h,c,u,d){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,s,r,a,o,l,h,c,u,d)}))}drawPathProxy(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=hh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=tp(u,d,h),_=ip(u,g),b=Jd(h),x=Qd(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Zi(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,b,x,y,_,l,s,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,n-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,n-v,l),e.fill())),this.afterRenderStep(t,e,i,n,b,x,y,_,l,s,a,o),!0}valid(t,e,i,n){const{fill:s=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:u=e.visible}=t.attribute,d=tp(o,l,s),p=ip(o,c),g=Jd(s,r),f=Qd(a,h);return!(!t.valid||!u)&&!(!g&&!f)&&!!(d||p||i||n||r)&&{fVisible:d,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,n=!1){const{x:s=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,u=i.modelMatrix,d=i.camera;am.x=s,am.y=r,am.z=a,am.lastModelMatrix=u;const p=d&&(n||Wu(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const n=Ko.allocate(),s=Ko.allocate();zu(s,t,e),Uo(n,u||n,s),am.x=0,am.y=0,am.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),Ko.free(s)}if(g&&!u){const n=t.getOffsetXY(e);am.x+=n.x,am.y+=n.y,am.z=a,i.setTransformForCurrent()}else if(p)am.x=0,am.y=0,am.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const n=t.getOffsetXY(e);am.x+=n.x,am.y+=n.y,this.transformWithoutTranslate(i,am.x,am.y,am.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),am.x=0,am.y=0,am.z=0;return am}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},u={x:s,y:r};n.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+u.y*o.x+(c.y-u.y)*a.x)*d,g=(c.y*l.y+h.y*(o.y-l.y)-u.y*o.y+(u.y-c.y)*a.y)*d,f=(h.x*(l.x-o.x)-c.x*l.x+u.x*o.x+(c.x-u.x)*a.x)*d,m=-(c.x*l.y+h.x*(o.y-l.y)-u.x*o.y+(u.x-c.x)*a.y)*d,v=(h.x*(u.y*o.x-c.y*l.x)+h.y*(c.x*l.x-u.x*o.x)+(u.x*c.y-c.x*u.y)*a.x)*d,y=(h.x*(u.y*o.y-c.y*l.y)+h.y*(c.x*l.y-u.x*o.y)+(u.x*c.y-c.x*u.y)*a.y)*d;n.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,n,s,r){const{context:a}=n;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.z=u,this.drawPathProxy(t,a,h,c,n,s)||(this.drawShape(t,a,h,c,n,s,null,null,r),this.z=0,a.modelMatrix!==d&&Ko.free(a.modelMatrix),a.modelMatrix=d),a.highPerformanceRestore()}}class lm extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ca,this.builtinContributions=[dp,gp,pp],this.init(t)}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let u=h.endAngle;u=o;const d=u>c;let p=!1;if(s_t){const t=Mt(b,_),r=Mt(x,_),a=rp(v,y,f,m,s,t,Number(d)),o=rp(A,C,w,T,s,r,Number(d));if(_0&&e.arc(i+o.cx,n+o.cy,r,wt(o.y11,o.x11),wt(o.y01,o.x01),!d)}}else e.moveTo(i+f,n+m);if(!(r>_t)||M<.001)e.lineTo(i+w,n+T),p=!0;else if(k>_t){const t=Mt(E,k),s=Mt(P,k),a=rp(w,T,A,C,r,-s,Number(d)),o=rp(f,m,v,y,r,-t,Number(d));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),k0&&e.arc(i+a.cx,n+a.cy,s,wt(a.y01,a.x01),wt(a.y11,a.x11),!d);const t=wt(a.cy+a.y11,a.cx+a.x11),o=u-l-.03;e.arc(i,n,r,t,o,d)}}else e.lineTo(i+r*Tt(B),n+r*Bt(B));return p}drawShape(t,e,i,n,s,r,a,o,l){l=null!=l?l:hh(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:u=l.stroke,x:d=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:C=l.outerRadius,innerRadius:w=l.innerRadius}=t.attribute;C+=b,w-=x;let T=0;const k=(c(S)&&S||S[0])&&"conical"===h.gradient;if(k){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Ct(n-i)=At-_t){e.beginPath();const r=Math.abs(C-w)/2/C,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,u=h;this.drawArcTailCapPath(t,e,i,n,C,w,u,u+r),M||this.beforeRenderStep(t,e,i,n,y,_,m,v,l,s,a,o);const d=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()))};(()=>{if(y){const s=c;if("conical"===s.gradient){const r=ml(0,0,h,s);a||tp&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=r,e.fill())}}})(),d()}}this.afterRenderStep(t,e,i,n,y,_,m,v,l,s,a,o),k&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,n,s,r,a,o,l,h){r&&(h?h(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l){r&&a&&(l?l(e,t.attribute,s):o&&(e.setStrokeStyle(t,t.attribute,i,n,s),e.stroke()))}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).arc;this._draw(t,s,!1,i,n,s)}}const hm=new WeakSet;function cm({bind:t}){rm(hm,t)||(t(lm).toDynamicValue((({container:t})=>new lm(ld(_g,t)))).inSingletonScope(),t(Gp).toService(lm),t($p).toService(Gp),t(_g).toService(_u),hd(t,_g))}const um=cm;class dm extends om{constructor(){super(...arguments),this.numberType=wa}drawShape(t,e,i,n,s,r,a,o){var l;const h=hh(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,u=this.valid(t,h,a,o);if(!u)return;const{fVisible:d,sVisible:p,doFill:g,doStroke:f}=u,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=el.Get(c,tl.Color255),{light:A}=s.stage||{},C=s.hack_pieFace,w={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===C||"top"===C?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let u=!1;if(r=At-_t)e.moveTo(i+r*Tt(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>_t&&(e.moveTo(i+a*Tt(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:d,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Tt(p),y=r*Bt(p),_=a*Tt(f),b=a*Bt(f);h<.001?u=!0:(e.moveTo(i+v,n+y,s),e.arc(i,n,r,p,g,!c,s)),!(a>_t)||d<.001?(e.lineTo(i+_,n+b,s),u=!0):(e.lineTo(i+_,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,w[C],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):d&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=A?A.computeColor(T[C],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==C&&"inside"!==C||("inside"===C&&(e.save(),e.beginPath(),e.arc(i,n,x,0,At,!0,w.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Ct(h-l),u=h>l;let d=!1;if(a<=_t)e.moveTo(i,n,s);else if(c>=At-_t)e.moveTo(i+a*Tt(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!u,s),e.lineTo(i+a*Tt(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,u,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Tt(c),f=a*Bt(c),m=a*Tt(p),v=a*Bt(p);t<.001?d=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!u,s),e.lineTo(i+m,n+v,r),e.arc(i,n,a,p,c,u,r))}e.closePath()}(t,e,i,n,w.top,w.bottom,"outside"===C?b:x,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===C?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):d&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=A?A.computeColor(T[C],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===C&&e.restore())}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).arc;this._draw(t,s,!1,i,n)}}const pm=new WeakSet;function gm({bind:t}){rm(pm,t)||(t(dm).toDynamicValue((()=>new dm)).inSingletonScope(),t(Yp).toService(dm),t($p).toService(Yp))}const fm=gm;function mm(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=on(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}function vm(t,e,i,n){var s;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;ou?Hi.ROW:Hi.COLUMN,Number.isFinite(c)||(o=Hi.COLUMN),Number.isFinite(u)||(o=Hi.ROW);const d=i*(o===Hi.ROW?c:u);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),mm(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+s,l.p0.y+r,a),mm(t,l,1,n),o=!1):o=!0}t.closePath()}function _m(t,e,i,n,s,r,a){var o;let l=e.p0,h=n;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)n||(t.lineTo(l.x+s,l.y+r,a),h=!n);else{const{originP1:c,originP2:u}=e;let d;if(c&&!1!==c.defined&&!i?d=l:c&&!1!==u.defined&&(d=null!==(o=e.p3)&&void 0!==o?o:e.p1),n){h=!n;const i=d?d.x:e.p0.x,o=d?d.y:e.p0.y;t.moveTo(i+s,o+r,a)}else d&&(h=!n,t.lineTo(d.x+s,d.y+r,a))}return h}function bm(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=s||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:u}=e;if(i>=1){if(h){let e,i=!0;u.forEach(((n,s)=>{n.originP1!==n.originP2?(i=_m(t,n,e,i,r,a,o),e=n):e=n}))}else u.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),mm(t,e,1,s),c=!1):c=!0}));return}if(i<=0)return;let d;"x"===n?d=Hi.ROW:"y"===n?d=Hi.COLUMN:"auto"===n&&(d=e.direction);const p=i*e.tryUpdateLength(d);let g=0,f=!0,m=null;for(let e=0,i=u.length;e{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}function Sm(t,e,i,n){const{offsetX:s=0,offsetY:r=0}=n||{},{points:a}=i,o=[];for(let t=0;t{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}const Am=new Np,Cm=lu;class wm extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ta,this.builtinContributions=[Am,Cm],this.init(t)}drawLinearAreaHighPerformance(t,e,i,n,s,r,a,o,l,h,c,u,d){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,u,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(u?u(e,t.attribute,l):s&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!s,!1,i,!1,l,h,u,null,{attribute:t.attribute}),(()=>{var i,s;if(n){const{stroke:n=l&&l.stroke}=t.attribute;if(_(n)&&(n[0]||n[2])&&!1===n[1])if(e.beginPath(),n[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const n=m[t];e.lineTo((null!==(i=n.x1)&&void 0!==i?i:n.x)+a,(null!==(s=n.y1)&&void 0!==s?s:n.y)+o,v)}}d?d(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,n,s,r,a,o){var l,h,c,u,d,p;const g=hh(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,C=S.doStroke&&S.sVisible,{clipRange:w=g.clipRange,closePath:T,points:k,segments:M}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===B&&(B="linearClosed"),1===w&&!M&&!k.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,C,v,_,i,n,g,s,r,a,o);if(t.shouldUpdateShape()){if(M&&M.length){let e,i;const n=M.map(((t,n)=>{if(t.points.length<=1&&0===n)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===n?e={x:i.endX,y:i.endY}:n>1&&(e.x=i.endX,e.y=i.endY);const s=Yn(E(t.points,x),B,{startPoint:e,curveTension:b});return i=s,s})).filter((t=>!!t));let s;const r=[];for(let t=M.length-1;t>=0;t--){const e=M[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=M[t-1].points,n=e[e.length-1];n&&i.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(u=n.y1)&&void 0!==u?u:n.y})}i.length>1&&(s=Yn(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(s))}t.cacheArea=r.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!k||!k.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(k,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(d=e[t].x1)&&void 0!==d?d:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const n=Yn(e,B,{curveTension:b}),s=Yn(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:n,bottom:s}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===w){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,C,_,r[c],[g,t.attribute],w,i,n,y,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=w*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(u=this.drawSegmentItem(e,l,A,v,C,_,r[d],[g,t.attribute],Mt(f,1),i,n,y,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,C,_,t.attribute,g,w,i,n,y,t,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).area;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f){return this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f)}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=d.attribute;let y,b,x=Hi.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Ct(y.x-b.x),A=Ct(y.y-b.y);x=null==y.x1?Hi.ROW:null==y.y1?Hi.COLUMN:Number.isFinite(S+A)?S>A?Hi.ROW:Hi.COLUMN:Hi.ROW,vm(t,e,l,{offsetX:h,offsetY:c,offsetZ:u,direction:x}),this.beforeRenderStep(d,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:C=0,x:w=0}=a;return!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(d,a,C-h,w-c,o),t.fill())),this.afterRenderStep(d,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==s)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),bm(t,i[0]?e.top:e.bottom,l,x===Hi.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u})),t.setStrokeStyle(d,a,C-h,w-c,o),t.stroke()}})(),!1}}const Tm=new WeakSet;function km({bind:t}){rm(Tm,t)||(t(wm).toDynamicValue((({container:t})=>new wm(ld(bg,t)))).inSingletonScope(),t(Xp).toService(wm),t($p).toService(Xp),t(bg).toService(_u),hd(t,bg))}const Mm=km;class Bm extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ka,this.builtinContributions=[mp,yp,vp],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=hh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:u=l.endAngle,x:d=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,n,h,c,u),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,y,_,m,v,l,s,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,p-n,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,p-n,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,n,y,_,m,v,l,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).circle;this._draw(t,s,!1,i,n)}}const Em=new WeakSet;function Pm({bind:t}){rm(Em,t)||(t(Bm).toDynamicValue((({container:t})=>new Bm(ld(xg,t)))).inSingletonScope(),t(Kp).toService(Bm),t($p).toService(Kp),t(xg).toService(_u),hd(t,xg))}const Om=Pm;class Rm{constructor(){this.numberType=Ma}reInit(){}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=hh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}}const Im=new WeakSet;function Dm({bind:t}){rm(Im,t)||(t(Rm).toDynamicValue((()=>new Rm)).inSingletonScope(),t(ag).toService(Rm),t($p).toService(ag))}const Lm=Dm,Fm=["","repeat-x","repeat-y","repeat"];function Um(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?Fm[i]:"no-repeat"}function Nm({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const n=Um(t,e);return{repeatMode:n,sizingMode:"no-repeat"===n&&null!=i?i:"fill"}}const jm={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function zm(t){return{backgroundMode:jm[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function Wm({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:n=1,imageOffsetX:s=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=Nm({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==n||0!==s||0!==r)}function Hm(t,e,i,n,s,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:u=0,imagePosition:d="top-left"}){const{repeatMode:p,sizingMode:g}=Nm({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?zm(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};yu(t,e,{x1:i,y1:n,x2:i+s,y2:n+r,width:()=>s,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:u,backgroundPosition:d})}class Vm extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ea,this.builtinContributions=[Bp,Ep],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=hh(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:u=l.x,y:d=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:C,sVisible:w,doFill:T,doStroke:k}=A;if(!S||!t.resources)return;const M=t.resources.get(S);if("success"!==M.state)return;const B=t.width,E=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,n,B,E):(Zd(e,i,n,B,E,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const O=()=>{T&&(a?a(e,t.attribute,l):C&&(e.setCommonStyle(t,t.attribute,i,n,l),Hm(e,M.data,i,n,B,E,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},R=()=>{k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,u-i,d-n,l),e.stroke()))},I=Wm({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),D=P||I;g?(R(),D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,n,T,!1,C,!1,l,s,a),O(),D&&e.restore()):(D&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,n,T,!1,C,!1,l,s,a),O(),D&&e.restore(),R()),this.afterRenderStep(t,e,i,n,T,!1,C,!1,l,s,a)}draw(t,e,i){const{image:n}=t.attribute;if(!n||!t.resources)return;const s=t.resources.get(n);if("loading"===s.state&&y(n))return void Os.improveImageLoading(n);if("success"!==s.state)return;const{context:r}=e.drawParams;if(!r)return;const a=hh(t).image;this._draw(t,a,!1,i)}}const Gm=new WeakSet;function Ym({bind:t}){rm(Gm,t)||(t(og).toDynamicValue((({container:t})=>new Vm(ld(Ag,t)))).inSingletonScope(),t($p).toService(og),t(Ag).toService(_u),hd(t,Ag))}const Xm=Ym;class Km extends om{constructor(){super(...arguments),this.numberType=Pa}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).line;this._draw(t,s,!1,i,n)}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,u,d,p,g){var f;if(!e)return;t.beginPath();bm(t,e,l,h,{offsetX:c,offsetY:u,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),d.cache&&!_(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(d,a,m-c,v-u,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(d,a,m-c,v-u,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,n,s,r,a,o,l,h,c,u,d){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,i,n,l,s,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,n=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const s=Yn(x(t.points,v),y,{startPoint:e,curveTension:m});return n=s,s})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,u,d,s[g],[l,t.attribute],_,b,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,d,s[m],[l,t.attribute],Mt(y,1),b,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,_,b,i,n,t,a,o)}}const $m=new WeakSet;function qm({bind:t}){rm($m,t)||(t(Km).toDynamicValue((()=>new Km)).inSingletonScope(),t(Zp).toService(Km),t($p).toService(Zp))}const Zm=qm,Jm=cp,Qm=lu;class tv extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Oa,this.builtinContributions=[Qm,Jm],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const u=null!==(l=this.tempTheme)&&void 0!==l?l:hh(t,null==r?void 0:r.theme).path,{x:d=u.x,y:p=u.y,fillStrokeOrder:g=u.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,u,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Zi(t.pathShape.commandList,e,i,n,1,1,f);else{Zi((null!==(c=t.attribute.path)&&void 0!==c?c:u.path).commandList,e,i,n,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,_,b,v,y,u,s,a,o);const x=()=>{b&&(o?o(e,t.attribute,u):y&&(e.setStrokeStyle(t,t.attribute,d-i,p-n,u),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,u):v&&(e.setCommonStyle(t,t.attribute,d-i,p-n,u),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,n,_,b,v,y,u,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).path;this.tempTheme=s,this._draw(t,s,!1,i,n),this.tempTheme=null}}const ev=new WeakSet;function iv({bind:t}){rm(ev,t)||(t(tv).toDynamicValue((({container:t})=>new tv(ld(Cg,t)))).inSingletonScope(),t(Jp).toService(tv),t($p).toService(Jp),t(Cg).toService(_u),hd(t,Cg))}const nv=iv;function sv(t,e,i,n){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s0===t))?sv(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s,r=!0){var a;if(e.length<3)return void sv(t,e,i,n);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+n));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],u=h.x-o.x,d=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(d,u)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(s)?null!==(a=s[r%e.length])&&void 0!==a?a:0:s,y=v/m;const _=rv(u,d),b=rv(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=av(h,y,_,u,d),A=av(h,y,b,p,g),C=2*h.x-S.x-A.x,w=2*h.y-S.y-A.y,T=rv(C,w),k=av(h,rv(y,v),T,C,w);let M=Math.atan2(S.y-k.y,S.x-k.x);const B=Math.atan2(A.y-k.y,A.x-k.x);let E=B-M;E<0&&(M=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+n):t.lineTo(S.x+i,S.y+n),E&&t.arcTo(h.x+i,h.y+n,A.x+i,A.y+n,v),t.lineTo(A.x+i,A.y+n)}r||t.lineTo(e[l+1].x+i,e[l+1].y+n)}(e.camera?e:e.nativeContext,h,i,n,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,y,b,m,v,l,s,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,d-n,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,d-n,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,n,y,b,m,v,l,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).polygon;this._draw(t,s,!1,i,n)}}const cv=new WeakSet;function uv({bind:t}){rm(cv,t)||(t(Qp).toDynamicValue((({container:t})=>new hv(ld(wg,t)))).inSingletonScope(),t($p).toService(Qp),t(wg).toService(_u),hd(t,wg))}const dv=uv;class pv extends om{stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c){const u=el.Get(r,tl.Color255),d=n.vertices,p=d.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];n.polygons.forEach(((t,e)=>{if(s&&!s[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,n=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=n+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((n=>{const{polygon:s,normal:p}=n.polygon,g=d[s[0]],f=d[s[1]],m=d[s[2]],v=d[s[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,u):r,a.fill())}))}}class gv extends pv{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=Ia}drawShape(t,e,i,n,s,r,a,o){var l;const h=hh(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:u=h.stroke,face:d=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=s.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,p,f,d,s,e,g,t,h,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,p,f,e))}draw(t,e,i){const n=hh(t).polygon;this._draw(t,n,!1,i)}}const fv=new WeakSet;function mv({bind:t}){rm(fv,t)||(t(gv).toDynamicValue((()=>new gv)).inSingletonScope(),t(rg).toService(gv),t($p).toService(rg))}const vv=mv;class yv extends om{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Da,this.builtinContributions=[wp,kp,Tp],this.init(t)}drawShape(t,e,i,n,s,r,a,o,l){l=null!=l?l:hh(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:u=l.stroke,cornerRadius:d=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:C=l.fillStrokeOrder,drawStrokeWhenZeroWH:w=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:k}=t.attribute;T=(null!=T?T:b-S)||0,k=(null!=k?k:x-A)||0;const M=ep(g,f,T,k,h),B=np(g,v,T,k,w),E=Jd(h,c),P=Qd(u,m);if(!t.valid||!y)return;if(!E&&!P)return;if(!(M||B||a||o||c))return;0===d||_(d)&&d.every((t=>0===t))?(e.beginPath(),e.rect(i,n,T,k)):(e.beginPath(),Zd(e,i,n,T,k,d,"bevel"!==p));const O={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,E,P,M,B,l,s,a,o,O),C?(this._runStroke(t,e,i,n,l,O,B,S,A,o),this._runFill(t,e,i,n,l,O,M,S,A,a)):(this._runFill(t,e,i,n,l,O,M,S,A,a),this._runStroke(t,e,i,n,l,O,B,S,A,o)),this.afterRenderStep(t,e,i,n,E,P,M,B,l,s,a,o)}_runFill(t,e,i,n,s,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,s):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-n,s),e.stroke()))}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).rect;this._draw(t,s,!1,i,n,s)}}const _v=new WeakSet;function bv({bind:t}){rm(_v,t)||(t(yv).toDynamicValue((({container:t})=>new yv(ld(Tg,t)))).inSingletonScope(),t(tg).toService(yv),t($p).toService(tg),t(Cp).toSelf(),t(Ap).toSelf(),t(Tg).toService(Cp),t(Tg).toService(Ap),t(Tg).toService(_u),hd(t,Tg))}const xv=bv;class Sv extends pv{constructor(){super(...arguments),this.type="rect3d",this.numberType=La}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=hh(t,null==r?void 0:r.theme).rect,{fill:u=c.fill,stroke:d=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:C}=t.attribute;A=(null!=A?A:p-f)||0,C=(null!=C?C:g-m)||0;const w=null!==(h=this.z)&&void 0!==h?h:0,T=ep(v,y,A,C,u),k=np(v,b,A,C,S),M=Jd(u),B=Qd(d,_);if(!t.valid||!x)return;if(!M&&!B)return;if(!(T||k||a||o))return;const{light:E}=s.stage||{},P=t.findFace();if(!1!==u){e.setCommonStyle(t,t.attribute,i,n,c);let s=u;"string"!=typeof s&&(s="black"),this.fill(i,n,w,P,null,s,e,E,null,null,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,c),this.stroke(i,n,w,P,e))}draw(t,e,i){const n=hh(t).rect;this._draw(t,n,!1,i)}}const Av=new WeakSet;function Cv({bind:t}){rm(Av,t)||(t(Sv).toDynamicValue((()=>new Sv)).inSingletonScope(),t(eg).toService(Sv),t($p).toService(eg))}const wv=Cv;const Tv=new class extends ou{constructor(){super(...arguments),this.time=Gi.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){var d,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:C=l.opacity,backgroundMode:w=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:k=l.backgroundKeepAspectRatio,backgroundScale:M=l.backgroundScale,backgroundOffsetX:B=l.backgroundOffsetX,backgroundOffsetY:E=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:O=l.backgroundClip,backgroundCornerRadius:R=l.backgroundCornerRadius}=t.attribute;let I,{background:D}=t.attribute;if(!D)return;const L=()=>{"richtext"===t.type&&(e.restore(),e.save(),I&&e.setTransformFromMatrix(I,!0,1))};let F;"richtext"===t.type&&(I=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const U=g(D)&&D.background?D:null,N=t.transMatrix.onlyTranslate();if(U){const e=t.AABBBounds,i=(null!==(d=U.x)&&void 0!==d?d:e.x1)+(null!==(p=U.dx)&&void 0!==p?p:0),n=(null!==(f=U.y)&&void 0!==f?f:e.y1)+(null!==(m=U.dy)&&void 0!==m?m:0),s=null!==(v=U.width)&&void 0!==v?v:e.width(),r=null!==(y=U.height)&&void 0!==y?y:e.height();if(F=au.allocate(i,n,i+s,n+r),D=U.background,!N){const t=F.width(),e=F.height();F.set((null!==(_=U.x)&&void 0!==_?_:0)+(null!==(b=U.dx)&&void 0!==b?b:0),(null!==(x=U.y)&&void 0!==x?x:0)+(null!==(S=U.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,N||(F=Ud(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 i=t.resources.get(D);if(!i||"success"!==i.state||!i.data)return void L();e.highPerformanceSave(),N&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*C,O&&(e.beginPath(),R?Zd(e,F.x1,F.y1,F.width(),F.height(),R,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:w,backgroundFit:T,backgroundKeepAspectRatio:k,backgroundScale:M,backgroundOffsetX:B,backgroundOffsetY:E,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=A*C,e.fillStyle=D,R?(Zd(e,F.x1,F.y1,F.width(),F.height(),R,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();U&&au.free(F),L()}};class kv extends om{constructor(){super(),this.numberType=Fa,this.builtinContributions=[Tv],this.init()}drawShape(t,e,i,n,s){const r=hh(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=tp(o,l,!0),u=tp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,n),this.beforeRenderStep(t,e,i,n,c,u,c,u,r,s),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,n,c,u,c,u,r,s))}drawIcon(t,e,i,n,s){var r;const a=hh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:d=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(v-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,v,y)):(e.beginPath(),Zd(e,i-t,n-s,v,y,f,!0)),u&&(e.globalAlpha=d,e.fillStyle=u,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const n=hh(t).richtext;this._draw(t,n,!1,i)}}const Mv=new WeakSet;function Bv({bind:t}){rm(Mv,t)||(t(kv).toDynamicValue((()=>new kv)).inSingletonScope(),t(sg).toService(kv),t($p).toService(sg))}const Ev=Bv;class Pv extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ua,this.builtinContributions=[Up,Fp],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=hh(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:u=l.fillStrokeOrder}=t.attribute,d=this.valid(t,l,a,o);if(!d)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=d,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,s)=>{0===s?e.moveTo(i+t.x,n+t.y):e.lineTo(i+t.x,n+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,f,m,p,g,l,s,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-n,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-n,l),e.stroke()))};u?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,n,f,m,p,g,l,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).star;this._draw(t,s,!1,i,n)}}const Ov=new WeakSet;function Rv({bind:t}){rm(Ov,t)||(t(Pv).toDynamicValue((({container:t})=>new Pv(ld(Bg,t)))).inSingletonScope(),t(cg).toService(Pv),t($p).toService(cg),hd(t,Bg))}const Iv=Rv;class Dv extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Na,this.builtinContributions=[Rp,Lp,Dp,Ip],this.init(t)}drawShape(t,e,i,n,s,r,a,o,l){var h;l=null!=l?l:hh(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:u=l.x,y:d=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:C=l.keepDirIn3d}=t.attribute,w=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,k=n,M=w;const B=e.camera;if(C&&B&&e.project){const t=e.project(i,n,w);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,k=t.y,M=void 0}!1===A.draw(e,c,T,k,M,((s,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,u-i,d-n,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(u-i)/p,(d-n)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,x,S,y,b,l,s,a,o),f?(this._runStroke(t,e,i,n,l,S,b,u,d,A,m,p,g,o),this._runFill(t,e,i,n,l,x,y,u,d,A,a)):(this._runFill(t,e,i,n,l,x,y,u,d,A,a),this._runStroke(t,e,i,n,l,S,b,u,d,A,m,p,g,o)),this.afterRenderStep(t,e,i,n,x,S,y,b,l,s,a,o)}_runFill(t,e,i,n,s,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,s):a&&(e.setCommonStyle(t,t.attribute,o-i,l-n,s),e.fill()))}_runStroke(t,e,i,n,s,r,a,o,l,h,c,u,d,p){r&&!h.isSvg&&(p?p(e,t.attribute,s):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/u,(l-n)/d,s),e.stroke()))}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).symbol;this._draw(t,s,!1,i,n)}}const Lv=new WeakSet;function Fv({bind:t}){rm(Lv,t)||(t(Dv).toDynamicValue((({container:t})=>new Dv(ld(kg,t)))).inSingletonScope(),t(ig).toService(Dv),t($p).toService(ig),t(kg).toService(_u),hd(t,kg))}const Uv=Fv;class Nv extends om{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ja,this.builtinContributions=[Tv],this.init(t)}drawShape(t,e,i,n,s,r,a,o){var l,h,c;const u=hh(t,null==r?void 0:r.theme).text,{text:d,underline:p=u.underline,lineThrough:g=u.lineThrough,keepDirIn3d:f=u.keepDirIn3d,direction:m=u.direction,fontSize:v=u.fontSize,verticalMode:y=u.verticalMode,x:_=u.x,y:b=u.y}=t.attribute,x=null!==(l=$s(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,u,a,o);if(!S)return;const{fVisible:A,sVisible:C,doFill:w,doStroke:T}=S,k=!f,M=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,w,T,A,C,u,s,a,o),k&&this.transformUseContext2d(t,u,M,e);const B=(s,r,l,h)=>{let c=i+r;const d=n+l;if(h){e.highPerformanceSave(),c+=v;const t=Xo.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),Xo.free(t)}T&&(o?o(e,t.attribute,u):C&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,u),e.strokeText(s,c,d,M))),w&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-n,u),e.fillText(s,c,d,M))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,M),"horizontal"===m){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;T&&(o?o(e,t.attribute,u):C&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,u),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,M)})))),w&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-n,u),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,M),this.drawUnderLine(p,g,t,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,s.descent,(s.descent-s.ascent)/2,M,u,e,{width:s.width})}))))}else{let{textAlign:i=u.textAlign,textBaseline:n=u.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[n])&&void 0!==h?h:"left",n=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const s=t.cache,{verticalList:r}=s;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=kt(e,o)}));let l=0,d=0;"bottom"===n?d=-a:"middle"===n&&(d=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const n=t.reduce(((t,e)=>t+(e.width||0)),0),s=o-n;let r=l;"center"===i?r+=s/2:"right"===i&&(r+=s),t.forEach((t=>{const{text:i,width:n,direction:s}=t;B(i,a-(e+1)*x+d,r,s),r+=n}))}))}k&&this.restoreTransformUseContext2d(t,u,M,e),this.afterRenderStep(t,e,i,n,w,T,A,C,u,s,a,o)}draw(t,e,i,n){const s=hh(t,null==n?void 0:n.theme).text,{keepDirIn3d:r=s.keepDirIn3d}=t.attribute,a=!r;this._draw(t,s,a,i,n)}drawUnderLine(t,e,i,n,s,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:vc(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,n,s,l),m&&h.setLineDash(m),h.beginPath();const e=s+r+f;h.moveTo(n+b,e,o),h.lineTo(n+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,n,s,l),h.beginPath();const t=s+a;h.moveTo(n+b,t,o),h.lineTo(n+b+_,t,o),h.stroke()}}}const jv=new WeakSet;function zv({bind:t}){rm(jv,t)||(t(ng).toDynamicValue((({container:t})=>new Nv(ld(Mg,t)))).inSingletonScope(),t($p).toService(ng),t(Mg).toService(_u),hd(t,Mg))}const Wv=zv,Hv=ju();function Vv(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function Gv(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const Yv=Symbol.for("MathPickerContribution"),Xv=Symbol.for("MathArcPicker"),Kv=Symbol.for("MathAreaPicker"),$v=Symbol.for("MathCirclePicker"),qv=Symbol.for("MathImagePicker"),Zv=Symbol.for("MathLinePicker"),Jv=Symbol.for("MathPathPicker"),Qv=Symbol.for("MathRectPicker"),ty=Symbol.for("MathSymbolPicker"),ey=Symbol.for("MathTextPicker"),iy=Symbol.for("MathPolygonPicker"),ny=Symbol.for("MathGlyphPicker"),sy=Symbol.for("MathRichTextPicker"),ry=Symbol.for("CanvasArcPicker"),ay=Symbol.for("CanvasArc3dPicker"),oy=Symbol.for("CanvasAreaPicker"),ly=Symbol.for("CanvasCirclePicker"),hy=Symbol.for("CanvasImagePicker"),cy=Symbol.for("CanvasGifImagePicker"),uy=Symbol.for("CanvasLinePicker"),dy=Symbol.for("CanvasLottiePicker"),py=Symbol.for("CanvasPathPicker"),gy=Symbol.for("CanvasRectPicker"),fy=Symbol.for("CanvasRect3dPicker"),my=Symbol.for("CanvasSymbolPicker"),vy=Symbol.for("CanvasTextPicker"),yy=Symbol.for("CanvasPolygonPicker"),_y=Symbol.for("CanvasPyramid3dPicker"),by=Symbol.for("CanvasRichTextPicker"),xy=Symbol.for("CanvasGlyphPicker"),Sy=Symbol.for("CanvasGroupPicker"),Ay=Symbol.for("CanvasStarPicker"),Cy=Symbol.for("CanvasPickerContribution"),wy=jg(),Ty=Hg((()=>zg(Qu))),ky=Hg((()=>zg(Ju))),My=Hg((()=>zg(za))),By=Hg((()=>zg(td)));function Ey(){Ps.global=Vg,Ps.graphicUtil=Ty,Ps.transformUtil=ky,Ps.graphicService=My,Ps.layerService=By,Ps.canvasFactory=t=>Wg(Ka,t),Ps.context2dFactory=t=>Wg($a,t),Ps.windowFactory=()=>new Xc(Ps.global),Ps.windowHandlerFactory=t=>function(t){const e=Wg(Gc,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),Ps.renderServiceFactory=()=>zg(md),Ps.renderService=Hg((()=>zg(md))),Ps.pluginServiceFactory=()=>zg(Xd),Ps.pluginService=Hg((()=>zg(Xd))),Ps.pickerServiceFactory=()=>zg(bd),Ps.layerHandlerFactory=t=>zg("static"===t?ed:"dynamic"===t?id:nd),Ps.incrementalDrawContributionFactory=()=>zg(Vp)}Ey();var Py=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class Oy{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new ue}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return Py(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class Ry{constructor(){this._uid=pi.GenAutoIncrementId(),this.viewBox=new ue,this.modelMatrix=new pe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,n,s,r){this.modelMatrix.setValue(t,e,i,n,s,r)}getViewBoxTransform(){return this.modelMatrix}}class Iy{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=el.Get(e,tl.Color1),this.ambient=i;const n=Et(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Mt(kt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=y(e)?el.Get(e,tl.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*s[0]*n}, ${r[1]*s[1]*n}, ${r[2]*s[2]*n})`}}const Dy=()=>{$u.registerPlugin("DirectionalLight",Iy)};class Ly{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=Ko.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Ko.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return No(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Ko.allocate()),this._vp=Uo(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Ko.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Ko.allocate());const{left:t,top:e,right:i,bottom:n}=this._params;return jo(this._projectionMatrixCached,t,i,n,e,0,-2e6),this._vp||(this._vp=Ko.allocate()),this._vp=Uo(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:n}=this._params;return(null!=e?e:n-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const n=[0,0,0];return zo(n,[t,e,i],this._viewMatrixCached),n}vp(t,e,i){const n=[0,0,0],{pos:s}=this._params.viewParams;zo(n,[t,e,i],this._viewMatrixCached),t=n[0],e=n[1],i=n[2];const r=this.getProjectionScale(i);return{x:t*r+s[0],y:e*r+s[1]}}}const Fy=()=>{$u.registerPlugin("OrthoCamera",Ly)},Uy={getContributions:()=>[]},Ny={getContributions:()=>[]};class jy{constructor(t=Uy,e=Ny,i={}){var n,s,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(n=i.global)&&void 0!==n?n:Ps.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(s=i.pickItemInterceptorContributions)&&void 0!==s?s:this.pickItemInterceptorContributions)&&void 0!==r?r:Uy,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:Ny,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;const s=i.bounds.width(),r=i.bounds.height();if(!(new ue).setValue(0,0,s,r).containsPoint(e))return n;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new pe(1,0,0,1,0,0);let o;for(let s=t.length-1;s>=0&&(n=t[s].isContainer?this.pickGroup(t[s],e,a,i):this.pickItem(t[s],e,a,i),!n.graphic);s--)o||(o=n.group);if(n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new Ft(e.x,e.y),a=hh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,s=this.pickGroup(r,i,l,n)}else{const a=new Ft(e.x,e.y);l.transformPoint(a,a);const o=hh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const u=this.pickItem(r,a,i,n);u&&u.graphic&&(s.graphic=u.graphic,s.params=u.params)}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&Ko.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),Xo.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class zy{constructor(t={}){var e,i,n,s,r,a,o,l,h,c,u,d,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new ku,picker:null!==(s=null===(n=t.registry)||void 0===n?void 0:n.picker)&&void 0!==s?s:new Mu,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new Eu,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new Bu},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new Yu(void 0,(()=>this.createStageDeps())),layer:null!==(d=null===(u=t.factory)||void 0===u?void 0:u.layer)&&void 0!==d?d:new Ku,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new kc}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),n=i,s=null===(e=n.release)||void 0===e?void 0:e.bind(i);let r=!1;return s&&(n.release=()=>{r||(r=!0,this.stageResources.delete(n),s())}),this.stageResources.add(n),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new Tu(new wu([],(t=this.registry.contribution,e=ug,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class Wy{constructor(t={}){this.context=new zy(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function Hy(t={}){return new Wy(t)}class Vy extends Wy{}class Gy extends Wy{}class Yy extends wm{constructor(){super(...arguments),this.numberType=Ta}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=hh(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,g=tp(d,u,c),f=Jd(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;sl.length)return;const h=hh(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=tp(d,p,c),y=ip(d,g),_=Jd(c),b=Qd(u,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=s;for(let s=e;s{};function r_(){qy.preloaded||(qy.preloaded=!0,fd({bind:Zy.bind}),Gd({bind:Zy.bind}),yd({bind:Zy.bind}),Vd({bind:Zy.bind,isBound:Zy.isBound}),$d(Zy),Og(Zy))}function a_(t,e){const i=c_().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function o_(t,e,i){e.forEach(((e,n)=>{var s,r,a;const o=null!==(a=null!==(s=null==e?void 0:e.type)&&void 0!==s?s:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${n}`,e)}))}function l_(t,e){let i=t_.get(t);i||(i=new Map,t_.set(t,i));let n=i.get(e);return n||(n=new Set,i.set(e,n)),n}function h_(t,e,i){const n=l_(t,e);i&&n.forEach((t=>i(t))),n.clear()}function c_(){return r_(),Zy}function u_(){ud.refreshAllContributions()}function d_(){var t;return r_(),null!==(t=qy.runtimeGlobal)&&void 0!==t||(qy.runtimeGlobal=new zc(ld(Wh,Zy))),qy.runtimeGlobal}function p_(t){const e=c_(),i=d_();Ps.global=i,Ps.canvasFactory=t=>e.getNamed(Ka,t),Ps.context2dFactory=t=>e.getNamed($a,t),Ps.windowHandlerFactory=t=>a_(Gc,t),Ps.windowFactory=()=>new Xc(i,(t=>a_(Gc,t))),Ps.pluginServiceFactory=()=>new Ou(ld(Yd,e),{pluginRegistry:t.context.registry.plugin}),Ps.incrementalDrawContributionFactory=()=>new Hp([],new Xy,new Yy(ld(bg,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,ug))}function g_(t){var e;const i=c_();u_();const n=i.getAll($p),s=l_(t.registry.renderer,Jy);h_(t.registry.renderer,Jy,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),o_(((e,i)=>{var n;null===(n=null==i?void 0:i.reInit)||void 0===n||n.call(i),t.registry.renderer.register(e,i),s.add(e)}),n,Jy)}function f_(t){var e;const i=c_();u_();const n=i.getAll(ug),s=null!==(e=e_.get(t.context.registry.contribution))&&void 0!==e?e:new Set;s.forEach((e=>{var i,n;null===(n=(i=t.context.registry.contribution).unregister)||void 0===n||n.call(i,ug,e)})),s.clear(),e_.set(t.context.registry.contribution,s);const r=new Set(t.context.registry.contribution.get(ug));n.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(ug,e),r.add(e)),s.add(e)}))}function m_(t,e){var i;const n=c_();u_();const s=n.getAll(e),r=l_(t.registry.picker,Qy);h_(t.registry.picker,Qy,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),o_(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),s,Qy)}function v_(t,e){(function(t,e){var i,n;return null!==(n=null===(i=i_.get(t))||void 0===i?void 0:i.has(e))&&void 0!==n&&n})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,s_,t.isBound,t.rebind),function(t,e){let i=i_.get(t);i||(i=new WeakSet,i_.set(t,i)),i.add(e)}(t,e))}function y_(t,{app:e,legacy:i=!0,targets:n}={}){v_(c_(),t),i&&(Ng(),v_(jg(),t)),u_(),e&&function(t,e){const i=null!=e?e:n_;let n=!1,s=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?n=!0:"draw-contribution"===t?s=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),s&&f_(t),n&&g_(t),r.forEach((e=>{m_(t,e)}))}(e,n)}function __(t,e,i){const n={};for(const i in e)i in t&&W(t[i],e[i])||(n[i]=e[i]);if(i)for(const s in t)if(!(s in e)){const t=i(s);void 0!==t&&(n[s]=t)}return n}function b_(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,u=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=u,r[4]=u,r[5]=c,r[6]=l,r[7]=n}function x_(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const u=s.filter((t=>t.length>2));return 1===u.length?[u[0]]:u}function B_(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:n}=Uh(t.attribute),s=P_(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=P_(o*(r+a)/2,l,e),c=[],u=l/h.length,d=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=P_(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;s{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return z_(l,e,h),h},F_=(t,e)=>{const i=t.attribute,n=i.points;if(n)return D_(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return D_(t,e)}return[]};const U_=t=>t.map((t=>({x:t.x,y:t.y}))),N_=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,u=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)u.push({x:t[e].x,y:t[e].y});u.push({x:c.x,y:c.y});const d=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];d.push({x:i.x,y:i.y})}return d.push({x:h.x,y:h.y}),[u,d]},j_=t=>{const e=new ce;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return N_(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return N_(t,{x:e.x1,y:s},{x:e.x2,y:s})},z_=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=j_(t);z_(s[0],n,i),z_(s[1],e-n,i)}},W_=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:U_(i)}];const n=[];return z_(i,e,n),n},H_=(t,e)=>{const i=M_(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;rObject.assign({},t))):[]}function G_(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:V_(t.touches),configurable:!0},changedTouches:{value:V_(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function Y_(t,e){try{return t[e]}catch(t){return}}function X_(t,e,i,n){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const s=e();if(1===(r=s).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=G_(t),l=Y_(t,"target"),h=Y_(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)n(t.clientX,t.clientY,s,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];n(t.clientX,t.clientY,s,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];n(t.clientX,t.clientY,s,a,t)}}return o}}var K_=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s=0;a++)"\n"===t[a].text?(s-=Number(r),r=!0):(s--,r=!1);return s>=0?t.length:(a-=1,e>n&&!r&&(a+=1),a)}function Z_(t,e){var i,n,s,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(n=t[t.length-1])||void 0===n?void 0:n.text)?a+.9:a+.1;const l="\n"===(null===(s=t[e])||void 0===s?void 0:s.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class J_{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:q_(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},$_(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},$_(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,n=K_(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let s=t.data;this.isComposing||"Backspace"===t.type||s||(s="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=q_(i,this.selectionStartCursorIdx),a=q_(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=$_(n));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=s,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;s&&s.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Z_(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(s,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(s,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),Ps.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,n=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const s=n.text,r=s?Array.from(s.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=n,this.selectionStartCursorIdx=s}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),Ps.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Q_{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,n=q_(i,Math.ceil(t)),s=q_(i,Math.floor(e));let r="";for(let t=n;t<=s;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let n=Math.round(e);const s=this.rt.attribute.textConfig;if(!s.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const n=e.getSelection();if(!n)return;const{selectionStartCursorIdx:s,curCursorIdx:r}=n,a=Math.min(s,r),o=Math.max(s,r),l=q_(i.attribute.textConfig,a),h=q_(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const n=i.attribute.textConfig;this._formatTextCommand(t,n,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,n)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,n)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const s=this.computedCursorPosByCursorIdx(i,n);this.setCursorAndTextArea(s.x,s.y1,s.y2,n),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(tb,[this.formatTextCommandCb]),this.commandCbs.set(eb,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>U(e,t))),i.setAttributes(i.attribute);const n=i.getFrameCache();n&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,n),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],n=i.indexOf(e);n>-1&&i.splice(n,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new J_,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),Ps.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(Ps.global.isMacOS()&&t.metaKey&&"c"===t.key||!Ps.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return Ps.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const n=i.getFrameCache();if(!n)return;const{lines:s}=n,r=s.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,n)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:n,y1:s,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:n,y:(s+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const n=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,n+.1)}fullSelectionKeyHandler(t){return!!(Ps.global.isMacOS()&&t.metaKey&&"a"===t.key||!Ps.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,n=0;"ArrowUp"===t.key?n=-1:"ArrowDown"===t.key?n=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:s,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===s.paragraphs[s.paragraphs.length-2]&&this.curCursorIdx0&&r===s.paragraphs[s.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===s.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===s.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(n){if(n>0&&s===e.lines[e.lines.length-1])return;if(n<0&&s===e.lines[0])return;const t=e.lines.findIndex((t=>t===s))+n;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=n*s.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let u=this.getColumnIndex(e,h)+c;const d=this.computedCursorPosByCursorIdx(u,this.currRt);u<-.1?u=-.1:u>o+.1&&(u=o+.1),this.curCursorIdx=u,this.selectionStartCursorIdx=u,this.setCursorAndTextArea(d.x,d.y1,d.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:n,placeholderColor:s="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},$_(this.currRt.attribute)),{text:n});s&&(l.fill=s),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=uc(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:Nd(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:n}=i;if(!i||!n)return;this.offsetShadowRoot();const s=this.getRichTextAABBBounds(this.currRt),r=s.height(),a=s.width();this.shadowBounds=this.shadowBounds||zh({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:n,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},$_(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),Ps.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=wh({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,ib.tryUpdateRichtext(i);const n=this.getShadow(i),s=i.getFrameCache();if(!s)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=Ph({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=wh({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,n),this.addEditLineOrBgOrBounds(this.editBg,n)}if(e=e||this.computedCursorPosByEvent(t,s)){const{x:t,y1:n,y2:s,cursorIndex:r}=e;this.startCursorPos={x:t,y:(n+s)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,n,s,i)}else{const t=0,e=0,n=Nd(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+n)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,n,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,n=0,s=t.attribute;"middle"!==e&&"bottom"!==e||(s.textConfig.length||(s=Object.assign(Object.assign({},s),{textConfig:[{text:"a"}]})),i=Nd(Object.assign(Object.assign({},s),{scaleX:1,scaleY:1}))),"middle"===e?n=-i.height()/2:"bottom"===e&&(n=-i.height()),this.editLine&&this.editLine.setAttributes({dy:n}),this.editBg&&this.editBg.setAttributes({dy:n}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:n})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const n=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,n),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,n),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,n),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const n=e.lineInfo,s=n.paragraphs.findIndex((t=>t===e.columnInfo));if(s<0)return;const r=n.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return n=Math.min(n+1,t.length),{startIdx:i,endIdx:n}}(r,s);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,n={x:t.x,y:(t.y1+t.y2)/2},s=this.getLineByPoint(e,i),r=this.getLineByPoint(e,n);if((i.y>n.y||i.y===n.y&&i.x>n.x)&&([i,n]=[n,i],[r,s]=[s,r]),this.hideSelection(),s===r)this.editBg.setAttributes({x:i.x,y:s.top,width:n.x-i.x,height:s.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:s.top,width:0,height:0});const t=e.lines.findIndex((t=>t===s)),a=e.lines.findIndex((t=>t===r));let o=0;for(let s=t;s<=a;s++){const r=e.lines[s];if(s===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(zh({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(s===a){const t=r.paragraphs[0];this.editBg.add(zh({x:t.left,y:o,width:n.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(zh({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let n=0;n=e.y);n++)i=t.lines[n+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],n=0;if(t.paragraphs.length){const s=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=s.left?(n=-.1,i=s):e.x>=r.left+r.width&&(n=.1,i=r)}if(!n)for(let s=0;s=e.x){n=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:n}}getColumnIndex(t,e){let i=-1;for(let n=0;nMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-n/2:"right"===t.globalAlign&&(this.deltaX=-n),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const n=this.currRt,{textBaseline:s}=n.attribute;let r=0;return"middle"===s?r=Nd(Object.assign(Object.assign({},n.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===s&&(r=Nd(Object.assign(Object.assign({},n.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,n){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const s={x:0,y:0};n.globalTransMatrix.getInverse().transformPoint({x:t,y:e},s);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();s.x+=r,s.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(s.x,s.y,n,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),n=this.getLineByPoint(e,i);if(!n)return;const{columnInfo:s,delta:r}=this.getColumnAndIndexByLinePoint(n,i);if(!s)return;const a=n.top,o=n.top+n.height;let l=this.getColumnIndex(e,s);return l+=r,{x:s.left+(r>0?s.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:n,columnInfo:s}}computedCursorPosByCursorIdx(t,e){var i,n,s;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(s=null===(n=e.attribute.textConfig)||void 0===n?void 0:n[0])||void 0===s?void 0:s.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:Nd(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:u}=l,d=c.top,p=c.top+c.height;return{x:u.left+(a<0?0:u.width),y1:d,y2:p,lineInfo:c,columnInfo:u}}getColumnByIndex(t,e){for(let i=0,n=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const xb=new bb;class Sb{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=pi.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}const Ab=()=>{$u.registerPlugin("ViewTransform3dPlugin",Sb)},Cb=new ue;class wb{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=pi.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new ue}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const n=hh(i).group,{display:s=n.display}=i.attribute;if("flex"!==s)return;const{flexDirection:r=n.flexDirection,flexWrap:a=n.flexWrap,alignItems:o=n.alignItems,clip:l=n.clip}=i.attribute,{alignContent:h=(null!=o?o:n.alignContent)}=i.attribute;let{width:c,height:u,justifyContent:d=n.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==u){let t=0,e=0,i=0;if(p.forEach((n=>{const s=this.getAABBBounds(n);s.empty()||("column"===r||"column-reverse"===r?(e+=s.height(),t=Math.max(t,s.width())):(t+=s.width(),e=Math.max(e,s.height())),i+=s.x1,i+=s.y1,i+=s.x2,i+=s.y2)})),!isFinite(i))return;c=t,u=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=u:u=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const g={main:{len:c,field:"x"},cross:{len:u,field:"y"}},f=g.main,m=g.cross;"column"!==r&&"column-reverse"!==r||(f.len=u,m.len=c,f.field="y",m.field="x"),"row-reverse"!==r&&"column-reverse"!==r||("flex-start"===d?d="flex-end":"flex-end"===d?d="flex-start":p.reverse());let v=0,y=0;const _=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===f.field?e.width():e.height(),n="x"===m.field?e.width():e.height();_.push({mainLen:i,crossLen:n}),v+=i,y=Math.max(y,n)}));const b=[];if(v>f.len&&"wrap"===a){let t=0,e=0;_.forEach((({mainLen:i,crossLen:n},s)=>{t+i>f.len?0===t?(b.push({idx:s,mainLen:t+i,crossLen:n}),t=0,e=0):(b.push({idx:s-1,mainLen:t,crossLen:e}),t=i,e=n):(t+=i,e=Math.max(e,n))})),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,d,f,_,x,t),x=t.idx+1})),y=b.reduce(((t,e)=>t+e.crossLen),0),1===b.length){const t={"flex-start":0,"flex-end":m.len,center:m.len/2};this.layoutCross(p,o,m,t,_,b[0],0)}else if("flex-start"===h){x=0;let t=0;b.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",m,n,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("center"===h){x=0;let t=Math.max(0,(m.len-y)/2);b.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",m,n,_,b[i],x),x=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){x=0;const t=Math.max(0,(m.len-y)/b.length/2);let e=t;b.forEach(((i,n)=>{const s={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[n],x),x=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){x=0;const t=Math.max(0,(m.len-y)/(2*b.length-2));let e=0;b.forEach(((i,n)=>{const s={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",m,s,_,b[n],x),x=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,n,s,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else if("flex-end"===i){let t=n.len;for(let i=a.idx;i>=r;i--){t-=s[i].mainLen;const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`]))}}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++){const r=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(r,e[t].attribute[n.field],a[`${n.field}1`])),o+=s[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++){const r=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(r,e[t].attribute[n.field],a[`${n.field}1`])),o+=s[t].mainLen+2*i}}else if("center"===i){let t=(n.len-a.mainLen)/2;for(let i=r;i<=a.idx;i++){const r=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(r,e[i].attribute[n.field],a[`${n.field}1`])),t+=s[i].mainLen}}}layoutCross(t,e,i,n,s,r,a){var o;for(let l=a;l<=r.idx;l++){const r=t[l];let{alignSelf:a}=r.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(r),c=null!==(o=n[a])&&void 0!==o?o:n["flex-start"];"flex-end"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-s[l].crossLen+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c-s[l].crossLen/2+(i.field,0),r.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(r.attribute[i.field]=this.updateChildPos(c+(i.field,0),r.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&Cb.copy(n)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(Cb.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const Tb=()=>{$u.registerPlugin("FlexLayoutPlugin",wb)};var kb=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:Bs,ARC3D_NUMBER_TYPE:wa,ARC_NUMBER_TYPE:Ca,AREA_NUMBER_TYPE:Ta,AbstractGraphicRender:class{},get AnimateMode(){return Zn},get AnimateStatus(){return ts},get AnimateStepType(){return Qn},AppContext:zy,Application:Ms,Arc:ph,Arc3d:Od,Arc3dRender:Yp,ArcRender:Gp,ArcRenderContribution:_g,Area:mh,AreaRender:Xp,AreaRenderContribution:bg,get AttributeUpdateType(){return Wi},AutoEnablePlugins:Yd,Base3dRender:pv,BaseCanvas:Qo,BaseEnvContribution:Oy,BaseRender:om,get BaseRenderContributionTime(){return Gi},BaseWindowHandlerContribution:Ry,Basis:_n,BeforeRenderConstribution:vd,BoundsContext:Mi,BoundsPicker:xd,BrowserEntry:Wy,CIRCLE_NUMBER_TYPE:ka,CONTRIBUTION_STORE_STATE_SYMBOL:sd,Canvas3DDrawItemInterceptor:yg,Canvas3DPickItemInterceptor:Hd,CanvasFactory:Ka,CanvasTextLayout:bc,Circle:_h,CircleRender:Kp,CircleRenderContribution:xg,ColorInterpolate:gl,ColorStore:el,get ColorType(){return tl},CommonDrawItemInterceptorContribution:mg,CommonRenderContribution:Eg,Context2dFactory:$a,ContributionProvider:ad,ContributionRegistry:Eu,ContributionStore:ud,CubicBezierCurve:ln,CurveContext:Gn,get CurveTypeEnum(){return Vi},CustomEvent:bi,CustomPath2D:Xn,CustomSymbolClass:Jr,DEFAULT_TEXT_FONT_FAMILY:Vh,DebugDrawItemInterceptorContribution:fg,DefaultArcAllocate:ab,DefaultArcAttribute:ds,DefaultArcRenderContribution:up,DefaultAreaAllocate:lb,DefaultAreaAttribute:ps,DefaultAreaTextureRenderContribution:Np,DefaultAttribute:us,DefaultBaseBackgroundRenderContribution:ou,DefaultBaseClipRenderAfterContribution:Su,DefaultBaseClipRenderBeforeContribution:bu,DefaultBaseInteractiveRenderContribution:_u,DefaultBaseTextureRenderContribution:hp,DefaultCanvasAllocate:Wc,DefaultCanvasArc3DRender:dm,DefaultCanvasArcRender:lm,DefaultCanvasAreaRender:wm,DefaultCanvasCircleRender:Bm,DefaultCanvasGroupRender:jp,DefaultCanvasImageRender:Vm,DefaultCanvasLineRender:Km,DefaultCanvasPathRender:tv,DefaultCanvasPolygonRender:hv,DefaultCanvasPyramid3dRender:gv,DefaultCanvasRect3dRender:Sv,DefaultCanvasRectRender:yv,DefaultCanvasSymbolRender:Dv,DefaultCanvasTextRender:Nv,DefaultCircleAllocate:cb,DefaultCircleAttribute:gs,DefaultCircleRenderContribution:fp,DefaultConnectAttribute:hs,DefaultDebugAttribute:cs,DefaultFillStyle:ns,DefaultGlobal:zc,DefaultGlobalPickerService:tu,DefaultGlyphAttribute:ms,DefaultGraphicAllocate:nb,DefaultGraphicMemoryManager:bb,DefaultGraphicService:Hu,DefaultGraphicUtil:Kc,DefaultGroupAttribute:fs,DefaultGroupBackgroundRenderContribution:_p,DefaultImageAttribute:Ts,DefaultImageRenderContribution:Mp,DefaultLayerService:Zu,DefaultLayout:es,DefaultLineAllocate:db,DefaultLineAttribute:vs,DefaultMat4Allocate:Yo,DefaultMatrixAllocate:Go,DefaultPathAllocate:gb,DefaultPathAttribute:ys,DefaultPickService:jy,DefaultPickStyle:os,DefaultPolygonAttribute:_s,DefaultRect3dAttribute:Ss,DefaultRectAllocate:sb,DefaultRectAttribute:xs,DefaultRectRenderContribution:Sp,DefaultRenderService:Tu,DefaultRichTextAttribute:ws,DefaultRichTextIconAttribute:ks,DefaultStarAttribute:bs,DefaultStrokeStyle:rs,DefaultStyle:ls,DefaultSymbolAllocate:mb,DefaultSymbolAttribute:As,DefaultSymbolClipRangeStrokeRenderContribution:Op,DefaultSymbolRenderContribution:Pp,DefaultTextAllocate:yb,DefaultTextAttribute:Cs,DefaultTextMeasureContribution:gd,DefaultTextStyle:as,DefaultTransform:is,DefaultTransformUtil:Zc,DefaultWindow:Xc,get Direction(){return Hi},DirectionalLight:Iy,DrawContribution:hg,DrawItemInterceptor:ug,DynamicLayerHandlerContribution:id,get Edge(){return Is},EditModule:J_,EmptyContext2d:Zo,EnvContribution:Wh,EventManager:Ai,EventSystem:Ti,EventTarget:Ci,FACTORY_STATE_SYMBOL:Jc,FORMAT_ALL_TEXT_COMMAND:eb,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:tb,Factory:$u,FederatedEvent:mi,FederatedMouseEvent:vi,FederatedPointerEvent:yi,FederatedWheelEvent:_i,FlexLayoutPlugin:wb,GLYPH_NUMBER_TYPE:Ma,GRAPHIC_CLASS_SYMBOL:Jl,GRAPHIC_REGISTRY_SYMBOL:Bc,GRAPHIC_UPDATE_TAG_KEY:Ul,GROUP_NUMBER_TYPE:Ba,Generator:pi,GlobalPickerService:Sd,Glyph:xh,GlyphRender:ag,GradientParser:Mo,Graphic:th,GraphicCreator:Wa,GraphicFactory:kc,GraphicPicker:_d,GraphicRender:$p,GraphicService:za,GraphicUtil:Qu,Group:Ch,GroupRender:qp,GroupRenderContribution:Sg,get GroupUpdateAABBBoundsMode(){return Ah},HtmlAttributePlugin:Gg,get IContainPointMode(){return zi},IMAGE_NUMBER_TYPE:Ea,Image:kh,ImageRender:og,ImageRenderContribution:Ag,IncrementalDrawContribution:Vp,InteractiveDrawItemInterceptorContribution:vg,InteractivePickItemInterceptorContribution:Wd,InteractiveSubRenderContribution:Pg,LINE_NUMBER_TYPE:Pa,Layer:Xu,LayerFactory:Ku,LayerService:td,Line:Eh,LineRender:Zp,Linear:fn,LinearClosed:Fn,Mat4Allocate:Ho,MatrixAllocate:Wo,get MeasureModeEnum(){return qn},MiniappEntry:Gy,MonotoneX:Tn,MonotoneY:kn,NOWORK_ANIMATE_ATTR:ql,Node:fi,NodeEntry:Vy,OrthoCamera:Ly,PATH_NUMBER_TYPE:Oa,POLYGON_NUMBER_TYPE:Ra,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:Ia,Path:Rh,PathRender:Jp,PathRenderContribution:Cg,PerformanceRAF:Uc,PickItemInterceptor:Ad,PickServiceInterceptor:Cd,PickerRegistry:Mu,PickerService:bd,PluginRegistry:Bu,PluginService:Xd,Polygon:Lh,PolygonRender:Qp,PolygonRenderContribution:wg,Pyramid3d:Id,Pyramid3dRender:rg,RECT3D_NUMBER_TYPE:La,RECT_NUMBER_TYPE:Da,RICHTEXT_NUMBER_TYPE:Fa,RUNTIME_INSTALLER_STATE_SYMBOL:Ky,RafBasedSTO:Ys,ReactAttributePlugin:Xg,Rect:jh,Rect3DRender:eg,Rect3d:kd,RectRender:tg,RectRenderContribution:Tg,ReflectSegContext:dn,RenderSelector:lg,RenderService:md,RendererRegistry:ku,ResourceLoader:Os,RichText:cc,RichTextEditPlugin:ib,RichTextRender:sg,STAR_NUMBER_TYPE:Ua,get STATUS(){return Jn},SVG_ATTRIBUTE_MAP:Ha,SVG_ATTRIBUTE_MAP_KEYS:Va,SVG_PARSE_ATTRIBUTE_MAP:Ga,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Ya,SYMBOL_NUMBER_TYPE:Na,SegContext:un,ShadowPickServiceInterceptorContribution:jd,ShadowRoot:dc,ShadowRootDrawItemInterceptorContribution:gg,ShadowRootPickItemInterceptorContribution:zd,SplitRectAfterRenderContribution:Cp,SplitRectBeforeRenderContribution:Ap,Stage:Gu,StageFactory:Yu,Star:Ed,StarRender:cg,StarRenderContribution:Bg,StateDefinitionCompiler:bl,StateEngine:Cl,StaticLayerHandlerContribution:ed,Step:On,StepClosed:Rn,Symbol:fc,SymbolRender:ig,SymbolRenderContribution:kg,TEXT_NUMBER_TYPE:ja,Text:Sc,get TextDirection(){return ya},TextMeasureContribution:pd,TextRender:ng,TextRenderContribution:Mg,Theme:oh,TransformUtil:Ju,get UpdateTag(){return ji},VGlobal:Hh,VWindow:Vc,ViewTransform3dPlugin:Sb,VirtualLayerHandlerContribution:nd,WILDCARD:"*",WindowHandlerContribution:Gc,WrapText:wc,XMLParser:pa,_calculateLineHeight:Ks,_interpolateColor:sl,addArcToBezierPath:$i,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:k_,alignSubpath:x_,application:Ps,applyTransformOnBezierCurves:B_,arc3dModule:fm,arcModule:um,areaModule:Mm,bezier:Xi,bezierCurversToPath:E_,binarySplitPolygon:j_,bindArc3dRenderModule:gm,bindArcRenderModule:cm,bindAreaRenderModule:km,bindCircleRenderModule:Pm,bindContributionProvider:hd,bindContributionProviderNoSingletonScope:cd,bindGlyphRenderModule:Dm,bindImageRenderModule:Ym,bindLineRenderModule:qm,bindPathRenderModule:iv,bindPolygonRenderModule:uv,bindPyramid3dRenderModule:mv,bindRect3dRenderModule:Cv,bindRectRenderModule:bv,bindRichtextRenderModule:Bv,bindStarRenderModule:Rv,bindSymbolRenderModule:Fv,bindTextRenderModule:zv,boundStroke:fa,builtInSymbolStrMap:ea,builtinSymbols:Qr,builtinSymbolsMap:ta,calcLineCache:Yn,calculateArcCornerRadius:ap,calculateLineHeight:$s,canvasAllocate:Hc,centroidOfSubpath:C_,circleBounds:zs,circleModule:Om,clock:xi,colorEqual:function(t,e){const i=we.parseColorString(t),n=we.parseColorString(e);return!(!i||!n)&&i.r===n.r&&i.g===n.g&&i.b===n.b&&i.opacity===n.opacity},colorStringInterpolationToStr:dl,configureRuntimeApplicationForApp:p_,container:wy,cornerTangents:rp,createApp:Hy,createArc:gh,createArc3d:Rd,createArea:vh,createBrowserApp:Hy,createCanvasEventTransformer:function(t,e,i,n){return X_(t.parentElement,e,i,n)},createCircle:bh,createColor:Eo,createConicalGradient:vl,createContributionProvider:ld,createEventTransformer:X_,createGlyph:Sh,createGraphic:Ic,createGroup:wh,createImage:Mh,createLine:Ph,createMat4:Vo,createMiniappApp:function(t={}){return new Gy(t)},createNodeApp:function(t={}){return new Vy(t)},createPath:Ih,createPolygon:Fh,createPyramid3d:Dd,createRect:zh,createRect3d:Md,createRectPath:Zd,createRichText:uc,createShadowRoot:pc,createStage:function(t){return Ey(),(new Yu).create(t)},createStar:Pd,createSymbol:mc,createText:Ac,createWrapText:Tc,cubicCalc:en,cubicLength:tn,cubicPointAt:nn,cubicSubdivide:b_,defaultArcAllocate:ob,defaultArcBackgroundRenderContribution:gp,defaultArcRenderContribution:dp,defaultArcTextureRenderContribution:pp,defaultAreaAllocate:hb,defaultBaseBackgroundRenderContribution:lu,defaultBaseClipRenderAfterContribution:Au,defaultBaseClipRenderBeforeContribution:xu,defaultBaseTextureRenderContribution:cp,defaultCircleAllocate:ub,defaultCircleBackgroundRenderContribution:yp,defaultCircleRenderContribution:mp,defaultCircleTextureRenderContribution:vp,defaultGraphicMemoryManager:xb,defaultGroupBackgroundRenderContribution:bp,defaultImageBackgroundRenderContribution:Ep,defaultImageRenderContribution:Bp,defaultLineAllocate:pb,defaultPathAllocate:fb,defaultRectAllocate:rb,defaultRectBackgroundRenderContribution:kp,defaultRectRenderContribution:wp,defaultRectTextureRenderContribution:Tp,defaultStarBackgroundRenderContribution:Up,defaultStarTextureRenderContribution:Fp,defaultSymbolAllocate:vb,defaultSymbolBackgroundRenderContribution:Lp,defaultSymbolClipRangeStrokeRenderContribution:Ip,defaultSymbolRenderContribution:Rp,defaultSymbolTextureRenderContribution:Dp,defaultTextAllocate:_b,diff:__,divideCubic:on,drawArc:Ki,drawArcPath:op,drawAreaSegments:vm,drawBackgroundImage:yu,drawImageWithLayout:Hm,drawIncrementalAreaSegments:Sm,drawIncrementalSegments:xm,drawSegments:bm,enumCommandMap:Oi,fillVisible:tp,findBestMorphingRotation:T_,findConfigIndexByCursorIdx:q_,findCursorIdxByConfigIndex:Z_,findNextGraphic:ru,flatten_simplify:function(t,e,i){return t.length<=10||i?t:function(t,e){let i,n,s=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(s=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===s&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)},foreach:nu,foreachAsync:su,genBasisSegments:xn,genBasisTypeSegments:bn,genLinearClosedSegments:Un,genLinearClosedTypeSegments:Nn,genLinearSegments:mn,genLinearTypeSegments:vn,genMonotoneXSegments:Bn,genMonotoneXTypeSegments:Mn,genMonotoneYSegments:Pn,genMonotoneYTypeSegments:En,genNumberType:va,genStepClosedSegments:Ln,genStepSegments:In,genStepTypeSegments:Dn,getApplicationState:Es,getAttributeFromDefaultAttrList:Gs,getBackgroundImage:cu,getConicGradientAt:ml,getContributionStoreState:rd,getCurrentEnv:function(){return ju()?"browser":"node"},getDefaultCharacterConfig:$_,getExtraModelMatrix:function(t,e,i){const{alpha:n,beta:s}=i.attribute;if(!n&&!s)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=vc(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Ko.allocate();return Do(o,o,[a[0],a[1],0]),s&&Oo(o,o,s),n&&Ro(o,o,n),Do(o,o,[-a[0],-a[1],0]),o},getFactoryState:Qc,getGraphicClassState:Ql,getGraphicRegistryState:Ec,getLegacyBindingContext:jg,getModelMatrix:zu,getRichTextBounds:Nd,getRuntimeInstallerBindingContext:c_,getRuntimeInstallerGlobal:d_,getRuntimeInstallerState:$y,getScaledStroke:Bo,getTextBounds:Ud,getTheme:hh,getThemeFromGroup:ch,globalTheme:lh,glyphModule:Lm,graphicCreator:Oc,graphicService:My,graphicUtil:Ty,identityMat4:Po,imageModule:Xm,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:y_,installRuntimeDrawContributionsToApp:f_,installRuntimeGraphicRenderersToApp:g_,installRuntimePickersToApp:m_,interpolateColor:nl,interpolateGradientConicalColor:ol,interpolateGradientLinearColor:rl,interpolateGradientRadialColor:al,interpolatePureColorArray:ll,interpolatePureColorArrayToStr:hl,intersect:sp,isBrowserEnv:ju,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){Nu();const t=Ps.global&&Ps.global.env;return t?"node"===t:!Uu},isSvg:ua,isXML:da,layerService:By,lineModule:Zm,lookAt:No,mapToCanvasPointForCanvas:function(t){var e;if(io(t._canvasX)&&io(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:Lo,mat4Allocate:Ko,matrixAllocate:Xo,multiplyMat4Mat3:function(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;return t[0]=_*n+b*o+x*u+S*f,t[1]=_*s+b*l+x*d+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i.c,b=i.d,x=0,S=0,t[4]=_*n+b*o+x*u+S*f,t[5]=_*s+b*l+x*d+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=0,b=0,x=1,S=0,t[8]=_*n+b*o+x*u+S*f,t[9]=_*s+b*l+x*d+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i.e,b=i.f,x=0,S=1,t[12]=_*n+b*o+x*u+S*f,t[13]=_*s+b*l+x*d+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t},multiplyMat4Mat4:Uo,newThemeObj:sh,ortho:jo,parsePadding:Us,parseStroke:Ls,parseSvgPath:Ni,pathModule:nv,pathToBezierCurves:M_,point:yn,pointEqual:Ws,pointInterpolation:Hs,pointInterpolationHighPerformance:function(t,e,i,n){const{x:s,y:r}=Rt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Rt(t.x1,t.y1,e.x1,e.y1,i);return n.x=s,n.y=r,n.x1=a,n.y1=o,n.defined=e.defined,n},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>Ws(t,e[i]))):!Number.isNaN(t.x+t.y)&&Ws(t,e))},pointsInterpolation:Vs,polygonModule:dv,preLoadAllModule:Ng,pyramid3dModule:vv,quadCalc:sn,quadLength:an,quadPointAt:rn,rafBasedSto:Xs,rect3dModule:wv,rectFillVisible:ep,rectModule:xv,rectStrokeVisible:np,recursiveCallBinarySplit:z_,refreshRuntimeInstallerContributions:u_,registerArc3dGraphic:zf,registerArcGraphic:jf,registerAreaGraphic:Wf,registerCircleGraphic:Hf,registerDirectionalLight:Dy,registerFlexLayoutPlugin:Tb,registerGlobalEventTransformer:function(t,e,i,n,s){const r=X_(0,i,n,s);t.setEventListenerTransformer(r)},registerGlyphGraphic:Vf,registerGraphic:Rc,registerGroupGraphic:Gf,registerHtmlAttributePlugin:Yg,registerImageGraphic:Yf,registerLineGraphic:Xf,registerOrthoCamera:Fy,registerPathGraphic:Kf,registerPolygonGraphic:$f,registerPyramid3dGraphic:qf,registerReactAttributePlugin:Kg,registerRect3dGraphic:Jf,registerRectGraphic:Zf,registerRichtextGraphic:Qf,registerShadowRootGraphic:tm,registerStarGraphic:em,registerSymbolGraphic:im,registerTextGraphic:nm,registerViewTransform3dPlugin:Ab,registerWindowEventTransformer:function(t,e,i,n,s){const r=X_(0,i,n,s);t.setEventListenerTransformer(r)},registerWrapTextGraphic:sm,renderCommandList:Zi,resolveBackgroundDrawMode:pu,resolveBackgroundParamsByImageSizing:zm,resolveBackgroundPosition:fu,resolveBackgroundSizing:uu,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:Nm,resolveImageRepeatMode:Um,resolveRenderableImageSize:vu,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:Ev,rotateX:Oo,rotateY:Ro,rotateZ:Io,runFill:Jd,runStroke:Qd,scaleMat4:Fo,segments:Yi,shouldClipImageByLayout:Wm,shouldUseMat4:Wu,snapLength:Qi,splitArc:R_,splitArea:L_,splitCircle:I_,splitLine:F_,splitPath:H_,splitPolygon:W_,splitRect:O_,splitToGrids:P_,starModule:Iv,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:ip,symbolModule:Uv,textAttributesToStyle:_c,textDrawOffsetX:vc,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:yc,textModule:Wv,transformMat4:zo,transformPointForCanvas:function(t,e,i,n,s){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(s,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:ky,translate:Do,verticalLayout:_a,vglobal:Vg,waitForAllSubLayers:function(t){return ga(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ps.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)}))},wrapCanvas:qa,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=Ps.global)||void 0===t?void 0:t.env,n=i?null===(e=Ps.context2dFactory)||void 0===e?void 0:e.call(Ps,i):void 0;if(!n)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return n}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===da(e)){const t=(new pa).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Aa(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Aa(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class Mb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme();n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n,s)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=s||l,o)),((t,i,s,r)=>{if(o||l)return!0;const a=i.lineWidth||s.lineWidth,h=i.pickStrokeBuffer||s.pickStrokeBuffer,c=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=c?a+h:Bo(n,a+h,n.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),n.highPerformanceRestore(),o}}class Bb extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Ca}}let Eb=!1;function Pb(t){Eb||(Eb=!0,t.bind(ry).toDynamicValue((()=>new Bb(Vv(t,Gp)))).inSingletonScope(),t.bind(Cy).toService(ry))}class Ob extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Ca}}let Rb=!1;function Ib(t){Rb||(Rb=!0,t.bind(Xv).toDynamicValue((()=>new Ob(Vv(t,Gp)))).inSingletonScope(),t.bind(Yv).toService(Xv))}function Db(){if(Db.__loaded)return;Db.__loaded=!0;const t=jg();jf(),um({bind:t.bind}),Hv?Pb(t):Ib(t)}Db.__loaded=!1;const Lb=Db;class Fb extends om{contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme();n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,n.modelMatrix!==h&&Ko.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}}class Ub extends Fb{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=wa,this.themeType="arc"}}let Nb=!1;function jb(t){var e;Nb||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Yp))&&(Nb=!0,t.bind(ay).toDynamicValue((()=>new Ub(Vv(t,Yp)))).inSingletonScope(),t.bind(Cy).toService(ay))}function zb(){if(zb.__loaded)return;zb.__loaded=!0;const t=jg();zf(),Dy(),Fy(),fm({bind:t.bind}),jb(t)}zb.__loaded=!1;const Wb=zb;class Hb extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Ta}}let Vb=!1;function Gb(t){Vb||(Vb=!0,t.bind(oy).toDynamicValue((()=>new Hb(Vv(t,Xp)))).inSingletonScope(),t.bind(Cy).toService(oy))}class Yb extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Ta}}let Xb=!1;function Kb(t){Xb||(Xb=!0,t.bind(Kv).toDynamicValue((()=>new Yb(Vv(t,Xp)))).inSingletonScope(),t.bind(Yv).toService(Kv))}function $b(){if($b.__loaded)return;$b.__loaded=!0;const t=jg();Wf(),Mm({bind:t.bind}),Hv?Gb(t):Kb(t)}$b.__loaded=!1;const qb=$b;class Zb{constructor(){this.type="glyph",this.numberType=Ma}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{if(n)return;const r=s.pickItem(t,e,null,i);n=!(!r||!r.graphic)})),n}return!1}}class Jb extends Zb{constructor(t){super(),this.canvasRenderer=t}}let Qb=!1;function tx(t){Qb||(Qb=!0,t.bind(xy).toDynamicValue((()=>new Jb(Vv(t,ag)))).inSingletonScope(),t.bind(Cy).toService(xy))}class ex extends Zb{constructor(t){super(),this.canvasRenderer=t}}let ix=!1;function nx(t){ix||(ix=!0,t.bind(ny).toDynamicValue((()=>new ex(Vv(t,ag)))).inSingletonScope(),t.bind(Yv).toService(ny))}function sx(){if(sx.__loaded)return;sx.__loaded=!0;const t=jg();Vf(),Lm({bind:t.bind}),Hv?tx(t):nx(t)}sx.__loaded=!1;const rx=sx;function ax(){ax.__loaded||(ax.__loaded=!0,Gf())}ax.__loaded=!1;const ox=ax;class lx extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Ea}}let hx=!1;function cx(t){hx||(hx=!0,t.bind(hy).toDynamicValue((()=>new lx(Vv(t,og)))).inSingletonScope(),t.bind(Cy).toService(hy))}class ux{constructor(){this.type="image",this.numberType=Ea}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}}let dx=!1;function px(t){dx||(dx=!0,t.bind(qv).toDynamicValue((()=>new ux)).inSingletonScope(),t.bind(Yv).toService(qv))}function gx(){if(gx.__loaded)return;gx.__loaded=!0;const t=jg();Yf(),Xm({bind:t.bind}),Hv?cx(t):px(t)}gx.__loaded=!1;const fx=gx;class mx extends om{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=t.getGraphicTheme(),r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?s+r:Bo(n,s+r,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Ko.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}}class vx extends mx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Pa}}let yx=!1;function _x(t){yx||(yx=!0,t.bind(uy).toDynamicValue((()=>new vx(Vv(t,Zp)))).inSingletonScope(),t.bind(Cy).toService(uy))}class bx extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Pa}}let xx=!1;function Sx(t){xx||(xx=!0,t.bind(Zv).toDynamicValue((()=>new bx(Vv(t,Zp)))).inSingletonScope(),t.bind(Yv).toService(Zv))}function Ax(){if(Ax.__loaded)return;Ax.__loaded=!0;const t=jg();Xf(),Zm({bind:t.bind}),Hv?_x(t):Sx(t)}Ax.__loaded=!1;const Cx=Ax;class Tx extends mx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Oa}}let kx=!1;function Mx(t){kx||(kx=!0,t.bind(py).toDynamicValue((()=>new Tx(Vv(t,Jp)))).inSingletonScope(),t.bind(Cy).toService(py))}class Bx extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Oa}}let Ex=!1;function Px(t){Ex||(Ex=!0,t.bind(Jv).toDynamicValue((()=>new Bx(Vv(t,Jp)))).inSingletonScope(),t.bind(Yv).toService(Jv))}function Ox(){if(Ox.__loaded)return;Ox.__loaded=!0;const t=jg();Kf(),nv({bind:t.bind}),Hv?Mx(t):Px(t)}Ox.__loaded=!1;const Rx=Ox;class Ix extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ra}}let Dx=!1;function Lx(t){Dx||(Dx=!0,t.bind(yy).toDynamicValue((()=>new Ix(Vv(t,Qp)))).inSingletonScope(),t.bind(Cy).toService(yy))}class Fx extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ra}}let Ux=!1;function Nx(t){Ux||(Ux=!0,t.bind(iy).toDynamicValue((()=>new Fx(Vv(t,Qp)))).inSingletonScope(),t.bind(Yv).toService(iy))}function jx(){if(jx.__loaded)return;jx.__loaded=!0;const t=jg();$f(),dv({bind:t.bind}),Hv?Lx(t):Nx(t)}jx.__loaded=!1;const zx=jx;class Wx extends Fb{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=Ia,this.themeType="polygon"}}let Hx=!1;function Vx(t){var e;Hx||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rg))&&(Hx=!0,t.bind(_y).toDynamicValue((()=>new Wx(Vv(t,rg)))).inSingletonScope(),t.bind(Cy).toService(_y))}function Gx(){if(Gx.__loaded)return;Gx.__loaded=!0;const t=jg();qf(),Dy(),Fy(),vv({bind:t.bind}),Vx(t)}Gx.__loaded=!1;const Yx=Gx,Xx=new ue;class Kx{constructor(){this.type="rect",this.numberType=Da}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getGraphicTheme(),{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth,a=i.pickStrokeBuffer||s.pickStrokeBuffer,o=i.keepStrokeScale||s.keepStrokeScale;return n.lineWidth=o?r+a:Bo(n,r+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;Xx.setValue(i.x1,i.y1,i.x2,i.y2),Xx.expand(-r/2),h=!Xx.containsPoint(e)}}return n.highPerformanceRestore(),h}}class $x extends Kx{constructor(t){super(),this.canvasRenderer=t}}let qx=!1;function Zx(t){qx||(qx=!0,t.bind(gy).toDynamicValue((()=>new $x(Vv(t,tg)))).inSingletonScope(),t.bind(Cy).toService(gy))}class Jx extends Kx{constructor(t){super(),this.canvasRenderer=t}}let Qx=!1;function tS(t){Qx||(Qx=!0,t.bind(Qv).toDynamicValue((()=>new Jx(Vv(t,tg)))).inSingletonScope(),t.bind(Yv).toService(Qv))}function eS(){if(eS.__loaded)return;eS.__loaded=!0;const t=jg();Zf(),xv({bind:t.bind}),Hv?Zx(t):tS(t)}eS.__loaded=!1;const iS=eS;class nS extends Fb{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=La,this.themeType="rect"}}let sS=!1;function rS(t){var e;sS||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,eg))&&(sS=!0,t.bind(fy).toDynamicValue((()=>new nS(Vv(t,eg)))).inSingletonScope(),t.bind(Cy).toService(fy))}function aS(){if(aS.__loaded)return;aS.__loaded=!0;const t=jg();Jf(),wv({bind:t.bind}),rS(t)}aS.__loaded=!1;const oS=aS;class lS{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Fa}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let hS=!1;function cS(t){hS||(hS=!0,t.bind(by).toDynamicValue((()=>new lS(Vv(t,sg)))).inSingletonScope(),t.bind(Cy).toService(by))}class uS{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Fa}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let dS=!1;function pS(t){dS||(dS=!0,t.bind(sy).toDynamicValue((()=>new uS(Vv(t,sg)))).inSingletonScope(),t.bind(Yv).toService(sy))}function gS(){if(gS.__loaded)return;gS.__loaded=!0;const t=jg();Qf(),Ev({bind:t.bind}),Hv?cS(t):pS(t)}gS.__loaded=!1;const fS=gS;function mS(){mS.__loaded||(mS.__loaded=!0,tm())}mS.__loaded=!1;const vS=mS;class yS extends Fb{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Na}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.getParsedPath();if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(s.isSvg||"imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,n),{x:o,y:l,z:h,lastModelMatrix:c}=a;let u=e;if(n.camera){u=e.clone();const i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,n,o,l,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?s+r:Bo(n,s+r,n.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==c&&Ko.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),d}}let _S=!1;function bS(t){_S||(_S=!0,t.bind(my).toDynamicValue((()=>new yS(Vv(t,ig)))).inSingletonScope(),t.bind(Cy).toService(my))}class xS extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Na}}let SS=!1;function AS(t){SS||(SS=!0,t.bind(ty).toDynamicValue((()=>new xS(Vv(t,ig)))).inSingletonScope(),t.bind(Yv).toService(ty))}function CS(){if(CS.__loaded)return;CS.__loaded=!0;const t=jg();im(),Uv({bind:t.bind}),Hv?bS(t):AS(t)}CS.__loaded=!1;const wS=CS;class TS extends Fb{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=ja}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,d=l.height(),f=l.width(),m=yc(a,d,s),v=vc(o,f);return e.rect(v+h,m+c,f,d,u),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==d&&Ko.free(n.modelMatrix),n.modelMatrix=d,n.highPerformanceRestore(),g}}let kS=!1;function MS(t){kS||(kS=!0,t.bind(vy).toDynamicValue((()=>new TS(Vv(t,ng)))).inSingletonScope(),t.bind(Cy).toService(vy))}class BS{constructor(){this.type="text",this.numberType=ja}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let ES=!1;function PS(t){ES||(ES=!0,t.bind(ey).toDynamicValue((()=>new BS)).inSingletonScope(),t.bind(Yv).toService(ey))}function OS(){if(OS.__loaded)return;OS.__loaded=!0;const t=jg();nm(),Wv({bind:t.bind}),Hv?MS(t):PS(t)}OS.__loaded=!1;const RS=OS;function IS(t){const e=[];for(let i=0;int.getInstance().info(`[VChart log]: ${t}`,...e),LS=(t,e)=>(u(US.warnHandler)&&US.warnHandler.call(null,t,e),e?nt.getInstance().warn(`[VChart warn]: ${t}`,e):nt.getInstance().warn(`[VChart warn]: ${t}`)),FS=(t,e,i)=>{if(!u(US.errorHandler))throw new Error(t);US.errorHandler.call(null,t,e)},US={silent:!1,warnHandler:!1,errorHandler:!1},NS=ju(),jS=NS&&globalThis?globalThis.document:void 0;function zS(t){return("desktop-browser"===t||"mobile-browser"===t)&&NS}function WS(t){return HS(t)||"mobile-browser"===t}function HS(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let VS=0;function GS(){return VS>=9999999&&(VS=0),VS++}function YS(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function XS(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}function KS(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&KS(t,e)}))}const $S=t=>!d(t)&&!1!==t.visible;const qS=["#ffffff","#000000"];function ZS(t,e,i,n,s,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new we(t).toHex(),o=new we(e).toHex();return JS(a,o,i,n,r)?a:function(t,e,i,n,s,r){const a=[];s&&(s instanceof Array?a.push(...s):a.push(s)),a.push(...qS);for(const s of a)if(t!==s&&JS(s,e,i,n,r))return s}(a,o,i,n,s,r)}function JS(t,e,i,n,s){if("lightness"===s){const i=we.getColorBrightness(new we(e));return we.getColorBrightness(new we(t))<.5?i>=.5:i<.5}return n?QS(t,e)>n:"largeText"===i?QS(t,e)>3:QS(t,e)>4.5}function QS(t,e){const i=tA(t),n=tA(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function tA(t){const e=ke(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function eA(t,e,i,n){let s;switch(t){case"base":s=e;break;case"invertBase":s=i;break;case"similarBase":s=n}return s}function iA(t){let e=function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}function nA(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=It(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const sA=Ic,rA={arc:t=>sA("arc",t),circle:t=>sA("circle",t),group:t=>sA("group",t),image:t=>sA("image",t),line:t=>sA("line",t),path:t=>sA("path",t),polygon:t=>sA("polygon",t),rect:t=>sA("rect",t),richtext:t=>sA("richtext",t),symbol:t=>sA("symbol",t),text:t=>sA("text",t)},aA=-.5*Math.PI,oA=1.5*Math.PI,lA="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 hA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(hA||(hA={}));const cA={[hA.selectedReverse]:{},[hA.selected]:{},[hA.hover]:{},[hA.hoverReverse]:{}},uA={container:"",width:30,height:30,style:{}},dA=(t,e,i,n)=>new re(Object.assign({defaultFontParams:Object.assign({fontFamily:lA,fontSize:14},n),getTextBounds:i?void 0:Ud,specialCharSet:"-/: .,@%'\"~"+re.ALPHABET_CHAR_SET+re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function pA(t,e,i={}){if(!t)return{width:0,height:0};const n=Ud({text:t,fontFamily:e.fontFamily||i.fontFamily||lA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:n.width(),height:n.height()}}function gA(t,e="type"){var i,n;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(n=t[e])&&void 0!==n?n:"text"}function fA(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function mA(t,e="type"){const i=gA(t,e);return"rich"===i?rA.richtext(fA(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.html=n,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:n}=e;return t.react=n,t.text=i,t.renderable=!1,t}(t)),rA.text(t))}function vA(t,e,i,n,s){"right"===t?"center"===i?e.setAttribute("x",n-s/2):"right"===i||"end"===i?e.setAttribute("x",n):e.setAttribute("x",n-s):"center"===i?e.setAttribute("x",n+s/2):"right"===i||"end"===i?e.setAttribute("x",n+s):e.setAttribute("x",n)}const yA={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},_A={size:8,stroke:"#000",lineWidth:1,zIndex:1};function bA(t,e){var i,n;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(n=e.OBBBounds)||void 0===n?void 0:n.empty())?$t(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||ee(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const xA=Math.sin(Math.PI/10);function SA(t,e=xA){const i=!d(t)&&0!==t,n=i?Math.cos(t):1;return i&&Math.abs(n)<=e}function AA(t,e=xA){const i=!d(t)&&0!==t,n=i?Math.sin(t):0;return!i||Math.abs(n)<=e}function CA(t){const e={};return KS(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function wA(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function TA(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 kA(t,e,i){var n;if(AA(null===(n=t.attribute)||void 0===n?void 0:n.angle,Number.EPSILON))return i>oe(t.AABBBounds,e.AABBBounds);const s=t.OBBBounds,r=e.OBBBounds;return!s||!r||s.empty()||r.empty()?i>oe(t.AABBBounds,e.AABBBounds):s.intersects(r)||i>le(s,r)}function MA(t,e){for(let i,n=1,s=t.length,r=t[0];n{const n=e?+i[e]:+i;return A(n)&&(t+=n),t}),0)}function EA(t,e){const i=PA(t),n=PA(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function PA(t,e={x:0,y:0}){return Ut.distancePP(t,e)}function OA(t,e,i){let n=!1;if(e&&u(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function RA(t){return function(e){let i;return i=_(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function IA(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&IA(t[i],e)}}var DA;!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"}(DA||(DA={}));const LA={};function FA(t){switch(t){case DA.Linear:case DA.Log:case DA.Pow:case DA.Sqrt:case DA.Symlog:case DA.Time:return!0;default:return!1}}function UA(t){return!!LA[t]}function NA(t){switch(t){case DA.Ordinal:case DA.Point:case DA.Band:return!0;default:return!1}}function jA(t){return t}Object.values(DA).forEach((t=>{LA[t]=!0}));const zA=t=>-Math.log(-t),WA=t=>-Math.exp(-t),HA=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,VA=t=>10===t?HA:t===Math.E?Math.exp:e=>Math.pow(t,e),GA=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),YA=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),XA=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function KA(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 $A(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function qA(t,e,i){let n;return n=1===t?t+2*i:t-e+2*i,t?n>0?n:1:0}function ZA(t,e,i,n){return 1===i&&(i=0),qA(t,i,n)*(e/(1-i))}function JA(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),n=t[0]-i*e[0];return[n,i+n]}function QA(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let s;return s=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,s*Math.pow(10,i)};class 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=JA(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:n}=this._fishEyeOptions,s=this.range(),r=s[0],a=s[s.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ut(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(n)?(l-o)*i:n;let u=Math.exp(e);u=u/(u-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const iC=Symbol("implicit");class nC 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=DA.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iC}clone(){const t=(new nC).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let n=this._index.get(e);if(!n){if(this._unknown!==iC)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}const s=this._ordinalRange[(n-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(s):s}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return sC(t,e,r,s)}class aC extends nC{constructor(t){super(),this.type=DA.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),n=super.domain().length,s=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=ZA(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),n=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const s=this._rangeFactorStart+n<=1,r=this._rangeFactorEnd-n>=0;if("rangeFactorStart"===e&&s?this._rangeFactorEnd=this._rangeFactorStart+n:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-n:t[0]<=t[1]?s?this._rangeFactorEnd=this._rangeFactorStart+n:r?this._rangeFactorStart=this._rangeFactorEnd-n:(this._rangeFactorStart=0,this._rangeFactorEnd=n):r?this._rangeFactorStart=this._rangeFactorEnd-n:s?this._rangeFactorEnd=this._rangeFactorStart+n:(this._rangeFactorStart=1-n,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,n=e+i;this._wholeRange=[e,n]}else{const e=t[1]+i*(1-this._rangeFactorEnd),n=e-i;this._wholeRange=[n,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=n,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[J(t[0]),J(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[J(t[0]),J(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:rC(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return rC(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n;if(i=pt(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,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new aC(!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:oC}=Me;function lC(t,e){const i=typeof e;let n;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return vt(t,e);if("string"===i){if(n=we.parseColorString(e)){const e=oC(we.parseColorString(t),n);return t=>e(t).formatRgb()}return vt(Number(t),Number(e))}return e instanceof Te?oC(t,e):e instanceof we?oC(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):vt(Number(t),Number(e))}class hC extends eC{constructor(t=jA,e=jA){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=jA,this._piecewise=$A,this._interpolate=lC}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),vt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const n=Array.from(t,J);return this._domain=n,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=yt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,n=i.length,s=this._range.length;let r=Math.min(n,s);if(n&&n=2?(e-i[n-2])/t:0;for(let s=1;s<=t;s++)i[n-2+s]=e-a*(t-s);r=s}return this._autoClamp&&(this._clamp=pt(i[0],i[r-1])),this._piecewise=r>2?QA:$A,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:jA),this.rescale(i)):this._clamp!==jA}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const cC=Math.sqrt(50),uC=Math.sqrt(10),dC=Math.sqrt(2),pC=[1,2,5,10],gC=(t,e,i)=>{let n=1,s=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?s=0:t<0&&t>=-Number.MIN_VALUE?s=-(e-1):!i&&a<1?n=yC(a).step:(i||a>1)&&(s=Math.floor(t)-r*n),n>0?(t>0?s=Math.max(s,0):t<0&&(s=Math.min(s,-(e-1)*n)),function(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ns+t*n))):t>0?mC(0,-(e-1)/n,n):mC((e-1)/n,0,n)},fC=ct(((t,e,i,n)=>{let s,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((s=e0){let i=Math.round(t/o),n=Math.round(e/o);for(i*oe&&--n,a=new Array(r=n-i+1);++le&&--n,a=new Array(r=n-i+1);++l{let n,s,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,s=new Array(n=o-a+1);++re&&--o,s=new Array(n=o-a+1);++r{let s,r,a;if(i=+i,(t=+t)==(e=+e))return gC(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return gC(t,i,null==n?void 0:n.noDecimals);(s=e0){let n=1;const{power:s,gap:a}=o,h=10===a?2*10**s:1*10**s;for(;n<=5&&(r=mC(t,e,l),r.length>i+1)&&i>2;)l+=h,n+=1;i>2&&r.length{let n;const s=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(n=a;n>=1;n--)e.push(s-n*i);return e.concat(t)}if(s>=0){for(n=1;n<=a;n++)t.push(r+n*i);return t}let o=[];const l=[];for(n=1;n<=a;n++)n%2==0?o=[s-Math.floor(n/2)*i].concat(o):l.push(r+Math.ceil(n/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==n?void 0:n.noDecimals)&&l<0&&(l=1),r=mC(t,e,l);return s&&r.reverse(),r})),yC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=pC[0];return i>=cC?n=pC[3]:i>=uC?n=pC[2]:i>=dC&&(n=pC[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function _C(t,e,i){const n=(e-t)/Math.max(0,i);return yC(n)}function bC(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e0;){if(n=_C(a,o,e).step,n===i)return t[s]=a,t[r]=o,t;if(n>0)a=Math.floor(a/n)*n,o=Math.ceil(o/n)*n;else{if(!(n<0))break;a=Math.ceil(a*n)/n,o=Math.floor(o*n)/n}i=n}}function SC(t,e){const i=S(e.forceMin),n=S(e.forceMax);let s=null;const r=[];let a=null;const o=i&&n?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:n?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const AC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CC=ct(((t,e,i,n,s,r,a)=>{let o=t,l=e;const h=l0){for(;d<=p;++d)for(c=1;cl)break;g.push(u)}}else for(;d<=p;++d)for(c=n-1;c>=1;--c)if(u=d>0?c/r(-d):c*r(d),!(ul)break;g.push(u)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),wC=ct(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=vC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?AC(t,e,s):AC(t,e,tC(s)),h=AC(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),TC=ct(((t,e,i,n,s)=>bC(n(t),n(e),i).map((t=>tC(s(t))))));class kC extends hC{constructor(){super(...arguments),this.type=DA.Linear}clone(){var t;const e=new kC;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return fC(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(u(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=vC(s[0],s[s.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=n.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return bC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let n,s,r=-1;if(i=+i,(s=(e=+e)<(t=+t))&&(n=t,t=e,e=n),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(s=o[1])&&void 0!==s?s:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function BC(t){return e=>-t(-e)}function EC(t=Number.EPSILON){return e=>Math.max(e,t)}class PC extends hC{constructor(){super(GA(10),VA(10)),this.type=DA.Log,this._limit=EC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new PC).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=GA(this._base),n=VA(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=BC(i),this._pows=BC(n),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=zA,this.untransformer=WA):(this._logs=i,this._pows=n,this._limit=EC(),this.transformer=this._logs,this.untransformer=n),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return jA}d3Ticks(t=10,e){const i=this.domain(),n=this._limit(i[0]),s=this._limit(i[i.length-1]);return CC(n,s,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return wC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}V(PC,MC);class OC extends kC{constructor(){super(YA(1),XA(1)),this.type=DA.Symlog,this._const=1}clone(){return(new OC).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=YA(t),this.untransformer=XA(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),n=i[0],s=i[i.length-1];return CC(n,s,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return wC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}V(OC,MC);class RC{constructor(){this.type=DA.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!d(t)&&A(+t)?this._range[st(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new RC).domain(this._domain).range(this._range).unknown(this._unknown)}}var IC,DC,LC;function FC(t){var e,i;const{type:n}=t;return n===DC.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(IC||(IC={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(DC||(DC={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(LC||(LC={}));const UC={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},NC={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function jC(t,e){var i;if(!t)return[];const n=XC(t,e);if(!n||_(n))return null!==(i=n)&&void 0!==i?i:[];if(g(n)){const{dataScheme:i}=n;return i?GC(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>VC(i)?WC(t,i,e):i)).filter(p)}))):i.map((i=>VC(i)?WC(t,i,e):i)).filter(p):[]}return[]}function zC(t,e){var i,n;return GC(t)?null!==(n=null===(i=t.find((t=>p(t.isAvailable)?u(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function WC(t,e,i){var n;const s=XC(t,i);if(!s)return;let r;const{palette:a}=s;if(g(a)&&(r=null!==(n=function(t,e){const i=UC[e];if(i&&t[i])return t[i];if(t[e])return t[e];const n=NC[e];return n?t[n]:void 0}(a,e.key))&&void 0!==n?n:e.default),!r)return;if(d(e.a)&&d(e.l)||!y(r))return r;let o=new we(r);if(p(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=me(t,i,n),a=fe(s,r,e.l),l=new we(`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 HC=(t,e)=>{if(e&&VC(t)){const i=WC(e,t);if(i)return i}return t};function VC(t){return t&&"palette"===t.type&&!!t.key}function GC(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function YC(t){return _(t)?{dataScheme:t}:t}function XC(t,e){var i,n;const{type:s}=null!=e?e:{};let r;if(!e||d(s))r=null==t?void 0:t.default;else{const a=FC(e);r=null!==(n=null!==(i=null==t?void 0:t[`${s}_${a}`])&&void 0!==i?i:null==t?void 0:t[s])&&void 0!==n?n:null==t?void 0:t.default}return r}class KC extends nC{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!GC(this._range))return void super.range(this._range);const t=zC(this._range,this._domain);super.range(t)}}const $C={linear:kC,band:aC,point:class extends aC{constructor(t){super(!1),this.type=DA.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:nC,threshold:RC,colorOrdinal:KC};function qC(t){const e=$C[t];return e?new e:null}function ZC(t,e,i){if(!e)return t;const n=e.range(),s=i&&e._calculateWholeRange?e._calculateWholeRange(n):e.range(),r=Math.min(s[0],s[s.length-1]),a=Math.max(s[0],s[s.length-1]);return Math.min(Math.max(r,t),a)}function JC(t,e,i){if(!e)return!0;const n=e.range(),s=(i&&e._calculateWholeRange?e._calculateWholeRange(n):e.range()).map((t=>e.invert(t))),r=Math.min(s[0],s[s.length-1]),a=Math.max(s[0],s[s.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function QC(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function tw(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ew(t){return!!y(t)&&(!!t.endsWith("%")&&YS(t.substring(0,t.length-1)))}function iw(t){return!!g(t)&&("percent"in t||"offset"in t)}function nw(t,e,i,n=0){var s,r;return S(t)?t:ew(t)?Number(t.substring(0,t.length-1))*e/100:u(t)?t(i):g(t)?e*(null!==(s=t.percent)&&void 0!==s?s:0)+(null!==(r=t.offset)&&void 0!==r?r:0):n}function sw(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(n=t.top)&&void 0!==n?n:0,o.right=null!==(s=t.right)&&void 0!==s?s:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((n=>{o[n]=nw(t[n],e.size,i)}))})),o}function rw(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function aw(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):S(t)||ew(t)||u(t)||iw(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function ow(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const lw=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i},hw=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function cw(t,e){return t&&e.key in t?t[e.key]:e.default}function uw(t){return t&&"token"===t.type&&!!t.key}const dw={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%"},pw={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:hw,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:dw,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},gw={name:"dark",colorScheme:{default:{dataScheme:hw,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},fw=(t,e,i)=>{if(d(e))return t;const n=e[0];return d(n)?t:1===e.length?(t[n]=i,t):(d(t[n])&&("number"==typeof e[1]?t[n]=[]:t[n]={}),fw(t[n],e.slice(1),i))};function mw(t,...e){let i=-1;const n=e.length;for(;++i{const n=t[i];return e[i]=YC(n),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}xw._charts=bw.charts,xw._series=bw.series,xw._components=bw.components,xw._graphicComponents=bw.graphicComponents,xw._marks=bw.marks,xw._regions=bw.regions,xw._animations=bw.animations,xw._implements=bw.implements,xw._chartPlugin=bw.chartPlugin,xw._vChartPlugin=bw.vChartPlugin,xw._componentPlugin=bw.componentPlugin,xw.transforms=bw.transforms,xw.dataParser=bw.dataParser,xw._layout=bw.layout,xw._grammarTransforms=bw.grammarTransforms,xw._stageEventPlugins=bw.stageEventPlugins,xw.registerStageEventPlugin=(t,e)=>{xw._stageEventPlugins[t]=e},xw.getStageEventPlugin=t=>xw._stageEventPlugins[t],xw._interactionTriggers=bw.interactionTriggers,xw.registerInteractionTrigger=(t,e)=>{xw._interactionTriggers[t]=e},xw._composedEventMap=bw.composedEventMap,xw.registerComposedEvent=(t,e)=>{xw._composedEventMap[t]=e},xw._tooltipProcessors=bw.tooltipProcessors,xw.registerTooltipProcessor=(t,e)=>{xw._tooltipProcessors[t]=e},xw.createTooltipProcessor=(t,e)=>{const i=xw._tooltipProcessors[t];return i?new i(e):null},xw._runtimePluginInstallers=bw.runtimePluginInstallers,xw.registerRuntimePluginInstaller=(t,e)=>{xw._runtimePluginInstallers[t]=e},xw.getRuntimePluginInstaller=t=>xw._runtimePluginInstallers[t];const Cw=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}},conversionArrow:{line:{style:{stroke:"black"}},symbol:{style:{fill:"black"}},text:{style:{fontSize:12,fill:"#606773"}}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e};Cw();const ww={[pw.name]:pw},Tw=pw.name,kw=new Map(Object.keys(ww).map((t=>[t,ww[t]]))),Mw=new Map,Bw=new Map(Object.keys(ww).map((t=>[t,t===Tw]))),Ew=(t,e)=>{if(!t)return;const i=Iw(e);kw.set(t,i),Bw.set(t,!0)},Pw=(t=Tw)=>(Bw.has(t)&&!Bw.get(t)&&Ew(t,kw.get(t)),kw.get(t)),Ow=t=>kw.delete(t)&&Mw.delete(t)&&Bw.delete(t),Rw=t=>!!y(t)&&kw.has(t),Iw=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:Tw;return Sw({},Pw(i),t)};class Dw{static registerInstance(t){Dw.instances.set(t.id,t)}static unregisterInstance(t){Dw.instances.delete(t.id)}static getInstance(t){return Dw.instances.get(t)}static instanceExist(t){return Dw.instances.has(t)}static forEach(t,e=[],i){const n=G(e);return Dw.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}Dw.instances=new Map;class Lw{static registerTheme(t,e){Ew(t,e)}static getTheme(t,e=!1){return Pw(t)}static removeTheme(t){return Ow(t)}static themeExist(t){return Rw(t)}static getDefaultTheme(){return Lw.themes.get(Tw)}static setCurrentTheme(t){Lw.themeExist(t)&&(Lw._currentThemeName=t,Dw.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return Lw.getTheme(Lw._currentThemeName,t)}static getCurrentThemeName(){return Lw._currentThemeName}}function Fw(t){return y(t)?Lw.themeExist(t)?Lw.getTheme(t):{}:g(t)?t:{}}Lw.themes=kw,Lw._currentThemeName=Tw;const Uw=["animationThreshold","colorScheme","name","padding"];function Nw(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((s=>{const r=t[s];Uw.includes(s)?n[s]=r:m(r)?VC(r)?n[s]=HC(r,e):uw(r)?n[s]=cw(i,r):n[s]=Nw(r,e,i):n[s]=r})),n}function jw(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=jw(t[n],e)}return i}return _(t)?t.map((t=>jw(t,e))):t}function zw(t,e){var i;if(!t)return t;if(y(t))return null!==(i=e.getFunction(t))&&void 0!==i?i:t;if(m(t)){const i={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=zw(t[n],e));return i}return _(t)?t.map((t=>zw(t,e))):t}function Ww(t,...e){return u(t)?t(...e):t}const Hw=(t,e,i,n)=>((t,e,i)=>dA(t,e,i,{fontFamily:dw.fontFamily,fontSize:dw.fontSize}))(e,i,n).measure(t),Vw="__VCHART",Gw=500,Yw=500,Xw=`${Vw}_MEASURE_CANVAS_ID`,Kw=`${Vw}_DEFAULT_DATA_INDEX`,$w=`${Vw}_DEFAULT_DATA_KEY`,qw=`${Vw}_DEFAULT_DATA_SERIES_FIELD`,Zw=`${Vw}_DEFAULT_SERIES_STYLE_NAME`,Jw=`${Vw}_STACK_KEY`,Qw=`${Vw}_STACK_START`,tT=`${Vw}_STACK_END`,eT=`${Vw}_STACK_START_PERCENT`,iT=`${Vw}_STACK_END_PERCENT`,nT=`${Vw}_STACK_START_OffsetSilhouette`,sT=`${Vw}_STACK_END_OffsetSilhouette`,rT=`${Vw}_STACK_TOTAL`,aT=`${Vw}_STACK_TOTAL_PERCENT`,oT=`${Vw}_STACK_TOTAL_TOP`,lT=`${Vw}_STACK_TOTAL_BOTTOM`,hT=`${Vw}_MOSAIC_VALUE_START_PERCENT`,cT=`${Vw}_MOSAIC_VALUE_END_PERCENT`,uT=`${Vw}_MOSAIC_CAT_START_PERCENT`,dT=`${Vw}_MOSAIC_CAT_END_PERCENT`,pT=`${Vw}_SEGMENT_START`,gT=`${Vw}_SEGMENT_END`,fT=`${Vw}_KEY`,mT=`${Vw}_MAP_LOOK_UP_KEY`;function vT(t,e){for(let i=0;it.key===e))}function _T(t,e){var i;if(!t)return null!=e?e:null;const n=t.getFields();return n&&n[e]?null!==(i=n[e].alias)&&void 0!==i?i:e:null!=e?e:null}function bT(t,e,i){const n=t.getStackSort(),s={};let r=null;return n&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var n;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(s[o]=null!==(n=s[o])&&void 0!==n?n:{groupField:a.groupField,nodes:{}},wT(t,a,s[o],l,e,r))})),n?xT(s):s}function xT(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))):xT(t[e].nodes);return t}function ST(t,e){if("values"in t&&t.values.length){const i=BA(t.values,e),n=function(t,e){const i=[];return t.forEach((t=>{const n=+t[e];A(n)&&i.push(n)})),0===i.length?null:X(i)}(t.values,iT);t.values.forEach((t=>{t[rT]=i,t[aT]=n}))}else for(const i in t.nodes)ST(t.nodes[i],e)}function AT(t){if(!t.values.length)return;const e=t.values[t.values.length-1][tT]/2;for(let i=0;i0){let n=0,o=0,l=1,h=0,c=null,u=null;const d=t.values.length;for(let i=0;i=0?(l[s.start]=n,n+=l[s.end],l[s.end]=n):(l[s.start]=o,o+=l[s.end],l[s.end]=o),l[s.key]=t.key,a&&(delete l[s.max],(!u||l[s.end]>u[s.end])&&(u=l)),r&&(delete l[s.min],(!c||l[s.start]=0?n:o;l=h>=0?1:-1,r[s.startPercent]=0===a?0:Math.min(1,r[s.start]/a)*l,r[s.endPercent]=0===a?0:Math.min(1,r[s.end]/a)*l}}for(const r in t.nodes)CT(t.nodes[r],e,i,n,s)}function wT(t,e,i,n,s,r,a){var o;if("values"in e)if(s&&e.values.forEach((t=>t[tT]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[n]))),i.series.push({s:t,values:e.values}),r){const n=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:n?r[n].sort[e[n]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),wT(t,e.nodes[l],i.nodes[l],n,s,r,h)}}function TT(t){return!u(t)&&!E(t)&&Object.keys(t).some((e=>u(t[e])))}function kT(t,e,i,n,s){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(u(t))return ET(t(r,i,n,s));if(TT(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{u(e[t])&&(e[t]=e[t](r,i,n,s))})),ET(e)}return ET(t)}function MT(t={}){const e=Object.assign({},t);if(u(t.style)||TT(t.style)?e.style=(e,i,n,s)=>kT(t.style,e,i,n,s):E(t.style)||(e.style=ET(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{u(t.state[e])||TT(t.state[e])?i[e]=(i,n,s,r)=>kT(t.state[e],i,n,s,r):E(t.state[e])||(i[e]=ET(t.state[e]))})),e.state=i}return e}function BT(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,n,s,r)=>ET(t[i](e,n,s,r)):E(t[i])||(e[i]=ET(t[i]))})),e}function ET(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:Nt(t.angle)}):t}const PT=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},OT=t=>"line"===t||"area"===t,RT=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return OT(i)?e:null==e?void 0:e[0]},IT=(t,e)=>{const i=t.getAttributes(!0),n={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(n[t]=e[t])})),n};let DT=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},s=xw.getComposedEvent(t);if(s){const e=new s(this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(n.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,n),this._addEventHandler(t,n);return this}off(t,e,i){var n,s,r;const a=null!=i?i:e;if(xw.getComposedEvent(t))if(a)null===(n=this._composedEventMap.get(a))||void 0===n||n.event.unregister(),this._composedEventMap.delete(a);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(s=this._composedEventMap.get(e[0]))||void 0===s||s.event.unregister(),this._composedEventMap.delete(e[0]));else if(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var LT;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(LT||(LT={}));const FT=["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 UT,NT,jT;t.ChartEvent=void 0,(UT=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",UT.rendered="rendered",UT.renderFinished="renderFinished",UT.animationFinished="animationFinished",UT.regionSeriesDataFilterOver="regionSeriesDataFilterOver",UT.afterInitData="afterInitData",UT.afterInitEvent="afterInitEvent",UT.afterInitMark="afterInitMark",UT.rawDataUpdate="rawDataUpdate",UT.viewDataFilterOver="viewDataFilterOver",UT.viewDataUpdate="viewDataUpdate",UT.viewDataStatisticsUpdate="viewDataStatisticsUpdate",UT.markDeltaYUpdate="markDeltaYUpdate",UT.viewDataLabelUpdate="viewDataLabelUpdate",UT.scaleDomainUpdate="scaleDomainUpdate",UT.scaleRawDomainUpdate="scaleRawDomainUpdate",UT.scaleUpdate="scaleUpdate",UT.dataZoomChange="dataZoomChange",UT.drill="drill",UT.layoutStart="layoutStart",UT.layoutEnd="layoutEnd",UT.layoutRectUpdate="layoutRectUpdate",UT.playerPlay="playerPlay",UT.playerPause="playerPause",UT.playerEnd="playerEnd",UT.playerChange="playerChange",UT.playerForward="playerForward",UT.playerBackward="playerBackward",UT.scrollBarChange="scrollBarChange",UT.brushStart="brushStart",UT.brushChange="brushChange",UT.brushEnd="brushEnd",UT.brushClear="brushClear",UT.brushActive="brushActive",UT.legendSelectedDataChange="legendSelectedDataChange",UT.legendFilter="legendFilter",UT.legendItemClick="legendItemClick",UT.legendItemHover="legendItemHover",UT.legendItemUnHover="legendItemUnHover",UT.tooltipShow="tooltipShow",UT.tooltipHide="tooltipHide",UT.tooltipRelease="tooltipRelease",UT.afterResize="afterResize",UT.afterRender="afterRender",UT.afterLayout="afterLayout",UT.afterMarkLayoutEnd="afterMarkLayoutEnd",UT.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(NT||(NT={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(jT||(jT={}));const zT=[jT.mark,jT.model,jT.chart,jT.vchart];class WT{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(jT.vchart,[]),this._levelNodes.set(jT.chart,[]),this._levelNodes.set(jT.model,[]),this._levelNodes.set(jT.mark,[])}addHandler(t,e){var i;const n={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(n),this._map.set(t.callback,n),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),n=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&(null==i||i.splice(n,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const HT={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class VT{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),n=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;n&&"component"===n.modelType&&(a=null!==(e=n.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:n,mark:null!=s?s:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let n=null;i.graphics&&(n=i.graphics);const s={event:t.event,chart:e,graphics:n,datums:n&&n.map((t=>RT(t)))};this.dispatch(t.type,s)},this.globalInstance=t,this._compiler=e}register(t,e){var i,n,s,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||NT.chart),l=this.getEventListeners((null===(n=e.filter)||void 0===n?void 0:n.source)||NT.chart);o.get(t)||o.set(t,new WT);if(o.get(t).addHandler(e,null===(s=e.filter)||void 0===s?void 0:s.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,n,s,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||NT.chart),l=this.getEventListeners((null===(n=null==e?void 0:e.filter)||void 0===n?void 0:n.source)||NT.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(s=null==e?void 0:e.wrappedCallback)||void 0===s?void 0:s.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||NT.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||NT.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{let i=0;for(;!s&&i{const n=this.getEventBubble(i).get(t);n&&n.getAllHandlers().forEach((t=>{e?zT.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[NT.chart,NT.window,NT.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var n,s,r;if(u(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.name)!==t.markName)return!1;let a=null===(s=i.model)||void 0===s?void 0:s.type;return HT[a]&&(a=HT[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(n=t.query)||void 0===n?void 0:n.consume;return a&&(null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?jT.model:jT.vchart:jT.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=mt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=ft(t.callback,i.debounce));let n=this._getQueryLevel(i),s=null,r=NT.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||n!==jT.model&&n!==jT.mark||(s=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,n=jT.model),t.filter={level:n,markName:o,type:s,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case NT.chart:return this._viewBubbles;case NT.window:return this._windowBubbles;case NT.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case NT.chart:return this._viewListeners;case NT.window:return this._windowListeners;case NT.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return FT.includes(t)||Object.values(LT).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&xw.hasInteractionTrigger(e)}}function GT(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function YT(t,e,i){t.getParser(e)||t.registerParser(e,i)}const XT=new Map;function KT(t,e=!1){let i=e;return t.latestData instanceof di&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const $T=(t,e)=>0===t.length?[]:1===t.length?KT(t[0],null==e?void 0:e.deep):t.map((t=>KT(t,null==e?void 0:e.deep)));function qT(e,i,n){GT(i=i instanceof ui?i:e.dataSet,"copyDataView",$T);const s=new di(i,n);return s.parse([e],{type:"dataview"}),s.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),s}function ZT(t,e,i=[]){var n;if(t instanceof di)return t;const{id:s,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let u;h.clone=!(!1===h.clone);const d=i.find((t=>t.name===s));if(d)u=d;else{const t={name:s};if(c&&(t.fields=c),u=new di(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return LS(`no data matches fromDataId ${o}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return LS(`no data matches fromDataIndex ${a}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else Array.isArray(r)?u.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(u.parse([]),LS("values should be array")):u.parse(r,null!==(n=h)&&void 0!==n?n:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&u.transform(t)}))}return u}function JT(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var QT,tk,ek,ik;t.TransformLevel=void 0,(QT=t.TransformLevel||(t.TransformLevel={}))[QT.copyDataView=-10]="copyDataView",QT[QT.treemapFilter=-8]="treemapFilter",QT[QT.treemapFlatten=-7]="treemapFlatten",QT[QT.dotObjFlat=-7]="dotObjFlat",QT[QT.linkDotInfo=-7]="linkDotInfo",QT[QT.sankeyLayout=-7]="sankeyLayout",QT[QT.dataZoomFilter=-6]="dataZoomFilter",QT[QT.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(tk||(tk={})),function(t){t.data="data",t.mark="mark"}(ek||(ek={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(ik||(ik={}));const nk=["line","area","trail"];function sk(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(fT,i?t.slice().sort(i):t.slice()),{keys:[fT],data:n};if(1===t.length){const i=e(t[0],0);return n.set(i,[t[0]]),{keys:[i],data:n}}const s=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=n.get(a))&&void 0!==r?r:[];o.push(t),n.set(a,o),s.add(a)})),i&&s.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(s),data:n}}const rk=(t,e,i={})=>(t&&Object.keys(t).forEach((n=>{i[n]=t[n](e)})),i);function ak(t,e,i,n,s){const r=t=>{if(!n&&t&&(!i||i(t))){const i=e.call(null,t);if(s&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{ak(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function lk(t,e,i,n){const s=sk(t,(t=>i(t))),r=sk(e,(t=>n(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const hk=`${Vw}_BuiltIn_CallBack_Disappear`;var ck;!function(t){t.render="render",t.disappear="disappear"}(ck||(ck={}));const uk=[0,0,0];class dk{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},ns),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},rs),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},as),{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 pe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new pe(1,0,0,1,0,0),this._clearMatrix=new pe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&nt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new pe(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Xo.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&&(Xo.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Xo.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n,s=!0){this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r,a=!0){this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,n=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=At;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,u=cthis.canvas.nativeCanvas)));const s=null!==(i=this.fontFamily)&&void 0!==i?i:as.fontFamily,r=null!==(n=this.fontSize)&&void 0!==n?n:as.fontSize;return this.mathTextMeasure.textSpec.fontFamily===s&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=s,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(zo(uk,[e,i,n],this.modelMatrix),e=uk[0],i=uk[1],n=uk[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=Eo(this,l,t,i,n))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const n=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(n,t)})),this._setShadowBlendStyle(t,e,n)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(s<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;n.shadowBlur=r*this.dpr,n.shadowColor=t,n.shadowOffsetX=s*this.dpr,n.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0);l?(n.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1),h?(n.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(n.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r=Object.create(s[0]);return s.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=s.lineWidth,stroke:o=s.stroke,lineJoin:l=s.lineJoin,lineDash:h=s.lineDash,lineDashOffset:c=s.lineDashOffset,lineCap:u=s.lineCap,miterLimit:d=s.miterLimit,keepStrokeScale:p=s.keepStrokeScale}=e;r.lineWidth=p?a:Bo(this,a,this.dpr),r.strokeStyle=Eo(this,o,t,i,n),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=u,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=se(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=se(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,n,s,r){this._clearMatrix.setValue(t,e,i,n,s,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Xo.free(t))),this.stack.length=0}}dk.env="browser";class pk extends Qo{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ps.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new dk(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.width=`${n}px`,t.style.height=`${s}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}}function gk(t,e){return i=>{var n,s;const r=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Ka,t.env)),a=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,$a,e.env));r||i.bind(Ka).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind($a).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}pk.env="browser";const fk=gk(pk,dk);class mk extends dk{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,n){return new Promise(((s,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}mk.env="feishu";class vk extends Qo{constructor(t){super(t)}init(){this._context=new mk(this,this._dpr)}release(...t){}}vk.env="feishu";const yk=gk(vk,mk);class _k extends dk{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:u=s.lineDash,lineCap:d=s.lineCap,miterLimit:p=s.miterLimit,keepStrokeScale:g=s.keepStrokeScale,lineDashOffset:f=s.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:Bo(this,l,this.dpr),r.strokeStyle=Eo(this,h,t,i,n),r.lineJoin=c,0===u[0]&&0===u[1]||(u&&r.setLineDash(u),r.lineDashOffset=f),r.lineCap=d,r.miterLimit=p}}measureText(t,e=Ps.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ps.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;let r="";r=t.font?t.font:se(t,e,s&&this.camera&&this.camera.getProjectionScale(i)),n.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:se(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}_k.env="harmony";class bk extends Qo{constructor(t){super(t)}init(){this._context=new _k(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}bk.env="harmony";const xk=gk(bk,_k);class Sk extends dk{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:u=s.lineDash,lineCap:d=s.lineCap,miterLimit:p=s.miterLimit,keepStrokeScale:g=s.keepStrokeScale,lineDashOffset:f=s.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:Bo(this,l,this.dpr),r.strokeStyle=Eo(this,h,t,i,n),r.lineJoin=c,0===u[0]&&0===u[1]||!u||(r.setLineDash(u),r.lineDashOffset=f),r.lineCap=d,r.miterLimit=p}}measureText(t,e=Ps.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,Ps.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}Sk.env="lynx";class Ak extends Qo{constructor(t){super(t)}init(){this._context=new Sk(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}Ak.env="lynx";const Ck=gk(Ak,Sk);class wk extends dk{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 pe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}wk.env="node";class Tk extends Qo{constructor(t){super(t)}init(){this._context=new wk(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&u(this._nativeCanvas.release)&&this._nativeCanvas.release()}}Tk.env="node";const kk=gk(Tk,wk);class Mk extends dk{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(Eo(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:u=s.lineDash,lineDashOffset:d=s.lineDashOffset,lineCap:p=s.lineCap,miterLimit:g=s.miterLimit,keepStrokeScale:f=s.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:Bo(this,l,this.dpr)),r.setStrokeStyle(Eo(this,h,t,i,n)),r.setLineJoin(c),u&&(r.setLineDash(u),r.lineDashOffset=d),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=se(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=se(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}getImageData(t,e,i,n){const s=this.nativeContext,r=s.taro;if(s&&r)return!s.getImageData&&r.canvasGetImageData?new Promise(((s,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:n,success(t){s(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,n,s,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,n,s,r)}}Mk.env="taro";class Bk extends Qo{constructor(t){super(t)}init(){this._context=new Mk(this,this._dpr)}release(...t){}}Bk.env="taro";const Ek=gk(Bk,Mk);class Pk extends mk{}Pk.env="tt";class Ok extends Qo{constructor(t){super(t)}init(){this._context=new Pk(this,this._dpr)}release(...t){}}Ok.env="tt";const Rk=gk(Ok,Pk);class Ik extends dk{draw(){}createPattern(t,e){return null}}Ik.env="wx";class Dk extends Qo{constructor(t){super(t)}init(){this._context=new Ik(this,this._dpr)}release(...t){}}Dk.env="wx";const Lk=gk(Dk,Ik);class Fk extends jy{constructor(t,e,i,n){super(i,n),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=n,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=Hc.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let s=0;snew jk(Vv(t,Kp)))).inSingletonScope(),t.bind(Cy).toService(ly))}class Hk extends Kx{constructor(t){super(),this.canvasRenderer=t}}let Vk=!1;class Gk extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=Ua}}let Yk=!1;function Xk(t){var e;Yk||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cg))&&(Yk=!0,t.bind(Ay).toDynamicValue((()=>new Gk(Vv(t,cg)))).inSingletonScope(),t.bind(Cy).toService(Ay))}const Kk=va();va();class $k{constructor(){this.type="gif-image",this.numberType=Kk}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}}let qk=!1;function Zk(t){qk||(qk=!0,t.bind(cy).toDynamicValue((()=>new $k)).inSingletonScope(),t.bind(Cy).toService(cy))}function Jk(t){t.isBound(Fk)||t.bind(Fk).toDynamicValue((()=>new Fk(Gv(Cy,t),Vv(t,hg),Gv(Ad,t),Gv(Cd,t)))).inSingletonScope(),t.isBound(bd)?t.rebind(bd).toService(Fk):t.bind(bd).toService(Fk)}function Qk(t){(function(t){Nk||(Nk=!0,t.bind(Sy).toDynamicValue((()=>new Uk)).inSingletonScope(),t.bind(Cy).toService(Sy),hd(t.bind.bind(t),Cy))})(t),Pb(t),jb(t),Gb(t),Wk(t),tx(t),cx(t),_x(t),function(t){Vk||(Vk=!0,t.bind(dy).toDynamicValue((()=>new Hk(Vv(t,tg)))).inSingletonScope(),t.bind(Cy).toService(dy))}(t),Mx(t),Lx(t),Vx(t),Zx(t),rS(t),cS(t),Xk(t),bS(t),MS(t),Zk(t),Jk(t)}class tM extends Ry{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${tM.idprefix}_${tM.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ps.global,this.viewBox=new ue,this.modelMatrix=new pe(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(){var t;if(null===(t=this.global)||void 0===t?void 0:t.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>n)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:tM.GenerateCanvasId(),canvasControled:!0};this.canvas=new pk(n)}createWindowByCanvas(t){var e,i,n;let s;if("string"==typeof t.canvas){if(s=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),s||"undefined"==typeof document||(s=document.getElementById(t.canvas)),!s)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else s=t.canvas;if(!s)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=s.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=s.getContext("2d").pixelRatio)&&void 0!==i?i:s.width/r),this.canvas=new pk({width:r,height:a,dpr:o,nativeCanvas:s,canvasControled:null!==(n=t.canvasControled)&&void 0!==n&&n})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}}function eM(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,tM))||t.bind(tM).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,tM.env))||t.bind(Gc).toService(tM).whenTargetNamed(tM.env)}tM.env="browser",tM.idprefix="visactor_window",tM.prefix_count=0;var iM=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class nM{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 sM(t,e=!1){const i=document.createElement("img");if(Ps.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class rM extends Oy{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,n;let s=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};s=e.clientX||0,r=e.clientY||0,a=s,o=r}else s=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=s,i=r,a=e.getBoundingClientRect(),o=null===(n=e.getNativeHandler)||void 0===n?void 0:n.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new nM(t)}return new ue}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:n,style:s}=e;return s&&(y(s)?t.setAttribute("style",s):Object.keys(s).forEach((e=>{t.style[e]=s[e]}))),null!=i&&(t.style.width=`${i}px`),null!=n&&(t.style.height=`${n}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,n=document.createElement(e);if(this.updateDom(n,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(n)}return n}loadImage(t){return sM(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return sM(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:pi.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,n=n.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetLeft,n=n.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,n=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,n+=s.offsetLeft,s=s.offsetParent;return{top:i,left:n}}loadFont(t,e,i){return iM(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function aM(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,rM))||(t.bind(rM).toSelf().inSingletonScope(),t.bind(Wh).toService(rM))}function oM(t=jg(),e=!0){oM.__loaded||(oM.__loaded=!0,aM(t),fk(t),eM(t),e&&Qk(t))}oM.__loaded=!1;class lM extends Ry{get container(){return null}constructor(t=Ps.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new vk(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new vk({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function hM(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,lM))||t.bind(lM).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,lM.env))||t.bind(Gc).toService(lM).whenTargetNamed(lM.env)}lM.env="feishu";class cM extends jy{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Zo(null,1)}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;const s=this.pickerMap.get(t.numberType);if(!s)return null;const r=s.contains(t,e,n),a=r?t:null;return a?{graphic:a,params:r}:null}}let uM=!1;class dM extends Mb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=ka}}let pM=!1;function gM(t){pM||(pM=!0,t.bind($v).toDynamicValue((()=>new dM(Vv(t,Kp)))).inSingletonScope(),t.bind(Yv).toService($v))}function fM(t){(function(t){uM||(uM=!0,hd(t.bind.bind(t),Yv))})(t),function(t){t.isBound(cM)||t.bind(cM).toDynamicValue((()=>new cM(Gv(Yv,t),Gv(Ad,t),Gv(Cd,t)))).inSingletonScope(),t.isBound(bd)?t.rebind(bd).toService(cM):t.bind(bd).toService(cM)}(t),Ib(t),Kb(t),gM(t),nx(t),px(t),Sx(t),Nx(t),Px(t),tS(t),pS(t),AS(t),PS(t)}class mM{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,n,s,r){this.nativeCanvas=t,this.ctx=e,this._w=n,this._h=s,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class vM{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,n,s,r){this.nativeCanvas=t,this.ctx=e,this._w=n,this._h=s,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function yM(t,e,i=null==t.id){var n,s,r;return{id:null==t.id?void 0:String(t.id),width:null!==(n=t.width)&&void 0!==n?n:0,height:null!==(s=t.height)&&void 0!==s?s:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function _M(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new mM(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function bM(t,e,i,n){const s=yM(t,e),r=s.id;if(null!=r){const t=i.get(r);if(t)return t}if(!n)return null;const a=function(t,e){var i;const n=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!n)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new vM(t,n,e.dpr,e.width,e.height,e.id)}(n(s),s);return null!=r&&i.set(r,a),a}function xM(t){var e,i,n,s,r;try{return null!==(n=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==n?n:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(s=null==t?void 0:t.feishu)&&void 0!==s?s:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function SM(t,e=xM(t)){var i,n,s,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(s=null===(n=null==e?void 0:e.getSystemInfoSync)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.pixelRatio)&&void 0!==r?r:1}class AM extends Oy{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,n=xM(i),s=null!==(e=t.dpr)&&void 0!==e?e:SM(i,n),r=bM(t,s,this.canvasMap,i.canvasFactory);if(r)return r;const a=yM(t,s,!1);if(null==a.id||"function"!=typeof(null==n?void 0:n.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=_M(n.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SM(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function CM(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,AM))||(t.bind(AM).toSelf().inSingletonScope(),t.bind(Wh).toService(AM))}function wM(t=jg(),e=!0){wM.__loaded||(wM.__loaded=!0,CM(t),yk(t),hM(t),e&&fM(t))}wM.__loaded=!1;function TM(t,e,i){if(t&&i)try{t[e]=i}catch(n){Object.defineProperty(t,e,{configurable:!0,value:i})}}function kM(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new bk(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new bk({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const n=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return TM(t,"target",n),TM(t,"currentTarget",n),function(t){var e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0];if(!y)return;const _=kM(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=kM(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&MM(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),MM(t,"x",_),MM(t,"y",b),MM(t,"offsetX",null!==(s=t.offsetX)&&void 0!==s?s:_),MM(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),MM(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),MM(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),MM(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),MM(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(u=y.y)&&void 0!==u?u:b,y.offsetX=null!==(d=y.offsetX)&&void 0!==d?d:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function EM(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,BM))||t.bind(BM).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,BM.env))||t.bind(Gc).toService(BM).whenTargetNamed(BM.env)}BM.env="harmony";const PM="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function OM(t){return"number"==typeof t&&Number.isFinite(t)}function RM(...t){for(let e=0;e({width:i,height:n})),new vM(t,l,s,i,n,e)}function UM(t,e,i,n,s,r,a){const o={id:t,width:e,height:i,dpr:n,offscreen:s};if(r.canvasFactory)return r.canvasFactory(o);if(s&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!s&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(s){const t=LM(e*n,i*n);if(t)return t}throw new Error(PM)}class NM extends Oy{constructor(){super(),this.type="harmony",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,this.rafSTO=new Ys(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=IM(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const n=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},s=IM(n),r=null!==(i=t.dpr)&&void 0!==i?i:DM(n),a=function(t,e){if(!OM(t)||!OM(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=FM(UM(e,a.width,a.height,r,!1,n,s),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=FM(UM(l,a.width,a.height,r,!0,n,s),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return DM(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,n;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0]}(t),i=RM(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),n=RM(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==n?null:{x:i,y:n}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function jM(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,NM))||(t.bind(NM).toSelf().inSingletonScope(),t.bind(Wh).toService(NM))}function zM(t=jg(),e=!0){zM.__loaded||(zM.__loaded=!0,jM(t),xk(t),EM(t),e&&fM(t))}zM.__loaded=!1;function WM(t,e,i){if(t&&i)try{t[e]=i}catch(n){Object.defineProperty(t,e,{configurable:!0,value:i})}}function HM(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Ak(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new Ak({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const n=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return WM(t,"target",n),WM(t,"currentTarget",n),function(t){var e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0];if(!y)return;const _=HM(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=HM(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&VM(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),VM(t,"x",_),VM(t,"y",b),VM(t,"offsetX",null!==(s=t.offsetX)&&void 0!==s?s:_),VM(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),VM(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),VM(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),VM(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),VM(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(u=y.y)&&void 0!==u?u:b,y.offsetX=null!==(d=y.offsetX)&&void 0!==d?d:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function YM(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,GM))||t.bind(GM).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,GM.env))||t.bind(Gc).toService(GM).whenTargetNamed(GM.env)}GM.env="lynx";function XM(t){return"number"==typeof t&&Number.isFinite(t)}function KM(...t){for(let e=0;e{n.onload=()=>{t(n)},n.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,n,s;if(null!=t.id){const n=String(t.id),s=this.canvasMap.get(n);if(s)return s;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=qM(r),o=null!==(i=t.dpr)&&void 0!==i?i:ZM(r,a),l=QM(t.width,t.height),h=tB(eB(n,l.width,l.height,o,!1,r,a),n,l.width,l.height,o);return this.canvasMap.set(n,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(n=this.lynxEnvParams)&&void 0!==n?n:{},o=qM(a),l=null!==(s=t.dpr)&&void 0!==s?s:ZM(a,o),h=QM(t.width,t.height),c=Math.random().toString(),u=tB(eB(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,u),this.freeCanvasList.push(u),u}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return ZM(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,n;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(n=null==t?void 0:t.touches)||void 0===n?void 0:n[0]}(t),i=KM(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),n=KM(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==n?null:{x:i,y:n}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function nB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,iB))||(t.bind(iB).toSelf().inSingletonScope(),t.bind(Wh).toService(iB))}function sB(t=jg(),e=!0){sB.__loaded||(sB.__loaded=!0,nB(t),Ck(t),YM(t),e&&fM(t))}sB.__loaded=!1;class rB extends Ry{get container(){return null}constructor(t=Ps.global){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:pi.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new Tk(i)}createWindowByCanvas(t){var e;const i=t.canvas,n=null!==(e=t.dpr)&&void 0!==e?e:1;let s=t.width,r=t.height;null!=s&&null!=r&&t.canvasControled||(s=i.width/n,r=i.height/n),this.canvas=new Tk({width:s,height:r,dpr:n,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function aB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,rB))||t.bind(rB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,rB.env))||t.bind(Gc).toService(rB).whenTargetNamed(rB.env)}rB.env="node";class oB extends Oy{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function lB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,oB))||(t.bind(oB).toSelf().inSingletonScope(),t.bind(Wh).toService(oB))}function hB(t=jg(),e=!0){hB.__loaded||(hB.__loaded=!0,lB(t),kk(t),aB(t))}hB.__loaded=!1;class cB extends Ry{get container(){return null}constructor(t=Ps.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Bk(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new Bk({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function uB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,cB))||t.bind(cB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,cB.env))||t.bind(Gc).toService(cB).whenTargetNamed(cB.env)}cB.env="taro";class dB extends Oy{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const n=this.taroEnvParams,s=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=bM(t,s,this.canvasMap,n.canvasFactory);if(r)return r;const a=yM(t,s,!1);if(null==a.id||"function"!=typeof(null===(i=n.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=_M(n.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function pB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,dB))||(t.bind(dB).toSelf().inSingletonScope(),t.bind(Wh).toService(dB))}function gB(t=jg(),e=!0){gB.__loaded||(gB.__loaded=!0,pB(t),Ek(t),uB(t),e&&fM(t))}gB.__loaded=!1;class fB extends Ry{get container(){return null}constructor(t=Ps.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Ok(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new Ok({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function mB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,fB))||t.bind(fB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,fB.env))||t.bind(Gc).toService(fB).whenTargetNamed(fB.env)}fB.env="tt";function vB(t){var e,i,n;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(n=null==t?void 0:t.tt)&&void 0!==n?n:null==t?void 0:t.runtime}}function yB(t,e=vB(t)){var i,n,s,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(s=null===(n=null==e?void 0:e.getSystemInfoSync)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.pixelRatio)&&void 0!==r?r:1}class _B extends Oy{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,n=vB(i),s=null!==(e=t.dpr)&&void 0!==e?e:yB(i,n),r=bM(t,s,this.canvasMap,i.canvasFactory);if(r)return r;const a=yM(t,s,!1);if(null==a.id||"function"!=typeof(null==n?void 0:n.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=_M(n.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return yB(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function bB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,_B))||(t.bind(_B).toSelf().inSingletonScope(),t.bind(Wh).toService(_B))}function xB(t=jg(),e=!0){xB.__loaded||(xB.__loaded=!0,bB(t),Rk(t),mB(t),e&&fM(t))}xB.__loaded=!1;class SB{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={}}}function AB(t,e,i){if(t&&i)try{t[e]=i}catch(n){Object.defineProperty(t,e,{configurable:!0,value:i})}}class CB extends Ry{get container(){return null}constructor(t=Ps.global){super(),this.global=t,this.type="wx",this.eventManager=new SB}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:pi.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Dk(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new Dk({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return AB(t,"target",o),AB(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(n=t.changedTouches[0].x)&&void 0!==n?n: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!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].listener.forEach((e=>{e(t)})),!0}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function wB(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,CB))||t.bind(CB).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,Gc,CB.env))||t.bind(Gc).toService(CB).whenTargetNamed(CB.env)}CB.env="wx";function TB(t){var e,i,n;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(n=null==t?void 0:t.wx)&&void 0!==n?n:null==t?void 0:t.runtime}}function kB(t,e=TB(t)){var i,n,s,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(s=null===(n=null==e?void 0:e.getSystemInfoSync)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.pixelRatio)&&void 0!==r?r:1}class MB extends Oy{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,n=TB(i),s=null!==(e=t.dpr)&&void 0!==e?e:kB(i,n),r=bM(t,s,this.canvasMap,i.canvasFactory);if(r)return r;const a=yM(t,s,!1);if(null==a.id||"function"!=typeof(null==n?void 0:n.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=_M(n.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return kB(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Xs.call(t)}}getCancelAnimationFrame(){return t=>{Xs.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function BB(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,MB))||(t.bind(MB).toSelf().inSingletonScope(),t.bind(Wh).toService(MB))}function EB(t=jg(),e=!0){EB.__loaded||(EB.__loaded=!0,BB(t),Lk(t),wB(t),e&&fM(t))}EB.__loaded=!1;var PB={},OB={},RB={};Object.defineProperty(RB,"__esModule",{value:!0}),RB.loop=RB.conditional=RB.parse=void 0;RB.parse=function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n;if(Array.isArray(i))i.forEach((function(i){return t(e,i,n,s)}));else if("function"==typeof i)i(e,n,s,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(s[r]={},t(e,i[r],n,s[r])):s[r]=i[r](e,n,s,t)}return n};RB.conditional=function(t,e){return function(i,n,s,r){e(i,n,s)&&r(i,t,n,s)}};RB.loop=function(t,e){return function(i,n,s,r){for(var a=[],o=i.pos;e(i,n,s);){var l={};if(r(i,t,n,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var IB={};Object.defineProperty(IB,"__esModule",{value:!0}),IB.readBits=IB.readArray=IB.readUnsigned=IB.readString=IB.peekBytes=IB.readBytes=IB.peekByte=IB.readByte=IB.buildStream=void 0;IB.buildStream=function(t){return{data:t,pos:0}};var DB=function(){return function(t){return t.data[t.pos++]}};IB.readByte=DB;IB.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var LB=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};IB.readBytes=LB;IB.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};IB.readString=function(t){return function(e){return Array.from(LB(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};IB.readUnsigned=function(t){return function(e){var i=LB(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};IB.readArray=function(t,e){return function(i,n,s){for(var r="function"==typeof e?e(i,n,s):e,a=LB(t),o=new Array(r),l=0;l=n){var a=n-t.pos;e.push((0,i.readBytes)(a)(t)),s+=a;break}e.push((0,i.readBytes)(r)(t)),s+=r}for(var o=new Uint8Array(s),l=0,h=0;h>=a,g-=a,c>n||c==o)break;if(c==s){r=(1<<(a=d+1))-1,n=s+2,h=-1;continue}if(-1==h){C[m++]=A[c],h=c,f=c;continue}for(l=c,c==n&&(C[m++]=f,c=h);c>s;)C[m++]=A[c],c=S[c];f=255&A[c],C[m++]=f,n<_&&(S[n]=h,A[n]=f,0==(++n&r)&&n<_&&(a++,r+=n)),h=l}m--,x[v++]=C[m],u++}for(u=v;u{const e=YB(t),i=jB(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=YB(this.attribute.gifImage),e=jB(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=Ps.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=Ps.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const n=this.loadedFrames[this.frameIndex||0];2===n.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(n),this.manipulate(t,e,i);const s=(new Date).getTime()-this.lastTime;n.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function $B(t){return new KB(t)}class qB extends Vm{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=Kk,this._renderContribitions=void 0,this.builtinContributions=[ZB],this.init(t)}drawShape(t,e,i,n,s,r,a,o){const l=hh(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:u=l.fillStrokeOrder}=t.attribute,d=this.valid(t,l,a);if(!d)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=d,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-n,l),e.stroke()))};u?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,n,f,!1,p,!1,l,s,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,n,f,!1,p,!1,l,s,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,n,f,!1,p,!1,l,s,a)}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=hh(t).image;this._draw(t,s,!1,i)}}const ZB=new class extends Sp{constructor(){super(...arguments),this.time=Gi.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,u){t.renderFrame&&t.playing&&t.renderFrame(e,i,n)}};let JB=!1;function QB(t){JB||(JB=!0,t.bind(qB).toDynamicValue((()=>new qB(Gv(Ag,t)))).inSingletonScope(),t.bind($p).toService(qB))}function tE(){Oc.RegisterGraphicCreator("gif",$B)}function eE(){if(eE.__loaded)return;eE.__loaded=!0;const t=jg();tE(),QB(t),Zk(t)}eE.__loaded=!1;const iE=eE,nE=[{register:jf,bindModule:um},{register:zf,bindModule:fm},{register:Wf,bindModule:Mm},{register:Hf,bindModule:Om},{register:Vf,bindModule:Lm},{register:Gf},{register:Yf,bindModule:Xm},{register:Xf,bindModule:Zm},{register:Kf,bindModule:nv},{register:$f,bindModule:dv},{register:qf,bindModule:vv},{register:Zf,bindModule:xv},{register:Jf,bindModule:wv},{register:Qf,bindModule:Ev},{register:tm},{register:em,bindModule:Iv},{register:im,bindModule:Uv},{register:nm,bindModule:Wv},{register:sm},{register:tE}];let sE=!1;const rE=[Pb,jb,Gb,Wk,tx,cx,_x,Mx,Lx,Vx,Zx,rS,cS,Xk,bS,MS,Zk];function aE(t){return{getContributions:t}}function oE(t,{envParams:e,force:i=!1}={}){d_().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function lE(t,e,{bindEnv:i,bindCanvasModules:n,bindWindowContribution:s},r){p_(t);const a=c_();i(a),n(a),s(a),u_(),oE(e,{envParams:r,force:!0})}function hE(t,e){lE(t,"browser",{bindEnv:aM,bindCanvasModules:fk,bindWindowContribution:eM},e)}function cE(t,e){lE(t,"node",{bindEnv:lB,bindCanvasModules:kk,bindWindowContribution:aB},e)}function uE(t){p_(t),function(){if(sE)return;const t=c_();sE=!0,nE.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),QB(t),u_()}(),f_(t),g_(t)}function dE(t){p_(t);const e=c_();rE.forEach((t=>t(e))),Jk(e),m_(t,Cy),function(t){const e=c_(),i=aE((()=>t.registry.picker.getAll())),n=aE((()=>e.isBound(Ad)?e.getAll(Ad):[])),s=aE((()=>e.isBound(Cd)?e.getAll(Cd):[])),r=d_();Ps.pickerServiceFactory=()=>new Fk(i,{},n,s),Ps.global=r}(t)}function pE(t){p_(t);fM(c_()),m_(t,Yv),function(t){const e=c_(),i=aE((()=>t.registry.picker.getAll())),n=aE((()=>e.isBound(Ad)?e.getAll(Ad):[])),s=aE((()=>e.isBound(Cd)?e.getAll(Cd):[]));Ps.pickerServiceFactory=()=>new cM(i,n,s)}(t)}function gE(){if(gE.__loaded)return;gE.__loaded=!0;const t=jg();Hf(),Om({bind:t.bind}),Hv?Wk(t):gM(t)}gE.__loaded=!1;const fE=gE;function mE(){if(mE.__loaded)return;mE.__loaded=!0;const t=jg();em(),Iv({bind:t.bind}),Xk(t)}mE.__loaded=!1;const vE=mE;function yE(){yE.__loaded||(yE.__loaded=!0,sm())}yE.__loaded=!1;const _E=yE;class bE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const n=this.target.getFinalAttribute(),s=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==n?void 0:n[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:s[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,a)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class xE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((n=>{var s;e[n]=0,i[n]=null!==(s=t[n])&&void 0!==s?s:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,bf(this.target,i,Wi.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class SE extends bE{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class AE extends xE{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["clipRange"]}}class CE extends bE{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class wE extends xE{constructor(t,e,i,n,s){super(t,e,i,n,s),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const TE=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s,endAngle:s},to:{startAngle:null==n?void 0:n.startAngle,endAngle:null==n?void 0:n.endAngle}}})(t,e):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==n?void 0:n.endAngle},to:{startAngle:null==n?void 0:n.startAngle}}:{from:{endAngle:null==n?void 0:n.startAngle},to:{endAngle:null==n?void 0:n.endAngle}}})(t,e)};class kE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){yf(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){yf(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class ME extends kE{onBind(){var t,e,i;super.onBind();const{from:n,to:s}=TE(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,r),this.determineUpdateFunction()}}class BE extends kE{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,this.params,!1!==(null!==(s=null==n?void 0:n.overall)&&void 0!==s&&s)?((t,e,i)=>{const n=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:n.startAngle,endAngle:n.endAngle},to:{startAngle:t,endAngle:t}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n.startAngle,endAngle:n.endAngle},to:{startAngle:s,endAngle:s}}})(i,n):((t,e,i)=>{const n=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:n.startAngle},to:{startAngle:null==n?void 0:n.endAngle}}:{from:{endAngle:n.endAngle},to:{endAngle:null==n?void 0:n.startAngle}}})(i,n));var i,n,s;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class EE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=((t,e,i)=>{const n=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=n.x,e=n.x1,i=n.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=n.y,e=n.y1,i=n.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=n.x,e=n.x1,i=n.width,s=n.y,r=n.y1,a=n.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=s+a/2,o.height=0,o.y1=void 0):(o.y=(s+r)/2,o.y1=(s+r)/2,o.height=void 0),{from:o,to:{x:t,y:s,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class PE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const n=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=n.x,e=n.x1,i=n.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=n.y,e=n.y1,i=n.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=n.x,e=n.y,i=n.x1,s=n.y1,r=n.width,a=n.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+s)/2,o.y1=(e+s)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const OE=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n,s,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(n=i.groupHeight)&&void 0!==n?n:null===(s=e.layoutRect)||void 0===s?void 0:s.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const n=t.getFinalAttribute(),s=n.y,r=n.y1,a=n.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:s,y1:r,height:a}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:s,y1:r,height:a}}}(t,e)};class RE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=OE(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){_f(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class IE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,s=this.params,!1!==(null!==(r=null==n?void 0:n.overall)&&void 0!==r&&r)?function(t,e,i){var n,s,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(n=i.groupHeight)&&void 0!==n?n:null===(s=e.layoutRect)||void 0===s?void 0:s.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,n,s):function(t,e,i){const n=t.getFinalAttribute(),s=n.y,r=n.y1,a=n.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,n));var i,n,s,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){_f(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const DE=(t,e,i)=>{const n=t.getFinalAttribute().points,s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,e&&e.center&&(A(e.center.x)&&(s.x=e.center.x),A(e.center.y)&&(s.y=e.center.y)),"area"===t.type&&(s.x1=s.x,s.y1=s.y),n.map((t=>Object.assign({},t,s)))};class LE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){var n,s;const r=null===(n=this.from)||void 0===n?void 0:n.points,a=null===(s=this.to)||void 0===s?void 0:s.points;r&&a&&(yf(this.target,{points:r.map(((t,i)=>Hs(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class FE extends LE{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:DE(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&xf(this.target,e)}else this.valid=!1}}class UE extends LE{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:n,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:DE(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=n||i,this.to=s}else this.valid=!1;var t,e}}const NE=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class jE extends LE{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:NE(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&xf(this.target,e)}else this.valid=!1}}class zE extends LE{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:n,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:NE(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=n||i,this.to=s}else this.valid=!1;var t,e}}const WE=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class HE extends LE{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const n=t.getFinalAttribute();return{from:{points:WE(t,e)},to:{points:n.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&xf(this.target,e)}else this.valid=!1}}class VE extends LE{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:WE(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=null!=i?i:this.target.attribute,this.to=n}else this.valid=!1;var t,e}}const GE=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute(),s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:s,outerRadius:s},to:{innerRadius:null==n?void 0:n.innerRadius,outerRadius:null==n?void 0:n.outerRadius}}})(t,e):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==n?void 0:n.outerRadius},to:{innerRadius:null==n?void 0:n.innerRadius}}:{from:{outerRadius:null==n?void 0:n.innerRadius},to:{outerRadius:null==n?void 0:n.outerRadius}}})(t,e)};class YE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class XE extends YE{onBind(){var t,e,i;super.onBind();const{from:n,to:s}=GE(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,r)}}class KE extends YE{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(n=null==i?void 0:i.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=t.getFinalAttribute(),s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==n?void 0:n.innerRadius,outerRadius:null==n?void 0:n.outerRadius},to:{innerRadius:s,outerRadius:s}}})(e,i):((t,e,i)=>{const n=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==n?void 0:n.innerRadius},to:{innerRadius:null==n?void 0:n.outerRadius}}:{from:{outerRadius:null==n?void 0:n.outerRadius},to:{outerRadius:null==n?void 0:n.innerRadius}}})(e,i));var e,i,n;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const $E=(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){var n;const s=t.getFinalAttribute(),r=s.x,a=s.x1,o=s.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const n=t.getFinalAttribute(),s=n.x,r=n.x1,a=n.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:s,x1:r,width:a}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:s,x1:r,width:a}}}(t,e)};class qE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i;super.onBind();const{from:n,to:s}=$E(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:n;this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=r,this.to=s,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&xf(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){_f(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ZE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,n=this.params.options,s=this.params,!1!==(null!==(r=null==n?void 0:n.overall)&&void 0!==r&&r)?function(t,e,i){var n;const s=t.getFinalAttribute(),r=s.x1,a=s.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(n=i.groupWidth)&&void 0!==n?n:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,n,s):function(t,e,i){const n=t.getFinalAttribute(),s=n.x,r=n.x1,a=n.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(s,s+a):Math.max(s,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=p(a)?Math.min(s,s+a):Math.min(s,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,n));var i,n,s,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){_f(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class JE extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class QE extends JE{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var n,s,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:d=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(n=p.width)&&void 0!==n?n:t.stage.viewWidth,f=null!==(s=p.height)&&void 0!==s?s:t.stage.viewHeight),g+=o,f+=o;const m=u(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=d.includes("x")?v:m&&A(m.x)?m.x:g,b=d.includes("y")?y:m&&A(m.y)?m.y:f;switch(h){case"x":return{from:{x:d.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&xf(this.target,e)}}class tP extends JE{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var n,s,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},d=i.group?i.group.AABBBounds:null,p=null!==(n=d.width())&&void 0!==n?n:i.width,g=null!==(s=d.height())&&void 0!==s?s:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=u(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&A(v.x)?v.x:f,_=v&&A(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class eP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.formatTemplate=null,this.decimalLength=null==s?void 0:s.decimalLength,(null==s?void 0:s.formatTemplate)&&s.formatTemplate.includes("{{var}}")&&(this.formatTemplate=s.formatTemplate)}onFirstRun(){var t,e,i;const n=this.getLastProps(),s=this.getEndProps(),r=null!==(t=n.text)&&void 0!==t?t:0,a=null!==(e=s.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",u=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=u)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const n=this.fromNumber+(this.toNumber-this.fromNumber)*e;let s="";const r=this.format,a=("%"===r?100*n:n).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;s=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,bf(this.target,{text:s})}}class iP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class nP extends iP{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const n=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let s=0;return s=ot(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:A(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:s},to:{angle:n}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&xf(this.target,e)}}class sP extends iP{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const n=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let s=0;return s=ot(n/(2*Math.PI),0)?Math.round(n/(2*Math.PI))*Math.PI*2:A(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:s}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class rP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v,y,_,b,x,S;let A,C;super.onBind();const w=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},k=null===(e=this.params)||void 0===e?void 0:e.options,M=null!==(n=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==n?n:null==k?void 0:k.direction,B=null!==(l=null!==(a=null!==(r=null===(s=this.params)||void 0===s?void 0:s.fromScaleX)&&void 0!==r?r:null==k?void 0:k.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==k?void 0:k.fromScale,E=null!==(p=null!==(u=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==k?void 0:k.fromScaleY)&&void 0!==u?u:null===(d=this.params)||void 0===d?void 0:d.fromScale)&&void 0!==p?p:null==k?void 0:k.fromScale;switch(M){case"x":A={scaleX:null!==(g=null!=B?B:T.scaleX)&&void 0!==g?g:0},C={scaleX:null!==(f=null==w?void 0:w.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=E?E:T.scaleY)&&void 0!==m?m:0},C={scaleY:null!==(v=null==w?void 0:w.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=B?B:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=E?E:T.scaleY)&&void 0!==_?_:0},C={scaleX:null!==(b=null==w?void 0:w.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==w?void 0:w.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=C,this.from=A,this.to=C,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&xf(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const n={};e&&(n.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(n.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),yf(this.target,n)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class aP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(n=null==o?void 0:o.scaleX)&&void 0!==n?n:1,scaleY:null!==(s=null==o?void 0:o.scaleY)&&void 0!==s?s:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const n={};this.propKeys.forEach((t=>{n[t]=this.from[t]+(this.to[t]-this.from[t])*e})),yf(this.target,n),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class oP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,n),this.onUpdate(t,n,i),this.syncAttributeUpdate()}}const lP={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function hP(t,e){for(let i=0;ilP[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&Zg(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const n=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,n),this.syncParentClipPathToTarget(),this.onUpdate(t,n,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,n=i.parent,s=null===(t=null==n?void 0:n.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==n?void 0:n.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(s)||!s.length)return;const r=this.getClipPathSyncChildIndex(n);if(r<0||r>=s.length)return;const a=s[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(yf(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,n)=>t===e&&(i=n,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const n=this.target,s=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&s&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=s[t])&&void 0!==e?e:null===(i=n.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const n=this.target;return null!==(i=null!==(e=null===(t=n.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:n.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,n={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var s;const r=null===(s=i.attribute)||void 0===s?void 0:s[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(n[e]=r)})),Object.keys(n).length?n:null}}class uP{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new Jg(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function dP(t){return new uP(t)}class pP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==s?void 0:s.showCursor)&&(this.showCursor=s.showCursor),void 0!==(null==s?void 0:s.cursorChar)&&(this.cursorChar=s.cursorChar),void 0!==(null==s?void 0:s.blinkCursor)&&(this.blinkCursor=s.blinkCursor),void 0!==(null==s?void 0:s.beforeText)&&(this.beforeText=s.beforeText),void 0!==(null==s?void 0:s.afterText)&&(this.afterText=s.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),n=this.getEndProps(),s=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=n.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=s.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const n=this.toText.length,s=this.fromText.length;let r,a;s>n?(r=Math.round(s-(s-n)*e),a=this.fromText.substring(0,r)):(r=Math.round(s+(n-s)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=s?this.fromText.substring(0,r):this.toText.substring(0,r-s+Math.min(s,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;bf(this.target,{text:o})}}class gP extends Bf{onBind(){super.onBind();const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target,{symbolStartOuterType:s="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(xf(n._symbolStart,{scaleX:0,scaleY:0}),t.animate(n._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===s?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),xf(n._symbolStartOuter,l),t.animate(n._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),xf(n._symbolEnd,{scaleX:0,scaleY:0}),t.animate(n._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),xf(n._line,{clipRange:0}),t.animate(n._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=n._titleTop.attribute.text;xf(n._titleTop,{text:""}),t.animate(n._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:pP});const i=n._titleBottom.attribute.text;xf(n._titleBottom,{text:""}),t.animate(n._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:pP})}else xf(n._titleTop,{dy:n._titleTop.AABBBounds.height()+10}),t.animate(n._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),xf(n._titleBottom,{dy:-(10+n._titleBottom.AABBBounds.height())}),t.animate(n._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[n._titleTopPanel,n._titleBottomPanel].forEach((n=>{var s;const r=null!==(s=n.attribute.scaleX)&&void 0!==s?s:1;xf(n,{scaleX:0}),t.animate(n,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[n._titleTopPanel,n._titleBottomPanel].forEach((n=>{const s=n.AABBBounds,r=2*(s.width()+s.height());xf(n,{lineDash:[0,10*r]}),t.animate(n,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class fP extends Bf{onBind(){super.onBind();const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target,{mode:s}=this.params;"scale"===s?t.animate(n._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(n._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(n._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(n._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(n._titleTop,{type:"to",to:{dy:n._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(n._titleBottom,{type:"to",to:{dy:-(10+n._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(n._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(n._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(n._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class mP extends Bf{onBind(){super.onBind();const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target,{wave:s}=this.params;if(xf(n,{scaleX:0,scaleY:0}),t.animate(n,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),n.titleShape&&t.animate(n.titleShape,{type:"custom",to:{text:n.titleShape.attribute.text},duration:e,easing:i,custom:pP}),n.contentShape&&t.animate(n.contentShape,{type:"custom",to:{text:n.contentShape.attribute.text},duration:e,easing:i,custom:pP}),s){const r=e/6;t.animate(n.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:s},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-s},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:s},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class vP extends Bf{onBind(){super.onBind();const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,n=this.target;t.animate(n,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class yP extends Ef{constructor(t,e,i,n,s){super(t,e,i,n,s),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=Vg.createCanvas({width:t.width,height:t.height,dpr:Vg.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),n=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!n)return null;const s=this.gl.createProgram();return s?(this.gl.attachShader(s,i),this.gl.attachShader(s,n),this.gl.linkProgram(s),this.gl.getProgramParameter(s,this.gl.LINK_STATUS)?s:(console.error("Shader program link error:",this.gl.getProgramInfoLog(s)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=Vg.createCanvas({width:t.width,height:t.height,dpr:Vg.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==yP.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class _P extends yP{constructor(t,e,i,n,s){super(t,e,i,n,s)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class bP extends yP{constructor(t,e,i,n,s){super(t,e,i,n,s)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==bP.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==bP.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,n;let s=null;if(!1!==(null===(n=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===n?void 0:n.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(s=this.applyWebGLEffect(e),s)return s;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(s=this.applyCanvas2DEffect(e),s)return s;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(s=this.applyCanvas2DEffect(e),s)return s;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class xP{static createTempCanvas(t,e,i){return Vg.createCanvas({width:t,height:e,dpr:i||Vg.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}static distance(t,e,i,n){const s=i-t,r=n-e;return Math.sqrt(s*s+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const n=Math.floor(t/i)*i,s=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*n+78.233*s);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,n,s)}static blendImageData(t,e,i){const{data:n,width:s,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(n.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=xP.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const n=this.createFullScreenQuad();return n?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(n),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),n=this.gl.getUniformLocation(this.program,"u_dissolveType"),s=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(s,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(n,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:n}=e,s=n.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(s,r);break;case"inward":a=this.applyInwardDissolve(s,r);break;case"radial":a=this.applyRadialDissolve(s,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(s,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(s,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(s,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(s,r);break;default:a=s}return n.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:n,height:s}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=n/2,o=s/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)d+=.4*(xP.pixelNoise(i,t,h)-.5),p=u>d?0:1;else if(this.dissolveConfig.fadeEdge){const t=d-.15;p=ud?0:1-(u-t)/(d-t)}else p=u>d?0:1;const g=4*(t*n+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,n,s)}applyInwardDissolve(t,e){const{data:i,width:n,height:s}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=n/2,o=s/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)d+=.4*(xP.pixelNoise(i,t,h)-.5),p=ut?1:(u-d)/(t-d)}else p=u0)u+=.3*(xP.pixelNoise(i,t,l)-.5),d=ct?1:(c-u)/(t-u)}else d=c0)o+=.3*(xP.pixelNoise(i,t,a)-.5),l=st?1:(s-o)/(t-o)}else l=s0)o+=.3*(xP.pixelNoise(i,t,a)-.5),l=s>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=so?0:1-(s-t)/(o-t)}else l=s>o?0:1;const h=4*(t*n+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,n,s)}applyTopToBottomDissolve(t,e){const{data:i,width:n,height:s}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(xP.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(xP.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*n+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,n,s)}}class CP extends bP{constructor(t,e,i,n,s){var r,a,o;super(t,e,i,n,s),this.distortionConfig={distortionType:(null===(r=null==s?void 0:s.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==s?void 0:s.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==s?void 0:s.options)||void 0===o?void 0:o.useWebGL)||s.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),n=this.gl.getUniformLocation(this.program,"u_distortionType"),s=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(s,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(n,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const n=i.getImageData(0,0,t.width,t.height),s=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(n,this.distortionConfig.strength,s);break;case"ripple":r=this.applyRippleDistortion(n,this.distortionConfig.strength,s);break;case"swirl":r=this.applySwirlDistortion(n,this.distortionConfig.strength,s);break;default:r=n}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:n,width:s,height:r}=t,a=new Uint8ClampedArray(n.length);for(let t=0;t=0&&c=0&&u=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class MP extends bP{constructor(t,e,i,n,s){var r,a,o,l,h;super(t,e,i,n,s),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==s?void 0:s.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==s?void 0:s.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==s?void 0:s.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==s?void 0:s.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==s?void 0:s.options)||void 0===h?void 0:h.useWebGL)||s.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:n}=e,s=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(n,t,s);break;case"gravity":this.applyCanvas2DGravity(n,t,s);break;case"vortex":this.applyCanvas2DVortex(n,t,s);break;default:n.globalAlpha=Math.max(0,1-s),n.drawImage(t,0,0)}return i}extractParticles(t){const e=xP.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const n=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const s=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const n=r/e.width*t.width,s=i/e.height*t.height,c={x:n,y:s,originX:n,originY:s,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,n=this.currentAnimationRatio,s=this.getDurationFromParent(),r=s<2e3,a=r?Math.max(1.5,3e3/s):1,o=r?Math.min(2,2e3/s):1;this.particles.forEach((s=>{const l=s.x-e,h=s.y-i,c=Math.sqrt(l*l+h*h),u=Math.atan2(h,l);this.applyParticleForces(s,u,c,n,o,t),this.updateParticleProperties(s,n,r,a,o)}))}applyParticleForces(t,e,i,n,s,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=n*this.particleConfig.strength*s*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,n,s,r,a);break;case"vortex":this.applyVortexEffect(t,n,s,r,e,i)}}applyGravityEffect(t,e,i,n,s){const r=(t.originX+.7*t.originY)/(n.width+n.height)*.8;if(e>r){const n=(e-r)/(1-r),a=this.particleConfig.strength*n*n*12*i;t.vy+=a;const o=Math.sin(3*s+.02*t.originX)*Math.cos(2*s+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,n,s,r){const a=n.width/2,o=n.height/2,l=s+e*Math.PI*.8,h=r+e*Math.max(n.width,n.height)*.7*1.8,c=a+Math.cos(l)*h,u=o+Math.sin(l)*h,d=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*d,t.vy+=(u-t.y)*d}updateParticleProperties(t,e,i,n,s){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/n);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),n=new Float32Array(this.particles.length);this.particles.forEach(((t,s)=>{e[2*s]=t.x,e[2*s+1]=t.y,i[4*s]=t.r,i[4*s+1]=t.g,i[4*s+2]=t.b,i[4*s+3]=Math.max(.1,t.a),n[s]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,n),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,n){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const s=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(s),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,n,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),n=t.getUniformLocation(this.program,"u_forceStrength"),s=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(n,this.particleConfig.strength),t.uniform1i(s,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const n=e.width/2,s=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(n,s);const r=1+.5*i;t.scale(r,r),t.translate(-n,-s),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const n=i*e.height*.3;t.drawImage(e,0,n),t.restore()}applyCanvas2DVortex(t,e,i){const n=e.width/2,s=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(n,s),t.rotate(i*Math.PI*2),t.translate(-n,-s),t.drawImage(e,0,0),t.restore()}}class BP extends yP{constructor(t,e,i,n,s){var r,a;super(t,e,i,n,s),this.pixelationConfig={maxPixelSize:(null===(r=null==s?void 0:s.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==s?void 0:s.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:n}=t,s=Math.ceil(i/e),r=Math.ceil(n/e),a=Vg.createCanvas({width:s,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=Vg.createCanvas({width:i,height:n,dpr:Vg.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,s,r),h.drawImage(a,0,0,i,n),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class EP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==s?void 0:s.showCursor)&&(this.showCursor=s.showCursor),void 0!==(null==s?void 0:s.cursorChar)&&(this.cursorChar=s.cursorChar),void 0!==(null==s?void 0:s.blinkCursor)&&(this.blinkCursor=s.blinkCursor),void 0!==(null==s?void 0:s.fadeInChars)&&(this.fadeInChars=s.fadeInChars),void 0!==(null==s?void 0:s.fadeInDuration)&&(this.fadeInDuration=s.fadeInDuration),void 0!==(null==s?void 0:s.strokeFirst)&&(this.strokeFirst=s.strokeFirst),void 0!==(null==s?void 0:s.strokeToFillRatio)&&(this.strokeToFillRatio=s.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?cc.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=cc.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const n=this.toTextConfig.length,s=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(s>n)a=Math.round(s-(s-n)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(s+(n-s)*t)}else a=Math.round(s+(n-s)*e);if(o=s>n?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const s=Object.assign({},t);if(this.strokeFirst){const t=i/n*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in s&&s.fill&&(s.stroke=s.fill,l<1&&(s.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));s.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/n*r)/this.fadeInDuration;s.opacity=Math.max(0,Math.min(1,t))}return s}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}bf(this.target,{textConfig:o})}}class PP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==s?void 0:s.showCursor)&&(this.showCursor=s.showCursor),void 0!==(null==s?void 0:s.cursorChar)&&(this.cursorChar=s.cursorChar),void 0!==(null==s?void 0:s.blinkCursor)&&(this.blinkCursor=s.blinkCursor),void 0!==(null==s?void 0:s.beforeText)&&(this.beforeText=s.beforeText),void 0!==(null==s?void 0:s.afterText)&&(this.afterText=s.afterText),void 0!==(null==s?void 0:s.fadeOutChars)&&(this.fadeOutChars=s.fadeOutChars),void 0!==(null==s?void 0:s.fadeOutDuration)&&(this.fadeOutDuration=s.fadeOutDuration),void 0!==(null==s?void 0:s.direction)&&(this.direction=s.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=cc.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?cc.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const n=this.fromTextConfig.length,s=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/s);r=Math.round(n*(1-t))}else r=Math.round(n*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(n-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,n,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),bf(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/s);r=Math.round(n*(1-t))}else r=Math.round(n*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,n,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),bf(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,n){const s=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,s));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const n=[...t];return"forward"===this.direction?n[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):n[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),n}}return t}}class OP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==s?void 0:s.fadeOutDuration)&&(this.fadeOutDuration=s.fadeOutDuration),void 0!==(null==s?void 0:s.slideDirection)&&(this.slideDirection=s.slideDirection),void 0!==(null==s?void 0:s.slideDistance)&&(this.slideDistance=s.slideDistance),void 0!==(null==s?void 0:s.wordByWord)&&(this.wordByWord=s.wordByWord),void 0!==(null==s?void 0:s.wordRegex)&&(this.wordRegex=s.wordRegex),void 0!==(null==s?void 0:s.reverseOrder)&&(this.reverseOrder=s.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=cc.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?cc.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,n=0;for((this.fromTextConfig.forEach(((i,s)=>{if("text"in i){const r=String(i.text);t+=r,e[n]=s,n++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,n=i.index+i[0].length,s=[];for(let i=t;i0&&this.wordGroups.push(s)}const s=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>s.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const n=1-this.fadeOutDuration;let s;s=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,n):this.updateByCharacter(e,n),bf(this.target,{textConfig:s})}updateByWord(t,e){const i=this.wordGroups.length,n=[...this.singleCharConfig];for(let s=0;s0?cc.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=cc.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,n=0;for((this.toTextConfig.forEach(((i,s)=>{if("text"in i){const r=String(i.text);t+=r,e[n]=s,n++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,n=i.index+i[0].length,s=[];for(let i=t;i0&&this.wordGroups.push(s)}const s=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>s.add(t)))}));for(let t=0;t0?this.updateByWord(e,n):this.updateByCharacter(e,n),bf(this.target,{textConfig:s})}updateByWord(t,e){const i=this.wordGroups.length,n=[...this.singleCharConfig];for(let s=0;s{s[t]=e[t]+(i[t]-e[t])*n})),s}function LP(t,e){yf(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class FP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a,o,l,h,c,u;super.onBind();const d=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(s=d.y)&&void 0!==s?s:0)-g,v.y=null!==(r=d.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=d.y)&&void 0!==a?a:0)+g,v.y=null!==(o=d.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=d.x)&&void 0!==l?l:0)-g,v.x=null!==(h=d.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=d.x)&&void 0!==c?c:0)+g,v.x=null!==(u=d.x)&&void 0!==u?u:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,xf(this.target,m)}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class UP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(s=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==s?s:0,u={opacity:c,baseOpacity:c},d={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(u.scaleX=l,d.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(u.scaleY=l,d.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=u,this.to=d,this.props=d,xf(this.target,u)}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class NP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onBind(){var t,e,i,n,s,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,u=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==n?n:0,d=null!==(r=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==r?r:0,p={opacity:d,baseOpacity:d,angle:c,scaleX:u,scaleY:u},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,xf(this.target,p)}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class jP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,n=null!==(t=i.width)&&void 0!==t?t:100,s=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(n+s)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(n=t.radiusX)&&void 0!==n?n:50,i=null!==(s=t.radiusY)&&void 0!==s?s:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(d=null===(u=this.params)||void 0===u?void 0:u.dashLength)&&void 0!==d?d:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,xf(this.target,this.from)}onUpdate(t,e,i){var n;const s={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(n=this.params)||void 0===n?void 0:n.showFill)&&(s.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),bf(this.target,s)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class zP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,n=null!==(t=i.width)&&void 0!==t?t:100,s=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(n+s)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(n=t.radiusX)&&void 0!==n?n:50,i=null!==(s=t.radiusY)&&void 0!==s?s:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(d=null===(u=this.params)||void 0===u?void 0:u.dashLength)&&void 0!==d?d:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,xf(this.target,this.from)}onUpdate(t,e,i){var n;const s={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(n=this.params)||void 0===n?void 0:n.showFill)&&(s.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),bf(this.target,s)}}class WP extends Mf{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,n,s,r;super.onBind();const a=new Jg(this.target);a.execute({type:"custom",custom:FP,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:UP,customParameters:{fromScale:(null===(s=this.params)||void 0===s?void 0:s.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class HP extends Mf{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,n,s,r;super.onBind();const a=new Jg(this.target);a.execute({type:"custom",custom:FP,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:NP,customParameters:{fromAngle:(null===(s=this.params)||void 0===s?void 0:s.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class VP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onFirstRun(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==n?n:1,y=null!==(r=null===(s=this.params)||void 0===s?void 0:s.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(u=g.x)&&void 0!==u?u:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(d=g.x)&&void 0!==d?d:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class GP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onFirstRun(){var t,e,i,n,s,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,u=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",d=null!==(s=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==s?s:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:d,baseOpacity:d},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==u&&"xy"!==u||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==u&&"xy"!==u||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class YP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}onFirstRun(){var t,e,i,n,s,r,a,o,l,h,c;const u=this.target.getAttributes(),d=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(n=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==n?n:0,g=null!==(r=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=u.angle)&&void 0!==l?l:0,scaleX:null!==(h=u.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=u.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:d,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){LP(this.target,DP(this.propKeys,this.from,this.to,e))}}class XP extends Mf{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,n;const s=new Jg(this.target);s.execute({type:"custom",custom:GP,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),s.execute({type:"custom",custom:VP,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(n=this.params)||void 0===n?void 0:n.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class KP extends Mf{constructor(t,e,i,n,s){var r;super(t,e,i,n,s);const a=null!==(r=null==s?void 0:s.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,n;const s=new Jg(this.target);s.execute({type:"custom",custom:YP,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),s.execute({type:"custom",custom:VP,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(n=this.params)||void 0===n?void 0:n.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class $P extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==s?void 0:s.pulseCount)&&(this.pulseCount=s.pulseCount),void 0!==(null==s?void 0:s.pulseScale)&&(this.pulseScale=s.pulseScale),void 0!==(null==s?void 0:s.pulseColor)&&(this.pulseColor=s.pulseColor),void 0!==(null==s?void 0:s.pulseColorIntensity)&&(this.pulseColorIntensity=s.pulseColorIntensity),void 0!==(null==s?void 0:s.strokeOnly)&&(this.strokeOnly=s.strokeOnly),void 0!==(null==s?void 0:s.fillOnly)&&(this.fillOnly=s.fillOnly),void 0!==(null==s?void 0:s.useScale)&&(this.useScale=s.useScale),void 0!==(null==s?void 0:s.useOpacity)&&(this.useOpacity=s.useOpacity),void 0!==(null==s?void 0:s.useStroke)&&(this.useStroke=s.useStroke),void 0!==(null==s?void 0:s.useFill)&&(this.useFill=s.useFill),void 0!==(null==s?void 0:s.useColor)&&(this.useColor=s.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const n=e*Math.PI*this.pulseCount,s=Math.abs(Math.sin(n)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*s;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*s;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,s),yf(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=nl(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=nl(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class qP extends Mf{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),n=Ps.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=n,n.pathProxy=new Xn,i.add(n)}onStartRect(){var t,e,i;const n=this.target.attachShadow(),s=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=s?"height":"width",a=s?"width":"height",o=this.target.AABBBounds[r](),l=s?0:this.target.AABBBounds.y1,h=Ps.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,n.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var n,s,r,a,o,l,h,c,u,d,p,g,f,m,v,y;const _=null===(s=null===(n=this.params)||void 0===n?void 0:n.isHorizontal)||void 0===s||s,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,n=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,s=null!==(u=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==u?u:60,d=-s,p=d+(n-d)*e,g=Math.max(p,0),f=Math.min(Math.min(p+s,s),n-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Wi.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(d=b.height)&&void 0!==d?d:Math.abs(b.y1-b.y))&&void 0!==p?p:250,n=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,s=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(n+s)*e;let a=Math.min(r,i);const o=Math.min(i-r,s);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Wi.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const n=this.line||this.area;if(!n)return;const s=n.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(s,r,t,e,i):this._onUpdateLineWithoutCache(s,r,t,e,i);const a=r.attribute;n.setAttributes(Object.assign({stroke:a.stroke},n.attribute)),n.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,n,s){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const s=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,s,n)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,s=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,s,n)}}_updateCurves(t,e,i,n){var s,r;const a=i*n,o=Math.min(a+(null!==(r=null===(s=this.params)||void 0===s?void 0:s.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,n.p2&&n.p3){const[e,i]=on(n,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=n.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(n.p2&&n.p3){c&&(u=(o-a)/c.getLength());const[e]=on(c||n,u);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=n.getPointAt(u);t.lineTo(e.x,e.y)}break}if(h)if(n.p2&&n.p3){const e=c||n;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(n.p1.x,n.p1.y);l+=s}}_onUpdateLineWithoutCache(t,e,i,n,s){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&d.push(Ut.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pu){d.push(Ut.pointAtPP(o[t-1],o[t],1-(p+e-u)/e));break}d.length&&d.push(o[t]),p+=e}if(d.length&&!(d.length<2)){t.clear(),t.moveTo(d[0].x,d[0].y);for(let e=1;ei(t))),n.clear()}function nO(t){var e,i;const n=null!==(e=jg().getAll($p))&&void 0!==e?e:[],s=eO(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;iO(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),n.forEach((e=>{var i;const n=tO(e,"vrender:legacy-renderer");r.has(n)||(r.add(n),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(n,e),s.add(n))}))}function sO(t,e){var i,n;const s=null!==(i=jg().getAll(e))&&void 0!==i?i:[],r=eO(t.registry.picker,"vrender:legacy-picker"),a=new Set;iO(t.registry.picker,"vrender:legacy-picker",null===(n=t.registry.picker.unregister)||void 0===n?void 0:n.bind(t.registry.picker)),s.forEach((e=>{const i=tO(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const rO=hE,aO=cE,oO={taro:{installEnv:function(t,e){lE(t,"taro",{bindEnv:pB,bindCanvasModules:Ek,bindWindowContribution:uB},e)},loadEnv:gB},feishu:{installEnv:function(t,e){lE(t,"feishu",{bindEnv:CM,bindCanvasModules:yk,bindWindowContribution:hM},e)},loadEnv:wM},tt:{installEnv:function(t,e){lE(t,"tt",{bindEnv:bB,bindCanvasModules:Rk,bindWindowContribution:mB},e)},loadEnv:xB},wx:{installEnv:function(t,e){lE(t,"wx",{bindEnv:BB,bindCanvasModules:Lk,bindWindowContribution:wB},e)},loadEnv:EB},lynx:{installEnv:function(t,e){lE(t,"lynx",{bindEnv:nB,bindCanvasModules:Ck,bindWindowContribution:YM},e)},loadEnv:sB},harmony:{installEnv:function(t,e){lE(t,"harmony",{bindEnv:jM,bindCanvasModules:xk,bindWindowContribution:EM},e)},loadEnv:zM}},lO=[Tb,Ab,Yg,Kg,Dy,Fy],hO=[()=>{Jg.registerBuiltInAnimate("increaseCount",eP),Jg.registerBuiltInAnimate("fromTo",Pf),Jg.registerBuiltInAnimate("scaleIn",rP),Jg.registerBuiltInAnimate("scaleOut",aP),Jg.registerBuiltInAnimate("growHeightIn",RE),Jg.registerBuiltInAnimate("growHeightOut",IE),Jg.registerBuiltInAnimate("growWidthIn",qE),Jg.registerBuiltInAnimate("growWidthOut",ZE),Jg.registerBuiltInAnimate("growCenterIn",EE),Jg.registerBuiltInAnimate("growCenterOut",PE),Jg.registerBuiltInAnimate("clipIn",SE),Jg.registerBuiltInAnimate("clipOut",AE),Jg.registerBuiltInAnimate("fadeIn",CE),Jg.registerBuiltInAnimate("fadeOut",wE),Jg.registerBuiltInAnimate("growPointsIn",FE),Jg.registerBuiltInAnimate("growPointsOut",UE),Jg.registerBuiltInAnimate("growPointsXIn",jE),Jg.registerBuiltInAnimate("growPointsXOut",zE),Jg.registerBuiltInAnimate("growPointsYIn",HE),Jg.registerBuiltInAnimate("growPointsYOut",VE),Jg.registerBuiltInAnimate("growAngleIn",ME),Jg.registerBuiltInAnimate("growAngleOut",BE),Jg.registerBuiltInAnimate("growRadiusIn",XE),Jg.registerBuiltInAnimate("growRadiusOut",KE),Jg.registerBuiltInAnimate("moveIn",QE),Jg.registerBuiltInAnimate("moveOut",tP),Jg.registerBuiltInAnimate("rotateIn",nP),Jg.registerBuiltInAnimate("rotateOut",sP),Jg.registerBuiltInAnimate("update",cP),Jg.registerBuiltInAnimate("state",oP),Jg.registerBuiltInAnimate("labelItemAppear",gP),Jg.registerBuiltInAnimate("labelItemDisappear",fP),Jg.registerBuiltInAnimate("poptipAppear",mP),Jg.registerBuiltInAnimate("poptipDisappear",vP),Jg.registerBuiltInAnimate("inputText",pP),Jg.registerBuiltInAnimate("inputRichText",EP),Jg.registerBuiltInAnimate("outputRichText",PP),Jg.registerBuiltInAnimate("slideRichText",RP),Jg.registerBuiltInAnimate("slideOutRichText",OP),Jg.registerBuiltInAnimate("slideIn",FP),Jg.registerBuiltInAnimate("growIn",UP),Jg.registerBuiltInAnimate("spinIn",NP),Jg.registerBuiltInAnimate("moveScaleIn",WP),Jg.registerBuiltInAnimate("moveRotateIn",HP),Jg.registerBuiltInAnimate("strokeIn",jP),Jg.registerBuiltInAnimate("slideOut",VP),Jg.registerBuiltInAnimate("growOut",GP),Jg.registerBuiltInAnimate("spinOut",YP),Jg.registerBuiltInAnimate("moveScaleOut",XP),Jg.registerBuiltInAnimate("moveRotateOut",KP),Jg.registerBuiltInAnimate("strokeOut",zP),Jg.registerBuiltInAnimate("pulse",$P),Jg.registerBuiltInAnimate("MotionPath",IP),Jg.registerBuiltInAnimate("streamLight",qP),Jg.registerBuiltInAnimate("dissolve",AP),Jg.registerBuiltInAnimate("grayscale",kP),Jg.registerBuiltInAnimate("distortion",CP),Jg.registerBuiltInAnimate("particle",MP),Jg.registerBuiltInAnimate("glitch",TP),Jg.registerBuiltInAnimate("gaussianBlur",wP),Jg.registerBuiltInAnimate("pixelation",BP)},function(){V(th,of),V(th,Nf)}],cO=[Lb,Wb,qb,fE,rx,iE,ox,fx,Cx,Rx,zx,Yx,iS,oS,fS,vS,wS,RS,_E,vE];function uO(){lO.forEach((t=>t())),hO.forEach((t=>t()))}function dO(t,e){if(!QP(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==Vg?void 0:Vg.env)?Vg.envParams:void 0}(e);return void 0===i?cE(t):aO(t,i),uE(t),pE(t),hB(),cO.forEach((t=>t())),nO(t),sO(t,Yv),uO(),t}function pO(t,e,i){if(!QP(t,e))return t;const n=oO[e];return n.installEnv(t,i),uE(t),function(t){pE(t)}(t),n.loadEnv(),cO.forEach((t=>t())),nO(t),sO(t,Yv),uO(),t}const gO=Symbol.for("visactor.vrender.sharedAppRegistry");function fO(){var t;const e=globalThis,i=null!==(t=e[gO])&&void 0!==t?t:new Map;return e[gO]=i,i}function mO(t,e){const i=fO(),n=i.get(t);if(n||!e)return n;const s=new Map;return i.set(t,s),s}function vO(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const n=fO(),s=n.get(t);(null==s?void 0:s.get(e))===i&&(s.delete(e),s.size||n.delete(t))}(t,e,i),i.releaseApp())}function yO(t,e,i,n=t){var s;const r=null!==(s=e.key)&&void 0!==s?s:"default",a=mO(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(vO(t,r,o),o=void 0),o||(o=function(t,e,i,n){const s=n(i),r=s.release.bind(s),a={app:s,refCount:0,released:!1,releaseApp:r};return s.release=()=>vO(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,n){let s=!1;return{app:n.app,env:e,key:i,release(){if(s)return;s=!0;const e=mO(t,!1);(null==e?void 0:e.get(i))!==n||n.released||(n.refCount-=1,n.refCount<=0&&vO(t,i,n))}}}(t,n,r,o)}const _O=y_,bO=[];function xO(t){bO.forEach((({module:e,options:i})=>{_O(e,Object.assign(Object.assign({},i),{app:t}))}))}var SO=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);st())),nO(t),sO(t,Cy),uO(),t):t}(Hy(SO(t,["envParams"])),e);return xO(i),i}var CO=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},PO={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},OO=(t,e)=>{const i=EO(t),n=PO[i];if(!n)return e;if(null==(s=e)||"object"!=typeof s&&"function"!=typeof s)return;var s;const r={};return n.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},RO=(t,e)=>{const i=yO((n=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,n,BO,n.env);var n;return{app:i.app,releaseAppRef:()=>i.release()}},IO="poptipForText";class DO{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,n,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterVRenderDraw)||void 0===s||s.call(n,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const n=i.findPluginsByName(t);if(n.length<=1)return;const s=n[0];i.uninstall?(i.uninstall(t),i.register(s)):n.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(IO))&&this._dedupeStagePlugin(IO)}initView(){var e,i,n,s,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:u,clickInterval:d,autoPreventDefault:f,background:m}=this._option,v=OO(l,h);Vg.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const n=EO(i.mode),s=OO(i.mode,i.modeParams);return RO(n,s)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=t.releaseAppRef,null===(e=this._option.runtimePluginInstallers)||void 0===e||e.forEach((e=>e(t.app)));try{this._stage=(_=t.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(n=this._container.canvas)&&void 0!==n?n:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,n;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(n=(i=this._option).beforeRender)||void 0===n||n.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:p(a)?a:!p(o)},null!==(s=this._option.renderHooks)&&void 0!==s?s:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=wh({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(p(c)?c:WS(l))&&!1!==u&&xw.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,g(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==u&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=ik.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),n=null==i?void 0:i.region;return!!_(n)&&n.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!zS(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:Vg.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(Vg.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=Vg.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>ak(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>ak(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,n,s,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{ak(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.beforeVRenderDraw)||void 0===s||s.call(n,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===ik.before;(e||i)&&(DS(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=ik.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=ik.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),DS(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:n=!1,animation:s={},enableExitAnimation:r=!1}=t,a=ok(this._rootMarks),{update:o,exit:l}=function(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):n.enter.push({next:[t]})}));const a=lk(s,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=lk(s,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=sk(s,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=sk(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}(this._cachedMarks,a,{morph:i,morphAll:n,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const n=t[i];_(n)?e[i]="disappear"===i?n.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:hk,customParameters:{callBack:t.callBack}}))):n.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{ak(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===tk.appear))?tk.appear:e.every((t=>t===tk.disappear))?tk.disappear:tk.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const n=this._width!==t||this._height!==e;this._width=t,this._height=e,n&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var n,s;if(!1!==this._option.interactive)if(t===NT.chart){const s=this.getRootGroup(),r=function(n){var r;const a=n.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=PT(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=PT(i.parent),i.context)return i;return null})(s,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,u=p(l.modelUserId)?l.modelUserId:null,d=p(l.markUserId)?l.markUserId:null,g={event:n,type:e,source:t,item:o,datum:RT(o),markId:h,modelId:c,markUserId:d,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(n=this._stage)||void 0===n||n.addEventListener(e,r)}else if(t===NT.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();null==s||s.addEventListener(e,n)}else if(t===NT.canvas){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._canvasListeners.set(i,{type:e,callback:n});const r=null===(s=this.getStage())||void 0===s?void 0:s.window;null==r||r.addEventListener(e,n)}}removeEventListener(t,e,i){var n,s,r,a,o;if(!1!==this._option.interactive)if(t===NT.chart){const t=null===(n=this._viewListeners.get(i))||void 0===n?void 0:n.callback;t&&(null===(s=this._stage)||void 0===s||s.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===NT.window){const t=this._getGlobalThis(),n=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;n&&(null==t||t.removeEventListener(e,n)),this._windowListeners.delete(i)}else if(t===NT.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,n=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&n&&(null==t||t.removeEventListener(e,n)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,n=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==n||n(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{ak(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=ok(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return zS(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{Vg.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{ak(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Vg.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){Vg.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function LO(t,e){var n;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(n=null==e?void 0:e.onError)&&void 0!==n?n:FS)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const FO={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}},UO={poptip:U({},FO)};function NO(t){t.crosshair=G(t.crosshair||{}).map((e=>mw({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function jO(t,e,i){var n;const{width:s,height:r}=t;if(p(s)&&p(r))return{width:s,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=Ee(l,i.width,i.height);a=t,o=e}else if(h&&zS(e.mode)){let t;t=y(h)?Vg.getElementById(h):h;const{width:e,height:n}=Ee(t,i.width,i.height);a=e,o=n}else if(HS(e.mode)&&(null===(n=e.modeParams)||void 0===n?void 0:n.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=s?s:a,o=null!=r?r:o,{width:a,height:o}}const zO=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function WO(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function HO(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function VO(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const n=t.effects;zO.forEach((t=>{i[t]&&(n[t]=n[t]||i[t])}))}))}(t,...e),t}function GO(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var YO,XO,KO,$O,qO,ZO;t.LayoutZIndex=void 0,(YO=t.LayoutZIndex||(t.LayoutZIndex={}))[YO.SeriesGroup=0]="SeriesGroup",YO[YO.Axis_Grid=50]="Axis_Grid",YO[YO.CrossHair_Grid=100]="CrossHair_Grid",YO[YO.Region=450]="Region",YO[YO.Mark=300]="Mark",YO[YO.Node=400]="Node",YO[YO.Axis=100]="Axis",YO[YO.MarkLine=500]="MarkLine",YO[YO.MarkArea=100]="MarkArea",YO[YO.MarkPoint=500]="MarkPoint",YO[YO.DataZoom=500]="DataZoom",YO[YO.ScrollBar=500]="ScrollBar",YO[YO.Player=500]="Player",YO[YO.Legend=500]="Legend",YO[YO.CrossHair=500]="CrossHair",YO[YO.Indicator=500]="Indicator",YO[YO.Title=500]="Title",YO[YO.Label=500]="Label",YO[YO.Brush=500]="Brush",YO[YO.CustomMark=500]="CustomMark",YO[YO.Interaction=700]="Interaction",t.LayoutLevel=void 0,(XO=t.LayoutLevel||(t.LayoutLevel={}))[XO.Indicator=10]="Indicator",XO[XO.Region=20]="Region",XO[XO.Axis=30]="Axis",XO[XO.DataZoom=40]="DataZoom",XO[XO.Player=40]="Player",XO[XO.ScrollBar=40]="ScrollBar",XO[XO.Legend=50]="Legend",XO[XO.Title=70]="Title",XO[XO.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(KO=t.AttributeLevel||(t.AttributeLevel={}))[KO.Default=0]="Default",KO[KO.Theme=1]="Theme",KO[KO.Chart=2]="Chart",KO[KO.Base_Series=3]="Base_Series",KO[KO.Series=4]="Series",KO[KO.Mark=5]="Mark",KO[KO.User_Chart=6]="User_Chart",KO[KO.User_Series=7]="User_Series",KO[KO.User_Mark=8]="User_Mark",KO[KO.User_SeriesStyle=9]="User_SeriesStyle",KO[KO.Built_In=99]="Built_In";class JO{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,U({},JO.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}JO.defaultMarkInfo={};class QO{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class tR{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const n=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(n.spec,e,i),n}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>mw({},i,n,t);return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class eR extends QO{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=tR,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new JO,this._lastLayoutRect=null,this.id=GS(),this.userId=t.id,this._spec=t,this.effect={},this.event=new DT(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:n}=e,s=Object.assign({},e);i&&(s.style=this._convertMarkStyle(i)),n&&(s.state={},Object.keys(n).forEach((t=>{s.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(s)}stateKeyToSignalName(t,e){let i=`${Vw}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},n){const{type:s,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=xw.createMark(s,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),n&&l.setMarkConfig(n)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!d(e))return P(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class iR{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var n;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(n=null==e?void 0:e.getSpec)||void 0===n?void 0:n.call(e)}_setLayoutAttributeFromSpec(t,e){var i,n,s,r;if(this._spec&&!1!==this._spec.visible){let a=sw(aw(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:nw(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(n=this._maxHeight)&&void 0!==n?n:null:nw(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(s=this._minWidth)&&void 0!==s?s:null:nw(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:nw(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:nw(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:nw(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=nw(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=nw(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,n,s,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(n=t.layoutLevel)&&void 0!==n?n:this.layoutLevel,this.layoutOrient=null!==(s=t.orient)&&void 0!==s?s:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=nw(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};d(n)||(r.width-=n),d(s)||(r.width-=s),d(e)||(r.height-=e),d(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(d(n)?d(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,d(e)?d(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var n,s,r,a;A(t)&&(null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(rw(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class nR extends eR{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new iR(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&W(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=U(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=U(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(n=this._spec.orient)&&void 0!==n?n:this._orient,this.layoutLevel=null!==(s=this._spec.layoutLevel)&&void 0!==s?s:this.layoutLevel}}class sR extends tR{_initTheme(t,e){return{spec:t,theme:this._theme}}}class rR extends nR{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(e,i){var n;super(e,i),this.transformerConstructor=sR,this.modelType="region",this.specKey="region",this.type=rR.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(n=e.coordinate)&&void 0!==n?n:"cartesian"}_getClipDefaultValue(){var t,e,i,n;const s=this._option.getChart().getSpec(),r=null===(e=null===(t=s.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(n=null===(i=s.scrollBar)||void 0===i?void 0:i.some)||void 0===n?void 0:n.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const n=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),n&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,n){var s,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:n});const o=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return W(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!p(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(n=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function aR(t){const e=[],i=[],n=[];return t.forEach((t=>{d(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&n.push(t)})),{startItems:e,endItems:n,middleItems:i}}function oR(t,e,i){e?t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+s})}))})):t.forEach((t=>{const e=Y(t),n=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,s=(i-n)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+s,y:t.getLayoutStartPoint().y})}))}))}function lR(t,e,i,n){let s;t.forEach(((t,r)=>{t.length>1&&(s=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?s-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):s-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+n*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+n*a*r})})))}))}function hR(t,e,i,n,s,r){if(t.length){let a=0;const o="right"===s,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const u=[];let d=[];const p=[];t.forEach((t=>{const{rect:n}=pR(t,e,r),s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=s,c>i&&d.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+s,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),u.push(d),d=[t]):(a=Math.max(a,g),d.push(t))})),p.push(a),u.push(d),lR(u,!0,p,l),n&&oR(u,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function cR(t,e,i,n,s){if(t.length){let i=0;const r="right"===n,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{rect:n}=pR(t,e,s),d=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:n}=pR(t,e,r),s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&d.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=s,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),u.push(d),d=[t]):(l=Math.max(l,s),d.push(t))})),p.push(l),u.push(d),lR(u,!1,p,o),n&&oR(u,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function dR(t,e,i,n,s){if(t.length){const i="top"===n,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{layoutTag:n,layoutRect:u,rect:d}=pR(t,e,s),p=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-d.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),n=t.filter((t=>"region-relative-overlap"===t.layoutType)),s=i.concat(n),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return n.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:n,allRelatives:s,overlapItems:r}}layoutItems(t,e,i,n){var s,r,a;this._layoutInit(t,e,i,n);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(s=null==t?void 0:t.getSpec())||void 0===s?void 0:s.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:u,relativeOverlapItems:d,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,u,d,g,o,l),this._processAutoIndent(c,u,d,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},s,r,a,o=!1){if(s.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:u}=this._checkAutoIndent(s,r);(l||h||c||u)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-u,this.layoutRegionItems(t,e,i,n,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=pR(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),n=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=aR(t);s.length&&hR(s,e,i,!1,"left",n),r.length&&hR(r,e,i,!0,"left",n),a.length&&cR(a,e,0,"left",n)}(i,this,o,e),s.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=aR(t);s.length&&uR(s,e,i,!1,"top",n),r.length&&uR(r,e,i,!0,"top",n),a.length&&dR(a,e,0,"top",n)}(s,this,a,e),n.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=aR(t);s.length&&hR(s,e,i,!1,"right",n),r.length&&hR(r,e,i,!0,"right",n),a.length&&cR(a,e,0,"right",n)}(n,this,o,e),r.length&&function(t,e,i,n){const{startItems:s,middleItems:r,endItems:a}=aR(t);s.length&&uR(s,e,i,!1,"bottom",n),r.length&&uR(r,e,i,!0,"bottom",n),a.length&&dR(a,e,0,"bottom",n)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:n}=pR(t,this,i);e.rect.width=Math.max(n.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(n.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{W(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=pR(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const n=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),s=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=n-t.layoutPaddingLeft-t.layoutPaddingRight,i=s-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:s,regionWidth:n}}layoutRegionItems(t,e,i,n={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},s,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),this._layoutRelativeOverlap("left",n.left,s),this._layoutRelativeOverlap("right",n.right,s),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),this._layoutRelativeOverlap("top",n.top,s),this._layoutRelativeOverlap("bottom",n.bottom,s),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,s)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:u}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+u-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.getModelId()===e));return n||(null!==(i=this._onError)&&void 0!==i?i:FS)("can not find target region item, invalid id"),n}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const n="left"===t.layoutOrient||"right"===t.layoutOrient,s=t.getLastComputeOutBounds(),r=this._getOutInLayout(s,t,e);n?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:n,y:s}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(n-t.x1),right:n+r+t.x2-i.right,top:i.top-(s-t.y1),bottom:s+a+t.y2-i.bottom}}}gR.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}($O||($O={})),t.STATE_VALUE_ENUM=void 0,(qO=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",qO.STATE_HOVER="hover",qO.STATE_HOVER_REVERSE="hover_reverse",qO.STATE_DIMENSION_HOVER="dimension_hover",qO.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",qO.STATE_SELECTED="selected",qO.STATE_SELECTED_REVERSE="selected_reverse",qO.STATE_SANKEY_EMPHASIS="selected",qO.STATE_SANKEY_EMPHASIS_REVERSE="blur",qO.STATE_HIGHLIGHT="highlight",qO.STATE_BLUR="blur",qO.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(ZO||(ZO={}));const fR=["linear","radial","conical"],mR={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const vR={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{vR[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class yR extends QO{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(U(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class _R extends yR{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];p(n.domain)&&(s.domain=n.domain),p(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,nk.includes(t));var t}checkOneState(t,e,i){var n;let s=!1,r=!1;if(p(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e),r=!0;else if(i.items)s=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:this._mark.type};s=i.filter(null==e?void 0:e[0],n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){var i;const n=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!vR[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const n=e[0];if(_(t.datums)){const e=this._isMultiMark(),s=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Vw)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?s.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])})):s.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(Vw))),s=this._isMultiMark();i=e.every((e=>{var i,r;return s?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var n;let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(n=e[0])||void 0===n?void 0:n[r];if(FA(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n){var s;const r=this._isMultiMark()?null===(s=i[0])||void 0===s?void 0:s[e]:i[e];return rt[t.length-1]}release(){}}class bR extends QO{constructor(){super(...arguments),this.id=GS(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=xw.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class xR extends bR{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const SR=1e3,AR="quadInOut",CR=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],wR=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=nl(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},TR=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?M_(t):[],s=M_(e);i&&n&&(i.fromTransform&&B_(n,i.fromTransform.clone().getInverse()),B_(n,i.toTransfrom));const[r,a]=k_(n,s);return t?T_(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},MR=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],BR=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!MR.includes(s))return;const r=e[s];if(!d(r)&&!d(t[s])&&r!==t[s]){if("fill"===s||"stroke"===s){const e=t=>"string"==typeof t?el.Get(t,tl.Color255):t;i.push({from:_(t[s])?t[s].map(e):e(t[s]),to:_(r)?r.map(e):e(r),key:s})}else i.push({from:t[s],to:r,key:s});n=!0}})),n?i:null};class ER extends Mf{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;TR(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&wR(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):bf(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const PR=(t,e,i,n)=>{var s,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=kR(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=BR(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const u=new ER({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:SR,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:AR);return c.play(u),c};class OR extends Mf{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;TR(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&wR(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const RR=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>CR.includes(t))(i)||(e[i]=t[i])})),e},IR=(t,e,i)=>{const n=RR(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{t.setAttributes({pickable:!1}),s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Ps.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});s.appendChild(i),e.push(i)}))}},DR=(t,e,i)=>{const n=[],s=i?null:RR(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:RR(t.attribute);if("rect"===t.type)O_(t,e).forEach((t=>{n.push(Ps.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)R_(t,e).forEach((t=>{n.push(Ps.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)I_(t,e).forEach((t=>{n.push(Ps.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=F_(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Ps.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?W_(t,e).forEach((t=>{n.push(Ps.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?L_(t,e).forEach((t=>{n.push(Ps.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&H_(t,e).forEach((t=>{"path"in t?n.push(Ps.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Ps.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&IR(t,n,e),n},FR=(t,e,i,n)=>"function"==typeof t?t(e,i,n):t,UR=(t,e,i,n,s)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=FR(l.delay,s,a,o),u=FR(l.duration,s,a,o),d=FR(l.oneByOne,s,a,o),p=FR(l.splitPath,s,a,o),g=A(d)&&d>0?t=>S(d)?t*d:!0===d?t*u:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?DR:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:LR)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);PR(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:u,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?DR:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:LR)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>kR(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>BR(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Wi.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const u=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),d=e.animate(Object.assign({},i,{onEnd:r}));d.wait(u),d.play(new ER({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:SR,null!==(l=i.easing)&&void 0!==l?l:AR))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Wi.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new OR({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:SR,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:AR))}})(t,e[0],{delay:c,duration:u,easing:h,onEnd:n,individualDelay:g,splitPath:p}):PR(t[0],e[0],{delay:c,duration:u,easing:h,onEnd:n})},NR=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))},jR=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,n;const s=null===(n=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===n?void 0:n[0];s&&(t.context.morphKey=s[e.morphElementKey])}))}},zR=(t,e,i)=>{var n;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const s=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,s)?null===(n=t.invalidateResolver)||void 0===n||n.call(t):s.length?t.useStates(s,i):t.clearStates(i)},WR=(t,e,i=!0,n)=>{var s;if(!e)return;const r=i&&null!==(s=t.currentStates)&&void 0!==s?s:[],a=i?Array.from(new Set([...r,e])):[e];zR(t,a,n)},HR=(t,e,i)=>{var n;const s=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!s.length)return;const r=(null!==(n=t.currentStates)&&void 0!==n?n:[]).filter((t=>!s.includes(t)));zR(t,r,i)},VR=Symbol("statesClearedBeforeReInit");class GR extends bR{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const n=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var s,r;const a="function"==typeof n?n(t,e,i):n;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(s=e.context.compiler.getChart())||void 0===s?void 0:s.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},n={};Object.keys(t).forEach((e=>{const s=t[e];_(s)?n[e]=s.map(i):p(s)&&(n[e]=i(s))})),this._animationConfig=n}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new xR(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=wh("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var n;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Xn)),i&&(u(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,n,s;const r=t.context.diffState===$O.enter||t.context.diffState===$O.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(n=t.effectiveStates)||void 0===n?void 0:n.length)||t.resolvedStatePatch||(null===(s=t.registeredActiveScopes)||void 0===s?void 0:s.size));((null==r?void 0:r.length)||a)&&zR(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new _R(i,this),this._attributeContext=i.attributeContext,null===(n=i.map)||void 0===n||n.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,n=i.range();return i.range(n.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,Nt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((s=>{let r=t[s];d(r)||(r=this._filterAttribute(s,r,e,i,n),this.setAttribute(s,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,n,s){let r=this._styleConvert(e);if(s)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var n;if(t)if(e&&i){const s=null!==(n=this.stateStyle[i])&&void 0!==n?n:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},s[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var n;(null===(n=this.stateStyle[i])||void 0===n?void 0:n[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const n={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(n[i]=this._computeAttribute(i,e)(t))})),n}}setAttribute(t,e,i="normal",n=0){var s;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:n,style:e,referer:void 0});const r=null===(s=this.stateStyle[i][t])||void 0===s?void 0:s.level;p(r)&&r<=n&&mw(this.stateStyle[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(UA(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=qC(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let n=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];n||(n=this.stateStyle.normal[t]);const s=this._computeStateAttribute(n,t,e),r=u(null==n?void 0:n.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=s(r);return a=n.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>n.postProcess(s(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return n=>i(t,n,e,s(n))}return s}_computeStateAttribute(t,e,i){var n;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):fR.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):UA(null===(n=t.style.scale)||void 0===n?void 0:n.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const n=i[e];if("style"in n){const i=n.style;let s={stateValue:e};"level"in n&&(s.level=n.level),"filter"in n&&(s=u(n.filter)?Object.assign({filter:n.filter},s):Object.assign(Object.assign({},n.filter),s)),this.state.addStateInfo(s),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(n,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,n,s,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let d=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(d=t),g||(g=e)}const f=zC(jC(this.model.getColorScheme(),"series"===this.model.modelType?null===(n=(i=this.model).getSpec)||void 0===n?void 0:n.call(i):void 0),null!==(a=null===(r=null===(s=this.model)||void 0===s?void 0:s.getDefaultColorDomain)||void 0===r?void 0:r.call(s))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},mR[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((n=>{const s=m[n];"stops"===n?e.stops=s.map((e=>{const{opacity:n,color:s,offset:r}=e;let a=null!=s?s:null==d?void 0:d.scale(t[g]);return u(s)&&(a=s(t,this._attributeContext,i)),p(n)&&(a=we.SetOpacity(a,n)),{offset:u(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):u(s)?e[n]=s(t,this._attributeContext,i):e[n]=s})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:n}=t,s=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(s).forEach((e=>{const i=s[e];u(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)fR.includes(null===(a=s.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(s.stroke)(t));else{const s=zC(jC(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=n;if(!(i&&n||"series"!==this.model.modelType)){const{scale:e,field:n}=this.model.getColorAttribute();i||(a=e),l||(l=n),o.stroke=(null==a?void 0:a.scale(t[l]))||s[0]}}return o}}_getDataByKey(t){return sk(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return xw.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=u(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[$w],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=sk(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===tk.appear))?tk.appear:t.every((t=>t===tk.disappear))?tk.disappear:t[0];return null!=e?e:tk.none}createAnimationStateList(t,e){var i;let n=e[t];return n&&Array.isArray(n)&&(n=1===n.length?n[0]:n),Array.isArray(n)?n.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):n?Object.assign(Object.assign({},n),{priority:"normal"===t?null!==(i=n.priority)&&void 0!==i?i:1/0:n.priority}):n}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const n=[],s=[];t.forEach((t=>{jR(t),n.push(...t.getGraphics())})),e.forEach((t=>{jR(t),s.push(...t.getGraphics())}));const r=t=>{var e,i,n;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(n=t.context)||void 0===n?void 0:n.key},a=new Map,o=new Map;if(n.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),s.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const u=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);UR([],e,i,u,{}),c+=1})),l.forEach((t=>{const e=a.get(t),n=o.get(t),s=Math.min(e.length,n.length);if(s>0){const t=NR(e,s),r=NR(n,s);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",n);if(s&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(n.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",n)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=n[e];if(i&&i.length>0){const n=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));n.forEach((e=>{e.animation.customParameters=t.context}));const s=[e];t.applyAnimationState(s,[1===n.length?n[0]:n])}"enter"===e&&n.normal&&(a=!0)})),a&&this._product&&(null===(i=n.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",n)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,n;const s=("component"===this.type?this.model.getAnimationStateCallback():null===(n=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===tk.exit?tk.exit:i===tk.update?tk.update:tk.appear}),r=s(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===$O.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,n=[],s=new Set(this._graphics.filter((t=>t.context.diffState===$O.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=$O.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=$O.enter,f.isExiting=!1,this._graphicMap.set(t,f),n.push(f)):(f=this._graphicMap.get(t),f&&(m=$O.update,n.push(f))),f&&(s.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=tk.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=tk.disappear}));s.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=n.length;n.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=n,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return rk(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=rk(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((n=>{this._unCompileChannel[n]||(this._option.noSeparateStyle||function(t,e,i){var n;const s=null===(n=e[t])||void 0===n?void 0:n.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,s);return!!r||(!!u(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(n,t,this._groupKey)?e[n]=t[n]:i[n]=t[n])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,n;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!s||s.referer||u(s.postProcess)||e in this._computeExChannel)return!1;const r=s.style;return!u(r)&&(!fR.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!UA(null===(n=null==r?void 0:r.scale)||void 0===n?void 0:n.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,n=new Map;i.forEach(((t,e)=>{n.set(t,e)}));const s={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=n.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),s[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==n?void 0:n.style)}:${this._getSharedStateDefinitionRefId(null==n?void 0:n.postProcess)}:${this._getSharedStateDefinitionRefId(null==n?void 0:n.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=s,this._product.sharedStateDefinitions=s)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const n=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);d(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const s=this._transformGraphicAttributes(t,i,null==n?void 0:n[t.context.groupKey]);t.context.finalAttrs=s}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,n;if(!e||!Object.keys(e).length)return;const s=t;null===(i=s.setFinalAttributes)||void 0===i||i.call(s,e),s._commitAnimationStaticAttributes?s._commitAnimationStaticAttributes(e):null===(n=s.commitInternalBaseAttributes)||void 0===n||n.call(s,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,n)=>{var s,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,IT(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?n:n+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(s=this.renderContext)||void 0===s?void 0:s.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:n}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,n)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:n,overflow:s}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(n)){const e=_(n)?n:n(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(s)||(t.overflow=s),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=xw.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const n=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=xw.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(n,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const n=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],s=this._runBeforeTransform(n);let r;if(null==s?void 0:s.progressive){this.renderContext={beforeTransformProgressive:s.progressive};const t=s.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(s),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===ik.before||(this._product||this._initProduct(),DS(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const n=i,s=n[VR],r=null==s?void 0:s.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?WR(i,t,!0,a):HR(i,t,a),r){const e=s.filter((e=>e!==t));e.length?n[VR]=e:delete n[VR]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===$O.exit&&!e.isExiting)if(e.context.animationState===$O.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const n=this.getAnimationConfig();if(n.exit&&n.exit.length){const s=n.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===s.length?s[0]:s],(()=>{e.context.diffState===$O.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((n=>{const s=this.renderContext.progressive.groupedData.get(n),r=this.renderContext.progressive.step,a=s.slice(t*r,(t+1)*r),o=[];a.forEach(((i,s)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$O.enter,data:[i],uniqueKey:`${n}_${null!=a?a:t*r+s}`,key:a,groupKey:n})};o.push(l),e.push(l)})),i[n]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=wh({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,n;if(this._attrsByGroup&&t){const s=t.parent;s&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&s.setTheme({common:this._attrsByGroup[null===(n=t.context)||void 0===n?void 0:n.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[VR]=t.currentStates.slice())}))}}var YR;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(YR||(YR={}));class XR extends GR{constructor(){super(...arguments),this.type=XR.type,this._marks=[],this._diffState=$O.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(LS("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?(LS("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return ak(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===$O.update){const t=this.hasAnimation(),e=IT(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=$O.update}render(){this._isCommited&&(DS(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}XR.type="group";const KR={measureText:Hw};class $R{static instance(){return $R.instance_||($R.instance_=new $R),$R.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 qR{constructor(){this.id=GS(),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))?LS("不要重复添加相同的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 ZR extends qR{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((n=>{n.onAfterModelSpecTransform&&n.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const JR=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},QR=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class tI extends l{constructor(t,e={}){var i,n,s,r,a,o,l,h,c,u;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=xi.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=xi.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||JR(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,u=QR(l[0],l[1]);n.scale=u/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const i=xi.now(),s=this.lastMoveTime;if(i-s<100){const t=s-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=QR(i,s),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=JR(i,s),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(u=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==u?u:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if("press"===e)return e;let s;return s=xi.now()-i>this.config.press.time&&QR(n[0],t){Ps.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n{var n,s;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(s=null===(n=t.points)||void 0===n?void 0:n.length)&&void 0!==s?s:0)})),i}return[]}onBind(){var t,e,i,n,s;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(n=l.finalAttrs)&&void 0!==n?n:{},c=null!==(s=l.diffAttrs)&&void 0!==s?s:{},u=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:u&&Object.prototype.hasOwnProperty.call(u,"points")&&(this.to.points=u.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:u&&Object.prototype.hasOwnProperty.call(u,"segments")&&(this.to.segments=u.segments),this.props=this.to;const d=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=d?Array.isArray(d)?d:[d]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=ut(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ft(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&Zg(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(yf(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const n=Hs(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));bf(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const n=t+this.segmentsCache[i],s=this.points.slice(t,n);return t=n,Object.assign(Object.assign({},e),{points:s})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const iI={type:"fadeIn"};function nI(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 iI;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const sI={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},rI={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},aI=()=>{xw.registerAnimation("scaleInOut",(()=>rI))},oI=(t,e)=>({appear:nI(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:eI,duration:sI.update.duration,easing:sI.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),lI=()=>{xw.registerAnimation("line",oI)},hI=()=>{Jg.registerBuiltInAnimate("growPointsIn",FE),Jg.registerBuiltInAnimate("growPointsOut",UE),Jg.registerBuiltInAnimate("growPointsXIn",jE),Jg.registerBuiltInAnimate("growPointsXOut",zE),Jg.registerBuiltInAnimate("growPointsYIn",HE),Jg.registerBuiltInAnimate("growPointsYOut",VE),Jg.registerBuiltInAnimate("clipIn",SE),Jg.registerBuiltInAnimate("clipOut",AE)},cI=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class uI{constructor(t){this._markSet=new JO,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const n=t.stateStyle;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const n=this.getMarkIdByState();return n&&n[e]&&n[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const dI={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class pI extends uI{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:n}=this.options;this._lastGraphic&&(n.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,n.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const n=t.item,s=n&&this._markSet.getMarkInId(n.context.markId);(this._resetType.includes("view")&&!s||this._resetType.includes("self")&&s)&&this.resetAll(t)},this.options=Object.assign({},dI,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:n,interaction:s}=this.options;if(this._lastGraphic===t)return;const r=s.updateStates(this,[t],s.getStatedGraphics(this),i,n);s.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&HR(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}pI.type="element-highlight",pI.defaultOptions=dI;const gI=()=>{xw.registerInteractionTrigger(pI.type,pI)},fI={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class mI extends uI{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:n}=this.options,s=n.getStatedGraphics(this);s&&s.length&&(n.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:s,options:this.options},t)),n.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const n=t.item,s=n&&this._markSet.getMarkInId(n.context.markId);(this._resetType.includes("view")&&!s||this._resetType.includes("self")&&s)&&this.resetAll(t)},this.options=Object.assign({},fI,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:n,resetType:s}=(t=>{const e=G(t),i=[],n=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(n.push(t.replace("view:","")),i.push("view")):(n.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:n,resetType:i}})(t);return n.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=s,i}start(t,e){const{state:i,reverseState:n,isMultiple:s,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const s=a&&a.filter((e=>e!==t));s&&s.length?r.setStatedGraphics(this,r.updateStates(this,s,a,i,n)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),WR(t,i,!0);const o=this.options.interaction.updateStates(this,s&&a?[...a,t]:[t],a,i,n);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&HR(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}mI.type="element-select",mI.defaultOptions=fI;const vI=()=>{xw.registerInteractionTrigger(mI.type,mI)};class yI extends qR{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const _I=(t,e=!0)=>{var i,n,s,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(s=(n=t).removeAllChild)||void 0===s||s.call(n,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},bI=t=>{var e,i;const n=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{n.push(...bI(t))})),n},xI=(t,e={})=>{var i,n;const{enableExitAnimation:s=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!s||!(null===(n=(i=t).releaseWithExitAnimation)||void 0===n?void 0:n.call(i,{removeFromParent:r,onComplete:a})))||(_I(t,r),!1)};class SI{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>xw.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>xw.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>xw.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return xw.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>xw.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){xw.registerTransform(t,e)}static registerFunction(t,e){t&&e&&$R.instance().registerFunction(t,e)}static unregisterFunction(t){t&&$R.instance().unregisterFunction(t)}static getFunction(t){return t?$R.instance().getFunction(t):null}static getFunctionList(){return $R.instance().getFunctionNameList()}static registerMap(t,e,i){const n=xw.getImplementInKey("registerMap");n&&n(t,e,i)}static unregisterMap(t){const e=xw.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,XT.get(e);var e}static registerSVG(t,e,i){const n=xw.getImplementInKey("registerSVG");n&&n(t,e,i)}static unregisterSVG(t){const e=xw.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){Dw.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 nt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,n){var s,r,a,o,l,h,c,u,d;this.id=GS(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=ck.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var n;if(this._isReleased)return;this._reSetRenderState();const s=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;W(s.theme,this._spec.theme)?W(this._spec.background,s.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(s);if(r.reSize=a,this._spec.type!==s.type)return null===(n=this._compiler)||void 0===n||n.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=VO(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,n)=>{var s;if(1!==n||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const n="series"===t[0]?xw.getSeriesBuiltInTheme(e):xw.getComponentBuiltInTheme(e);i=i?mw({},n,i[e]):n}n===t.length-1&&p(i)&&(i=Nw({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e],(null===(s=this.getFunctionList())||void 0===s?void 0:s.length)&&(i=zw(i,this)))})),this._cachedProcessedTheme[e]=i,i},IA(n),this._option=Object.assign(Object.assign({},this._option),n),(null==n?void 0:n.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),n.optimize)),this._onError=null===(s=this._option)||void 0===s?void 0:s.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=zS(v);if(S?oM(wy):"node"===v&&hB(wy),S&&f&&(this._container=y(f)?Vg.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=Lw.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],C=[];if(!1!==b){const t=xw.getRuntimePluginInstaller("poptipForText");t&&(t(),C.push(t)),A.push("poptipForText")}"sankey"===i.type&&A.push("scrollbar");const w=new nt(null!==(a=this._option.logLevel)&&void 0!==a?a:it.Error);nt.setInstance(w),(null===(o=this._option)||void 0===o?void 0:o.onError)&&w.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new DO({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:C},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new VT(this,this._compiler),this._event=new DT(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),Dw.registerInstance(this),null===(d=null===(u=this._option.performanceHook)||void 0===u?void 0:u.afterCreateVChart)||void 0===d||d.call(u,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=mw({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=jw(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,n;SI.getFunctionList()&&SI.getFunctionList().length&&(t=zw(t,SI)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=xw.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(n=this._chartSpecTransformer)||void 0===n?void 0:n.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=xw.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(e){var i,n,s;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(n=this._option)||void 0===n||n.onError("chart is already initialized"));const r=xw.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=mt(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,n;return jO(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:Gw,height:null!==(n=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==n?n:Yw})}_initDataSet(t){this._dataSet=t instanceof ui?t:new ui,YT(this._dataSet,"dataview",li),YT(this._dataSet,"array",n),GT(this._dataSet,"copyDataView",$T);for(const t in xw.transforms)GT(this._dataSet,t,xw.transforms[t]);for(const t in xw.dataParser)YT(this._dataSet,t,xw.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return u(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),WO(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,n,s,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(s=this._compiler)||void 0===s||s.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,n,s,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const n=e=>{var i;const n=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===n?tk.none:tk.appear:n};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(n)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(n)}))}}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(n=this._compiler)||void 0===n||n.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,Dw.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{_I(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,n,s){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,n,s)}))}_updateDataById(t,e,i){const n=this._spec.data.find((e=>e.name===t||e.id===t));n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,n){return this._isReleased?this:(this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==n?void 0:n.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const n=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:s,fields:r}=t,a=n.find((t=>t.name===e));if(a)a instanceof di?(a.setFields(I(r)),a.parse(i,I(s))):(a.values=i,p(s)&&(a.parser=s),p(r)&&(a.fields=r));else{const e=ZT(t,this._dataSet,n);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,n,s){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,s);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:n,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,n){const s=this._updateSpec(t,e,n);return s?(this.updateCustomConfigAndRerender(s,!0,{morphConfig:i,transformSpec:s.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const n=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(n,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,n=!1,s){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,n,s)}))}updateModelSpecSync(t,e,i=!1,n){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),u(t)||function(t,e,i,n){Object.keys(t).forEach((s=>{if(g(e))e.type===s&&(_(t[s])?t[s].length>=e.index&&(t[s][e.index]=n?mw({},t[s][e.index],i):i):t[s]=n?mw({},t[s],i):i);else if(_(t[s])){const r=t[s].findIndex((t=>t.id===e));r>=0&&(t[s][r]=n?mw({},t[s][r],i):i)}else t.id===e&&(t[s]=n?mw({},t[s],i):i)}))}(this._spec,t,e,i),this._chart){const s=this._chart.getModelInFilter(t);if(s)return this._updateModelSpec(s,e,!0,i,n)}return this}_updateModelSpec(t,e,i=!1,n=!1,s){n&&(e=mw({},t.getSpec(),e));const r=t.updateSpec(e),a=WO(r),o=HO(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:s,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,n;return this._beforeResize(t,e)?(null===(n=(i=this._compiler).resize)||void 0===n||n.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,n,s,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(n=this._event)||void 0===n||n.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const n=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));n>=0&&(this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,n;const s=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=Sw({},e,e.chart[t])),e};let l;if(E(s)&&E(r))l=Fw(this._currentThemeName),this._currentTheme=o(a,l);else{const t=Sw({},Fw(g(r)&&r.type?r.type:g(s)&&s.type?s.type:this._currentThemeName),Fw(s),Fw(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),U(UO.poptip,FO,h),null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let n=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(n=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(n=!0);const s=this._autoSize;return this._autoSize=!!zS(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==s&&(n=!0),n}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return Fw(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!Lw.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const n=this._getTooltipComponent();n&&(null===(i=null===(e=n.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),n.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const n=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==n?void 0:n.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);n&&n[t]&&n[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield LO(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,n;return i(this,void 0,void 0,(function*(){if(!zS(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(n=this._option)||void 0===n||n.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}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)?Vg.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,n){var s;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===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o){const e=Object.keys(t),s=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=s?o.dataToPosition(s,n):o.dataToPosition(t,n),a?ow(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||d(t)||E(e))return null;if(!_(t)){const{axisId:s,axisIndex:r}=e;let a;if(p(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):p(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return LS("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?ow(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(LS("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return $R.instance().getFunction(t)}registerFunction(t,e){t&&e&&$R.instance().registerFunction(t,e)}unregisterFunction(t){t&&$R.instance().unregisterFunction(t)}getFunctionList(){return $R.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);n&&n[t]&&n[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var n,s;const a=null===(n=this._chart)||void 0===n?void 0:n.getRegionsInQuerier(t)[0],o=null===(s=this._chart)||void 0===s?void 0:s.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=xw.getChartPlugins();t.length>0&&(this._chartPlugin=new ZR(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=xw.getVChartPlugins();e.length>0&&(this._vChartPlugin=new yI(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=ck.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=ck.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}SI.InstanceManager=Dw,SI.ThemeManager=Lw,SI.globalConfig={uniqueTooltip:!0},SI.Utils=KR,SI.vglobal=Vg;xw.registerRegion("region",rR),xw.registerLayout("base",gR),vS(),ox(),xw.registerMark(XR.type,XR),xw.registerStageEventPlugin("gesture",tI),gI(),vI(),Ew(gw.name,gw);const AI="monotone",CI="linear",wI="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class TI{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function kI(t,e){return e("component",t)}function MI(t,e,i,n){if(t)return{formatFunc:t,args:[i,n]};const s=xw.getFormatter();return e&&s?{formatFunc:s,args:[i,n,e]}:{}}const BI=(t,e,i,n)=>{if(d(t[e]))return;const s=_(t[e]),r=s?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||n&&!n(t)||a.push({spec:t,specPath:s?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},EI=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},PI=(t,e,i,n)=>{let s;if(s=u(t)?t(e,i):m(t)&&p(t.field)?P(e,t.field):t,n){const{formatFunc:i,args:r}=MI(void 0,n,t,e);i&&r&&(s=i(...r))}return s},OI=(t,e,i)=>d(t)?t:u(t)?t(e,i):t;const RI=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function II(t,i,n,s,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},s),n),i):Object.assign(Object.assign({},s),i),{key:h,keyFormatter:c,keyTimeFormat:u,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=LI(PI(h,r,a,c),u,g),o.value=LI(PI(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=PI(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function DI(t,e,i,n,s,r,a){if(u(e)){II(t,e(s,a),i,n,r,a)}else e&&II(t,e,i,n,r,a)}const LI=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const n=Oe.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?n.timeFormat:n.timeUTCFormat)(e,t)};class FI{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:p(s)?G(s):null!==(t=n.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=n.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=n.getMeasureField())&&void 0!==i?i:[],type:n.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const n=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[n]},this._getSeriesStyle=(t,e,i)=>{var n;for(const i of G(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let n=this._seriesCacheInfo.dimensionFields;return i[0]&&(n=n.filter((t=>t!==i[0]))),n.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var n,s,r,a,o,l,h,c,u,d,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(n=null==i?void 0:i.style)||void 0===n?void 0:n.shape),null==i?void 0:i[t]),null===(s=null==i?void 0:i[t])||void 0===s?void 0:s[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(u=m.shapeStroke)&&void 0!==u?u:this.shapeStrokeCallback,shapeHollow:null!==(d=m.shapeHollow)&&void 0!==d&&d,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,n,s,r){var a;return function(t,e,i,n,s,r){if(s&&s.length){const a=[];return s.forEach((s=>{_(t)?t.forEach((t=>{DI(a,t,e,i,n,s,r)})):u(t)?DI(a,t,e,i,n,s,r):t&&II(a,t,e,i,s,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,n,s,r)}getTitleResult(t,e,i,n,s){let r=u(e)?e(n,s):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(n),e={visible:PI(r.visible,t,s),value:LI(PI(r.value,t,s,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:PI(r.valueStyle,t,s),hasShape:r.hasShape};return Object.keys(i).forEach((n=>{e[n]=PI(i[n],t,s)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,n,s){var r,a;if(!(this.enableByType(t)&&RI(t,this.spec)&&("dimension"!==t||n&&n.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,n,s).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,n,s);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,s),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const UI={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},NI=(t,e)=>{var i,n;let s=e.fields;if(u(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return{};s=vT([],s);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(n=(i=t[0]).getFields)||void 0===n?void 0:n.call(i);return jI(a,s,o)},jI=(t,e,i)=>{const n={};let s=[],r=[];return e.forEach((e=>{const a=e.key;n[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;s.length=0,t&&t.forEach((t=>{t&&s.push(t[a])}));const u=s.length;if(h){r.length=0,s.forEach(((t,e)=>{YS(t)&&r.push(t)}));const t=s;s=r,r=t,c=s.length===u}else s=l.some((t=>"array-min"===t||"array-max"===t))?s.reduce(((t,e)=>(e&&e.forEach((e=>{YS(e)&&t.push(e)})),t)),[]):s.filter((t=>void 0!==t));e.filter&&(s=s.filter(e.filter)),l.forEach((t=>{if(e.customize)n[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(n[a][t]=o.domain.slice())}else if("allValid"===t)return;n[a][t]=UI[t](s),"array-max"===t&&(n[a].max=n[a][t]),"array-min"===t&&(n[a].min=n[a][t])}})),h&&(n[a].allValid=c)})),n},zI=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||s&&s.length&&t.forEach((t=>{s.forEach((e=>{YS(t[e])||(t[e]=0)}))})),t};function WI(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function HI(t,e,i){t&&(i.needDefaultSeriesField&&(t[qw]=i.defaultSeriesField),t[Kw]=e,t[$w]=i.getKey(t,e,i))}const VI={label:{name:"label",type:"text"}},GI=`${Vw}_rect_x`,YI=`${Vw}_rect_x1`,XI=`${Vw}_rect_y`,KI=`${Vw}_rect_y1`,$I={data:!0},qI={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},ZI=[...Object.keys(sI),"normal"];function JI(t={},e,i){const n={};for(let s=0;s{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var n;let s=t;return nD(s)&&delete s.type,s.oneByOne&&(s=tD(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:eD,null==i?void 0:i.dataCount)),s})):o.map(((t,e)=>{var n;let s=mw({},o[e],a);return nD(s)&&delete s.type,s.oneByOne&&(s=tD(s,null!==(n=null==i?void 0:i.dataIndex)&&void 0!==n?n:eD,null==i?void 0:i.dataCount)),s})),n[r]=l):n[r]=o}return n}function QI(t,e,i){var n,s,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(n=e.animationAppear[t])&&void 0!==n?n:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(s=e.animationDisappear[t])&&void 0!==s?s:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),sD(t,(t=>{var i;if(u(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function tD(t,e,i){const{oneByOne:n,duration:s,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=u(s)?s(t,i,a):A(s)?s:0,h=u(r)?r(t,i,a):A(r)?r:0;let c=u(n)?n(t,i,a):n;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=u(s)?s(t,r,o):A(s)?s:0,c=u(a)?a(t,r,o):A(a)?a:0;let d=u(n)?n(t,r,o):n;if(!1===d)return c;return d=!0===d?0:d,c+((i?i():r.parent.count-1)-l)*(h+d)},delete t.oneByOne,t}function eD(t,e){var i;return null!==(i=null==t?void 0:t[Kw])&&void 0!==i?i:e.context.graphicIndex}function iD(t,e){var i,n,s,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(s=null===(n=t.animationAppear)||void 0===n?void 0:n[e])&&void 0!==s?s:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function nD(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function sD(t,e,i=[]){if(_(t))t.forEach(((n,s)=>{t[s]=e(t[s],s),sD(t[s],e,i)}));else if(g(t)&&"function"!=typeof t)for(const n in t)i.includes(n)||(t[n]=e(t[n],n),sD(t[n],e,i))}function rD(t){var e,i,n,s,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(n=o.animationThreshold)&&void 0!==n?n:Number.MAX_SAFE_INTEGER;return null===(s=t.getMarks())||void 0===s||s.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class aD extends tR{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,n,s;const r=FC(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=xw.getSeriesMarkMap(o)?function(t,e,i){const n=xw.getSeriesMarkMap(e);if(!n)return t;const s={};return Object.values(n).forEach((({type:e,name:n})=>{s[n]=mw({},i("mark",G(e)[0]),i("markByName",n),null==t?void 0:t[n])})),Object.assign(Object.assign({},t),s)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return mw({},l,h,(null!==(s=null!==(n=this.stack)&&void 0!==n?n:null==h?void 0:h.stack)&&void 0!==s?s:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const n=super.transformSpec(t,e,i);return this._transformLabelSpec(n.spec),Object.assign(Object.assign({},n),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",n="initLabelMarkStyle",s=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!s;this.addLabelSpec(u(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&d)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[n])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:n,innerRadius:s,direction:r}=t;return p(n)&&(i.outerRadius=n),p(s)&&(i.innerRadius=s),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const n=this._getDefaultSpecFromChart(e),s=t=>{const e=mw({},i,n,t),s=i.label;return s&&g(s)&&_(e.label)&&(e.label=e.label.map((t=>mw({},s,t)))),e};return _(t)?{spec:t.map((t=>s(t))),theme:i}:{spec:s(t),theme:i}}return{spec:t,theme:i}}}const oD=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(qI[e]||(t[e]=!0),t)),{}),lD={compileOnlyKeys:qI,dataRelatedKeys:oD,seriesOnlyKeys:{tooltip:!0}},hD={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},cD=t=>(t=>g(t)&&!_(t)&&!u(t))(t)?t:d(t)?{}:null,uD=(t,e,i)=>{const n=cD(t),s=cD(e);if(!n||!s)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(s),...Object.keys(n)]));for(const t of a)if(!W(n[t],s[t])){if(!i[t])return!1;r=!0}return r};function dD(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class pD extends eR{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${Vw}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var n;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=aD,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(n=this._spec)||void 0===n?void 0:n.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=rD(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return d(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(GT(this._rawData.dataSet,"invalidTravel",zI),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const n=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(n&&(this._rawData=ZT(n,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=qT(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=qT(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new xR(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,n,s;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(n=this._rawData.getFields())||void 0===n?void 0:n[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=jI(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=U(null!==(s=this._rawStatisticsCache[t])&&void 0!==s?s:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){GT(this._dataSet,"dimensionStatistics",NI);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new di(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&&vT(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){GT(this._dataSet,"dimensionStatistics",NI);const n=new di(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=vT(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&vT(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new di(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:()=>({fields:this.getStackGroupFields()})},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return d(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:n}=i,s=this._getSeriesDataKey(t);return void 0===n.get(s)?(n.set(s,0),s):(n.set(s,n.get(s)+1),`${s}_${n.get(s)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):u(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(GT(this._rawData.dataSet,"addVChartProperty",EI),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:WI.bind(this),call:HI}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,n,s){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${n}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),s.hasAnimation&&!1!==t.animation){const e=JI({},QI(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${n}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,s)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(n=this._option.mode)===t.RenderModeEnum["desktop-browser"]||n===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:WS(n)||HS(n)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var n;let s=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?s.enable=a:g(a)&&(s.enable=!0,s=mw(s,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=mw(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(s.enable){const t=cI(s,e);t.length&&l.push({trigger:this._defaultHoverConfig(s),marks:t})}if(r.enable){const t=cI(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,n=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:n,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=cI(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const n=null!==(e=this._seriesField)&&void 0!==e?e:qw;this.getMarksWithoutRoot().forEach((e=>{const s={},r={},a={};i.forEach((t=>{var i;const n=null===(i=t[e.name])||void 0===i?void 0:i.style;n&&(s[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(n).forEach((e=>{r[e]=!0,a[t.name][e]=n[e]})))})),e.state.addStateInfo({stateValue:Zw,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][n]]:!0===s[t[n]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var s,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(s=a[i[0][n]])||void 0===s?void 0:s[t]}return o=null===(r=a[i[n]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,Zw,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,n;(null===(n=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(xw.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new FI(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!W(e,t[i]))))&&(i.reCompile=!0,dD(i))}_getSpecUpdatePolicy(){return lD}_compareSpec(t,e,i){var n,s,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!W(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),u=null!==(n=c.compileOnlyKeys)&&void 0!==n?n:{},d=null!==(s=c.dataRelatedKeys)&&void 0!==s?s:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},u),d),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},$I),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(G(t.label),G(e.label),l),!l.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>uD(t[i],e[i],hD)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!W(t[i],e[i]))),_=h.filter((i=>g[i]&&!W(t[i],e[i]))),b=h.filter((i=>p[i]&&uD(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>d[t]))?dD(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&dD(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!W(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof di||JT(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();rD(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:void 0}}_getSeriesInfo(t,e){var i;const n=this.getDefaultShapeType(),s=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==s||s.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const s=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:s,style:this.getSeriesStyle(s),shapeType:n}}))}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:qw,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=this._getDataScheme();return null===(e=(t=(new KC).domain(i)).range)||void 0===e?void 0:e.call(t,n)}_getDataScheme(){return jC(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:qw}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var n,s,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:u={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=null!==(n=i.morph)&&void 0!==n&&n,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(s=e.morph)||void 0===s?void 0:s.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,mw({},u,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:$w}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),n=this.getDimensionField(),s=i?t[i]:void 0;let r,a=!1;for(let s=0;s0?"_":""}${d(l)?"":l}`,a||(a=o===i),r=l}return!i||a||n.length>1&&r===s||(e+=`_${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!==tT&&t!==iT&&t!==Qw&&t!==eT||(t=this.getStackValueField()),null!==(e=_T(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>YS(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),n=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=n?n:[]}_forEachStackGroup(t,e){var i,n;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(n=e.values)||void 0===n?void 0:n.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:qw]}}function gD(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();FA(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n.index(t[e])-n.index(i[e]))*(s?-1:1)))}function fD(t){return{dataIndex:e=>{var i,n;const s="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[s],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(n=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==n?n:[]).indexOf(r)||0},dataCount:()=>{var e,i,n;const s="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(n=(null!==(i=null===(e=null==s?void 0:s.domain)||void 0===e?void 0:e.call(s))&&void 0!==i?i:[]).length)&&void 0!==n?n:0}}}pD.mark=VI,pD.transformerConstructor=aD;class mD extends pD{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const n={key:i,operations:[]},s=e.axisHelper.getScale(0);FA(s.type)?(n.operations=["max","min"],"log"===s.type&&(n.filter=t=>t>0)):n.operations=["values"],t.push(n)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${Vw}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(tT),this.setFieldX2(Qw)):(this.setFieldY(tT),this.setFieldY2(Qw))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(iT),this.setFieldX2(eT)):(this.setFieldY(iT),this.setFieldY2(eT))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(sT),this.setFieldX2(nT)):(this.setFieldY(sT),this.setFieldY2(nT))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,n,s,r){const a=s();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,n);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),s()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(t.ChartEvent.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(gD("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function vD(t){return"bottom"===t||"top"===t}function yD(t){return"left"===t||"right"===t}function _D(t){return"z"===t}function bD(t,e){return tw(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function xD(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?vD(t)?"linear":"band":vD(t)?"band":"linear"}(t.orient,e);return{axisType:n,componentName:`${r.cartesianAxis}-${n}`}}const SD=(t,e,i)=>{var n;const s=null!==(n="band"===e?kI("axisBand",i):["linear","log","symlog"].includes(e)?kI("axisLinear",i):{})&&void 0!==n?n:{},r=vD(t)?kI("axisX",i):yD(t)?kI("axisY",i):kI("axisZ",i);return mw({},kI("axis",i),s,r)};class AD{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,n;(null!==(n=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:FS)("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:FS)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n,s;const r=null!==(s=null===(n=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===n?void 0:n.call(i,this.chart,{x:t,y:e}))&&void 0!==s?s:[];return 0===r.length?null:r}dispatch(t,e){var i,n;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)))),r=s.filter((t=>NA(t.getScale().type))),a=r.length?r:s.filter((t=>{const e=t.getOrient();return vD(e)||"angle"===e})),o=[],l=null===(n=this.chart)||void 0===n?void 0:n.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class CD extends AD{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:n.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:NT.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const wD=(t,e)=>{var i,n;return t===e||!d(t)&&!d(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(n=e.axis)||void 0===n?void 0:n.id))},TD=(t,e)=>{const i=t.tooltipFilterRange,n="function"==typeof i?i({scale:e}):i;return A(n)?[-n,n]:n},kD=(t,e,i,n)=>{var s;const r=e.getScale(),a=NA(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(n(h)),l=null===(s=h.getViewData())||void 0===s?void 0:s.latestData;if(i&&l)if(a){const e=[],n=[];l.forEach(((s,r)=>{var a;(null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(s),n.push(r))})),o.push({series:h,datum:e,key:MD(h,n)})}else if(p(i[1])){const e=[],n=[];l.forEach(((s,r)=>{var a;((null===(a=s[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(s[i[0]])&&p(s[i[1]])&&t>=s[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=s[0]&&r<=s[1]&&(a.push(e),c.push(n))}}));else{let e=1/0,n=0;l.forEach(((s,r)=>{if(p(s[i[0]])){const o=Math.abs(s[i[0]]-t),l=Math.sign(s[i[0]]-t);o`${t.id}_${e.join("_")}`,BD=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&e(n)&&((t,e,i)=>{const n=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==n?void 0:n.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))})(t,n,i)));return n.length?n:null};class ED extends AD{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,n,s;if(!t||(null===(s=null===(n=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===n?void 0:n.disableDimensionHoverEvent)||void 0===s?void 0:s.call(n)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!wD(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,n,s;t&&!(null===(s=null===(n=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===n?void 0:n.disableDimensionHoverEvent)||void 0===s?void 0:s.call(n))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:NT.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:NT.canvas}),callback:this.onMouseOut}),WS(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:NT.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),WS(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var PD;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(PD||(PD={}));const OD={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},RD={sampling:!0,samplingFactor:!0};class ID{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,n=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(OD.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:wI,curveType:CI,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,o=a===AI?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(OD.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:iD(this._spec,OD.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new di(this._option.dataSet,{name:`${Vw}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(PD.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const n in this._symbolMark.stateStyle[i])"visible"!==n&&(this._symbolActiveMark.stateStyle[i][n]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const n=this._symbolActiveMark;n&&(this._initSymbolMark(n),n&&(null===(i=null===(e=this._spec[OD.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(n.setVisible(!0),this.event.on(PD.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(n,mw({},this._spec[OD.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var n,s,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(s=null===(n=e.stateStyle.normal)||void 0===n?void 0:n[i])||void 0===s?void 0:s.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const DD=Object.assign(Object.assign({},VI),OD),LD=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>LD(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},FD=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class UD extends GR{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return FD}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const n=this._getIgnoreAttributes(),s=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||n.includes(a))return;r&&s.includes(a)&&(UA(null==o?void 0:o.type)||(null==o?void 0:o.scale)||u(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let n=null;return t.forEach(((t,e)=>{n&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?LD(t,e):t===e))(n[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),n=t,i.push({attrs:n,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var n,s;const r=e.context.data,a=[],o=[],l={},h=null===(n=this.renderContext)||void 0===n?void 0:n.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var n;o[i]={},a[i]={},Object.keys(t).forEach((n=>{this._isValidPointChannel(n)?o[i][n]=t[n](e):this._segmentStyleKeys.includes(n)&&!h?a[i][n]=t[n](e):0!==i||h&&!c||(l[n]=t[n](e))})),o[i].context=null!==(n=this._keyGetter(e))&&void 0!==n?n:i})),h){const t=(null===(s=e.attribute)||void 0===s?void 0:s.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const n=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&n&&n.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,n)=>{const s=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=s.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$O.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[n].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[$w]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const ND=new Uint32Array(33),jD=new Uint32Array(33);jD[0]=0,ND[0]=~jD[0];for(let t=1;t<=32;++t)jD[t]=jD[t-1]<<1|1,ND[t]=~jD[t];function zD(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:n=0,left:s=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+s+r+o)/o),h=~~((e+n+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:({x1:n,y1:s,x2:r,y2:a})=>{if(r<0||a<0||n>t||s>e)return!0;let o,l,h,c,u=a;for(;u>=s;--u)if(o=u*t+n,l=u*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&ND[31&o]&jD[1+(31&l)])return!0}else{if(i[h]&ND[31&o])return!0;if(i[c]&jD[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||s>e)return;let o,l,h,c,u;for(;s<=a;++s)if(o=s*t+i,l=s*t+r,h=o>>>5,c=l>>>5,h===c)n(h,ND[31&o]&jD[1+(31&l)]);else for(n(h,ND[31&o]),n(c,jD[1+(31&l)]),u=h+1;u{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+n,l=a>>>5,h=o>>>5,l===h)s(l,jD[31&a]|ND[1+(31&o)]);else for(s(l,jD[31&a]),s(h,ND[1+(31&o)]),c=l+1;ci<0||n<0||r>=e||s>=t,toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(l,h),c.x=t=>~~((t+s)/o),c.y=t=>~~((t+n)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function WD(t,e){const{x1:i,x2:n,y1:s,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ut(i,-o,t.width+l),u=ut(n,-o,t.width+l),d=ut(s,-a,t.height+h),p=ut(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(u),y1:t.y(d),y2:t.y(p)}}function HD(t,e,i=!1){return i?WD(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function VD(t,e,i,n=!0,s=0){let r=i;s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=HD(t,r);const a=e.outOfBounds(r);return!(n&&a||(a&&(r=WD(t,r)),e.getRange(r)))}function GD(t,e,i,n=[],s=!0,r=0,a=!1){var o,l,h,c;const u=n.filter((t=>p(t))),d=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(s.AABBBounds,r,t,n.offset))),l=!1===i.restorePosition;return GD(t,e,s,o,h,c,l)}return!1}var d;if("moveY"===i.type){const n=(i.offset?u(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return GD(t,e,s,n,h,c)}if("moveX"===i.type){const n=(i.offset?u(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return GD(t,e,s,n,h,c)}return!1}const XD=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],KD=["top","inside-top","inside"];function $D(t,e,i,n={}){const{x1:s,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:u=0}=n,d=Math.min(s,r),p=Math.max(s,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+u;let y=0,_=0;return d<0-h?y=-d:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const qD={mode:"same-time",duration:300,easing:"linear"};function ZD(t){return 3===t||4===t}function JD(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}const QD=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 tL(t,e,i,n,s,r){return Math.abs(e/t)0?s:-s),y:n+e*s/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:n+(e>0?r:-r)}}class eL extends Bf{onBind(){const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:n,curText:s,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in s.attribute)n.attribute[t]!==s.attribute[t]&&(l[t]=s.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(n,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(n,{type:"increaseCount",to:{text:s.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class iL extends Bf{onBind(){const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:n,relatedGraphics:s,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?n.animates&&n.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?s&&s.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):n.animates&&n.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const nL=(t,e)=>Math.ceil(t)>Math.floor(e),sL=([t,e],[i,n])=>n>t&&e>i;function rL(t,e){const[i,n]=t,[s,r]=e,a=Math.max(i,s),o=Math.min(n,r);return Math.max(0,o-a)}const aL=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class oL extends Ch{constructor(t,e){super(t),this._skipRenderAttributes=aL,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,n){const s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);if(s)return this._setAttributes(s,i);m(this.attribute[t])&&m(e)&&!u(this.attribute[t])&&!u(e)?U(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){d(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{cL(t,e,i)})),e}function uL(t,e){e&&(null==t||t.onComplete.push(e))}function dL(t){t.forEach((t=>{t()}))}function pL(t,e,i){const n=t=>{const n=e();n&&!n.finalized&&n.pendingAnimates.has(t)&&(n.pendingAnimates.delete(t),n.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>n(t))),t.onRemove((()=>n(t)))}))}var gL=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(hA.hover,!0),KS(this,(t=>{t===e||E(t.states)||t.addState(hA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(KS(this,(t=>{E(t.states)||(t.removeState(hA.hoverReverse),t.removeState(hA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void KS(this,(t=>{E(t.states)||(t.removeState(hA.selectedReverse),t.removeState(hA.selected))}));E(e.states)||(e.addState(hA.selected,!0),KS(this,(t=>{t===e||E(t.states)||t.addState(hA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,n,s,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===Wi.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Wi.ANIMATE_UPDATE&&(null===(n=t.detail.animationState)||void 0===n?void 0:n.isFirstFrameOfStep)){const e=null!==(r=null===(s=t.target)||void 0===s?void 0:s.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,n){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if($t(t,e,!0))return;const i=Math.min(t.x1,t.x2),n=Math.min(t.y1,t.y2),s=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-n)/2,l=Math.abs(e.x2-s)/2,h=Math.abs(e.y2-r)/2,c=i+a,u=n+o,d=s+l,p=r+h,g=d-c,f=p-u;return[tL(g,f,c,u,a,o),tL(-g,-f,d,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const n=rA.line({points:i}),{line:s={}}=t.attribute;if(s.customShape){const i=s.customShape;n.pathProxy=n=>i({text:t,baseMark:e},n,new Xn)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&n.setAttribute("stroke",r.fill),this.attribute.line&&!E(this.attribute.line.style)&&n.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(n),n}}_finalizeExitRelease(){var t,e,i,n;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const r=this.parent,a=!!(null==s?void 0:s.removeFromParent),o=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(n=null!=r?r:this.parent)||void 0===n||n.removeChild(this)),dL(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,uL(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(qD),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const n=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&n.add(t.text),(null==t?void 0:t.labelLine)&&n.add(t.labelLine)})),!n.size)return!1;const s=cL(this);n.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=cL(this).filter((t=>!s.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},pL(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:s}=this.attribute;let r=this.attribute.data;if(u(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}let a=this._initText(r);a=u(n)?n(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(a);const o=[],l=a;if(!c(t)&&u(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}u(s)?a=s(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),u(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return mA(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let n;if(n=u(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),n.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:s}=this.attribute;if(s&&0!==s.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),s),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let n=0;nl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,s,h,c):this._overlapByStrategy(t,s,h,c)}_overlapGlobal(t,e,i,n){let s=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,u=t=>o.get(t).x,d=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let s=t.length-1;s>=0;s--){const r=t[s],a=t[s-1],l=t[s+1];if(a&&nL(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=n(r);l&&nL(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:n,x2:s}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:n,x2:s,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(n>=o&&s<=l)i.push(e),h=!0;else if(ot(r,u(i[0]),void 0,5)){const r={start:Math.min(o,n),end:Math.max(l,s)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(rL([o,l],[n,s])/(l-o)>.5){const r={start:Math.min(o,n),end:Math.max(l,s)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:n,end:s},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==s.enable){const{maxIterations:e=10,maxError:n=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:u=Number.MAX_VALUE}=s;for(let s=0;sl(t)-l(e)));let e=0;for(let n=0;n=o)continue;let r,v=n+1;for(;(r=t[v])&&!sL([d(s),p(s)],[d(r),p(r)]);)v+=1;if(r){const t=c(s),n=h(s),o=c(r),d=o-(t+n);if(di){const e=t-(a-d),i=l(s)-e;Math.abs(i)<=u&&(f(s,e),m(s,g(s)+1))}else if(t-n<0){const t=o+(a-d),e=l(r)-t;Math.abs(e)<=u&&(f(r,t),m(r,g(r)+1))}else{const e=t-n,i=l(s)-e,a=o+n,h=l(r)-a;Math.abs(i)<=u&&Math.abs(h)<=u&&(f(s,e),f(r,a),m(s,g(s)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(s,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&n.setRange(HD(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&n.setRange(HD(i,t.AABBBounds,!0))})):t.AABBBounds&&n.setRange(HD(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:n}=e;return{x1:i,x2:i,y1:n,y2:n}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:n=t,y1:s=i}=e;return{x1:(t+n)/2,x2:(t+n)/2,y1:(i+s)/2,y2:(i+s)/2}}const{x:n,y:s}=e;return{x1:n,x2:n,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,n=new Map,s=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,u=(null==s?void 0:s.get(c))?"update":"enter";let d;o&&(d=this._createLabelLine(t,h));const p=d?{text:t,labelLine:d}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u)r.push(t),n.set(c,p),this._addLabel(p,r,a,e);else if("update"===u){const t=s.get(c);s.delete(c),n.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(s),this._graphicToText=n}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:n}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var s;null===(s=e.setFinalAttributes)||void 0===s||s.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},n),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},n),{type:e===t?n.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:n}=t,{text:s,labelLine:r}=e;hL(i,null==s?void 0:s.attribute),hL(n,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:s,prevLabelLine:n,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,n){const{text:s,labelLine:r}=t,a=this.getRelatedGraphic(s.attribute);this._syncStateWithRelatedGraphic(a),s&&this.add(s),r&&this.add(r),this.runEnterAnimation(s,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:n,labelLine:s}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),i&&s&&t.labelLine.setAttributes(s.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,n,s,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:u,mode:d,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(n=l.brightColor)&&void 0!==n?n:"#ffffff",y=null!==(s=l.darkColor)&&void 0!==s?s:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{mL[t]=e};var yL=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),n&&0!==n.length||(n=[e]);const r="start"===i?0:n.length-1;return n[r]?{x1:n[r].x,x2:n[r].x,y1:n[r].y,y2:n[r].y}:void 0}labeling(t,e,i="end",n=0){return function(t,e,i="end",n=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:s,x2:r}=t,a=Math.abs(r-s),o=e.x1;let l=o;return"end"===i?l=o+a/2+n:"start"===i&&(l=o-a/2-n),{x:l,y:e.y1}}(t,e,i,n)}};_L.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const bL=()=>{vL("line",_L),vL("area",_L)};var xL=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,u=(e.y1+e.y2)/2;let d=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":d=-1;break;case"right":d=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":d=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":d=0,p=0}return{x:c+d*(n+g)+Math.sign(d)*(l/2),y:u+p*(n+f)+Math.sign(p)*(h/2)}})(t,e,i,n)}}SL.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const AL=()=>{vL("symbol",SL),vL("line-data",SL)};class CL extends UD{constructor(){super(...arguments),this.type=CL.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)===DC.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}CL.type="line";const wL=()=>{xw.registerMark(CL.type,CL),vS(),Cx(),bL(),AL(),hI(),xw.registerGraphicComponent("line",Ph)};class TL extends GR{constructor(){super(...arguments),this.type=TL.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var n,s,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(s=null!==(n=a.shape)&&void 0!==n?n:a.symbolType)&&void 0!==s?s:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}TL.type="symbol";const kL=()=>{xw.registerMark(TL.type,TL),vS(),wS(),AL(),xw.registerGraphicComponent("symbol",mc)};class ML extends aD{_transformLabelSpec(t){var e,i,n;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function BL(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function EL(t,e){var i;const n=Y(e)-e[0],s=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===n?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=n,a/=n);const o=t.getDomainSpec(),l={total:n,negative:r,positive:a,includeZero:s,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let n,s;0===i?(n=t._break.scope[i],s=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,s=[e[e.length-2],e[e.length-1]]):(n=t._break.scope[i-1],s=[e[i-1],e[i]],l.negative=n[0]+(0-s[0])/(s[1]-s[0])*(n[1]-n[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=s}return l}function PL(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:u}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),u[0]=-u[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),u[1]=-u[0]*t}return!0}function OL(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function RL(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function IL(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}const DL=t=>t.map(((t,e)=>({index:e,value:t}))),LL=(t,e,i,n)=>it?Math.min(t-e/2,i-e):i{var n,s,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let u=null!==(n=a.angle)&&void 0!==n?n:0;"vertical"===a.direction&&(u+=Nt(90));const d=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;d||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=dA(a),y=t.range();let _=[];for(let i=0;i{var i,n,s,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(n=null==e?void 0:e.currentAxis)||void 0===n?void 0:n.call(e);if(!l)return t;const h=null===(s=l.getTickData())||void 0===s?void 0:s.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const u=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==u?void 0:u.length))return t;const d=o.getScale();if(!d)return t;const p=d.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=u.map((t=>function(t,e,i,n,s){const r=Lt(t,e),a=Math.max(Dt(i),Dt(r));return s*(Math.round(r*10**a)/Math.round(i*10**a))+n}(t.value,p[0],g,f[0],m)));return DL(v)};class NL{constructor(t){this.id=GS(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class jL extends NL{constructor(){super(jL.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!FA(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const n=this._checkEnableSync(i);if(!n)return;if(!n.zeroAlign)return;const s=this._getTargetAxis(i,n);s&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===s.id},(()=>{((t,e)=>{var i,n,s,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(s=null===(n=(i=t).getDomainAfterSpec)||void 0===n?void 0:n.call(i))&&void 0!==s?s:[0,1],u=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&u&&BL(c)&&BL(u)))return;const d=EL(t,c),p=EL(e,u);if(!0===d.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=d,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!OL(d,p))return}else if(0===_&&0===b){if(!OL(p,d))return}else if(y||A)if(y&&!A){if(!PL(d,p))return}else if(A&&!y){if(!PL(p,d))return}else{if(f===b)return;if(f>b){if(!RL(d,p))return}else if(!RL(p,d))return}else{if(0===f&&0===_){if(!IL(d,p))return}else if(0===b&&0===g&&!IL(p,d))return;if(0===f&&0===b)if(0===c[0]&&u[0]>0){if(!x)return;u[0]=0}else{if(!(0===u[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&u[1]>0){if(!S)return;u[1]=0}else{if(!(0===u[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(u)})(s,i)}))}onDidCompile(t,e){var i;const n=this._checkEnableSync(e);if(!n)return;const s=this._getTargetAxis(e,n);if(s&&n.tickAlign){GT(e.getOption().dataSet,"tickAlign",UL);const t={targetAxis:()=>s,currentAxis:()=>e},n=null===(i=s.getTickData())||void 0===i?void 0:i.getDataView();n&&n.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}jL.pluginType="component",jL.type="AxisSyncPlugin";const zL={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function WL(t,e){var i,n,s,r,a,o;return{min:null!==(s=null!==(i=t.min)&&void 0!==i?i:null===(n=t.range)||void 0===n?void 0:n.min)&&void 0!==s?s:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function HL(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const VL=t=>"band"===t||"ordinal"===t||"point"===t;function GL(t,e){return{id:t,label:t,value:e,rawValue:t}}function YL(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class XL extends qR{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const KL=`${Vw}_ARC_TRANSFORM_VALUE`,$L=`${Vw}_ARC_RATIO`,qL=`${Vw}_ARC_START_ANGLE`,ZL=`${Vw}_ARC_END_ANGLE`,JL=`${Vw}_ARC_K`,QL=`${Vw}_ARC_MIDDLE_ANGLE`,tF=`${Vw}_ARC_QUADRANT`,eF=`${Vw}_ARC_RADIAN`,iF=-Math.PI/2,nF=3*Math.PI/2,sF=(t,e,i)=>{var n;const s=null!==(n="band"===e?kI("axisBand",i):"linear"===e?kI("axisLinear",i):{})&&void 0!==n?n:{},r=kI("angle"===t?"axisAngle":"axisRadius",i);return mw({},kI("axis",i),s,r)};function rF(t,e,i,n){switch(t){case r.cartesianBandAxis:return SD(bD(i,["z"]),"band",e);case r.cartesianLinearAxis:return SD(bD(i,["z"]),"linear",e);case r.cartesianLogAxis:return SD(bD(i,["z"]),"log",e);case r.cartesianSymlogAxis:return SD(bD(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return SD(bD(i),void 0,e);case r.polarBandAxis:return sF(i.orient,"band",e);case r.polarLinearAxis:return sF(i.orient,"linear",e);case r.polarAxis:return sF(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,n;const s=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:u}=null!==(n=kI(r.crosshair,t))&&void 0!==n?n:{},d=s.find((t=>vD(t.orient)));let g;g=p(d)?mw({},VL(d.type)?a:o,l):l;const f=s.find((t=>yD(t.orient)));let m;return m=p(f)?mw({},NA(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:u}})(e,n);case r.polarCrosshair:return((t,e)=>{var i,n;const s=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:u}=null!==(n=kI(r.crosshair,t))&&void 0!==n?n:{},d=s.find((t=>"angle"===t.orient));let g;g=p(d)?mw({},VL(d.type)?a:o,l):l;const f=s.find((t=>"radius"===t.orient));let m;return m=p(f)?mw({},NA(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:u}})(e,n);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return aF(i,kI(t,e));default:return kI(t,e)}}const aF=(t,e)=>{var i;const n=e[function(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}(null!==(i=t.orient)&&void 0!==i?i:e.orient)],s=mw({},e,n);return delete s.horizontal,delete s.vertical,s};class oF extends tR{getTheme(t,e){return rF(this.type,this._option.getTheme,t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:n}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:n}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:n}=t;i&&e&&n&&(t.padding=Object.assign(Object.assign({},aw(e)),{[n]:0}))}}class lF extends nR{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=oF,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,n=null,s=null)=>{var r,a;e instanceof bi||this.event.emit(i,{model:this,node:t,event:e,item:n,datum:s,source:NT.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]);return new this(n,Object.assign(Object.assign({},i),s))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new XL(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!W(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,n;_I(t),null===(n=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===n||n.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=bI(t),n=xI(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,n,s;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(s=null===(n=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===s||s.call(n,t)}))}});return n?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,n;this._exitingVRenderComponents.add(t),null===(n=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===n||n.call(i,t)}))):void 0}_I(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var hF,cF;lF.transformerConstructor=oF,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(hF||(hF={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(cF||(cF={}));class uF extends GR{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,n,s,r;null===(r=null===(s=null===(n=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.globalInstance)||void 0===s?void 0:s._registerExitingVRenderComponent)||void 0===r||r.call(s,t)}_unregisterExitingComponent(t){var e,i,n,s,r;null===(r=null===(s=null===(n=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===r||r.call(s,t)}_releaseComponentWithExitAnimation(t,e){var i,n;const s=this._product;if(!t||(null===(n=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===n?void 0:n.call(i)))return!1;const r=xI(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&s?this._removeProductAfterExit(t,s):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?s:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?_I(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(_I(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?(this._component.setAttributes(i),this._product&&this._component.parent!==this._product&&this._product.appendChild(this._component)):(this._component=xw.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(LT.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}uF.type="component";const dF=()=>{xw.registerMark(uF.type,uF)};var pF,gF;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(pF||(pF={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(gF||(gF={}));const fF={[gF.selectedReverse]:{},[gF.selected]:{},[gF.hover]:{},[gF.hoverReverse]:{}},mF=t=>t,vF={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class yF extends lF{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,n;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(n=t.hideWhenEmpty)&&void 0!==n&&n,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,n,s,r,a,o,l,h,c,u,d,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?hF.circleAxis:hF.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?cF.circleAxisGrid:cF.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(s=null===(n=this._spec.grid)||void 0===n?void 0:n.style)||void 0===s?void 0:s.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=JI(null===(h=xw.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(u=null!==(c=this._spec.animationAppear)&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==u?u:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b: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||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new xR(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&OA(this._regions,(n=>{var s;let a=this.collectSeriesField(t,n);if(a=_(a)?FA(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=n.getFieldAlias(a[0])),a){const t=n.getViewData();if(e)a.forEach((t=>{i.push(n.getRawDataStatisticsByField(t,!!FA(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(s=n.getViewDataStatistics)||void 0===s?void 0:s.call(n),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((n=>{var s;(null===(s=null==e?void 0:e.latestData)||void 0===s?void 0:s[n])&&(o?i.push(Object.assign(Object.assign({},e.latestData[n]),{values:t.latestData.map((t=>t[n]))})):i.push(e.latestData[n]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return OA(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;p(t)&&(this._seriesUserId=G(t)),p(i)&&(this._regionUserId=G(i)),p(e)&&(this._seriesIndex=G(e)),p(n)&&(this._regionIndex=G(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=function(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),OA(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,n,s,r,a,o,l,h,c,u;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(s=null===(n=this._axisMark)||void 0===n?void 0:n.getComponent)||void 0===s?void 0:s.call(n))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(u=this._spec.grid)||void 0===u?void 0:u.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&W(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):OA(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(OA(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;tW(null==e?void 0:e[i],null==t?void 0:t[i])||vF[i]))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var n;if(t.domainLine&&t.domainLine.visible?i.line=((n=MT(n=t.domainLine)).startSymbol=MT(n.startSymbol),n.endSymbol=MT(n.endSymbol),n):i.line={visible:!1},t.label&&t.label.visible){const e=N(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=u(t.label.style)?(e,i,n,s)=>{var r;const a=t.label.style(e.rawValue,i,e,n,s);return ET(mw({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:ET(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,n,s,r)=>ET(t[i](e.rawValue,n,e,s,r)):E(t[i])||(e[i]=ET(t[i]))})),e}(t.label.state)),u(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:u(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=u(t.tick.style)?(e,i,n,s)=>{var r;const a=t.tick.style(e,i,n,s);return ET(mw({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:ET(t.tick.style)),t.tick.state&&(i.tick.state=BT(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=u(t.subTick.style)?(e,i,n,s)=>{var r;const a=t.subTick.style(e,i,n,s);return ET(mw({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:ET(t.subTick.style)),t.subTick.state&&(i.subTick.state=BT(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const n=t.title,{autoRotate:s,angle:r,style:a={},background:o,state:l,shape:h}=n,c=e(n,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==t.orient&&"right"!==t.orient||s&&d(p)&&(p="left"===t.orient?-90:90,u=zL[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Nt(p):null,textStyle:mw({},u,ET(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:ET(h.style)}),h.state&&(i.title.state.shape=BT(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:ET(o.style)}),o.state&&(i.title.state.background=BT(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=BT(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=ET(t.background.style)),t.background.state&&(i.panel.state=BT(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:Ww(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:u(t.grid.style)?(e,i)=>{var n,s;const r=t.grid.style(null===(n=e.datum)||void 0===n?void 0:n.rawValue,i,e.datum);return ET(mw({},null===(s=this._theme.grid)||void 0===s?void 0:s.style,r))}:ET(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:Ww(t.subGrid.alternateColor),style:ET(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=MI(t,e);return i?(t,n,s)=>i(n.rawValue,n,e):null}_initTickDataSet(t,e=0){YT(this._option.dataSet,"scale",mF);const i=this.registerTicksTransform();return new di(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:n,tickStep:s,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:n,tickStep:s,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var n;null===(n=null==i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===pF.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}yF.specKey="axes";const _F=()=>{dF(),xw.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},bF=[jL];class xF extends yF{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,n){super(i,n),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),OA(this._regions,(t=>{const e=this.getOrient();vD(e)?YL(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):yD(e)?YL(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):_D(e)&&YL(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._clearContinuousBarBandwidthCache=()=>{this._continuousBarBandwidthCache=void 0},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:n}=i,s=e(i,["grid"]),r=mw({x:t.x,y:t.y},this._axisStyle,s);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(mw({x:t.x,y:t.y},this._getGridAttributes(),n)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),n=vD(this.getOrient()),s=t=>{var e;return(n?!vD(t.getOrient()):vD(t.getOrient()))&&FA(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>s(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);n?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=bD(i,["z"]),_D(this._orient)&&(this.layoutType="absolute"),this._dataSet=n.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!HL(e))return null;const{axisType:t,componentName:n}=xD(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:n}]}const n=e.filter((t=>"z"===t.orient))[0];let s=!0;if(n){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>yD(t.orient)))[0];s=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));s||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!HL(t))return;const{axisType:n,componentName:s}=xD(t,i);t.type=n,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:s})})),a}static createComponent(t,i){const{spec:n}=t,s=e(t,["spec"]),r=xw.getComponentInKey(s.type);return r?new r(n,Object.assign(Object.assign({},i),s)):(i.onError(`Component ${s.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:n,top:s,bottom:r}=this._innerOffset;let a=[];return vD(this.getOrient())?A(t)&&(a=this._inverse?[t-n,i]:[i,t-n]):_D(this.getOrient())?A(t)&&(a=this._inverse?[t-n,i]:[i,t-n],this._scale.range(a)):A(e)&&(a=this._inverse?[s,e-r]:[e-r,s]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(bF.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){vD(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&&!vD(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!_D(this.getOrient())&&this._spec.innerOffset){const t=this._spec;yD(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=nw(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=nw(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=vD(this.getOrient())?t.fieldX:_D(this.getOrient())?t.fieldZ:t.fieldY,FA(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,n;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(n=this._spec.label)||void 0===n?void 0:n.flush})}axisHelper(){return{isContinuous:FA(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getBandwidth:(t=0)=>this._getContinuousBarBandwidth(t),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}_getContinuousBarBandwidth(t=0){if(0!==t||!FA(this._scale.type))return;const e=this._scales[0],i=e.domain(),n=e.range(),s=+(null==i?void 0:i[0]),r=+(null==i?void 0:i[i.length-1]),a=+(null==n?void 0:n[0]),o=+(null==n?void 0:n[n.length-1]);if(!(Number.isFinite(s)&&Number.isFinite(r)&&Number.isFinite(a)&&Number.isFinite(o)&&s!==r))return;const l=this._continuousBarBandwidthCache;if(l&&l.scale===e&&l.domainStart===s&&l.domainEnd===r&&l.rangeStart===a&&l.rangeEnd===o)return l.bandWidth;const h=new Set,c=this.getOrient();OA(this._regions,(t=>{var e,i,n,s;if(t.type!==DC.bar)return;const r=t,a=vD(c)&&"vertical"===r.direction?r.fieldX[0]:yD(c)&&"horizontal"===r.direction?r.fieldY[0]:void 0,o=a?null===(s=null===(n=null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.latestData)||void 0===n?void 0:n[a])||void 0===s?void 0:s.values:void 0;null==o||o.forEach((t=>{const e=+t;Number.isFinite(e)&&h.add(e)}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const u=Array.from(h).sort(((t,e)=>t-e));if(u.length<2)return;let d=1/0,p=u[0];for(let t=1;t0&&i{if(t===this._axisMark&&!1===this._isLayout&&(vD(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=vD(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return OA(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,n;let s;return s=t>0?null===(n=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===n?void 0:n[t]:vD(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:_D(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,s}updateSeriesScale(){const t=this.getOrient();OA(this._regions,(e=>{vD(t)?YL(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):yD(t)?YL(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):_D(t)&&YL(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=vD(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const n={skipLayout:!1},s=vD(this.getOrient());this.pluginService&&(s?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),n=mw(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(n);a&&!a.empty()||(a=(new ce).set(n.x,n.y,n.x,n.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,s)}return i}positionToData(t,e){const i=vD(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?ut(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):ut(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const n=this._scale.range();return(t-n[0])*(t-Y(n))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,n,s,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=a.style)||void 0===s?void 0:s.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),n=e+t[0].getLayoutRect().width,s=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return GL(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,n=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:FA(this._scale.type)?i>=n[0]&&i<=Y(n):n.includes(i)}))]:[]}initEvent(){super.initEvent(),OA(this._regions,(t=>{var e,i;null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i||i.target.addListener("change",this._clearContinuousBarBandwidthCache)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let n=0,s=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;n=Math.max(n,e)}else if(e===a){const e=t.getLayoutRect().width;s=Math.max(s,e)}})),{left:n,right:s}}}}xF.type=r.cartesianAxis,xF.specKey="axes";const SF=(t,e,i,n)=>{const s=FL(t,e,i);return s&&s.map((t=>n?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},AF=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,CF=(t,e)=>t[1]{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?DL([n[n.length-1]]):DL([n[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(s)){const e=u(s)?s({axisLength:f,labelStyle:h}):s;m=t.ticks(e)}else if(e.sampling){const s=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(g),a=X(g);if(n.length<=f/s){const i=SF(t,n,e,c);if(i){const s=Math.min(...i.map((t=>t[2]))),l=(a-r)/n.length,h=TF(n,i,o,e.labelLastVisible,Math.floor(s/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(n[n.length-1]))}}else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],s=SF(t,i,e,c);if(s){let i=null;s.forEach((t=>{i?i[2]0?Math.ceil(n.length*(o+i[2])/(a-r-o)):n.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===n[n.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(n[n.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=n=>{let s=!0,r=0;do{r+n{let n=t,s=e;for(;n=0?s=t:n=t+1}return n})(s,t.length,(t=>c(t)?1:-1));let d=u;do{if(d>u&&!r&&!c(d))d++;else{if(!n){o=d;break}{const n=t.length-1;let s,r=0;s=t.length%d>0?t.length-t.length%d+d:t.length;do{if(s-=d,s!==n&&!AF(e[s],e[n],i))break;r++}while(s>0);if(s===n){o=d,a=r;break}{const i=Math.floor(t.length/d)-r+1;if(i=0?CF(e[s-d],e[s]):t,u=Math.abs(t-c);if(u{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function MF(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=TA(t,!!s),o=TA(r,!!s);const h=Ut.distancePP(n,l),c=Ut.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=kF(e,t,!1,!!s),o=kF(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=TA(t,!!s),o=TA(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class BF extends oL{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&CA(this._innerView),this.removeAllChild(!0),this._innerView=rA.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 wA(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=U({},this.attribute,this.getGridAttribute(t)),{type:n,items:s,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${pF.grid}-sub`:`${pF.grid}`;if(s.forEach(((t,i)=>{const{id:s,points:o}=t;let c="";if("line"===n||"polygon"===n)c=TA(o,!!a);else if("circle"===n){const{center:t}=this.attribute;c=kF(t,o,!1,!!a)}const d=rA.path(Object.assign({path:c,z:l},u(r)?U({},this.skipDefault?null:BF.defaultAttributes.style,r(t,i)):r));d.name=`${h}-line`,d.id=this._getNodeId(`${h}-path-${s}`),e.add(d)})),l&&"line"===n&&s.forEach(((t,i)=>{const{id:n,points:s}=t,o=[];o.push(s[0]);const c=s[1].x-s[0].x,d=s[1].y-s[0].y,p=Math.sqrt(c*c+d*d),g=l/p;o.push({x:s[0].x+c*g,y:s[0].y+d*g});const f=TA(o,!!a),m=Ct(o[0].x-o[1].x),v=Ct(o[0].y-o[1].y),y=rA.path(Object.assign({path:f,z:0,alpha:m>v?(s[1].x-s[0].x>0?-1:1)*bt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},u(r)?U({},this.skipDefault?null:BF.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${n}`),e.add(y)})),s.length>1&&o){const t=_(o)?o:[o,"transparent"],n=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!ot(a.value,0)&&!ot(l.value,0),u=!ot(a.value,1)&&!ot(l.value,1),d=[],p=a.value>l.value;(p&&u||!p&&c)&&d.push(this.getGridPointsByValue(p?1:0)),s.forEach((t=>{d.push(t.points)})),(p&&c||!p&&u)&&d.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,n=[];return i>=2&&this.data.forEach((i=>{let s=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;s=e}n.push({value:s})})),n}release(){super.release(),this._prevInnerView=null,this._innerView=null}}BF.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class EF{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:n=1}=this.attribute,s=iA(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([s[1],-1*s[0]],t*(e?1:-1)*n)}}class PF extends Bf{onBind(){var t;const e=dP(this.target);this._animator=e;const i=this.duration,n=this.easing,{config:s,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),s=this.target.attribute.x,h=this.target.attribute.y;hL(this.target,{x:s,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:s,y:h},duration:i,easing:n})}e.animate(this.target,{type:null!==(t=s.type)&&void 0!==t?t:"fadeIn",to:s.to,duration:i*o,easing:n}),this.completeBind(e)}}class OF extends Bf{onBind(){const t=dP(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:n}=this.params;hL(this.target,Object.assign({},n)),t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function RF(){ox(),Cx(),fS(),RS(),Jg.registerBuiltInAnimate("axisEnter",PF),Jg.registerBuiltInAnimate("axisUpdate",OF)}ox(),Rx();class IF extends BF{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},BF.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n=6,startAngle:s=aA,endAngle:r=oA}=this.attribute;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2){const s=this._getPointsOfSubGrid(n,i);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})}}V(IF,EF),ox(),Cx(),zx(),wS();class DF extends oL{getStartAngle(){return Wt(this._startAngle)}getEndAngle(){return Wt(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},DF.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:n,visible:s=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!s)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(q(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var s,r;const a=rA.line(Object.assign(Object.assign({points:t},_(i)?null!==(s=i[e])&&void 0!==s?s:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),E(null==n?void 0:n.line)||(a.states=_(n.line)?null!==(r=n.line[e])&&void 0!==r?r:n.line[n.line.length-1]:n.line),this.add(a),this.lines.push(a)}))}else{let t=rA.line;G(i)[0].cornerRadius&&(t=rA.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(null==n?void 0:n.line)||(e.states=[].concat(n.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:n=!0}=t;let s;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:u=0,refAngle:d=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+u*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+u*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+u*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+u*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),s=rA.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:n?v+d:0,strokeBoundsBuffer:0}),p)),s.name=`${this.name}-${i}-symbol`,s.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(s.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(s.states=o.startSymbol):E(null==o?void 0:o.endSymbol)||(s.states=o.endSymbol),this.add(s)}return s}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let n;return n=e?A(i)?t[i]:q(t):t,this._mainSegmentPoints=n,n}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let n=t;if(e.visible){const i=e.clip?e.size||10:0;n=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...n.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,s={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};n=[...n.slice(0,n.length-1),s]}return n}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],n=t[t.length-2],s=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[s.x-n.x,s.y-n.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}function LF(){ox(),iS(),wS(),fS(),RS()}DF.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}}};var FF=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),C=0,w=0;let j=0;"left"===U||"start"===U?j=1:"right"===U||"end"===U?j=-1:"center"===U&&(j=0),j?j<0?(C-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-B)):j>0&&x.setAttribute("x",b[3]):(C-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-B/2));const z="right"===_||"end"===_,W="left"===_||"start"===_,H=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:G(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=I+B,i=1===j?(t-e)/2+B+I/2:b[0]+B-(T/2+e/2-B)+I/2;if(H(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(W&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+B/2:-T+b[3]+b[1]+B;if(H(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(z&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+B/2:t;if(H(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===N?(w-=k/2,A&&A.setAttribute("y",0)):"bottom"===N?(w-=k,A&&A.setAttribute("y",-D/2),x.setAttribute("y",-b[2])):"top"===N&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",D/2)),E(null==m?void 0:m.text)||(R.states=m.text);const{visible:V}=a,Y=FF(a,["visible"]);if(f&&c(V)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:V&&!!n,width:T,height:k,x:C,y:w}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Xn)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:U({},UF.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,n,s,r,a,o,l,h,c,u,d,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(s=null===(n=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===n?void 0:n.slice())&&void 0!==s?s:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(u=this._bgRect)||void 0===u||u.clearStates(),null===(d=this._symbol)||void 0===d||d.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}UF.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const NF={type:"default",duration:300,easing:"linear"};class jF extends lL{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=((t,e,i)=>{const n=t.target;return n!==i&&n.name&&!E(n.states)?(n.addState(hA.hover,!0),KS(e,(t=>{t!==n&&t.name&&!E(t.states)&&t.addState(hA.hoverReverse,!0)})),n):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(KS(e,(t=>{t.name&&!E(t.states)&&(t.removeState(hA.hoverReverse),t.removeState(hA.hover))})),null):i)(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=((t,e,i)=>{const n=t.target;return i===n&&n.hasState(hA.selected)?(KS(e,(t=>{t.name&&!E(t.states)&&(t.removeState(hA.selectedReverse),t.removeState(hA.selected))})),null):n.name&&!E(n.states)?(n.addState(hA.selected,!0),KS(e,(t=>{t!==n&&t.name&&!E(t.states)&&t.addState(hA.selectedReverse,!0)})),n):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=rA.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const n=this.parent,s=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),s&&(null===(e=null!=n?n:this.parent)||void 0===e||e.removeChild(this)),dL(r)}_runExitAnimationBeforeRelease(t={}){var e,i,n;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,uL(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=new Set;if(KS(this._innerView,(t=>{"group"!==t.type&&s.add(t)})),!s.size)return!1;const r=cL(this),{delay:a=0,duration:o=NF.duration,easing:l=NF.easing}=this._animationConfig.exit;s.forEach((t=>{var e,i,n;const s={opacity:0,fillOpacity:0,strokeOpacity:0};hL(t,s,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.attribute.strokeOpacity)&&void 0!==n?n:1}),t.animate().wait(a).to(s,o,l)}));const h=cL(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(n=(i=this._innerView).removeAllEventListeners)||void 0===n||n.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},pL(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&CA(this._innerView),this.removeAllChild(!0),this._innerView=rA.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(NF)}_bindEvent(){if(this.attribute.disableTriggerEvent)return;const{hover:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:n,line:s,items:r}=this.attribute,a=rA.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=pF.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),s&&s.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),n&&n.visible&&this.renderTicks(a),i&&i.visible)){const t=rA.group({x:0,y:0,pickable:!1});t.name=pF.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,r.length),this.handleLabelsOverlap(s,e,n,i,r.length),this.afterLabelsOverlap(s,e,n,i,r.length);let a=0,o=0,l="center",h="middle",c=0;s.forEach(((t,e)=>{var i;const n=t.attribute,s=null!==(i=n.angle)&&void 0!==i?i:0,r=t.AABBBounds;let u=r.width(),d=r.height();s&&(u=Math.abs(u*Math.cos(s)),d=Math.abs(d*Math.sin(s))),a=Math.max(a,u),o=Math.max(o,d),l=n.textAlign,h=n.textBaseline,0===e&&(c=n.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=rA.group({x:0,y:0,pickable:!1});i.name=pF.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=rA.line(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=pF.tick,r.id=this._getNodeId(t.id),E(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=cA;else{const t=this.data[n],e=U({},cA,this.attribute.tick.state);Object.keys(e).forEach((i=>{u(e[i])&&(e[i]=e[i](t.rawValue,n,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:n}=this.attribute;if(n&&n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=rA.line(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=pF.subTick,r.id=this._getNodeId(`${s}`),E(n.state))r.states=cA;else{const i=U({},cA,n.state);Object.keys(i).forEach((n=>{u(i[n])&&(i[n]=i[n](t.value,s,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&u(n)&&(e=n(e,i));const s=this._transformItems(e),r=rA.group({x:0,y:0,pickable:!1});return r.name=`${pF.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),s.forEach(((t,e)=>{var n;const a=mA(this._getLabelAttribute(t,e,s,i));if(a.name=pF.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(n=this.attribute.label)||void 0===n?void 0:n.state))a.states=cA;else{const n=U({},cA,this.attribute.label.state);Object.keys(n).forEach((r=>{u(n[r])&&(n[r]=n[r](t,e,s,i))})),a.states=n}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new UF(Object.assign({},e));i.name=pF.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return wA(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&u(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let o=0,h=0;Ct(n[0])>Ct(n[1])?o=bt/2*(l.x>e.x?1:-1):h=bt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?d+=(this.axisLabelLayerSize[n-1].height+P(this.attribute,"label.space",4))*n:d+=(this.axisLabelLayerSize[n-1].width+P(this.attribute,"label.space",4))*n);const f=this.getVerticalCoord(t.point,d,o),m=this.getVerticalVector(d||1,o,f),v=l?l(`${t.label}`,t,e,i,n):t.label;let{style:y}=this.attribute.label;y=u(y)?U({},yA.label.style,y(t,e,i,n)):y;y=U(this.getLabelAlign(m,o,y.angle),y),u(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:n}));let _=y.react;return u(_)&&(_=_(t,e,i,n)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,n){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const n=this._animationConfig;this._newElementAttrMap={},KS(e,(e=>{var s;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=I(r.attribute),a=I(e.attribute),o=__(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(s=a.opacity)&&void 0!==s?s:1,l=!0),n.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},hL(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},n.update),{type:"axisUpdate",customParameters:{config:n.update,diffAttrs:o,lastScale:t}})}]))}else n.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},n.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:n.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const zF={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,n)=>n&&kA(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function WF(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function HF(t,e,i,n,s=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;t{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},XF(t,e.attribute.angle)),{angle:YF(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({},KF(t,e.attribute.angle)),{angle:YF(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Jt({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),n=i.x-e.centerX,s=i.y-e.centerY;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}function YF(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function XF(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=YF(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function KF(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],n=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const s=(e=YF(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function $F(t,e){const{limitLength:i,verticalLimitLength:n,ellipsis:s="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,p=c?Math.sin(h):0,f=AA(h),m=SA(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=n)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=n)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=n)return}}let r=null;if(f||m)r=v?f?n:i:"vertical"===y||m?n:i;else if(v){const{x1:e,x2:n}=t.AABBBounds,s=p/u,l=Math.abs(i/p);if(_&&s>0&&e<=a+o.right&&i/s+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&s<0&&n>=-o.left&&i/s+n<-o.left){const t=(n+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:s})}))}function qF(t,e,i){let n;return A(e)&&(n=Math.abs(e-t)),A(i)&&(n=A(n)?Math.min(Math.abs(t-i),n):Math.abs(t-i)),n}var ZF=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const{startPoint:n,endPoint:s,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=rA.group({zIndex:999});e.name=pF.axisBreak,e.id=this._getNodeId(`${pF.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:n={},angle:s=.5*Math.PI}=t,r=U({},_A,n),a=null!==(e=r.size)&&void 0!==e?e:_A.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(s)} L ${a/2} ${-a*Math.sin(s)}`,symbolSize:a})}(r),l=rA.symbol(Object.assign({x:n.x,y:n.y},o));l.name=pF.axisBreakSymbol;const h=rA.symbol(Object.assign({x:s.x,y:s.y},o));h.name=pF.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,n=t.AABBBounds,s=rA.rect(Object.assign({x:n.x1,y:n.y1,width:n.width(),height:n.height()},i.style));s.name=pF.background,s.id=this._getNodeId("background"),s.states=U({},fF,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(s,t.firstChild)}const{labelHoverOnAxis:n}=this.attribute;n&&n.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new UF(Object.assign({},t));e.name=pF.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:n}=this.attribute,s=n,{startSymbol:r,endSymbol:a,style:o,state:l}=s,h=ZF(s,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let n=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:s}=e;t.push([n,i]),n=s})),t.push([n,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:U({},fF,l),symbol:U({},fF,l)});const u=new DF(c);u.name=pF.line,u.id=this._getNodeId("line"),t.add(u)}getTextAlign(t){let e="center";return ot(t[0],0)?ot(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const n=this.attribute.title,{position:s="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=n,p=ZF(n,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===s?g=0:"end"===s&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,n=this.axisLabelsContainer.AABBBounds;_+=(1===m?n.x2>i?Math.min(n.x2-i,n.width()):0:n.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),C=this.getVerticalCoord(v,S,!1),w=this.getVerticalVector(S,!1,{x:0,y:0});let T,k,{angle:M}=p;if(T="start"===s?"start":"end"===s?"end":"center",d(M)&&o){M=nA(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;k=1==-1*t?"bottom":"top"}else T=this.getTextAlign(w),k=this.getTextBaseline(w,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,n=Math.min(t||1/0,e||1/0);if(A(n))if("bottom"===i||"top"===i)if(M!==Math.PI/2){const t=Math.abs(Math.cos(null!=M?M:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=n-S;else if(M&&0!==M){const t=Math.abs(Math.sin(M));B=t<1e-6?1/0:this.attribute.end.y/t}else B=n-S}const E=Object.assign(Object.assign(Object.assign({},C),p),{maxWidth:B,textStyle:Object.assign({textAlign:T,textBaseline:k},a),state:{text:U({},fF,c.text),shape:U({},fF,c.shape),panel:U({},fF,c.background)}});return E.angle=M,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,n=this.attribute.labelHoverOnAxis,{position:s=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=n,p=ZF(n,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=s:g.y=s;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=nA(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,C=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return C.angle=b,l&&l.visible&&(C.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),C}getTextBaseline(t,e){let i="middle";const{verticalFactor:n=1}=this.attribute,s=(e?1:-1)*n;return ot(t[1],0)?i=!ot(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===s?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(["top","bottom","right","left"].includes(n)||0===t[0]&&0===t[1]){if("top"===n||"bottom"===n)return XF(e?"bottom"===n?"top":"bottom":n,i);if("left"===n||"right"===n)return KF(e?"left"===n?"right":"left":n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,h=t[0],c=Y(t),u=s?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-d}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=u?c:h,e=u?h:c,s=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,d=n.y;rd&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+d-s}):t.setAttributes({y:d,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,n,s){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,s),{layoutFunc:h,autoRotate:c,autoRotateAngle:d,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(u(h))h(t,e,n,this);else{if(c)!function(t,e){if(E(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0,a=n;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);s{t.attribute.angle=Nt(e)})),GF(i,t),!VF(t))break}}(t,{labelRotateAngle:d,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:n,ellipsis:s="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=AA(a),l=SA(a),h="top"===r||"bottom"===r;let c=n/t.length;t.forEach(((e,n)=>{var r,a,u,d,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=qF(e.attribute.x,null===(r=t[n+1])||void 0===r?void 0:r.attribute.x,null===(a=t[n-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Mt(c,i))}}else{if(l){const i=qF(e.attribute.y,null===(u=t[n+1])||void 0===u?void 0:u.attribute.y,null===(d=t[n-1])||void 0===d?void 0:d.attribute.y);A(i)&&(c=Mt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:s,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);$F(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&function(t,e){if(E(t))return;const i=t.filter(WF);if(E(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=u(s)?s:zF[s]||zF.parity;if(n.length>=3&&MA(n,r)){do{n=a(n,r)}while(n.length>=3&&MA(n,r));const t=(t,e,i=!0)=>i&&t<3||e,s=t(n.length,e.firstVisible,!1);let o=t(n.length,e.lastVisible);const l=i[0],h=Y(i);kA(l,h,r)&&s&&o&&(h.setAttribute("opacity",0),o=!1),HF(l,n,s,(t=>kA(t,l,r))),HF(h,n,o,(t=>kA(t,h,r)||!(!s||t===l)&&kA(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,s);let e,n;h=Math.max(h,t),"left"===a?(e=l.x2-h,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-h):"bottom"===a&&(e=l.x1,n=l.y1);const r=rA.rect({x:e,y:n,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=pF.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){"left"===n||"right"===n?"left"===s?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===s?t.forEach((t=>{var n;t.setAttributes({dx:(null!==(n=t.attribute.dx)&&void 0!==n?n:0)+e+i-t.AABBBounds.x2})})):"center"===s&&t.forEach((t=>{var n;t.setAttributes({dx:(null!==(n=t.attribute.dx)&&void 0!==n?n:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==n&&"top"!==n||("top"===s?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===s?t.forEach((t=>{var n;t.setAttributes({dy:(null!==(n=t.attribute.dy)&&void 0!==n?n:0)+e+i-t.AABBBounds.y2})})):"middle"===s&&t.forEach((t=>{var n;t.setAttributes({dy:(null!==(n=t.attribute.dy)&&void 0!==n?n:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,u=null!==(i=o.space)&&void 0!==i?i:4;let d=t,p=0,g=0;const f=h&&h.visible?null!==(n=h.style.lineWidth)&&void 0!==n?n:1:0,m=c&&c.visible?null!==(s=c.length)&&void 0!==s?s:4:0;if(l&&l.visible&&"string"==typeof l.text){p=pA(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=Be(l.padding);g=l.space+t[0]+t[2]}return d&&(d=(d-u-g-p-f-m)/e),d}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const n=this.axisContainer.AABBBounds,s=n.width(),r=n.height(),a=n.x1,o=n.y1,l=n.x2,h=n.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,n=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",n),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,n=i.width()-s,c=i.height()-r;n>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-n,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}JF.defaultAttributes=yA,V(JF,EF);const QF={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}}},tU={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}}},eU={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}}};class iU extends xF{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new aC}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return GT(this._option.dataSet,t,wF),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=ZA(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:n,bandSizeLevel:s=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};s=Math.min(s,this._scales.length-1);for(let t=s;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),u=e=>{const i=t===s?a:0;if(d(r)||t1)for(let e=0;e{this._onTickDataChange(n)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=n}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new xR(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const n=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},s=this._tickDataMap[t],r=null==s?void 0:s.getDataView().transformsArr.find((t=>t.type===n));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===n));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,n;if(0===t.length||0===this._scales.length)return 0;const{position:s,bandScale:r}=this.getPosition(t);return s+r.bandwidth()*(null!==(n=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==n?n:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((n,s)=>{var r;const a=this._tickDataMap[s],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):n.domain();if(l&&l.length)if(i&&i.length){const n=[],s=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(s.push(r),o){const e=GL(i,this._getNormalizedValue(r,t));n.push(e)}}))})),o&&e.push(n.filter((t=>t.value>=0&&t.value<=1))),i=s}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>GL(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}});const nU=()=>{xw.registerGraphicComponent(hF.lineAxis,((t,e)=>new JF(t,e))),xw.registerGraphicComponent(cF.lineAxisGrid,((t,e)=>new IF(t,e))),_F(),xw.registerComponent(iU.type,iU,!1)},sU=(t,e,i)=>i.reduce(((t,n,s)=>(t.push([n,i.length===s+1?e:i[s+1]]),t)),[[t,i[0]]]);function rU(t,e){const i=t[0],n=t[t.length-1],s=e.filter((t=>t>i&&tt-e,oU=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let n=0,s=0;for(;n{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(s);return i[n]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function lU(t,e,i="count"){const n=oU(t,e),s="count"===i?t.length:n.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return n.forEach(((t,e)=>{if(0===s)r.push([0,e/n.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===n.length-1?1:Math.min((a+l)/s,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const hU=Math.sqrt(50),cU=Math.sqrt(10),uU=Math.sqrt(2);class dU{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=WL(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(u(i.tickCount)){const t=this._scale.range();let n=Math.abs(Y(t)-t[0]);if(1===n&&this._option){n=vD(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=n,e=i.tickCount({axisLength:n,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:n,max:s}=null!==(t=this._domain)&&void 0!==t?t:{};return d(n)&&d(s)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(p(n)||p(this._softMinValue))&&d(s)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(n)||!d(this._softMinValue)||!p(s)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!u(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(Y(e)-e[0]);i<=1||A(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let n,s,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;n=void 0===n?e:Math.min(n,e),s=void 0===s?a:Math.max(s,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?s:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:n,scope:s}=function(t,e,i){return t.sort(aU),e.sort(aU),{domain:rU(t,e),scope:lU(t,e,i)}}(r,IS(t),this._spec.breaks[0].scopeType);e=IS(n),this._break={domain:n,scope:s,breakDomains:t,breaks:i}}else e=[n,s]}else e=[n,s]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=WL(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=hU?10:s>=cU?5:s>=uU?2:1)*Math.pow(10,n),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,n=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*n)/n:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function pU(t,e,i,n){let s;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();s=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||s.push(e)}));e.domain(a)}else s=n(i);return s}function gU(t,e,i,n,s=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){s?e.push(t):e.unshift(t);for(let t=0;t{var i,n,s,r;if(!FA(t.type))return DL(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return DL([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:d=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=pU(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const n=null!==(i=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=pU(e,t,n,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:d}):t.d3Ticks(e,{noDecimals:d})))}else{const i=null!==(n=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==n?n:5,s=u(e.tickMode)?e.tickMode:void 0;m=pU(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:d,customTicks:s}):t.ticks(e,{noDecimals:d,customTicks:s})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e,a=6;let l;if(m.length*a>o){const i=[],n=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%n!=0&&e!==m.length-1||i.push(t)})),l=null===(s=FL(t,i,e))||void 0===s?void 0:s.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=FL(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],s=Y(l),r=f&&f()?mU.greedy:mU.parity;for(;l.length>=3&&MA(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;kA(t,s,i)&&l.includes(s)&&l.length>1&&a&&o&&(l.splice(l.indexOf(s),1),o=!1),gU(t,l,a,(e=>kA(e,t,i))),gU(s,l,o,(e=>kA(e,s,i)||!(!a||e===t)&&kA(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&n&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return DL(m)},mU={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>!(n&&kA(i,t,e)||(i=t,0))))}},vU={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class yU extends xF{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new kC}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const n=super._getUpdateAttribute(t);if(!_D(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=vD(this._orient),s=i?t:e;n.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:n,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/s;let o;o=ew(r)?Number(r.substring(0,r.length-1))/100:r/s;const l=A(null==n?void 0:n.angle)?n.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},n),{angle:l*Math.PI/180}),rawRange:e}}))}return n}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=IS(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return GT(this._option.dataSet,t,fU),t}}yU.type=r.cartesianLinearAxis,yU.specKey="axes",yU.builtInTheme={axis:QF,axisLinear:vU,axisX:tU,axisY:eU},V(yU,dU);const _U=()=>{xw.registerGraphicComponent(hF.lineAxis,((t,e)=>new JF(t,e))),xw.registerGraphicComponent(cF.lineAxisGrid,((t,e)=>new IF(t,e))),_F(),xw.registerComponent(yU.type,yU)},bU=`${Vw}_hide_`;function xU(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const SU=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:n,deltaMul:s=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[bU]&&(xU(t,!0),t[bU]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let n=-1/0,s=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+s)*i),r=(-1/0-l)**2+(n-h)**2,r<(o+s+e)**2?t.context.finalAttrs.forceShow||(t[bU]=!0,xU(t,!1)):n=h,s=e}))}(r,n,s):1===i?function(t,e,i){let n=-1/0,s=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+s)*i),Math.abs(o-n){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+s)*i),Math.abs(o-n){var i,n;const s=null===(n=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===n?void 0:n[r];return t[s]?t[s].push(e):t[s]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},AU=()=>{xw.registerGrammarTransform("symbolOverlap",{transform:SU,runType:"afterEncode"})},CU={min:K,max:X,average:function(t,e){let i=0,n=0;return t.forEach((t=>{const s=e?+t[e]:+t;A(s)&&(i+=s,n++)})),i/n},sum:BA};function wU(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,u=0;r[u++]=c;for(let t=1;to&&(o=l,h=t))}r[u++]=h,c=h}r[u-1]!==a-1&&(r[u++]=a-1);return r.map((t=>i?e[t].i:t))}function TU(t,e,i,n,s){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][s]=e[l][s];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function kU(t,e,i,n){return TU(t,e,i,"min",n)}function MU(t,e,i,n){return TU(t,e,i,"max",n)}function BU(t,e,i,n){return TU(t,e,i,"average",n)}function EU(t,e,i,n){return TU(t,e,i,"sum",n)}const PU=(t,e)=>{let i=u(t.size)?t.size():t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:s,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=wU;if("min"===s?l=kU:"max"===s?l=MU:"average"===s?l=BU:"sum"===s&&(l=EU),e.length){const t={};if(a){for(let i=0,n=e.length;i{const r=t[s];if(r.length<=i){const t=r.map((t=>t.i));n=n.concat(t)}else{const t=l(i,r,!0,o);n=n.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]},OU=()=>{xw.registerGrammarTransform("dataSampling",{transform:PU})};class RU extends mD{constructor(){super(...arguments),this.type=DC.line,this.transformerConstructor=ML,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),RD)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(JI(null===(i=xw.getAnimationInKey("line"))||void 0===i?void 0:i(s,r),QI("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=fD(this);this._symbolMark.setAnimationConfig(JI(null===(n=xw.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),QI("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var n,s;return i&&"fill"===e&&(e="stroke"),null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}RU.type=DC.line,RU.mark=DD,RU.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},RU.transformerConstructor=ML,V(RU,ID);class IU{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(n,((t,e)=>{JT(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof di)return;const n=this.getSeriesData(t.id,i);n&&e(t,n,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];LS(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];LS(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class DU{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{XS(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{vT(e,[{key:t,operations:FA(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&vT(e,[{key:i.field,operations:FA(s.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?qC("colorOrdinal"):qC(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(XS(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(W(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;if(!W(r.specified,n.specified)){if("color"!==n.id)return e.reMake=!0,e;const t=s;if(t.setSpecified)t.setSpecified(n.specified);else{if(!n.specified||!t.specified)return e.reMake=!0,e;t.specified(n.specified)}e.reRender=!0}n.range&&!W(n.range,s.range())&&(s.range(n.range),e.reRender=!0),XS(n.domain)?e.reRender=!0:W(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!XS(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,n.domain().slice());let s;s=FA(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const n=FA(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,n);e&&(n?(d(s[0])?s[0]=e.min:s[0]=Math.min(e.min,s[0]),d(s[1])?s[1]=e.max:s[1]=Math.max(e.max,s[1])):e.values.forEach((t=>{s.add(t)})))}))}));const r=s;FA(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(FA(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const n=this._getSeriesBySeriesId(t.seriesId),s=FA(e.type),r=n.getRawDataStatisticsByField(t.field,s);if(!E(r))return"expand"===t.changeDomain?(s?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(s?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));FA(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:s})),s}}class LU{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,n,s;const r=null!==(n=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==n?n:e.get(t.context.markId);return!!(null===(s=null==r?void 0:r.hasAnimationByState)||void 0===s?void 0:s.call(r,"state"))}updateStates(t,e,i,n,s){return this._disableTriggerEvent?[]:e&&e.length?(n&&s?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,s),this.toggleStateOfGraphics(t,e,i,n)):this.addBothStateOfGraphics(t,e,n,s):n&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,n):this.addStateOfGraphics(t,e,n)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,n,s),[])}toggleReverseStateOfGraphics(t,e,i,n){const s=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(n&&s[n]&&s[n].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);WR(t,n,!0,e)}})),e.forEach((t=>{if(n&&s[n]&&s[n].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);HR(t,n,e)}}))}toggleStateOfGraphics(t,e,i,n){const s=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(n&&s[n]&&s[n].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);HR(t,n,e)}})),e.forEach((t=>{if(n&&s[n]&&s[n].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);WR(t,n,!0,e)}}))}addBothStateOfGraphics(t,e,i,n){const s=t.getMarks(),r=t.getMarkIdByState();s.forEach((t=>{var s;const a=n&&r[n]&&r[n].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)?o&&WR(t,i,!0,l):a&&WR(t,n,!0,l)}))}))}addStateOfGraphics(t,e,i){const n=t.getMarks(),s=t.getMarkIdByState();n.forEach((t=>{var n;const r=i&&s[i]&&s[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)&&r&&WR(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const n=this.getStatedGraphics(t);if(!n||!n.length)return;const s=t.getMarks(),r=t.getMarkIdByState();s.forEach((t=>{if(t){const s=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");s&&s.length&&(i&&r[i]&&r[i].includes(t.id)&&s.forEach((t=>{HR(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&s.forEach((t=>{n.includes(t)&&HR(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const FU={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},UU={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class NU extends QO{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const n=this.getCompiler();return n&&(n.updateLayoutTag(),t&&i&&n.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,n,s,r;super(e),this.type="chart",this.id=GS(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:Gw,height:Yw},this._viewRect={width:Gw,height:Yw},this._viewBox={x1:0,y1:0,x2:Gw,y2:Yw},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(UU).some((t=>!d(e[t])))},this._paddingSpec=aw(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new DT(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new IU(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(n=this._option)||void 0===n?void 0:n.onError,disableTriggerEvent:!0===(null===(s=this._option)||void 0===s?void 0:s.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new LU;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const n=t.getInteractionTriggers();if(n&&n.length){const s=t.getRegion().id;n.forEach((({trigger:t,marks:n})=>{const r=i.find((e=>e.regionId===s&&W(e.config,t)));if(r)r.trigger.marks.push(...n);else{const r=Object.assign(Object.assign({},t),{marks:[...n]});i.push({regionId:s,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=xw.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(JI({},QI("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const n={width:t,height:e};this._canvasRect=n,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=N(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=xw.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]),r=new t(n,Object.assign(Object.assign({},this._modelOption),s));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:n}=i,s=e(i,["spec"]);let r;if(p(n.regionId)?r=this.getRegionsInUserId(n.regionId):p(n.regionIndex)&&(r=this.getRegionsInIndex([n.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(n,Object.assign(Object.assign(Object.assign({},this._modelOption),s),{type:n.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(u(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var n;if((null!==(n=i.specKey)&&void 0!==n?n:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const n=xw.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,n,s;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===s||s.call(n,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof eR)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const n=this.getComponentByUserId(t);return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof GR))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof GR)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&(s.markRunning(),s.parseNewData(e,n)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&JT(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=jO(this._spec,this._option,{width:Gw,height:Yw})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const n=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=jC(n),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new DU(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){VO(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=jC(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),n=new Set(e),s=[...t.filter((t=>!n.has(t))),...e.filter((t=>!i.has(t)))];return s.length>0&&s.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const n={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return n.reMake=!0,this.setLayoutTag(!0,null,!1),n;const s=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!W(s,r)&&!this._canChangeSpecKeysWithoutRemake(s,r))return n.reMake=!0,this.setLayoutTag(!0,null,!1),n;const a=Array.from(new Set([...s,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=n.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),n):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(n),n.reMake||(this.reInit(),u&&this._canSkipChartDataStages(n)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),n))}updateChartConfig(t,e){var i,n;this._paddingSpec=aw(null!==(i=this._spec.padding)&&void 0!==i?i:null===(n=this._option)||void 0===n?void 0:n.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{VO(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const n={},s={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));s[l.type]&&(s[l.type]=!1);const u=l.specKey||l.type,d=null!==(h=this._spec[u])&&void 0!==h?h:{};if(_(d)){if(n[u]=n[u]||{specCount:d.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(u,[l.getSpec()],d))return void a.push(l);n[u].componentCount++;const s=null!==(c=d[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(s,d);HO(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):W(r,s)||(i=!0),VO(t,o)}else{const n=l.getSpec(),s=l.updateSpec(d);HO(s)||this._isComponentScaleDomainOnlyUpdate(s)?e.push(l):W(n,d)||(i=!0),VO(t,s)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,n);for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const i=n[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(s).forEach((e=>{if(s[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(FU[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return FU[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let n=!1;const s=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(n=!0,!0):W(t[i],e[i])));return n&&s}_isComponentSpecKey(t){return!!FU[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let n=!1;const s=t,r=e,a=i.every((t=>!!W(s[t],r[t])||!!this._isComponentSpecKey(t)&&(n=!0,!0)));return n&&a}_isOnlySeriesSpecsChanged(t,e,i){var n,s;let r=!1;const a=t,o=e,l=null!==(s=null===(n=this._specTransformer)||void 0===n?void 0:n.getSeriesRelatedSpecKeys())&&void 0!==s?s:{},h=i.every((t=>!!W(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var n,s;let r=!1;const a=t,o=e,l=null!==(s=null===(n=this._specTransformer)||void 0===n?void 0:n.getSeriesRelatedSpecKeys())&&void 0!==s?s:{},h=i.every((t=>!!W(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],n=i[i.length-1];return"number"==typeof n?n:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let n=0,s=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;FU[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,n++,s=s||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),n&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),s?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,n=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],n)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];VO(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:n=0,x2:s,y2:r}=e;i={width:s-t,height:r-n}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=sw(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===n||n.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===n||n.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(E(t[n]))continue;const s=t[n];let r={stateValue:n};r=u(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r),s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(e,i,n){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,n)}setHovered(e,i,n){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,n)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(LT.AFTER_MARK_RENDER_END,e)};this._event.on(LT.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const n=(t=t?G(t):null)?Object.keys(t[0]):null,s=[],r=null!==(i=e.getDatum)&&void 0!==i?i:RT;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||u(e.filter)&&e.filter(o,l))){if(OT(l.type))h.filter((h=>{const c=r(h,l,o,i),u=c&&t.every(((t,e)=>n.every((i=>t[i]==c[e][i]))));u&&(a.push(h),s.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),u=h&&c.findIndex((t=>n.every((e=>t[e]==h[e]))));u>=0&&(c.splice(u,1),a.push(t),s.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const s=r(e,l,o,i);return s&&n.every((e=>t[0][e]==s[e]))}));c&&(a.push(c),s.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),s}_setStateInDatum(t,e,i,n){if(!e)return void this._interaction.clearByState(t);const s=this.filterGraphicsByDatum(e,{filter:i,region:n});this._interaction.updateStateOfGraphics(t,s)}setDimensionIndex(t,e){var i,n;let s=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:r}=i;if(n===PD.dimensionHover||n===PD.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(s=i)}}));const a=d(t)||!s||s.every((t=>NA(t.axis.getScale().type)&&d(t.index))),o=a||s.every((t=>NA(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};s.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{var e,s,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(s=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===s?void 0:s[o])&&void 0!==a?a:n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(s))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const n=this.getComponentsByKey("axes"),s=[];n.forEach((e=>{const i=t(e);!1!==i&&s.push({axis:e,value:i})})),i.showCrosshair(s)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const jU=(t,e)=>{var i;const n=t.spec,{regionId:s,regionIndex:r}=n;if(p(s)){const t=G(s);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)},zU={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class WU{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},zU),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,n,s)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=n,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,s),u=Object.assign(Object.assign({},n),c);e?u.theme=h.getTheme(r,t):fw(t,a,c.spec),fw(s,null!=o?o:a,u)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,n;e||(e=this.generateTransform(t,!0));const s={};return this.forEachRegionInSpec(t,e,s),this.forEachSeriesInSpec(t,e,s),null===(i=s.series)||void 0===i||i.forEach(((t,e)=>{var i,n;const r=(null!==(n=null!==(i=jU(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,s),Object.values(null!==(n=s.component)&&void 0!==n?n:{}).forEach((t=>t.forEach(((t,e)=>{var i,n,r;if(t){if(!t.regionIndexes){const e=null!==(n=null!==(i=jU(t,s))&&void 0!==i?i:s.region)&&void 0!==n?n:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const n=t.spec,{seriesId:s,seriesIndex:r}=n;if(p(s)){const t=G(s);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,s);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,n;const r=null===(i=s.region)||void 0===i?void 0:i[t];null===(n=null==r?void 0:r.seriesIndexes)||void 0===n||n.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),s}_isValidSeries(t){return!0}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var n,s,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(n=t.animation)&&void 0!==n?n:null===(s=this._option.globalInstance)||void 0===s?void 0:s.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var n;return(null!==(n=t.region)&&void 0!==n?n:[]).map(((t,n)=>e(xw.getRegionInType("region"),{spec:t,specPath:["region",n],type:"region",regionIndexes:[n]},i)))}forEachSeriesInSpec(t,e,i){var n;return(null!==(n=t.series)&&void 0!==n?n:[]).map(((t,n)=>e(xw.getSeriesInType(t.type),{spec:t,specPath:["series",n],type:t.type,seriesIndexes:[n]},i)))}forEachComponentInSpec(t,e,i){var n,s,a;const o=[],l=xw.getComponents();let h,c,u,d;const p=[];for(let e=0;e0&&(g=!0,n.forEach((t=>{const n=xw.getComponentInKey(t.type);o.push(e(n,t,i))})))}if(c&&!g){const n=c.getSpecInfo(t,i);(null==n?void 0:n.length)>0&&(g=!0,n.forEach((t=>{const n=xw.getComponentInKey(t.type);o.push(e(n,t,i))})))}return u&&!g&&(null===(s=u.getSpecInfo(t,i))||void 0===s||s.forEach((t=>{o.push(e(u,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:n})=>{var s;null===(s=n.getSpecInfo?n.getSpecInfo(t,i):BI(t,n.specKey,n.type))||void 0===s||s.forEach((t=>{o.push(e(n,t,i))}))})),d&&(null===(a=BI(t,d.specKey,d.type))||void 0===a||a.forEach((t=>{o.push(e(d,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const n="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!n.includes(i.orient))return!1;if(p(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:n,barMinWidth:s,barWidth:r,barGapInGroup:a}=i;let o=!1;S(s)?(t.minBandSize=s,o=!0):S(r)?(t.minBandSize=r,o=!0):S(n)&&(t.minBandSize=n,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class HU extends WU{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:n}=i;let s=null;"top"!==n&&"bottom"!==n||(e.x=!0,s=this._setDefaultXAxisSpec(t)),"left"!==n&&"right"!==n||(e.y=!0,s=this._setDefaultYAxisSpec(t)),"z"===n&&(e.z=!0,s=this._setDefaultZAxisSpec(t)),s&&Object.keys(s).forEach((t=>{d(i[t])&&(i[t]=s[t])})),P(i,"trimPadding")&&mw(i,GO(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class VU extends HU{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),NO(t)}}const GU=(t,e)=>{const i={nodes:{}},{fields:n}=u(e)?e():e;if(!(null==n?void 0:n.length))return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),n=i.some((t=>t.getStack()));if(!n)return;const s=i.some((t=>{var e,i,n,s;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(s=null===(n=t.getSpec())||void 0===n?void 0:n.totalLabel)||void 0===s?void 0:s.visible)})),r=s||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=bT(t,!0);for(const e in o)for(const i in o[e].nodes)CT(o[e].nodes[i],t.getStackInverse(),r,s);if(a)for(const t in o)for(const e in o[t].nodes)AT(o[t].nodes[e]);s&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),n=t.getStackValueField();e&&n&&ST(o[i],n)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class XU{_beforeInit(){this._dataSet&>(this._dataSet,"stackSplit",GU)}_initStack(){this._stack=new YU(this),this._stack.init()}}const KU={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:PD.dimensionHover};class $U extends uI{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,n=i.getStatedGraphics(this);n&&n.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:n,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},KU,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),n=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{i.filter((e=>e.model===t.series&&e.getVisible())).forEach((i=>{const s=i.getGraphics();if(!s||!s.length)return;const r=s.filter((i=>{const n=RT(i);let s;return s=_(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s}));n.push(...r)}))}))})),n}}$U.type="dimension-hover",$U.defaultOptions=KU;const qU=()=>{xw.registerInteractionTrigger($U.type,$U)},ZU=()=>{xw.registerComposedEvent(PD.dimensionHover,ED),xw.registerComposedEvent(PD.dimensionClick,CD)},JU=t=>t.fieldX[0],QU=t=>t.fieldY[0],tN=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},eN=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},iN=(t,e)=>t?e?JU:tN:e?QU:eN,nN=(t,e,i)=>{var n,s;if(!t)return null;const{x:r,y:a}=e,o=null!==(n=BD(t,(t=>vD(t.getOrient())),e))&&void 0!==n?n:[],l=null!==(s=BD(t,(t=>yD(t.getOrient())),e))&&void 0!==s?s:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,u=new Set;[o,l].forEach((t=>t.forEach((t=>{NA(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&u.add(t)}))));const d=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(u.size>0){if(u.has(t)){const n=sN(t,i,iN(e,NA(t.getScale().type)));n&&d.push(n)}}else{const n=h.size>0;if((n?h:c).has(t)){const s=sN(t,i,iN(e,n));s&&d.push(s)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===d.length&&p("x")):(p("x"),0===d.length&&p("y")),d.length?d:null},sN=(t,e,i)=>{const n=t.positionToData(e,!0);return d(n)?null:rN(t,n,i)},rN=(t,e,i)=>{const n=t.getScale();if(d(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=kD(e,t,"cartesian",null!=i?i:vD(t.getOrient())?JU:QU);return{index:s,value:e,position:n.scale(e),axis:t,data:r}},aN=(t,e,i,n=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((s=>{var r,a,o,l,h,c;const{currentValue:u,cacheInfo:d,labelsComp:g,attributes:f,coordKey:m}=t[s];let v=null,y=0,_=null;if(u.size){const t=Array.from(u.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!u.size&&Number.isFinite(y)&&!Number.isNaN(y),x=n&&!b&&p(d),S=x?d:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let C=0;if(f&&u.forEach((({axis:t,datum:i=""})=>{var n,r,a,o,l,h,c,u,d,p;let g=null;const m=t.getScale();if(NA(m.type))A=m.bandwidth(),0===A&&m.step&&(C=m.step());else if(FA(m.type)){const n="xField"===s?e.fieldX[0]:e.fieldY[0],r="xField"===s?e.fieldX2:e.fieldY2,a=function(t,e,i,n){for(let s=0,r=t.length;s=e)return r}}return null}(e.getViewData().latestData,+i,n,r);if(a){const t="xField"===s?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===s?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[n]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(n=f.label)||void 0===n?void 0:n.visible)&&!x){const e=function(t){let e=0;return P(t,"tick.visible")&&(e+=P(t,"tick.tickSize")),P(t,"label.visible")&&(e+=P(t,"label.space")),e}(t.getSpec()),n=t.getOrient(),s=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[n]&&(S.labels[n].visible=!0,S.labels[n].text=i,"left"===n?(S.labels[n].dx=-e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:s&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===n?(S.labels[n].dx=e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:s&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===n?(S.labels[n].y=0,S.labels[n].dy=-e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:s&&_&&null!==(u=_.attribute.textBaseline)&&void 0!==u?u:"bottom"}):"bottom"===n&&(S.labels[n].dy=e,S.labelsTextStyle[n]={textAlign:s&&_&&null!==(d=_.attribute.textAlign)&&void 0!==d?d:"center",textBaseline:s&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[n].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};lN(t,u),"xField"===s?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&oN(S.labels[t],t,f.label)}))}t[s].bandSize=null!=A?A:0,t[s].offsetSize=C,t[s].cacheInfo=S})),t),oN=(t,e,i)=>{const{formatMethod:n,formatter:s}=i,{formatFunc:r,args:a}=MI(n,s,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},lN=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:n}=e.getLayoutStartPoint(),{width:s,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,n),t.x2=Math.max(t.x2,i+s),t.y2=Math.max(t.y2,n+r)}))}))},hN=t=>{const{cacheInfo:e,attributes:i,bandSize:n,offsetSize:s,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+n/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=cN(i,n,s,e.axis),{coordRange:u}=e;c={visible:!0,start:{[r]:Math.max(o+t,u[0]),[a]:l[0]},end:{[r]:Math.min(o+h,u[1]),[a]:l[1]}}}return c},cN=(t,e,i,n)=>{var s,r,a;const o=0===e?i:e;let l=o;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=n.getLayoutRect();l=t.style.size(e,n)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},uN=(t,e)=>{var i;const n=new Map,s=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?s:n).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:n,attributes:{visible:!!n.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:s,attributes:{visible:!!s.size,type:"rect"}}};return aN(c,r,e),c.xField.cacheInfo?hN(c.xField):c.yField.cacheInfo?hN(c.yField):void 0},dN=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],pN=(t,e,i,n,s)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&dN.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,n,n[0].datum,s)))}break;case"dimension":if(null==n?void 0:n.length){if(gN(n).every((t=>{var e;return!RI("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return n.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,n,r.datum,s);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},gN=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},fN={dom:`${Vw}_TOOLTIP_HANDLER_DOM`,canvas:`${Vw}_TOOLTIP_HANDLER_CANVAS`},mN={key:"其他",value:"..."};var vN;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(vN||(vN={}));class yN{constructor(e){this._showTooltipByHandler=(e,i)=>{var n,s,r;if(d(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(d(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=d(null==o?void 0:o.key)&&d(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(n=a.handler)||void 0===n?void 0:n.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,n,s,r,a,o,l,h,c;const{changePositionOnly:u,model:g}=e;if(!u||!this._cacheActiveSpec){const u=this.component.getSpec();if(this._cacheActiveSpec=pN(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&p(u.handler)&&(this._cacheActiveSpec.handler=u.handler);const g=null!==(i=u[this.activeType])&&void 0!==i?i:{},f=null!==(n=this._cacheActiveSpec.updateTitle)&&void 0!==n?n:g.updateTitle,m=null!==(s=this._cacheActiveSpec.updateContent)&&void 0!==s?s:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},mN),t):mN;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,n;return!!this.component.enable&&(!d(e)&&RI(this.activeType,null===(n=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===n?void 0:n.spec))}clearCache(){this._cacheActiveSpec=void 0}}class _N extends yN{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,n)}_getDimensionInfo(t){var e,i,n;let s;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),s=null!==(n=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==n?n:[],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(!NA(i.getScale().type))return!1;let n;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){n=e;break}if(p(n))break}return p(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const bN=()=>{xw.registerTooltipProcessor("dimension",_N)};class xN extends yN{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var n,s,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,u=null===(n=o.getSpec())||void 0===n?void 0:n.tooltip,d=null===(s=null==u?void 0:u.mark)||void 0===s?void 0:s.checkOverlap;let p=!1;if(!0===d||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==d){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),n={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},n),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(n.x,n.y,zi.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(RT(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,n;const s=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===s){const e=t.model,s=e.tooltipHelper,r=null==s?void 0:s.activeTriggerSet.mark,a=null==s?void 0:s.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(n=!0)}else if("component"===s){const e=t.model,s=t.node;if("label"===e.name&&s){const t=e.getLabelInfoByTextGraphic(s),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:s.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(n=!0)}}return{tooltipInfo:i,ignore:n}}}const SN=()=>{xw.registerTooltipProcessor("mark",xN)};class AN extends yN{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:G(n),series:s}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let n;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,s=e.tooltipHelper,r=null==s?void 0:s.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const s=this.component.getSpec()[this.activeType];((null==s?void 0:s.triggerMark)?G(s.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(n={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:n,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:n}=t,s=e;if(["line","area"].includes(i.type))return G(n);const r=s.getViewData().latestData,a=s.getSeriesField();if(!a)return r;const o=G(n)[0][a];return r.filter((t=>t[a]===o))}}const CN=()=>{xw.registerTooltipProcessor("group",AN)};class wN extends NU{constructor(){super(...arguments),this.transformerConstructor=VU,this.type="line",this.seriesType=DC.line}_setModelOption(){this._modelOption.getDimensionInfo=nN,this._modelOption.getDimensionInfoByValue=rN,this._modelOption.getRectByDimensionData=uN}}wN.type="line",wN.seriesType=DC.line,wN.transformerConstructor=VU,V(wN,XU);function TN(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const kN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:TN(t,e)}),MN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:TN(t,e)}),BN={type:"fadeIn"},EN={type:"growCenterIn"};function PN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return BN;case"scaleIn":return EN;default:return kN(t)}}var ON=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=s.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=u(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=u(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===s[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:s[t].attribute.width:e.maxLineWidth=null!==(n=r.labelLimit)&&void 0!==n?n:s[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),s[t].setAttributes(e)}}return s}layoutArcLabels(t,e,i,n,s,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),n.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(n[i])&&!d(s[i])){const t=n[i]?n[i]:null,r=s[i]?s[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=Vt(h.endAngle-d/2),g=zt(c,h.outerRadius,o),f=zt(c,a+e.line.line1MinLength,o),m=new DN(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=zt(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):ZD(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var n,s;const r=e,a=r.spaceWidth,o=null!==(n=r.position)&&void 0!==n?n:"inside",l=null!==(s=r.offsetRadius)&&void 0!==s?s:-a;return t.forEach((t=>{var i,n,s;const{labelSize:h,radian:c}=t,u=t.innerRadius,d=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(d,h.height))p=0;else{let t;t=c>=Math.PI?u:Math.max(u,h.height/2/Math.tan(c/2)),p=d-t-a}!0!==r.rotate&&(p=d-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?u-l+y:"inside-center"===o?u+(d-u)/2:d+l-y,t.labelPosition=zt(t.circleCenter,v,t.middleAngle),t.labelLimit=f,lt(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle;let a=null!==(s=r.offsetAngle)&&void 0!==s?s:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var n,s,r;const a=null!==(n=i[0].attribute.x)&&void 0!==n?n:0,o=2*(null!==(s=i[0].attribute.y)&&void 0!==s?s:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ZD(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=ZD(n.quadrant)?{x:t.x+s.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-s.width/2-this._line2MinLength-h,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const n=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:n}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-s),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const n of t)this._computePointB(n,h,e,i),this._computeX(n,e,i)}const c=2*a;return t.forEach((t=>{var i,n;t.labelVisible&&(ht(t.pointB.x,this._line2MinLength+h)||lt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var n;const s=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(n=e.layout)||void 0===n?void 0:n.align,c=e.spaceWidth,{labelPosition:u,quadrant:d,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=ZD(d)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+s.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):u.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,n,s,r,a,o;const l=e,h=null!==(n=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=l.textStyle)||void 0===s?void 0:s.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?d(h)||"auto"===h?"edge"===c?ZD(t.quadrant)?"left":"right":ZD(t.quadrant)?"right":"left":h:d(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,n){var s;n[0].attribute.x;const r=2*(null!==(s=n[0].attribute.y)&&void 0!==s?s:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,d)}else if(-1!==u&&-1===d){const i=p.labelPosition.y;cn?(e.labelPosition.y=n-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,s[h].originIndex)):c=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computePointB(t,e,i,n){const s=i;let r=0;n.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=s.line.line1MinLength;if("none"===s.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const n=t.circleCenter,s=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(s+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(n.y-r.y)**2)-h;A(c)?t.pointB={x:n.x+c*(ZD(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const n=t.circleCenter,s={width:2*n.x,height:2*n.y};let r=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=s,c=this.computeRadius(a,e.width,e.height),u=this._computeLayoutRadius(h/2,e,i),d=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(ot(l/2,d))g=0,f=1,m=-p;else if(ot(h/2,p))g=1,f=0,m=-d;else{const t=-1/(p/d);g=t,f=-1,m=p-t*d}const v=function(t,e,i,n,s,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-s)**2;return a<0?[]:0===a?[{x:n,y:t}]:[{x:Math.sqrt(a)+n,y:t},{x:-Math.sqrt(a)+n,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-n)**2;return a<0?[]:0===a?[{x:e,y:s}]:[{x:e,y:Math.sqrt(a)+s},{x:e,y:-Math.sqrt(a)+s}]}const a=(e/t)**2+1,o=2*((i/t+n)*(e/t)-s),l=o**2-4*a*((i/t+n)**2+s**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),u=-(e*h+i)/t;return 0===l?[{x:u,y:h}]:[{x:u,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-u,0,u);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?ot(v[0].y,v[1].y)?lt(t.middleAngle,-Math.PI)&&ht(t.middleAngle,0)||lt(t.middleAngle,Math.PI)&&ht(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-s;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let n=-1,s=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const s=this.parent,r=!!(null==n?void 0:n.removeFromParent),a=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=s?s:this.parent)||void 0===i||i.removeChild(this)),dL(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,uL(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},n=[],s=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?n.push(t):(i.pendingCount-=1,s.push(t))})),n.length?(s.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}UN.defaultAttributes={pickable:!1};class NN extends GR{constructor(){super(...arguments),this.type=NN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}NN.type="rect";const jN=()=>{vS(),iS(),vL("rect",RN),xw.registerMark(NN.type,NN),Jg.registerBuiltInAnimate("growHeightIn",RE),Jg.registerBuiltInAnimate("growHeightOut",IE),Jg.registerBuiltInAnimate("growWidthIn",qE),Jg.registerBuiltInAnimate("growWidthOut",ZE),Jg.registerBuiltInAnimate("growCenterIn",EE),Jg.registerBuiltInAnimate("growCenterOut",PE),xw.registerGraphicComponent("rect",zh)},zN=Object.assign(Object.assign({},VI),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function WN(t,e,i){var n,s;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:n,width:s,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===n){const t=i-this._viewPosition.y,e=ut(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ut(t-o/2,l,h);c=t/s,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:n,y:s}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?n:s,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=YN(),a="browser"===Vg.env?Vg:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:n}=this.stage.eventPointTransform(t);let s,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:u}=this.attribute,d=ut(u[1]-u[0],0,1);return"vertical"===e?(s=n,a=s-this._prePos):(s=i,a=s-this._prePos),r=c>0&&d<1?a/c*(1-d):0,[s,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[n,s]=this._computeScrollValue(t);this.setScrollRange([i[0]+s,i[1]+s],!0),this._prePos=n},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:XN[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,n=this.getScrollRange(),[s,r]=this._computeScrollValue(t),a=[n[0]+r,n[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:dt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:n=[0,1],range:s,realTime:r=!0}=this.attribute,a=dt(t,n[0],n[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:s,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",XN[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===Vg.env?Vg:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),u=this._getSliderPos(dt(n,s[0],s[1])),d=u[1]-u[0];let p;this._sliderSize=d,p="horizontal"===t?{x:u[0],y:c.y1,width:d,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:d};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Be(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[n,s,r,a]=Be(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:Math.max(0,t-(a+s)),height:Math.max(0,e-(n+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:n,height:s,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?n:s,l="horizontal"===e?r:a,h=ut(t[0],0,1),c=ut(t[1],0,1),u=ut(c-h,0,1),d=Math.max(u*o,i),p=Math.max(o-d,0),g=l+h/Math.max(1-u,1e-12)*p;return[g,g+d]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_clearDragEvents(){const t=YN(),e="browser"===Vg.env?Vg:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===Vg.env?Vg:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}KN.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class $N extends oL{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}ox(),Cx();class qN extends $N{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},qN.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}qN.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},ox(),iS();class ZN extends $N{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},ZN.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}function JN(){ox(),wS(),RS()}ZN.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};const QN={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};JN();class tj extends oL{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:U({},tj.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(aj.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,n,s;const r=t.target;if(r&&r.name&&r.name.startsWith(aj.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aj.focus||"focus"===o){const n=a.hasState(sj.focus);a.toggleState(sj.focus),n?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[sj.unSelected,sj.unSelectedHover,sj.focus],t),this._setLegendItemState(e,sj.selected,t)})):(this._setLegendItemState(a,sj.selected,t),this._removeLegendItemState(a,[sj.unSelected,sj.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[sj.selected,sj.selectedHover,sj.focus],t),this._setLegendItemState(e,sj.unSelected,t))})))}else{null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((t=>{t.removeState(sj.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(sj.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rj.legendItemClick,a,t);i?(this._removeLegendItemState(a,[sj.selected,sj.selectedHover],t),this._setLegendItemState(a,sj.unSelected,t)):(this._setLegendItemState(a,sj.selected,t),this._removeLegendItemState(a,[sj.unSelected,sj.unSelectedHover],t))}else this._setLegendItemState(a,sj.selected,t),this._removeLegendItemState(a,[sj.unSelected,sj.unSelectedHover],t),null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[sj.selected,sj.selectedHover],t),this._setLegendItemState(e,sj.unSelected,t))}))}this._dispatchLegendEvent(rj.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,sj.selected),this._removeLegendItemState(e,[sj.unSelected,sj.unSelectedHover])):(this._removeLegendItemState(e,[sj.selected,sj.selectedHover]),this._setLegendItemState(e,sj.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:n,defaultSelected:s,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=ej,spaceRow:l=ij,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:u,isHorizontal:d,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:d?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:C}=this._itemContext,w=0,T=0;const k=[];for(let t=g,e=u.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=u[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(s)&&(e=s.includes(y.label));const i=this._renderEachItem(y,e,t,u),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),d?(p(n)&&(f&&a?(C=Math.ceil((S+g)/n),b=C>1):S+g>n&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||k.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),C+=1,S=0,A+=T+l,T=0,k.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),k.push(i)):(p(v)&&(f&&a?(C=Math.ceil((A+m)/v),b=C>1):v<=m?(C+=1,b=!0,A=0,t>0&&(S+=w+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=C,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=C),r||(this._itemContext.startIndex=u.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:n,maxHeight:s}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,s-this._parsedPadding[0]-this._parsedPadding[2]);const a=rA.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:u,height:d}=t,g=[];p(c)&&g.push(c),p(u)&&g.push(u),g.length&&(p(n)&&g.push(n),this._itemWidthByUser=K(g)),p(d)&&(this._itemHeightByUser=d);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,n){var s,r;const{label:a,value:o}=this.attribute.item,l=n.AABBBounds,h=i.AABBBounds,c=l.width(),u=h.width();let d=!1;"labelFirst"===t?u>e?d=!0:n.setAttribute("maxLineWidth",e-u):"valueFirst"===t?c>e?d=!0:i.setAttribute("maxLineWidth",e-c):c+u>e&&(d=!0),d&&(n.setAttribute("maxLineWidth",Math.max(e*(null!==(s=a.widthRatio)&&void 0!==s?s:.5),e-u)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,n){var s,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:u,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,n),A=this._handleStyle(y,t,e,i,n),C=this._handleStyle(b,t,e,i,n),w=this._handleStyle(x,t,e,i,n),T=Be(c);let k;!1===x.visible?(k=rA.group({x:0,y:0,cursor:null===(s=w.style)||void 0===s?void 0:s.cursor}),this._appendDataToShape(k,aj.item,t,k)):(k=rA.group(Object.assign({x:0,y:0},w.style)),this._appendDataToShape(k,aj.item,t,k,w.state)),k.id=`${null!=a?a:o}-${i}`,k.addState(e?sj.selected:sj.unSelected);const M=rA.group({x:0,y:0,pickable:!1});k.add(M);let B,E=0,O=0,R=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);O=_(i)?i[0]||0:i,R=P(v,"space",8);const n=rA.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(n,aj.itemShape,t,k,S.state),n.addState(e?sj.selected:sj.unSelected),M.add(n)}let I=0;if(u){const e=P(g,"size",10);B=rA.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,aj.focus,t,k),I=e}const D=y.formatMethod?y.formatMethod(o,t,i):o,L=mA(Object.assign(Object.assign({x:O/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:D,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(L,aj.itemLabel,t,k,A.state),L.addState(e?sj.selected:sj.unSelected),M.add(L);const F=P(y,"space",8);if(p(l)){const n=P(b,"space",u?8:0),s=b.formatMethod?b.formatMethod(l,t,i):l,r=mA(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:C.style.fontSize},C.style),{text:s,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,aj.itemValue,t,k,C.state),r.addState(e?sj.selected:sj.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-O-R-F-I-n;this._autoEllipsis(m,t,L,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-T[1]-T[3]-I-n}):r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2))}else r.setAttribute("x",F+(L.AABBBounds.empty()?0:L.AABBBounds.x2));E=n+(r.AABBBounds.empty()?0:r.AABBBounds.x2),M.add(r)}else this._itemWidthByUser?(L.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-O-R-I),E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2)):E=F+(L.AABBBounds.empty()?0:L.AABBBounds.x2);B&&(B.setAttribute("x",E),M.add(B));const U=M.AABBBounds,N=U.width();if("right"===f){const t=U.x2,e=U.x1;M.forEachChildren(((i,n)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const j=U.height(),z=p(this.attribute.item.width)?this.attribute.item.width:N+T[1]+T[3],W=this._itemHeightByUser||j+T[0]+T[2];return k.setAttributes({width:z,height:W}),B&&B.setAttribute("visible",!1),M.translateTo(-U.x1+T[3],-U.y1+T[0]),k}_createPager(t){var e,i;const{disableTriggerEvent:n,maxRow:s}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new tj(Object.assign(Object.assign({layout:1===s?"horizontal":"vertical",total:r(this._itemContext.pages)},U({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:n})):new tj(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:n,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new KN(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new KN(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:n}=this.attribute,{totalPage:s,isHorizontal:r}=this._itemContext,a=n&&n.position||"middle";if(this._pagerComponent.setTotal(s),r){let n;n="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:n})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,n=e.AABBBounds;let s,r;return t?(r=n.width(),s=r/i.width()):(r=n.height(),s=r/i.height()),s}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:n,currentPage:s,totalPage:r}=this._itemContext,a=(s-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),n?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:n=!0,animationDuration:s=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:n}=e.attribute,{width:s,height:r}=e.getSliderRenderBounds(),a="vertical"===n?t.deltaY/r:t.deltaX/s;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",mt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:n=2,item:s={},pager:r={}}=this.attribute,{spaceCol:a=ej,spaceRow:o=ij}=s,l=this._itemsContainer,{space:h=nj,defaultCurrent:c=1}=r,u=lj(r,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(d){if(m=(n-1)*o+this._itemHeight*n,f=e,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;v<_+i&&e>0&&(_=0,b+=n+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/n);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+n}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(d?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=rA.group({x:0,y:t,width:d?v:f,height:d?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(d?m+o:f+a,d?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:n={},pager:s={}}=this.attribute,{spaceCol:r=ej,spaceRow:a=ij}=n,o=this._itemsContainer,{space:l=nj,defaultCurrent:h=1}=s,c=lj(s,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,d=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(u)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=d-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],n=f,s=Math.floor(n/(a+e));f=s*(a+e),v=Math.ceil(t.length/s)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,n=v,s=m;v=Math.floor((m+i)/f)+1,m+=a+i,n!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=s+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(u){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=rA.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=s.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(u?g:f,u?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:n=16,gradientStops:s}=e;if(!i||!s)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=s.map((t=>({offset:n*t.offset/o,color:t.color}))),h=s.map((t=>({offset:(o-n*t.offset)/o,color:t.color}))),c=rA.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];ot(ut(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ot(ut(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(sj.selected)?this._setLegendItemState(t,sj.selectedHover,e):this._setLegendItemState(t,sj.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aj.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rj.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(sj.unSelectedHover)||t.hasState(sj.selectedHover))&&(i=!0),t.removeState(sj.unSelectedHover),t.removeState(sj.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(sj.unSelectedHover)&&!t.hasState(sj.selectedHover)||(i=!0),t.removeState(sj.unSelectedHover),t.removeState(sj.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===aj.focus),!1);n&&n.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rj.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rj.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let n=!1;t.hasState(e)||(n=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==aj.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,!0))})),n&&this._dispatchLegendEvent(rj.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let n=!1;e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==aj.focus&&e.forEach((e=>{!n&&t.hasState(e)&&(n=!0),t.removeState(e)}))})),n&&this._dispatchLegendEvent(rj.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(sj.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n,s={}){t.name=e,t.data=i,t.delegate=n,t.states=U({},hj,s)}_dispatchLegendEvent(t,e,i){const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(sj.selected),currentSelectedItems:n,currentSelected:s,event:i})}_handleStyle(t,e,i,n,s){const r={};return t.style&&(u(t.style)?r.style=t.style(e,i,n,s):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(u(t.state[a])?r.state[a]=t.state[a](e,i,n,s):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};cj.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:ej,spaceRow:ij,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:nj,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const uj=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],n=[t.key,...e.map((t=>null==t?void 0:t.key))],s=[t.value,...e.map((t=>null==t?void 0:t.value))];return U(t,...e,{shape:i.every(d)?void 0:U({},...i),key:n.every(d)?void 0:U({},...n),value:s.every(d)?void 0:U({},...s)})},dj=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},pj={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:lA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:lA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:lA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new ue).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},gj=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];ox(),iS(),wS(),RS(),fS();let fj=class t extends oL{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:U({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:n,panel:s,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const u=Be(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},s),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:u[3],y:u[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",U({symbolType:"circle"},d.shape,{visible:$S(d)&&$S(d.shape)}),"symbol"),"object"!=typeof d.value.text||null===d.value.text||"rich"!==d.value.text.type&&"html"!==d.value.text.type?d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:$S(d)&&$S(d.value)},dj(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=d.value.text)&&void 0!==e?e:"",visible:$S(d)&&$S(d.value)},d.value),"text"):"rich"===d.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:$S(d)&&$S(d.value)},dj(d.value)),"richtext"):"html"===d.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:d.value.text.text},uA),d.value),visible:$S(d)&&$S(d.value),width:d.value.width,height:d.value.height,wordBreak:d.value.wordBreak,textAlign:d.value.textAlign,textBaseline:d.value.textBaseline,singleLine:!1,textConfig:[]},d.value),"richtext"));const g=$S(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:f,textBaseline:m}=d.value,v=s.width-u[3]-u[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",d.height):"middle"===m?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const y=$S(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),n&&n.length){this._tooltipContent.setAttribute("x",u[3]),this._tooltipContent.setAttribute("y",u[0]+y);let e=0;n.forEach(((i,n)=>{const s=t.getContentAttr(this.attribute,n);if(!$S(s))return;const l=`tooltip-content-${n}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),u=s.shape.size+s.shape.spacing;let d="right"===c?(o?u:0)+($S(s.key)?r+s.key.spacing:0)+($S(s.value)?a:0):0;this._createShape("right"===c?d-s.shape.size/2:d+s.shape.size/2,s,h,l),o&&("right"===c?d-=u:d+=u);const g=this._createKey(s,h,l);g&&(vA(c,g,s.key.textAlign,d,r),g.setAttribute("y",0),"right"===c?d-=r+s.key.spacing:d+=r+s.key.spacing);const f=this._createValue(s,h,l);if(f){let t="right";p(s.value.textAlign)?t=s.value.textAlign:$S(s.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),vA(c,f,t,d,a),f.setAttribute("y",0)}e+=s.height+s.spaceRow}))}}_createShape(t,e,i,n){var s;if($S(e.shape))return i.createOrUpdateChild(`${n}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(s=$s(e.key.lineHeight,e.key.fontSize))&&void 0!==s?s:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var n;if($S(t.key)){let s;return s=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},dj(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.key.text)&&void 0!==n?n:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},dj(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},uA),t.key)},"richtext"),s}}_createValue(t,e,i){var n;if($S(t.value)){let s;return s=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},dj(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(n=t.value.text)&&void 0!==n?n:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},dj(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),s}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>gj.includes(t)))?(this._mergeAttributes(e,n),d(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,u=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?u-=i+s:"middle"===l?u-=i/2:u+=s,c+e>h.x2&&(c-=e+n),u+i>h.y2&&(u-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&$S(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach((([e,i],a)=>{var c;const{key:u,value:d,shape:p,spaceRow:g}=i,f=$S(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=dA(u),y=dA(d);let _=0;if($S(u)){const{width:t,height:e}=v.quickMeasure(u.text);l.push(t),_=Math.max(_,e)}if($S(d)){const{width:t,height:e}=y.quickMeasure(d.text);h.push(t),_=Math.max(_,e)}f&&ta[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=u,e.valueWidth=d}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return uj({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return uj({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};fj.defaultAttributes=pj;class mj extends yU{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),OA(this._regions,(t=>{vD(this.getOrient())?YL(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):YL(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=mw({},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 di(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new xR(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,n,s,r,a,o;const l=Oe.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(n=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===n?void 0:n.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,u=(null===(r=null===(s=this._spec.layers)||void 0===s?void 0:s[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",d="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?d(u,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const n=[],s=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();s&&s.length&&n.push(s.map((e=>GL(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&n.push(r.map((e=>GL(e.value,this._getNormalizedValue([e.value],t))))),n}registerTicksTransform(){const t=`${this.type}-ticks`;return GT(this._option.dataSet,t,fU),t}transformScaleDomain(){}}mj.type=r.cartesianTimeAxis,mj.specKey="axes",mj.builtInTheme={axis:QF,axisX:tU,axisY:eU};class vj extends yU{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new PC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return GT(this._option.dataSet,t,fU),t}transformScaleDomain(){}}vj.type=r.cartesianLogAxis,vj.specKey="axes",vj.builtInTheme={axis:QF,axisLinear:vU,axisX:tU,axisY:eU},V(vj,dU);class yj extends yU{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new OC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return GT(this._option.dataSet,t,fU),t}transformScaleDomain(){}}yj.type=r.cartesianSymlogAxis,yj.specKey="axes",yj.builtInTheme={axis:QF,axisLinear:vU,axisX:tU,axisY:eU},V(yj,dU);const _j={barWidth:!0,barMinWidth:!0,barMaxWidth:!0,barGapInGroup:!0,barMinHeight:!0,stackCornerRadius:!0};class bj extends mD{constructor(){super(...arguments),this.type=DC.bar,this._barMarkName="bar",this._barMarkType="rect",this.transformerConstructor=VN,this._bandPosition=0,this._getLinearBarRange=(t,e)=>{let[i,n]=[t,e].sort(((t,e)=>t-e));const s=n-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,n=n-t}const r=n-i,a=lw(this._spec.barMinWidth||2,s);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[GI]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):ZC(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[YI]):ZC(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const n=ZC(this._dataToPosX(t),e,i),s=ZC(this._dataToPosX1(t),e,i);return this._getLinearBarRange(n,s)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[XI]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):ZC(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[KI]):ZC(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const n=ZC(this._dataToPosY(t),e,i),s=ZC(this._dataToPosY1(t),e,i);return this._getLinearBarRange(n,s)},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)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),_j)})}getStatisticFields(){var t;const e=super.getStatisticFields(),i="horizontal"===this.direction?this.getYAxisHelper():this.getXAxisHelper(),n="horizontal"===this.direction?this._fieldY:this._fieldX,s=null===(t=null==i?void 0:i.getScale)||void 0===t?void 0:t.call(i,0);return s&&FA(s.type)&&n.forEach((t=>{const i=e.find((e=>e.key===t));i?i.operations.includes("values")||i.operations.push("values"):e.push({key:t,operations:["values"]})})),e}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},bj.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:iD(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(bj.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const n=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let s;if(GT(this._option.dataSet,"addVChartProperty",EI),n){const t=([t],{scaleDepth:e})=>{var i,n;let s=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[n,s]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[n]}-${t[s]}`;r[e]||(r[e]={[n]:t[n],[s]:t[s]},i.push(r[e]))})),i};GT(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();s=new di(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:WI.bind(this),call:HI}},!1),null==e||e.target.addListener("change",s.reRunAllTransform)}this._barBackgroundViewData=new xR(this._option,s)}init(t){super.init(t),this.initRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,n,s,r,a;e._bar_series_position_calculated=!0,t?(i=KI,n=XI,s="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=YI,n=GI,s="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=bT(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)WN(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:n,startMethod:s,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var n,s;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(s=(n=this[o]).getScale)||void 0===s?void 0:s.call(n,0),h=this[o].isInverse(),c=this._spec.barMinHeight,u=ZC(this[r](t),l,i),d=ZC(this[a](t),l,i);let p=Math.abs(u-d);p<=0&&!JC(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,n;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&d(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let n=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,d=1/0,g=-1/0;i.values.forEach((e=>{const i=e[Qw],s=e[tT],r=e[eT],u=e[iT];if(n=Math.min(n,i,s),o=Math.max(o,i,s),t){const t=e[a?XI:GI],i=e[a?KI:YI];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(u)&&(c=!0,d=Math.min(d,r,u),g=Math.max(g,r,u))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[Qw]:n,[tT]:o}),c?{[eT]:d,[iT]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,s),x1:t?h:this._getBarXEnd(f,s),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(zh(Object.assign(Object.assign({},m),{cornerRadius:u(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,n,s;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>ZC(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>ZC(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,n,s,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(s=null===(n=this._yAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=d(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),n=X(t);return n<0?e.scale(n):i>0?e.scale(i):e.scale(0)}}},n=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,s=fD(this);this._barMark.setAnimationConfig(JI(null===(e=xw.getAnimationInKey("bar"))||void 0===e?void 0:e(i,n),QI(this._barMarkName,this._spec,this._markAttributeContext),s))}_getBarWidth(t,e){var i;const n=this._groups?this._groups.fields.length:1,s=d(e)?n:Math.min(n,e),r=p(this._spec.barWidth)&&s===n,a=r&&"number"==typeof this._spec.barWidth&&"string"!=typeof this._spec.barMinWidth&&"string"!=typeof this._spec.barMaxWidth||null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,s-1),o=null!=a?a:6,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=!t.isContinuous||d(a)||r?o:.5*o;return r&&(c=lw(this._spec.barWidth,o)),l&&(c=Math.max(c,lw(this._spec.barMinWidth,o))),h&&(c=Math.min(c,lw(this._spec.barMaxWidth,o))),c}_getPosition(t,e,i,n){var s,r,a,o,l,h;let c,u,g;"horizontal"===t?(c=this.getYAxisHelper(),u="height",g="barBackground"===n?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(c=this.getXAxisHelper(),u="width",g="barBackground"===n?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const f=c.getScale(0),m=this._groups?this._groups.fields.length:1,v=d(i)?m:Math.min(m,i),y=null!==(r=null===(s=c.getBandwidth)||void 0===s?void 0:s.call(c,v-1))&&void 0!==r?r:6,_=v===m?this._barMark.getAttribute(u,e):y;if(v>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const h=t[r],u=null!==(o=null===(a=c.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],d=u.length,p=lw(null!==(l=i[r-1])&&void 0!==l?l:Y(i),y),g=u.indexOf(e[h]);r===t.length-1?(n+=d*_+(d-1)*p,s+=g*(_+p)):(s+=g*(n+p),n+=n+(d-1)*p)}return f.scale(e[t[0]])+(null!==(h=c.getBandwidth(0))&&void 0!==h?h:y)/2-n/2+s}const b=FA(f.type||"band");return g(e,v)+.5*(y-_)+(b?-y/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,n=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._barBackgroundViewData)||void 0===n||n.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}bj.type=DC.bar,bj.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},bj.mark=zN,bj.transformerConstructor=VN;const xj=()=>{OU(),jN(),xw.registerAnimation("bar",((t,e)=>({appear:PN(t,e),enter:kN(t,!1),exit:MN(t,!1),disappear:{duration:sI.disappear.duration}}))),nU(),_U(),xw.registerSeries(bj.type,bj)};class Sj extends HU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),NO(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const n=t.series.some((t=>"horizontal"===t.direction)),s=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(n?["left","right"]:["top","bottom"]).includes(t.orient)));if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(s,e,{barMaxWidth:n,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class Aj extends NU{constructor(){super(...arguments),this.transformerConstructor=Sj,this.type="bar",this.seriesType=DC.bar}_setModelOption(){this._modelOption.getDimensionInfo=nN,this._modelOption.getDimensionInfoByValue=rN,this._modelOption.getRectByDimensionData=uN}}Aj.type="bar",Aj.seriesType=DC.bar,Aj.transformerConstructor=Sj,V(Aj,XU);const Cj=[...FD,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class wj extends UD{constructor(){super(...arguments),this.type=wj.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return Cj}_getIgnoreAttributes(){return[]}}wj.type="area";class Tj extends FI{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of G(e)){let e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const kj=Object.assign(Object.assign(Object.assign({},VI),OD),{area:{name:"area",type:"area"}}),Mj=()=>{xw.registerAnimation("area",oI),lI(),aI()};class Bj extends ML{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,n;const s=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(n=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===n?void 0:n.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!s||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,u=!1!==l.visible&&!1!==(null===(n=l.style)||void 0===n?void 0:n.visible),d=!1!==h.visible&&!1!==(null===(s=h.style)||void 0===s?void 0:s.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||d&&!u)&&(g=h,f=l),l.style=mw({},f.style,g.style),l.state=mw({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class Ej extends mD{constructor(){super(...arguments),this.type=DC.area,this.transformerConstructor=Bj,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),RD)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(Ej.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,n,s,r;const a=null!==(n=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==n?n:null===(r=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.curveType,o=a===AI?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return ZC(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return ZC(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[tT]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,n;const s={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(JI(null===(e=xw.getAnimationInKey("line"))||void 0===e?void 0:e(s,r),QI("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(JI(null===(i=xw.getAnimationInKey("area"))||void 0===i?void 0:i(s,r),QI("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=fD(this);this._symbolMark.setAnimationConfig(JI(null===(n=xw.getAnimationInKey("scaleInOut"))||void 0===n?void 0:n(),QI("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new Tj(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,n,s,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}Ej.type=DC.area,Ej.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},Ej.mark=kj,Ej.transformerConstructor=Bj,V(Ej,ID);const Pj=()=>{OU(),AU(),wL(),xw.registerMark(wj.type,wj),vS(),qb(),bL(),AL(),hI(),xw.registerGraphicComponent("area",vh),kL(),Mj(),nU(),_U(),xw.registerSeries(Ej.type,Ej)};class Oj extends HU{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),NO(t)}}class Rj extends NU{constructor(){super(...arguments),this.transformerConstructor=Oj,this.type="area",this.seriesType=DC.area}_setModelOption(){this._modelOption.getDimensionInfo=nN,this._modelOption.getDimensionInfoByValue=rN,this._modelOption.getRectByDimensionData=uN}}Rj.type="area",Rj.seriesType=DC.area,Rj.transformerConstructor=Oj,V(Rj,XU);class Ij extends pD{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const n=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:n,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};FA(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:[]};FA(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)&&gD(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Dj(t){return YS(t)?Number.parseFloat(t):0}const Lj=(t,e)=>{const{asStartAngle:i,asEndAngle:n,asMiddleAngle:s,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:u}=e,d=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&u&&Fj(m,d,c))return[];const v=(t,e,a)=>{t[i]=e,t[n]=e+a,t[s]=e+a/2,t[r]=a,t[o]=Vt(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[d]))),S=g-p;let A=p,C=S,w=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const n=Math.pow(10,e),s=t.map((t=>(isNaN(t)?0:t)/i*n*100)),r=100*n,a=s.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=s.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/n))}(x);if(m.forEach(((t,e)=>{const i=t[KL],n=y?i/y:0;let s=n*S;s{v(e,p+i*t,t)}))}else{const t=C/w;A=p,m.forEach((e=>{const i=e[r]===f?f:e[KL]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][n]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},Fj=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===Dj(t[e])))||!i&&0===t.reduce(((t,i)=>t+Dj(i[e])),0)));function Uj(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const Nj=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:Uj(t,!0,tk.appear)}),jj={type:"fadeIn"},zj=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:Uj(t,!0,tk.enter)}),Wj=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:Uj(t,!0,tk.exit)});function Hj(t,e){if(!1===e)return{};switch(e){case"fadeIn":return jj;case"growRadius":return Nj(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Nj(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Vj extends GR{constructor(t,e){super(t,e),this.type=Gj.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n)=>{var s;return n+(null!==(s=this.getAttribute("radiusOffset",e,i))&&void 0!==s?s:0)},this.computeCenter=(t,e,i="normal",n)=>zt({x:0,y:0},this.getAttribute("centerOffset",e,i),e[QL])[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 Gj extends Vj{constructor(){super(...arguments),this.type=Gj.type}}Gj.type="arc";const Yj=()=>{vS(),Lb(),vL("arc",LN),Jg.registerBuiltInAnimate("growRadiusIn",XE),Jg.registerBuiltInAnimate("growRadiusOut",KE),Jg.registerBuiltInAnimate("growAngleIn",ME),Jg.registerBuiltInAnimate("growAngleOut",BE),xw.registerGraphicComponent("arc",gh),xw.registerMark(Gj.type,Gj)},Xj=Object.assign(Object.assign({},VI),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class Kj extends aD{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let n=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);n=mw({},this._theme,i,t);const s=(t,e)=>mw({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(n.label)?n.label=n.label.map((t=>s(t.position,t))):n.label=s(n.label.position,n.label)}return{spec:n,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:n,centerY:s}=t;return p(n)&&(i.centerX=n),p(s)&&(i.centerY=s),Object.keys(i).length>0?i:void 0}}const $j=`${Vw}_LABEL_VISIBLE`,qj={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},Zj={outerRadius:!0};class Jj extends Ij{constructor(){super(...arguments),this.transformerConstructor=Kj,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:nw(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:nw(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=iF,this._endAngle=nF,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[QL];if(d(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t);return zt(this.computeCenter(t),(i+n)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,n,s,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,n=2*Math.PI;const s=p(t),r=p(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(p(this._spec.startAngle)?Nt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?Nt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?Nt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(n=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==n&&n,this._showAllZero=null!==(s=this._spec.showAllZero)&&void 0!==s&&s,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;GT(this._dataSet,"pie",Lj),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?Nt(this._spec.minAngle):0,asStartAngle:qL,asEndAngle:ZL,asRatio:$L,asMiddleAngle:QL,asRadian:eF,asQuadrant:tF,asK:JL,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new di(this._dataSet,{name:`${Vw}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new xR(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Jj.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:$w,groupKey:this._seriesField,isSeriesMark:!0},{morph:iD(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return RA(qL)(t)}endAngleScale(t){return RA(ZL)(t)}_computeLayoutRadius(){return((t,e,i,n)=>{const s=t();if(S(s))return s;if(u(s))return s(e(),i());const r=e();if("auto"===s&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=n();return Ht(r,i(),t,e)}return Math.min(r.width/2,r.height/2)})((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:QC(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:QC(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const n=this._emptyArcMark;n&&this.setMarkStyle(n,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const n in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[n]),n,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:RA($j).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===n?void 0:n.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===n?void 0:n.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Zj),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),qj)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const n=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];n.forEach((t=>{i[t]=!0}));const s=super._compareSpec(t,e,i);return t=null!=t?t:{},n.some((i=>t[i]!==e[i]))&&(s.reRender=!0,s.change=!0),s}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[QL];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const n=this.computeDatumRadius(t);return zt(this.computeCenter(t),n,i)}initAnimation(){var t,e,i;const n={growFrom:(t,e,i)=>{var n,s;if(i===tk.appear)return this._startAngle;if(i===tk.disappear)return this._endAngle;const r=[tk.disappear,tk.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[Kw];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Kw]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Kw])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[Kw])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+zt({x:0,y:0},a,e[QL]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+zt({x:0,y:0},a,e[QL]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+zt({x:0,y:0},a,e[QL]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+zt({x:0,y:0},a,e[QL]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=JI(null===(i=xw.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(n,null!=s?s:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Jj.transformerConstructor=Kj,Jj.mark=Xj,Jj.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class Qj extends Jj{constructor(){super(...arguments),this.type=DC.pie}}Qj.type=DC.pie;const tz=()=>{Yj(),xw.registerAnimation("pie",((t,e)=>({appear:Hj(t,e),enter:zj(t),exit:Wj(t),disappear:{duration:sI.disappear.duration}}))),xw.registerAnimation("emptyCircle",((t,e)=>({appear:Hj(t,e)}))),xw.registerSeries(Qj.type,Qj)};class ez extends WU{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,n;const s=G(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(n=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===n?void 0:n.innerRadius;return p(r)&&s.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),s}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class iz extends ez{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class nz extends NU{constructor(){super(...arguments),this.transformerConstructor=iz}}nz.transformerConstructor=iz;class sz extends nz{constructor(){super(...arguments),this.transformerConstructor=iz,this.type="pie",this.seriesType=DC.pie}}sz.type="pie",sz.seriesType=DC.pie,sz.transformerConstructor=iz;class rz extends WU{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var n;if("bar"===e.type){const s=this._findBandAxisBySeries(e,i,t.axes);if(s&&!s.bandSize&&!s.maxBandSize&&!s.minBandSize){const t=g(e.autoBandSize)&&null!==(n=e.autoBandSize.extend)&&void 0!==n?n:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(s,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{P(e,"trimPadding")&&mw(e,GO(this.type,t))})),this._transformAxisSpec(t)}}const az=(t,e)=>{if(!t)return null;const i=BD(t,(t=>"angle"===t.getOrient()),e),n=BD(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||n&&n.length))return null;const s=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&NA(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=EA({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,n=K(e),s=X(e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,h);const g=PA(u),f=null===(e=n[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=kD(v,t,"polar",r);s.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),n&&n.forEach((t=>{var e;const n=t.getScale(),l=null==n?void 0:n.range();if(n&&NA(n.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=EA({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=PA(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=n.invert(p);if(d(m))return;let v=n.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=kD(m,t,"polar",r);s.push({index:v,value:m,position:n.scale(m),axis:t,data:y})}})),s.length?s:null};class oz extends NU{constructor(){super(...arguments),this.transformerConstructor=rz,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var n,s;return[...null!==(n=nN(t,e,i))&&void 0!==n?n:[],...null!==(s=az(t,e))&&void 0!==s?s:[]]},this._modelOption.getDimensionInfoByValue=rN,this._modelOption.getRectByDimensionData=uN}}oz.type="common",oz.transformerConstructor=rz,V(oz,XU);const lz={rect:gz,symbol:dz,arc:mz,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=dz(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:function(t,e,i){const n=t.series,s=t.labelSpec||{},r=n.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=s.position||"withChange",o=s.offset||0,l=e?e(r.data):r.data,h=cz(t,l,s.formatMethod);return h.x=function(t,e,i,n){if("horizontal"===e.direction)return"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-n:e.totalPositionX(t,"end")+(t.end>=t.start?n:-n);return e.totalPositionX(t,"index",.5)}(l,n,a,o),h.y=function(t,e,i,n){if("horizontal"===e.direction)return e.totalPositionY(t,"index",.5);if("middle"===i)return.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start"));if("max"===i)return e.totalPositionY(t,t.end>=t.start?"end":"start")-n;if("min"===i)return e.totalPositionY(t,t.end>=t.start?"start":"end")+n;return e.totalPositionY(t,"end")+(t.end>=t.start?-n:n)}(l,n,a,o),"horizontal"===n.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Ac(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const s=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[n.getDimensionField()[0]])}));s&&(s.data=i,e.push(s))})),e},overlap:{strategy:[]}}},line:vz,area:vz,rect3d:gz,arc3d:mz,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,n)=>{for(let s=0;s"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function hz(t,e){var i;const{labelSpec:n}=e;n.overlap&&!g(n.overlap)&&(n.overlap={});const s=null!==(i=lz[t])&&void 0!==i?i:lz.point;return e.series.type===DC.sankey?function(t){var e,i,n;const{series:s,labelSpec:r={}}=t,a=null!==(e=uz(r.position))&&void 0!==e?e:"outside",o=s.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(n=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==n?n:yz(s)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):s(e)}function cz(t,e,i,n){var s,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(s=h.text)&&void 0!==s?s:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==DC.sankey){const{formatFunc:t,args:s}=MI(i,n,h.text,e);t&&(h._originText=h.text,h.text=t(...s,{series:o}))}return h}function uz(t){return u(t)?e=>t(e.data):t}function dz(t){var e,i,n;const{series:s,labelSpec:r}=t,a="horizontal"===s.direction?"right":"top",o=null!==(e=uz(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(n=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==n?n:pz(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function pz(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function gz(t){var e,i,n,s,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=uz(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",u="horizontal"===o.direction?null===(n=o.getXAxisHelper())||void 0===n?void 0:n.isInverse():null===(s=o.getYAxisHelper())||void 0===s?void 0:s.isInverse();let d,p=h;p=t=>{var e;const{data:i}=t,n=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===n){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},n=(null==i?void 0:i[t])>=0&&u||(null==i?void 0:i[t])<0&&!u?1:0;return e[c][n]}return n},d=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:fz(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:d,smartInvert:g}}function fz(t){const e=[{type:"position",position:e=>{var i,n;const{data:s}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function mz(t){var e;const{labelSpec:i}=t,n=null!==(e=uz(i.position))&&void 0!==e?e:"outside",s=n;let r;return r=i.smartInvert?i.smartInvert:y(n)&&n.includes("inside"),{position:s,smartInvert:r}}function vz(t){var e,i,n,s;const{labelSpec:r,series:a}=t,o=null===(n=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===n?void 0:n.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[qw]:a.getSeriesKeys()[0]}];return{position:null!==(s=r.position)&&void 0!==s?s:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function yz(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class _z extends lF{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,W(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:n})=>{const s=i(),r=HC({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=n(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:s}=t.context;s!==$O.exit&&e.forEach(((t,{})=>{const e=n(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},s)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:s}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}_z.type=r.label;class bz extends GR{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=bz.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const n=super._transformGraphicAttributes(t,e,i),{text:s}=n;return g(s)&&p(s.text)&&("rich"===this._textType||"rich"===s.type)&&(n.textConfig=s.text),n}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?uc(t):Ac(t)}}bz.type="text";class xz extends bz{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}xz.type="text",xz.constructorType="label";const Sz=()=>{xw.registerMark(bz.type,bz),vS(),RS(),fS(),xw.registerGraphicComponent("text",Ac),xw.registerGraphicComponent("richtext",uc),xw.registerMark(xz.constructorType,xz)};class Az extends oF{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Cz extends _z{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=Az,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],n=(null==e?void 0:e.region)||[];return n.forEach(((n,s)=>{(n.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:n={}}=i;return Object.values(n).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,s],regionIndexes:[s]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(LT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(LT.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),OA(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),n=t.getRegion();this._labelInfoMap.get(n)||this._labelInfoMap.set(n,[]);for(let s=0;s{var s,o,l;if(e.visible){const h=this._labelInfoMap.get(n),c=this._createMark({type:"label",name:`${null!==(s=t.userId)&&void 0!==s?s:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let n=!1;const s=`${i.getGroupMark().name}-label-component`;let r=t[s];r||(n=!0,r=this._createMark({type:"component",name:s},{componentType:"label"},{support3d:this._spec.support3d})),r&&(n&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[s]=null)}else e.forEach(((e,n)=>{var s;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(s=e.baseMark.getData())||void 0===s||s.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[n])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,n;const{labelMark:s,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(s,r),u(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,s,r)}(null===(n=null===(i=s.stateStyle)||void 0===i?void 0:i.normal)||void 0===n?void 0:n.lineWidth)&&s.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const n=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,s;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),u=null!==(s=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==s?s:0;let d=mw({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:n.map((t=>t.getMarks()[0].getProductId()))}},hz(h,r),Object.assign(Object.assign(Object.assign({},N(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:u}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[lT])):t=>t.filter((t=>t.data[oT]))}:{});return l&&l.parseLabelStyle&&(d=l.parseLabelStyle(d,a,o)),"line"!==h&&"area"!==h||(d.type=h),d},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?cz(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,n=null==i?void 0:i.parent;if(n){const t=n.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,s)=>{s.getComponent()===n&&(e=G(i())[t])}))}return e}}Cz.type=r.label,Cz.specKey="label",Cz.transformerConstructor=Az;var wz;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(wz||(wz={}));const Tz={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},kz={labelZIndex:!0,gridZIndex:!0},Mz={xField:!0,yField:!0,categoryField:!0,valueField:!0},Bz={visible:!0,width:!0,style:!0};class Ez extends lF{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=mt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:n}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,n,e,t.activeType);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let n=!1;if(t.forEach((t=>{NA(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!this.enable)return!1;const{currentValue:s}=this._stateByField[i];return t.forEach(((t,i)=>{const n=t.axis;s.set(i,{datum:this._getDatumAtPoint(n,e),axis:n})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:n=0,datum:s}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===n));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(n,{axis:r,datum:s}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!W(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>W(null==e?void 0:e[i],null==t?void 0:t[i])||kz[i]||Mz[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>W(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>W(null==t?void 0:t[i],null==e?void 0:e[i])||Bz[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var n;if(!1===(null===(n=this._option.componentShowContent)||void 0===n?void 0:n.crosshair))return;const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:jT.chart}:{source:NT.chart};_(t)?t.forEach((t=>{this.event.on(t,r,s)})):this.event.on(t,r,s)}_eventOff(t,e,i){const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,n)})):this.event.off(t,n)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),n={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},n),{x:n.x-this.getLayoutStartPoint().x,y:n.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:WS(e)||HS(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=G(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const n=[];return t.forEach((t=>{n.push({click:"click"===t,in:i[t],out:e(t)})})),n}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:NT.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:NT.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:NT.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const n=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=P(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{Tz[t].includes(e.getOrient())&&s.push(i)}))),!s.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:u}=this.getLayoutStartPoint();return s.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const s=n.find((e=>e.getSpecIndex()===t));if(!s)return;const d=(null===(i=(e=s).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};s.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+d.left),o=Math.min(o,i-u+d.top),l=Math.max(l,e+t.getLayoutRect().width-c-d.right),h=Math.max(h,i+t.getLayoutRect().height-u-d.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:s})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:n}=this._stateByField[t].attributes,s="rect"===n?"rectStyle":"lineStyle";i.setAttributes({[s]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:n}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==n&&(this.gridZIndex=n)}_parseField(t,i){var n,s,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:u,fillOpacity:d,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?u:d;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=P(o,"width",h||2);else{a.style.fill=l||r,(null===(s=null===(n=null==t?void 0:t.line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.stroke)&&(a.style.stroke=t.line.style.stroke);const e=P(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,n=l.style||{},s=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:u}=s,d=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},n),{fill:n.fill||"#fff",stroke:P(n,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},u)},d):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((n=>{const s=n.axis;var r,a,o;if(a=e,o=i,((r=n).x1>a||r.x2o||r.y2a||os&&(d=s-l),h>r&&(p=r-h),d&&t.setAttribute("dx",d+c),p&&t.setAttribute("dy",p+u)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:n}=this._stateByField[e];return i&&t.push(i),n&&Object.keys(n).forEach((e=>{n[e]&&t.push(n[e])})),t}),[])}}Ez.specKey="crosshair";const Pz={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class Oz extends Ez{static getSpecInfo(t){return BI(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}_getDatumAtPoint(t,e){const i=vD(t.getOrient())?"x":"y",n=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(n)}setAxisValue(t,e){vD(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,n){var s;let r=t,a=e;if(i&&i.length)if("dimension"===n){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let n;if(e>-1){const i=t.data[e];n=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:yD(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.getOrient()))?a=null==n?void 0:n.y:r=null==n?void 0:n.x}else if("mark"===n){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=((t,e)=>{for(let i=0;i{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:n,bandSize:s,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=hN(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,u,d;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+s/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(u=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==u?u:0,textStyle:Object.assign(Object.assign({},null===(d=i.label)||void 0===d?void 0:d.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(n[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,n[l]=e}))}else n[l]&&n[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:n}=this._stateByField[t];let{crosshairComp:s}=this._stateByField[t];if(s)s.setAttributes(e);else{const r=n.style;"line"===n.type?s=new qN(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===n.type&&(s=new ZN(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(s),this._stateByField[t].crosshairComp=s}}}Oz.specKey="crosshair",Oz.builtInTheme={crosshair:Pz},Oz.type=r.cartesianCrosshair;const Rz=(t,e)=>p(e)?t.map((t=>e[t])):void 0,Iz=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),Dz=t=>!d(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function Lz(t,e,i){var n,s,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),u=i.getOption(),g=u.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=Fz(t,g),m=null!==(n=c.activeType)&&void 0!==n?n:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=u.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>Iz(i,n)(t)&&Iz(s,r)(t)&&(d(a)||Iz([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),s=null!==(e=c.x)&&void 0!==e?e:v.x+n.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+n.y,a={x:0,y:0};S.transformPoint({x:s,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const n=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(s=u.globalInstance.getChart())&&void 0!==s?s:void 0,datum:void 0,model:void 0,source:NT.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=u.globalInstance;return SI.globalConfig.uniqueTooltip&&SI.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const n=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),s=[{datum:[n],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:n[e.data.dimensionFields[0]],data:s}],chart:null!==(h=u.globalInstance.getChart())&&void 0!==h?h:void 0,datum:n,model:e.series,source:NT.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:n,mark:null,series:e.series},r,!1);const a=u.globalInstance;return SI.globalConfig.uniqueTooltip&&SI.hideTooltip(a.id),m}return"none"}const Fz=(t,e)=>{const i=e.getSeries(),n=[];return i.forEach((e=>{var i,s,r,a,o,l,h;const c=e.getDimensionField(),u=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(s=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=Rz(c,t);let y=Rz(u,t);const _=Dz(y),b=!_&&p(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(Iz(c,v));if(!_&&(y=Rz(u,i),!Dz(y)))return;const s=e.type===DC.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(s)||isNaN(s.x)||isNaN(s.y)||n.push({pos:s,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=NA(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",s=c.map(((t,e)=>[t,e])).filter((([,t])=>d(null==v?void 0:v[t])));let r=[null!=v?v:[]];s.length>0&&s.forEach((([t,i])=>{var n,s,a,o;const l=null!==(o=null===(a=null===(s=null===(n=e.getViewDataStatistics)||void 0===n?void 0:n.call(e))||void 0===s?void 0:s.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var n;const s=null!==(n=null==t?void 0:t.slice())&&void 0!==n?n:[];s[i]=e,h.push(s)}))})),r=h})),r.forEach((s=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(Iz(c,s));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=Rz(u,o),!Dz(y))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||n.push({pos:l,data:{dimensionFields:c,dimensionData:s,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(Iz(c,s));if(!_&&(y=Rz(u,r),!Dz(y)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;n.push({pos:o,data:{dimensionFields:c,dimensionData:s,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===DC.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(Iz(c,v))).find((t=>t[g]===f));m.forEach((s=>{if(y=Rz(u,i),!Dz(y))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||n.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:s},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,s,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(Iz(c,v));const o=e.getNameMap(),l=null===(r=null===(s=e.getMapViewData)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=Rz(u,a),h=y,!Dz(y)&&!a)return;Dz(y)||(y=[null])}const p=e.dataToPosition(a);d(p)||isNaN(p.x)||isNaN(p.y)||n.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),n},Uz=t=>p(t)&&!_(t),Nz=t=>p(t)&&_(t),jz=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class zz extends oF{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:n}=super._initTheme(t,e),s=mw({},...jz.map((t=>void 0!==(null==n?void 0:n[t])?{[t]:n[t]}:void 0)),null==n?void 0:n.style),r=mw({},n);jz.forEach((t=>{delete r[t]})),delete r.style;const a=mw({},r,i);return a.style=mw({},s,a.style),{spec:a,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var n,s,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(n=t.visible)||void 0===n||n,t.activeType=(t=>{var e,i,n;if(!1===(null==t?void 0:t.visible))return[];const s={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(n=null==t?void 0:t.group)||void 0===n?void 0:n.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(s).forEach((e=>{var i;s[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(s).filter((t=>s[t]))})(t),t.renderMode=null!==(s=t.renderMode)&&void 0!==s?s:HS(this._option.mode)||!zS(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=Vg.getElementById(t.parentElement)):zS(this._option.mode)&&(t.parentElement=null==jS?void 0:jS.body)}}const Wz={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class Hz extends lF{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=zz,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,n,s,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return;const o=zS(null===(s=this._option)||void 0===s?void 0:s.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,n,s,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(s=this._spec)||void 0===s?void 0:s.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:n},ignore:{mark:s}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let n=0,s=a.length;n!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(s&&Uz(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(n)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(n)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,n,s)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),s)o=!a.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],s=this._isSameAsCache(n,i,t);o=!a.showTooltip(n,i,s),o&&(this._cacheInfo=n,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,n&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&SI.globalConfig.uniqueTooltip&&l&&SI.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e},this._hideTooltipByHandler=e=>{var i,n,s;if(!this._isTooltipShown&&!(null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===n?void 0:n.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:NT.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:NT.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!W(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s,this._enterable=!1;else{const t="canvas"===n?fN.canvas:fN.dom,s=xw.getComponentPluginInType(t);s||FS("Can not find tooltip handler: "+t);const r=new s;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===n&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,n;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const s=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);s&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===s[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(n=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==n?n:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=xw.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),n=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(WS(n)||HS(n))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,mt(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,n;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",s=this._spec.enterable&&"html"===t;s&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=s,null===(n=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===n||n.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const n=Lz(t,e,this);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=n),n}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(Nz(t)){if(Uz(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>wD(t,e[i])))}if(Nz(this._cacheInfo))return!1;const n=this._cacheInfo;if(!((null==t?void 0:t.datum)===n.datum&&(null==t?void 0:t.mark)===n.mark&&(null==t?void 0:t.series)===n.series))return!1;const s=this._cacheParams;return!d(s)&&!d(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:n,y:s}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return n>=a&&n<=a+l&&s>=o&&s<=o+h}getVisible(){return!1!==this._spec.visible}}Hz.type=r.tooltip,Hz.transformerConstructor=zz,Hz.builtInTheme={tooltip:Wz},Hz.specKey="tooltip";function Vz(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(u(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else E(t.style)||(t.style=e(t.style));return E(t.state)||Object.keys(t.state).forEach((i=>{if(u(t.state[i])){const n=t.state[i];t.state[i]=(...t)=>e(n(...t))}else E(t.state[i])||(t.state[i]=e(t.state[i]))})),t}function Gz(t,i,n){const{title:s={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:d,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:C={},pager:w={},background:T={}}=t;A=I(A),C=I(C),w=I(w),T=I(T);const k=S;if(u(k.maxRow)||u(k.maxCol)){const t=tw(n)?n:tw(d)?d:"left";u(k.maxRow)&&(k.maxRow=k.maxRow({rect:i,orient:t,id:h})),u(k.maxCol)&&(k.maxCol=k.maxCol({rect:i,orient:t,id:h}))}return A.visible?k.title=function(t){var e,i;const n=Object.assign({},t);return E(t.style)||(n.textStyle=ET(t.style)),E(t.textStyle)||mw(n.textStyle,ET(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&ET(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&ET(n.background.style),n}(A):k.title={visible:!1},E(C.focusIconStyle)||ET(C.focusIconStyle),C.shape&&(C.shape=Vz(MT(C.shape))),C.label&&(C.label=MT(C.label)),C.value&&(C.value=MT(C.value)),C.background&&(C.background=MT(C.background)),ew(C.maxWidth)&&(C.maxWidth=Number(C.maxWidth.substring(0,C.maxWidth.length-1))*i.width/100),ew(C.width)&&(C.width=Number(C.width.substring(0,C.width.length-1))*i.width/100),ew(C.height)&&(C.height=Number(C.height.substring(0,C.height.length-1))*i.width/100),k.item=C,"scrollbar"===w.type?(E(w.railStyle)||ET(w.railStyle),E(w.sliderStyle)||ET(w.sliderStyle)):(E(w.textStyle)||ET(w.textStyle),w.handler&&MT(w.handler)),k.pager=w,T.visible&&!E(T.style)&&(mw(k,T.style),p(T.padding)&&(k.padding=T.padding)),k}const Yz=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},Xz=(t,e)=>{var i,n,s;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),u=l();if(0===c.length&&u.length)return[];if(c.length===u.length)return t;const d={};c.forEach((t=>{d[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:qw;return h?h(t,c,g):(_(t)&&(null===(n=t[0])||void 0===n?void 0:n.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(s=t[0])||void 0===s?void 0:s.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(g)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,g)]))),t)},Kz={position:!0,item:!0,title:!0,pager:!0,background:!0};class $z extends lF{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:()=>{OA(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),OA(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=tw(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:n,seriesIndex:s}=this._spec;p(n)&&(this._seriesUserId=G(n)),p(e)&&(this._regionUserId=G(e)),p(s)&&(this._seriesIndex=G(s)),p(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const n=!W(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):n&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(n&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,n=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>W(null==i?void 0:i[t],null==n?void 0:n[t])||Kz[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new xR(this._option,e),this._initSelectedData(),OA(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,n,s;const r=this._selectedData;d(e)||JSON.stringify(r)===JSON.stringify(e)||(OA(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(n=(i=this.effect).onSelectedDataChange)||void 0===n||n.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(n.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)W(n,this._cacheAttrs)||this._legendComponent.setAttributes(mw({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(mw({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:n,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(n-s)/2:"end"===i&&(o=n-s):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+s,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());W(t,this._cacheAttrs)||this._legendComponent.setAttributes(mw({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}$z.specKey="legends";class qz extends $z{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return BI(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),OA(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){GT(this._option.dataSet,"discreteLegendFilter",Xz),GT(this._option.dataSet,"discreteLegendDataMake",Yz);const t=new di(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return OA(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,n;const s=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return s;if(!t.getRawData())return s;const a=this._option.globalScale.getScaleSpec(r);if(!a)return s;if(this._spec.field)return this._spec.field;if(!XS(a.domain))return s;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(n=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==n?n:s}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return u(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!e)return;t.title.text=_T(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=Object.assign(Object.assign({layout:e,items:this._getLegendItems(),zIndex:this.layoutZIndex},Gz(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return cj}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(rj.legendItemClick,(i=>{const n=P(i,"detail.currentSelected");e&&this.setSelectedData(n),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:n,event:i})})),this._legendComponent.addEventListener(rj.legendItemHover,(e=>{const i=P(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rj.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 n=t.style("fillOpacity"),s=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,datum:t.datum,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(n)?n:1,strokeOpacity:A(s)?s:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return u(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,n,s;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(s=null===(n=this._spec.item)||void 0===n?void 0:n.value)&&void 0!==s?s:{},{formatFunc:h}=MI(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=MI(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}qz.specKey="legends",qz.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},qz.type=r.discreteLegend;const Zz="vchart-tooltip",Jz=`${Zz}-container`,Qz=`${Zz}-title`,tW=`${Zz}-content-box`,eW={offsetX:10,offsetY:10},iW="99999999999999";function nW(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const sW=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,rW=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?nW(t):"",aW=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(u(t)){const n=t(e);S(n)&&(i=n)}return i},oW={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},lW=(t,e,i=2)=>{var n,s;return null!==(s=null===(n=oW[t])||void 0===n?void 0:n["x"===e?0:1])&&void 0!==s?s:i};class hW extends NL{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:n}=i;return n?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,n,s,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const u=h.activeType;if(h.handler)return null!==(s=null===(n=(i=h.handler).showTooltip)||void 0===n?void 0:n.call(i,u,e,t))&&void 0!==s?s:0;const d=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[u])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==d?void 0:d.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var n,s,r,a,o,l,h,c,d;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(s=null===(n=b[0])||void 0===n?void 0:n.data)||void 0===s?void 0:s[0]:null==b?void 0:b[0],{offsetX:C,offsetY:w}=this._option,T=m[_],k=OI(null==T?void 0:T.position,b,e),M=null!==(r=OI(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,O=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==O?void 0:O.width)&&void 0!==o?o:Gw,I=null!==(l=null==O?void 0:O.height)&&void 0!==l?l:Yw;let D=!1;const L={width:0,height:0};let F,U={x:0,y:0},N={x:0,y:0},j=1,z=1;const W=zS(this._env);if(W&&!m.confine?(L.width=window.innerWidth,L.height=window.innerHeight):(L.width=R,L.height=I),W&&!P){const t=this._getParentElement(m);N=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(d=this._compiler.getCanvas())&&void 0!==d?d:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),U={x:F.x-N.x,y:F.y-N.y},j=sW(e,F),z=sW(t,N)}const H=z/j,V={},G={x:k,y:k},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:n},s)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=n?n:"x"===s?C:w;if("mark"===i){D=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===s?i.x1:i.y1)+h[s],o=("x"===s?i.x2:i.y2)+h[s])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){D=!0;const t=f(x,h);t&&(a=t.start[s],o=t.end[s])}else G[s]=t;if(D){const e=Y[s][0],i="x"===s?B:E;switch(lW(t,s)){case-2:V[e]=a-i*H-c;break;case-1.5:V[e]=a+c;break;case 0:V[e]=(a+o)/2-i*H/2;break;case-1:V[e]=(a+o)/2-i*H-c;break;case 1:V[e]=(a+o)/2+c;break;case 1.5:V[e]=o-i*H-c;break;case 2:V[e]=o+c}}},K=["x","y"];if(g(k))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(k)){const{left:t,right:e,top:i,bottom:n}=k;V.left=aW(t,y),V.top=aW(i,y),V.right=aW(e,y),V.bottom=aW(n,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(k)&&K.forEach((t=>{const e=k[t];S(e)||u(e)?V[Y[t][0]]=aW(e,y):X(e,t)}));else p(k)&&(X({orient:k,mode:M},"x"),X({orient:k,mode:M},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?B:E,n="x"===t?R:I,s="x"===t?C:w,r=lW(G[t],t);if(A(V[Y[t][0]]))$[t]=V[Y[t][0]];else if(A(V[Y[t][1]]))$[t]=n-i*H-V[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+s:0===r?e-i*H/2:e-i*H-s}$[t]*=j,W&&($[t]+=U[t]),$[t]/=z;const a="x"===t?L.width:L.height,o=m.confine?-(N[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/z:-N[t]/z,l=a/z+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(D?$[t]=l:($[t]-=0===r?s+i/2:2*s+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",uW=(t={},e={})=>{var i,n;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const s=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(s)&&(e.color=s),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=cW(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=cW(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(n=t.wordBreak)&&void 0!==n?n:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},dW=(t={})=>{const{lineHeight:e}=t;return t.fontSize?nw(e,t.fontSize):0},pW=t=>{var e;const{backgroundColor:i,border:n,shadow:s,padding:r}=t,a={borderWidth:`${null!==(e=null==n?void 0:n.width)&&void 0!==e?e:0}px`};let o=null;(null==n?void 0:n.color)&&(a.borderColor=n.color),i&&(a.backgroundColor=i),a.boxShadow=s?`${s.x}px ${s.y}px ${s.blur}px ${s.spread}px ${s.color}`:"initial";const{radius:l}=null!=n?n:{};return p(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),p(r)&&(o=Be(r),a.padding=cW(o)),{panelStyle:a,panelPadding:o}};function gW(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const fW=t=>!!t&&1===t.nodeType&&"function"==typeof t.appendChild&&!!t.children;class mW extends hW{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(mW.type),this.type=fN.dom,this._tooltipContainer=null==jS?void 0:jS.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}_getTooltipParentElement(t){return fW(t.parentElement)?t.parentElement:fW(this._chartContainer)?this._chartContainer:fW(null==jS?void 0:jS.body)?jS.body:void 0}initEl(){const t=this._component.getSpec(),e=this._getTooltipParentElement(t);if(jS&&e){for(let t=0;t{var e,i,n,s;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=pW(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:cW(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=uW(h),x=uW(u),S=uW(p),C="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[C]=cW(null!==(i=c.spacing)&&void 0!==i?i:8),x[C]=cW(null!==(n=u.spacing)&&void 0!==n?n:26),S[C]=cW(null!==(s=p.spacing)&&void 0!==s?s:0);const w=Math.max(dW(p),dW(u));return y.lineHeight=w>0?`${w}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:n}=t,s=n&&n.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(Qz))),l=a.find((t=>t.className.includes(tW)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(Qz),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(gW(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),s?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&s&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${Zz}-column`),e.classList.add(`${Zz}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(tW),this._rootDom.appendChild(l)),l&&s){const t=[...l.children];gW(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&n.every((t=>!t.hasShape||!t.shapeType));gW(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const s=[...t.children];s.slice(n.length).forEach((t=>{t.parentNode.removeChild(t)})),n.forEach(((e,a)=>{let o=s[a];o||(o=document.createElement("div"),o.classList.add(`${Zz}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===n.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=rW(e.key),e.keyStyle&&uW(e.keyStyle,l)):"value"===i?(o.innerHTML=rW(e.value),e.valueStyle&&uW(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,n,s,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:u=!1,shapeFill:d}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?nW(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?nW(c):m,_=p,b=t=>new fc({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,C;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;C=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(C=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new ce));let w=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,n]=w.split(" ").map((t=>Number(t))),s=Number(f.slice(0,-2));w=`${t-s/2} ${e-s/2} ${i+s} ${n+s}`}const T=Mo.IsGradientStr(d);if(!d||y(d)&&!T||u)return m=u?"none":d?nW(d):"currentColor",`\n \n \n \n `;const k=T?Mo.Parse(d):g(d)?d:null;if(k){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(n=k.stops)&&void 0!==n?n:[]).map((t=>``)).join("");return"radial"===k.gradient?t=`\n ${i}\n `:"linear"===k.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),gW(o,l)}))}}))}else l&&!s&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,n,s,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(tW))),h=[...o.children].find((t=>t.className.includes(Qz)));if(l){const o=this._component.getSpec(),c={},u=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(u&&u.autoWidth&&!1!==u.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(n=null==o?void 0:o.style)||void 0===n?void 0:n.maxContentHeight)){const t=h&&h.className.includes(Qz)?h.getBoundingClientRect().height+(null!==(s=o.style.spaceRow)&&void 0!==s?s:0):0,e=this._chartOption.getChartViewRect(),i=nw(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,gW(l,c))}const d=l.children,g=[];if(d){for(let i=0;i{var i;let n,s;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(n=t.split("\n"),n=n.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(s=t.text,n=t);const r=Nd({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:s});return{width:r.width(),height:r.height(),text:n}};function _W(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:vW),{fill:null!==(n=t.fill)&&void 0!==n?n:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(s=t.fontFamily)&&void 0!==s?s:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const bW=t=>{var e;const{backgroundColor:i,border:n,shadow:s}=t,r={lineWidth:null!==(e=null==n?void 0:n.width)&&void 0!==e?e:0,shadow:!!s};(null==n?void 0:n.color)&&(r.stroke=n.color),i&&(r.fill=i),s&&(r.shadowColor=s.color,r.shadowBlur=s.blur,r.shadowOffsetX=s.x,r.shadowOffsetY=s.y,r.shadowSpread=s.spread);const{radius:a}=null!=n?n:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class xW extends hW{constructor(){super(xW.type),this.type=fN.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new fj({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,n;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var n,s,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:u={},titleLabel:d,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=Be(u.padding),b=aw(u.padding),x=_W(Object.assign({textAlign:"right"===y?"right":"left"},d),i),S=_W(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=_W(m,i),C={fill:!0,size:null!==(n=null==g?void 0:g.size)&&void 0!==n?n:8,spacing:null!==(s=null==g?void 0:g.spacing)&&void 0!==s?s:6},w={panel:bW(u),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:C,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:k=[]}=t;let M=b.left+b.right,B=b.top+b.bottom,E=0;const P=!!k.length;let O=0,R=0,I=0,D=0;if(P){const t=[],e=[],i=[],n=[];let s=0;w.content=k.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:u,shapeStroke:d,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:w}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=mw({},S,_W(b,void 0,{})),{width:n,height:s,text:r}=yW(h,i);T.key=Object.assign(Object.assign({width:n,height:s},i),{text:r}),y?e.push(n):t.push(n),o=Math.max(o,s)}if(p(m)){const t=mw({},A,_W(x,void 0,{})),{width:e,height:n,text:s}=yW(m,t);T.value=Object.assign(Object.assign({width:e,height:n},t),{text:s}),i.push(e),o=Math.max(o,n)}if(l){const t={visible:!0,symbolType:c};w?t.stroke=u:t.fill=u,t.stroke=null!=d?d:u,t.lineWidth=g,T.shape=t;const e=null!=f?f:C.size;o=Math.max(e,o),n.push(e)}else T.shape={visible:!1};return T.height=o,s+=o,aH.autoWidth&&!1!==H.multiLine;if(N){H=mw({},x,_W(z,void 0,{})),V()&&(H.multiLine=null===(r=H.multiLine)||void 0===r||r,H.maxWidth=null!==(a=H.maxWidth)&&void 0!==a?a:P?Math.ceil(E):void 0);const{text:t,width:e,height:i}=yW(j,H);w.title.value=Object.assign(Object.assign({width:V()?Math.min(e,null!==(o=H.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},H),{text:t}),L=w.title.value.width,F=w.title.value.height,U=F+(P?w.title.spaceRow:0)}return B+=U,w.title.width=L,w.title.height=F,V()?M+=E||L:M+=Math.max(L,E),P&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=M-b.left-b.right-D-O-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=M,w.panel.height=B,w})(t,this._component.getSpec(),e)}const{panel:s}=null!==(n=this._attributes)&&void 0!==n?n:{};return{width:s.width+s.lineWidth,height:s.height+s.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:n}=e,s=n.position;e.changePositionOnly?p(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),s)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}xW.type=fN.canvas;const SW=/\{([^}]+)\}/,AW=/\{([^}]+)\}/g,CW=/:/;class wW extends NL{constructor(){super(wW.type),this.type="formatterPlugin",this._timeModeFormat={utc:Oe.getInstance().timeUTCFormat,local:Oe.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=je.getInstance().format,this._numericSpecifier=je.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:n}=t;if(!n)return;this._spec=null!==(i=null==e?void 0:e[wW.specKey])&&void 0!==i?i:{};const{timeMode:s,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;u(r)?this._formatter=r:(this._formatter=this._format.bind(this),u(o)?this._timeFormatter=o:s&&this._timeModeFormat[s]&&(this._timeFormatter=this._timeModeFormat[s]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),xw.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,n)=>{const s=_(i)?i[n]:i;return s?this._formatSingleLine(t,e,s):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let n;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?n=this._isNumericFormatterCache.get(i):(n=SW.test(i),this._isNumericFormatterCache.set(i,n))),n){return i.replace(AW,((t,i)=>{if(!CW.test(i)){const n=e[i.trim()];return void 0!==n?n:t}const n=i.split(":"),s=e[n.shift()],r=n.join(":");return this._formatSingleText(s,r)}))}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Fe.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}wW.pluginType="chart",wW.specKey="formatter",wW.type="formatterPlugin";SI.useRegisters([()=>{bN(),SN(),CN(),ZU(),qU(),OU(),AU(),wL(),kL(),lI(),aI(),nU(),_U(),xw.registerSeries(RU.type,RU),xw.registerChart(wN.type,wN)},()=>{bN(),SN(),CN(),qU(),Pj(),ZU(),xw.registerChart(Rj.type,Rj)},()=>{bN(),SN(),CN(),qU(),xj(),ZU(),xw.registerChart(Aj.type,Aj)},()=>{SN(),tz(),xw.registerChart(sz.type,sz)},()=>{bN(),SN(),CN(),ZU(),xw.registerChart(oz.type,oz),qU()},_U,nU,()=>{xw.registerComponent(qz.type,qz)},()=>{xw.registerComponent(Hz.type,Hz)},()=>{xw.registerComponent(Oz.type,Oz)},()=>{xw.registerGraphicComponent(Cz.type,(t=>new UN(t))),Sz(),dF(),xw.registerComponent(Cz.type,Cz,!0,1/0)},()=>{var t;t=xW,xw.registerComponentPlugin(t.type,t)},()=>{var t;t=wW,xw.registerChartPlugin(t.type,t)},gI,vI]),SI.useRegisters([()=>{EB(wy)}]),t.DEFAULT_CHART_HEIGHT=Yw,t.DEFAULT_CHART_WIDTH=Gw,t.DEFAULT_CLOSE_STROKE_JOIN=wI,t.DEFAULT_DATA_INDEX=Kw,t.DEFAULT_DATA_KEY=$w,t.DEFAULT_DATA_SERIES_FIELD=qw,t.DEFAULT_KEY=fT,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=CI,t.DEFAULT_MAP_LOOK_UP_KEY=mT,t.DEFAULT_MEASURE_CANVAS_ID=Xw,t.DEFAULT_SERIES_STYLE_NAME=Zw,t.DEFAULT_SMOOTH_INTERPOLATE=AI,t.Factory=xw,t.MOSAIC_CAT_END_PERCENT=dT,t.MOSAIC_CAT_START_PERCENT=uT,t.MOSAIC_VALUE_END_PERCENT=cT,t.MOSAIC_VALUE_START_PERCENT=hT,t.ManualTicker=class extends Uf{constructor(t){super(t),this.lastFrameTime=0,this.status=Jn.RUNNING}setupTickHandler(){const t=new TI;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Jn.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Jn.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Jn.RUNNING,!0}},t.PREFIX=Vw,t.SEGMENT_FIELD_END=gT,t.SEGMENT_FIELD_START=pT,t.STACK_FIELD_END=tT,t.STACK_FIELD_END_OffsetSilhouette=sT,t.STACK_FIELD_END_PERCENT=iT,t.STACK_FIELD_KEY=Jw,t.STACK_FIELD_START=Qw,t.STACK_FIELD_START_OffsetSilhouette=nT,t.STACK_FIELD_START_PERCENT=eT,t.STACK_FIELD_TOTAL=rT,t.STACK_FIELD_TOTAL_BOTTOM=lT,t.STACK_FIELD_TOTAL_PERCENT=aT,t.STACK_FIELD_TOTAL_TOP=oT,t.StreamLight=qP,t.ThemeManager=Lw,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=SI,t.boundsInRect=rw,t.builtinThemes=ww,t.calcLayoutNumber=nw,t.calcPadding=sw,t.computeActualDataScheme=zC,t.convertPoint=ow,t.createArc=gh,t.createArea=vh,t.createGroup=wh,t.createLine=Ph,t.createRect=zh,t.createRichText=uc,t.createSymbol=mc,t.createText=Ac,t.darkTheme=gw,t.dataScheme=hw,t.default=SI,t.defaultThemeName=Tw,t.getActualColor=HC,t.getActualNumValue=lw,t.getColorSchemeBySeries=XC,t.getDataScheme=jC,t.getFunnelTheme=Cw,t.getMergedTheme=Iw,t.getSpecInfo=BI,t.getTheme=Pw,t.hasThemeMerged=Bw,t.isColorKey=VC,t.isPercent=ew,t.isPercentOffset=iw,t.isProgressiveDataColorScheme=GC,t.isTokenKey=uw,t.isValidOrient=tw,t.lightTheme=pw,t.lookup=(t,e)=>{var i;const n=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!n)return t;const s=(r=e.fields,u(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[s],c=n.reduce((function(t,e){return e[s]&&t.set(`${e[s]}`,e),t}),new Map);let g;if(u(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(d(i))for(let i=0;i(g(t),t)))},t.measureText=Hw,t.normalizeLayoutPaddingSpec=aw,t.queryColorFromColorScheme=WC,t.queryToken=cw,t.registerDataSetInstanceParser=YT,t.registerDataSetInstanceTransform=GT,t.registerTheme=Ew,t.removeTheme=Ow,t.themeExist=Rw,t.themes=kw,t.token=dw,t.transformColorSchemeToStandardStruct=YC,t.transformToGraphic=ET,t.version="2.1.4",t.vglobal=Vg,t.warn=LS,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart/package.json b/packages/vchart/package.json index 0af8de3d38..beb79b3748 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart", - "version": "2.1.3", + "version": "2.1.4", "description": "charts lib based @visactor/VGrammar", "main": "cjs/index.js", "module": "esm/index.js", @@ -133,7 +133,7 @@ "@visactor/vrender-kits": "~1.1.4", "@visactor/vrender-components": "~1.1.4", "@visactor/vrender-animate": "~1.1.4", - "@visactor/vutils-extension": "workspace:2.1.3" + "@visactor/vutils-extension": "workspace:2.1.4" }, "publishConfig": { "access": "public", diff --git a/packages/vutils-extension/package.json b/packages/vutils-extension/package.json index 82a6ffee36..06705ff163 100644 --- a/packages/vutils-extension/package.json +++ b/packages/vutils-extension/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vutils-extension", - "version": "2.1.3", + "version": "2.1.4", "description": "The extension module for VUtil from VisActor", "sideEffects": false, "main": "cjs/index.js", diff --git a/packages/wx-vchart/miniprogram/src/vchart/index.js b/packages/wx-vchart/miniprogram/src/vchart/index.js index c041819f1f..0d576b6028 100644 --- a/packages/wx-vchart/miniprogram/src/vchart/index.js +++ b/packages/wx-vchart/miniprogram/src/vchart/index.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=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 M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(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(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&I.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,It=t=>0,Ot=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Oe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{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}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,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 Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{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 Xe(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 Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={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 Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(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=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(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=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(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 ni(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=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{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`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(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}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(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 ni(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:Ke});function oi(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 li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(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 di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(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 Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{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 Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal: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?Ci[8+bi/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 C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=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")+_i(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 wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Fi(){return new zi}function zi(){this.reset()}zi.prototype={constructor:zi,reset:function(){this.s=this.t=0},add:function(t){ji(Hi,t,this.t),ji(this,Hi.s,this.s),this.s?this.t+=Hi.t:this.s=Hi.t},valueOf:function(){return this.s}};var Hi=new zi;function ji(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Ni=1e-6,Ui=Math.PI,Vi=Ui/2,Wi=Ui/4,Gi=2*Ui,Yi=180/Ui,Xi=Ui/180,Ki=Math.abs,$i=Math.atan,qi=Math.atan2,Zi=Math.cos,Ji=Math.exp,Qi=Math.log,ts=Math.pow,es=Math.sin,is=Math.sign||function(t){return t>0?1:t<0?-1:0},ss=Math.sqrt,ns=Math.tan;function rs(t){return t>1?0:t<-1?Ui:Math.acos(t)}function as(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function os(){}function ls(t,e){t&&cs.hasOwnProperty(t.type)&&cs[t.type](t,e)}var hs={Feature:function(t,e){ls(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sUi?t+Math.round(-t/Gi)*Gi:t,e]}function As(t,e,i){return(t%=Gi)?e||i?xs(Cs(t),Ts(e,i)):Cs(t):e||i?Ts(e,i):Ss}function ks(t){return function(e,i){return[(e+=t)>Ui?e-Gi:e<-Ui?e+Gi:e,i]}}function Cs(t){var e=ks(t);return e.invert=ks(-t),e}function Ts(t,e){var i=Zi(t),s=es(t),n=Zi(e),r=es(e);function a(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*i+o*s;return[qi(l*n-c*r,o*i-h*s),as(c*n+l*r)]}return a.invert=function(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*n-l*r;return[qi(l*n+h*r,o*i+c*s),as(c*i-o*s)]},a}function Ms(t,e){(e=fs(e))[0]-=t,bs(e);var i=rs(-e[1]);return((-e[2]<0?-i:i)+Gi-Ni)%Gi}function ws(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:os,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Es(t,e){return Ki(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 Rs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function zs(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 Hs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ws(),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=zs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=es(s),r=[es(i),-Zi(i),0],a=0,o=0;Ls.reset(),1===n?s=Vi+Ni:-1===n&&(s=-Vi-Ni);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ui,M=f*x;if(Ls.add(qi(M*k*es(C),m*S+M*Zi(C))),a+=T?A+k*Gi:A,T^p>=i^_>=i){var w=vs(fs(u),fs(y));bs(w);var E=vs(r,w);bs(E);var B=(T^A>=0?-1:1)*as(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Ni||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(js))}return u}}function js(t){return t.length>1}function Ns(t,e){return((t=t.x)[0]<0?t[1]-Vi-Ni:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-Ni:Vi-e[1])}1===(Is=Fs).length&&(Os=Is,Is=function(t,e){return Fs(Os(t),e)});var Us=Hs((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?Ui:-Ui,l=Ki(r-i);Ki(l-Ui)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ui&&(Ki(i-n)Ni?$i((es(e)*(r=Zi(s))*es(i)-es(s)*(n=Zi(e))*es(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*Vi,s.point(-Ui,n),s.point(0,n),s.point(Ui,n),s.point(Ui,0),s.point(Ui,-n),s.point(0,-n),s.point(-Ui,-n),s.point(-Ui,0),s.point(-Ui,n);else if(Ki(t[0]-e[0])>Ni){var r=t[0]0,n=Ki(e)>Ni;function r(t,i){return Zi(t)*Zi(i)>e}function a(t,i,s){var n=[1,0,0],r=vs(fs(t),fs(i)),a=ms(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=vs(n,r),u=_s(n,h);ys(u,_s(r,c));var p=d,g=ms(u,p),f=ms(p,p),m=g*g-f*(ms(u,u)-1);if(!(m<0)){var v=ss(m),y=_s(p,(-g-v)/f);if(ys(y,u),y=gs(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Ki(y[0]-b)Ui^(b<=y[0]&&y[0]<=x)){var T=_s(p,(-g+v)/f);return ys(T,u),[y,gs(T)]}}}function o(e,i){var n=s?t:Ui-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Hs(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?Ui:-Ui),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Es(e,p)||Es(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&&Es(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=Zi(e),o=es(e),l=s*i;null==n?(n=e+s*Gi,r=e-l/2):(n=Ms(a,n),r=Ms(a,r),(s>0?nr)&&(n+=s*Gi));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 Ki(s[0]-t)0?0:3:Ki(s[0]-i)0?2:1:Ki(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=ws(),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=zs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ps(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(Gs,Math.min(Ws,g)),f=Math.max(Gs,Math.min(Ws,f))],b=[r=Math.max(Gs,Math.min(Ws,r)),a=Math.max(Gs,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&&(_.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 Xs(t){return t}var Ks,$s,qs,Zs,Js=Fi(),Qs=Fi(),tn={point:os,lineStart:os,lineEnd:os,polygonStart:function(){tn.lineStart=en,tn.lineEnd=rn},polygonEnd:function(){tn.lineStart=tn.lineEnd=tn.point=os,Js.add(Ki(Qs)),Qs.reset()},result:function(){var t=Js/2;return Js.reset(),t}};function en(){tn.point=sn}function sn(t,e){tn.point=nn,Ks=qs=t,$s=Zs=e}function nn(t,e){Qs.add(Zs*t-qs*e),qs=t,Zs=e}function rn(){nn(Ks,$s)}var an=tn,on=1/0,ln=on,hn=-on,cn=hn;var dn,un,pn,gn,fn={point:function(t,e){thn&&(hn=t);ecn&&(cn=e)},lineStart:os,lineEnd:os,polygonStart:os,polygonEnd:os,result:function(){var t=[[on,ln],[hn,cn]];return hn=cn=-(ln=on=1/0),t}},mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn=0,Cn={point:Tn,lineStart:Mn,lineEnd:Bn,polygonStart:function(){Cn.lineStart=Pn,Cn.lineEnd=Rn},polygonEnd:function(){Cn.point=Tn,Cn.lineStart=Mn,Cn.lineEnd=Bn},result:function(){var t=kn?[Sn/kn,An/kn]:xn?[_n/xn,bn/xn]:yn?[mn/yn,vn/yn]:[NaN,NaN];return mn=vn=yn=_n=bn=xn=Sn=An=kn=0,t}};function Tn(t,e){mn+=t,vn+=e,++yn}function Mn(){Cn.point=wn}function wn(t,e){Cn.point=En,Tn(pn=t,gn=e)}function En(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Tn(pn=t,gn=e)}function Bn(){Cn.point=Tn}function Pn(){Cn.point=In}function Rn(){On(dn,un)}function In(t,e){Cn.point=On,Tn(dn=pn=t,un=gn=e)}function On(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Sn+=(n=gn*t-pn*e)*(pn+t),An+=n*(gn+e),kn+=3*n,Tn(pn=t,gn=e)}var Ln=Cn;function Dn(t){this._context=t}Dn.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,Gi)}},result:os};var Fn,zn,Hn,jn,Nn,Un=Fi(),Vn={point:os,lineStart:function(){Vn.point=Wn},lineEnd:function(){Fn&&Gn(zn,Hn),Vn.point=os},polygonStart:function(){Fn=!0},polygonEnd:function(){Fn=null},result:function(){var t=+Un;return Un.reset(),t}};function Wn(t,e){Vn.point=Gn,zn=jn=t,Hn=Nn=e}function Gn(t,e){jn-=t,Nn-=e,Un.add(ss(jn*jn+Nn*Nn)),jn=t,Nn=e}var Yn=Vn;function Xn(){this._string=[]}function Kn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $n(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ps(t,i(s))),s.result()}return r.area=function(t){return ps(t,i(an)),an.result()},r.measure=function(t){return ps(t,i(Yn)),Yn.result()},r.bounds=function(t){return ps(t,i(fn)),fn.result()},r.centroid=function(t){return ps(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Xs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Xn):new Dn(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 qn(t){return function(e){var i=new Zn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Zn(){}function Jn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ps(i,t.stream(fn)),e(fn.result()),null!=s&&t.clipExtent(s),t}function Qn(t,e,i){return Jn(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 tr(t,e,i){return Qn(t,[[0,0],e],i)}function er(t,e,i){return Jn(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 ir(t,e,i){return Jn(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)}Xn.prototype={_radius:4.5,_circle:Kn(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=Kn(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}},Zn.prototype={constructor:Zn,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 sr=16,nr=Zi(30*Xi);function rr(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=ss(b*b+x*x+S*S),k=as(S/=A),C=Ki(Ki(S)-1)e||Ki((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Xi:0,E()):[m*Yi,v*Yi,y*Yi]},M.angle=function(t){return arguments.length?(_=t%360*Xi,E()):_*Yi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=rr(o,T=t*t),B()):ss(T)},M.fitExtent=function(t,e){return Qn(M,t,e)},M.fitSize=function(t,e){return tr(M,t,e)},M.fitWidth=function(t,e){return er(M,t,e)},M.fitHeight=function(t,e){return ir(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function dr(t){var e=0,i=Ui/3,s=cr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Xi,i=t[1]*Xi):[e*Yi,i*Yi]},n}function ur(t,e){var i=es(t),s=(i+es(e))/2;if(Ki(s)2?t[2]*Xi:0),e.invert=function(e){return(e=t.invert(e[0]*Xi,e[1]*Xi))[0]*=Yi,e[1]*=Yi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===_r?[[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 xr(t){return ns((Vi+t)/2)}function Sr(t,e){var i=Zi(t),s=t===e?es(t):Qi(i/Zi(e))/Qi(xr(e)/xr(t)),n=i*ts(xr(t),s)/s;if(!s)return _r;function r(t,e){n>0?e<-Vi+Ni&&(e=-Vi+Ni):e>Vi-Ni&&(e=Vi-Ni);var i=n/ts(xr(e),s);return[i*es(s*t),n-i*Zi(s*t)]}return r.invert=function(t,e){var i=n-e,r=is(s)*ss(t*t+i*i),a=qi(t,Ki(i))*is(i);return i*s<0&&(a-=Ui*is(t)*is(i)),[a/s,2*$i(ts(n/r,1/s))-Vi]},r}function Ar(t,e){return[t,e]}function kr(t,e){var i=Zi(t),s=t===e?es(t):(i-Zi(e))/(e-t),n=i/s+t;if(Ki(s)Ni&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Ir.invert=mr(as),Or.invert=mr((function(t){return 2*$i(t)})),Lr.invert=function(t,e){return[-e,2*$i(Ji(t))-Vi]};var zr={exports:{}},Hr=function(t,e){this.p1=t,this.p2=e};Hr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Hr.prototype.run=function(){return this.p2[0]-this.p1[0]},Hr.prototype.slope=function(){return this.rise()/this.run()},Hr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Hr.prototype.isVertical=function(){return!isFinite(this.slope())},Hr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Hr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Hr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Hr.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)},Hr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var jr=Hr,Nr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new jr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Nr(t.slice(0,s),e),o=Nr(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},Ur=Nr;!function(t){var e=Ur;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Xr,e),{tolerance:s}=i;return Vr(t,s)};var $r;!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"}($r||($r={}));const qr=(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a},Zr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return Jr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return Jr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},ta=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",I=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[I]=r,f[O]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var ea={},ia={};function sa(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function na(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ra(t,e){var i=t+"",s=i.length;return s9999?"+"+ra(e,6):ra(e,4))+"-"+ra(t.getUTCMonth()+1,2)+"-"+ra(t.getUTCDate(),2)+(r?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"."+ra(r,3)+"Z":n?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"Z":s||i?"T"+ra(i,2)+":"+ra(s,2)+"Z":"")}function oa(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 ia;if(h)return h=!1,ea;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=$r.DSV;const s=Wr(ca,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return oa(n).parse(t)},ua=(t,e={},i)=>(i.type=$r.DSV,la(t)),pa=(t,e={},i)=>(i.type=$r.DSV,ha(t));function ga(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return fa(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 fa(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return va(t);default:throw new Error("unknown GeoJSON type")}}function fa(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=ma(t.properties),e.geometry=va(t.geometry),e}function ma(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]=ma(s):e[i]=s})),e):e}function va(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return va(t)})),e):(e.coordinates=ya(t.coordinates),e)}function ya(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return ya(t)}))}function _a(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 ba(t){for(var e,i,s=_a(t),n=0,r=1;r0}function xa(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=ga(t));var r=[];switch(t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,s)})),t;case"FeatureCollection":return xa(t,(function(t){xa(ka(t,s),(function(t){r.push(t)}))})),di(r)}return ka(t,s)}function ka(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,e)})),t;case"LineString":return Ca(_a(t),e),t;case"Polygon":return Ta(_a(t),e),t;case"MultiLineString":return _a(t).forEach((function(t){Ca(t,e)})),t;case"MultiPolygon":return _a(t).forEach((function(t){Ta(t,e)})),t;case"Point":case"MultiPoint":return t}}function Ca(t,e){ba(t)===e&&t.reverse()}function Ta(t,e){ba(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Pa=(t,e={},i)=>{i.type=$r.GEO;const s=Wr(Ea,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Aa(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=wa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=wa.bounds(t);t.bbox=e}})),t.features=l,t},Ra={},Ia=(t,e,i)=>{i.type=$r.GEO;const s=Wr(Ea,Ra,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 Fr(a,t)}))}:Fr(a,o));var a,o;return Pa(r,s,i)},Oa=(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 La=0;function Da(t="dataset"){return La>1e8&&(La=0),t+"_"+La++}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:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class za{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof za||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Zr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}$n();const Ha={},ja={albers:gr,albersusa:function(){var t,e,i,s,n,r,a=gr(),o=pr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=pr().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)}},Na=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ua(t,e){return function i(){const s=e();return s.type=t,s.path=$n().projection(s),s.copy=s.copy||function(){const t=i();return Na.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ga 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=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Za.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Ja(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(Ja(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,Ja(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Ja(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 $a))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Za.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Qa(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ka,this.rootWheelEvent=new $a,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const so=Nt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,fo;function mo(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;tfo){let t,e=uo;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 wo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Fo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Ho(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new jo(i,n),new jo(n,s)]}class jo extends Eo{constructor(t,e){super(),this.type=xo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p1.x):t===bo.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class No{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new jo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===bo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===bo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Uo extends No{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?bo.ROW:bo.COLUMN;return"monotoneY"===t?new Uo(t,s):new No(t,s)}class Go{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,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Xo(new Go(n,s),t),n}function Xo(t,e){return Vo(t,e,1)}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 $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&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 qo(t,e){return Vo(t,e,2)}function Zo(t,e={}){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 qo(new $o(n,s),t),n}function Jo(t){return t<0?-1:1}function Qo(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(Jo(r)+Jo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function tl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function el(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 il{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:el(this,this._t0,tl(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,el(this,tl(this,e=Qo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:el(this,this._t0,e=Qo(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 sl extends il{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function nl(t,e){return Vo(t,e,2)}function rl(t,e={}){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 nl(new il(n,s),t),n}function al(t,e){return Vo(t,e,2)}function ol(t,e={}){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 al(new sl(n,s),t),n}let ll=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class hl extends ll{lineEnd(){this.context.closePath()}}function cl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new ll(r,e,n),t),r}function dl(t,e){return Vo(t,e,1)}function ul(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new hl(r,e,n),t),r}class pl extends Go{lineEnd(){this.context.closePath()}}function gl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return fl(new pl(n,s),t),n}function fl(t,e){return Vo(t,e,1)}function ml(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function vl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Yo(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const yl=vl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const _l=vl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class bl extends Eo{constructor(t,e,i){super(),this.type=xo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Lo(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p2.x):t===bo.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Lo(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new bl(i,a,r),new bl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class xl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new jo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new bl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Sl(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return Zo(t,i);case"monotoneX":return rl(t,i);case"monotoneY":return ol(t,i);case"step":return cl(t,.5,i);case"stepClosed":return ul(t,.5,i);case"stepBefore":return cl(t,0,i);case"stepAfter":return cl(t,1,i);case"catmullRom":return yl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return _l(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return gl(t,i)}}class Al extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.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([lo.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([lo.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([lo.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([lo.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([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new xl(this);wo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];To(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.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=mo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Sl(e,i);"x"===s?this.direction=bo.ROW:"y"===s?this.direction=bo.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[lo.M]=this.moveToTransform,t[lo.L]=this.lineToTransform,t[lo.Q]=this.quadraticCurveToTransform,t[lo.C]=this.bezierCurveToTransform,t[lo.AT]=this.arcToTransform,t[lo.E]=this.ellipseTransform,t[lo.R]=this.rectTransform,t[lo.A]=this.arcTransform,t[lo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),wo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===bo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===bo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),$l=Object.assign(Object.assign({},Nl),{points:[],cornerRadius:0,closePath:!0}),ql=Object.assign(Object.assign({},Nl),{width:100,height:100,spikes:5,thickness:.5}),Zl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Ql=Object.assign(Object.assign({},Nl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),th=Object.assign(Object.assign(Object.assign({},Nl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),eh=Object.assign(Object.assign(Object.assign({},Nl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ih=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Nl),{fill:!0,cornerRadius:0,cornerType:"round"}),sh=Object.assign(Object.assign({},ih),{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});class nh{}const rh=Symbol.for("@visactor/vrender-core/application-state");function ah(){const t=globalThis;return t[rh]||(t[rh]={application:new nh}),t[rh]}const oh=ah().application;class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?oh.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):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?oh.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"},lh.cache.set(t,s),s.dataPromise=oh.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oh.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oh.global.loadBlob(t):"json"===e&&(i.dataPromise=oh.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=oh.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{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 Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Ph=new class extends Th{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Ih=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Oh(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{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 Oh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Oh(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{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 Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Gh=new class extends Th{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(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 Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+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(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{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 Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{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 ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{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 sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{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 rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(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 dc=new class extends Th{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 cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(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 pc=new class extends Th{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 uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(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 fc=new class extends Th{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 gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(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 vc=new class extends Th{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 mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(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 Ac=new class extends Th{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 Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{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)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),wo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(wo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}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 Ec=[wh,Eh,Ph,Ih,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{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 Ic(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Oc(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Oc(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Ic(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Oc(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 Rc(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 Rc(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 Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;eqc.set(t,!0)));const Zc=new Map;function Jc(t){if(qc.has(t))return!0;if(Zc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Qc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Zc.set(t,!0)));const td=Xc(),ed=Xc(),id=Xc(),sd=Xc(),nd=Xc(),rd=Xc(),ad=Xc(),od=Xc(),ld=Xc(),hd=Xc(),cd=Xc(),dd=Xc(),ud=Xc(),pd=Xc(),gd=Xc(),fd=Xc(),md=Xc(),vd=Symbol.for("GraphicService"),yd=Symbol.for("GraphicCreator"),_d={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},bd=Object.keys(_d),xd={"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"},Sd=Object.keys(xd),Ad={duration:200,easing:"cubicOut"},kd=Symbol.for("CanvasFactory"),Cd=Symbol.for("Context2dFactory");function Td(t){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.canvasFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Md=1e-4,wd=Math.sqrt(3),Ed=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Rd(t){return"number"==typeof t&&Number.isFinite(t)}const Id=[0,0],Od=[0,0],Ld=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Fd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function zd(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 Hd(t){return(t%=Ut)<0&&(t+=Ut),t}function jd(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+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Vd(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(Bd(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 Yd=[-1,-1,-1],Xd=[-1,-1];function Kd(){const t=Xd[0];Xd[0]=Xd[1],Xd[1]=t}function $d(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(Bd(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,Ed):Math.pow(i,Ed),s=s<0?-Math.pow(-s,Ed):Math.pow(s,Ed);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+wd*Math.sin(e)))/(3*a),h=(-o+i*(s-wd*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,Yd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Kd(),p=zd(e,s,r,o,Xd[0]),u>1&&(g=zd(e,s,r,o,Xd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Yd);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=Fd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Yd[0]=-l,Yd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Yd[0]+t&&a<=Yd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Yd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Jd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function Qd(t,e){let i=Jd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Jd(i-n)):e&&i1&&(i||(h+=Ie(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;tu[0]=S,tu[1]=A,Qd(tu,Boolean(a[6])),S=tu[0],A=tu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case lo.M:u=m,p=v,c=u,d=p;break;case lo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Ie(c,d,m,v,s,n)||0;c=m,d=v;break;case lo.C:if(i){if(Nd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(jd(c,d,m,v,y,_,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case lo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Ie(c,d,o,l,s,n),i){if(Ud(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Zd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case lo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Ie(o,p,o,l,s,n),h+=Ie(u,l,u,p,s,n);break;case lo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Ie(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class su{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(su.IsGradientStr(t))try{const e=iu(t)[0];if(e){if("linear"===e.type)return su.ParseLinear(e);if("radial"===e.type)return su.ParseRadial(e);if("conic"===e.type)return su.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:su.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:su.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function au(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ou(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];return 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}function lu(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];return 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}function hu(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];return 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,t}function cu(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 du(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 uu(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function pu(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 gu(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];return Math.abs(g-b)0&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Cu),function(t,e,i){return eu(t,0,!1,e,i)}(this.path.commandList,Cu.x,Cu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Cu);const i=nu(this,this.lineWidth,this.dpr);return function(t,e,i,s){return eu(t,e,!0,i,s)}(this.path.commandList,i,Cu.x,Cu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ku,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}const Mu={WIDTH:500,HEIGHT:500,DPR:1};class wu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Mu.WIDTH,height:n=Mu.HEIGHT,dpr:r=Mu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Eu;wu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Eu||(Eu={}));class Bu{static Get(t,e=Eu.Color1,i=[0,0,0,1]){if(e===Eu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Eu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Pu(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ru(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Iu(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Iu(t,e,i,s,n)}function Iu(t,e,i,s,n){if(!t||!e)return t&&Pu(t)||e&&Pu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Eu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Eu.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:Pu(a)})))});return o?Ru(r,l,i,s,n):Ru(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 Ou(s,n,i);if("radial"===s.gradient)return Lu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Pu(Fu(r,a,i),s)}function Ou(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(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]}function zu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const Hu=[0,0,0,0],ju=[0,0,0,0];function Nu(t,e,i){return Bu.Get(t,Eu.Color255,Hu),Bu.Get(e,Eu.Color255,ju),`rgba(${Math.round(Hu[0]+(ju[0]-Hu[0])*i)},${Math.round(Hu[1]+(ju[1]-Hu[1])*i)},${Math.round(Hu[2]+(ju[2]-Hu[2])*i)},${Hu[3]+(ju[3]-Hu[3])*i})`}class Uu{static GetCanvas(){try{return Uu.canvas||(Uu.canvas=oh.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 Vu extends Ye{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Gu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;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),Ru(o.color,l.color,h,!1)}function Yu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Uu.GetCanvas(),d=Uu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Ku(t){return null==t?void 0:t}class $u{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Ku(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Xu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Ku(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function qu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Zu(t){if(!qu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Zu(t[i])})),e}function Ju(t,e){var i;const s=null!==(i=Zu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];qu(n)&&qu(i)?s[t]=Ju(n,i):s[t]=Zu(i)})),s}class Qu{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Zu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];qu(r)&&qu(n)?t[i]=Ju(r,n):!qu(r)&&qu(a)&&qu(n)?t[i]=Ju(a,n):t[i]=Zu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?tp.PAINT|tp.BOUNDS|tp.PICK:tp.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?tp.PAINT|tp.BOUNDS:tp.PAINT}};class sp{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Ad;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:_o.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:_o.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:_o.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const np=new $u;function rp(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,ap(t),!0)}function ap(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=np.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function op(t){if(t)return t.parentScope&&op(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&ap(t),t}function lp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function hp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function cp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,hp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),lp(null!=e?e:t.ownerStage))}const dp=new Ve,up=new Ge,pp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],gp=["x","y"],fp=["scaleX","scaleY"],mp=["angle"],vp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),yp=new re,_p=[],bp=tp.PAINT|tp.SHAPE|tp.BOUNDS|tp.TRANSFORM|tp.LAYOUT;function xp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Sp(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Sp(s):s})),i}function Ap(t,e){return t===e||!!(xp(t)||xp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function kp(t,e){var i;const s=null!==(i=Sp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];xp(n)&&xp(i)?s[t]=kp(n,i):s[t]=Sp(i)})),s}const Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Tp extends Ga{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,hp(this.stage,this),lp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&op(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(op(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new $u).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Sp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&xp(n)&&xp(s)?e[t]=kp(n,s):e[t]=Sp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Sp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Ap(a,o)||(s.set(n,{prev:a,next:o}),t[n]=Sp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ip[t];return n?n(e,i):null!==(s=ep[t])&&void 0!==s?s:tp.PAINT}(e,i,s):null!==(n=ep[e])&&void 0!==n?n:tp.PAINT;return r&tp.PICK&&(r|=tp.BOUNDS),r===tp.PAINT&&this.needUpdateTag(e)&&(r=tp.SHAPE|tp.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&bp)!==bp?(t&tp.SHAPE?this.addUpdateShapeAndBoundsTag():t&tp.BOUNDS&&this.addUpdateBoundTag(),t&tp.PAINT&&this.addUpdatePaintTag(),t&tp.TRANSFORM&&this.addUpdatePositionTag(),t&tp.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=tp.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&vo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Ep.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];dp.clear();const n=[];s.forEach((t=>{const e=(new Al).fromString(t.d),i={};Sd.forEach((e=>{t[e]&&(i[xd[e]]=t[e])})),n.push({path:e,attribute:i}),dp.union(e.bounds)}));const r=dp.width(),a=dp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Ep.userSymbolMap[t]=l,l}const i=(new Al).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Ep.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return wo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&vo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&vo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&vo.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&vo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=vo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===yo.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===_o.STATE||null!=i&&i>=_o.ANIMATE_BIND&&i<=_o.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===_o.STATE||null!=o&&o>=_o.ANIMATE_BIND&&o<=_o.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Ap(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:_p,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ad}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:_p,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Sp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:_o.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:_p,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:_p,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,scaleX:i=Rl.scaleX,scaleY:s=Rl.scaleY,angle:n=Rl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(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,!0),oh.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Rl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=up.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=oh.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Al).fromString(t):this.pathProxy=new Al,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:oh.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new qa(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ga.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:_o.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:_o.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||oh.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Tu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Tp.userSymbolMap={};const Mp=Symbol.for("@visactor/vrender-core/graphic-class");function wp(){var t;const e=globalThis;return null!==(t=e[Mp])&&void 0!==t||(e[Mp]={Graphic:Tp}),e[Mp]}const Ep=wp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!vp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Lp=Ip();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Rp.forEach((t=>{this._defaultTheme[t]=Object.create(Lp[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Rp.forEach((s=>{const n=Object.create(Lp[s]);t&&t[s]&&Op(n,t[s]),i[s]&&Op(n,i[s]),e[s]&&Op(n,e[s]),this.combinedTheme[s]=n})),e.common&&Rp.forEach((t=>{Op(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 Fp=new Dp;function zp(t,e){return t.glyphHost?zp(t.glyphHost):e?(t.isContainer,e):Hp(t)||t.attachedThemeGraphic&&zp(t.attachedThemeGraphic)||Fp.getTheme()}function Hp(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)):Fp.getTheme()}return null}const jp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Np=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...pp];class Up extends Ep{constructor(t){super(t),this.type="arc",this.numberType=td}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return zp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Np)}needUpdateTag(t){return super.needUpdateTag(t,Np)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const Wp=["segments","points","curveType","curveTension",...pp];class Gp extends Ep{constructor(t){super(t),this.type="area",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return zp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Al;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Gp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gp.NOWORK_ANIMATE_ATTR}}function Yp(t){return new Gp(t)}Gp.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Xp=["radius","startAngle","endAngle",...pp];class Kp extends Ep{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return zp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Xp)}needUpdateTag(t){return super.needUpdateTag(t,Xp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Al,s.arc(0,0,r,a,o),s}clone(){return new Kp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kp.NOWORK_ANIMATE_ATTR}}function $p(t){return new Kp(t)}Kp.NOWORK_ANIMATE_ATTR=Cp;class qp extends Ep{constructor(t){super(t),this.type="glyph",this.numberType=nd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return zp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new qp(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return qp.NOWORK_ANIMATE_ATTR}}function Zp(t){return new qp(t)}var Jp;qp.NOWORK_ANIMATE_ATTR=Cp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Jp||(Jp={}));let Qp=class t extends Ep{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rd,this._childUpdateTag=vo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(rp(this.sharedStateScope,t),cp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===yo.GLOBAL){const i=new re(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&vo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,dx:i=Rl.dx,dy:s=Rl.dy,scaleX:n=Rl.scaleX,scaleY:r=Rl.scaleY,angle:a=Rl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return zp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=vo.CLEAR_BOUNDS,this._childUpdateTag&=vo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&vo.UPDATE_BOUNDS||(this._childUpdateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&vo.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=oh.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&rp(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return ap({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Cp;const eg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...pp];class ig extends Ep{constructor(t){super(t),this.type="image",this.numberType=ad,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return zp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ih[t]}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}clone(){return new ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ig.NOWORK_ANIMATE_ATTR}}function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Cp);const ng=["segments","points","curveType","curveTension",...pp];let rg=class t extends Ep{constructor(t={}){super(t),this.type="line",this.numberType=od}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=bh(i,s,e))}getGraphicTheme(){return zp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,ng)}needUpdateTag(t){return super.needUpdateTag(t,ng)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Al;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ag(t){return new rg(t)}rg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const og=["path","customPath",...pp];class lg extends Ep{constructor(t){super(t),this.type="path",this.numberType=ld}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Al?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Al?this.cache:t.path)}getGraphicTheme(){return zp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Al).fromString(t.path):t.customPath&&(this.cache=new Al,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,og)}needUpdateTag(t){return super.needUpdateTag(t,og)}toCustomPath(){return(new Al).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new lg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lg.NOWORK_ANIMATE_ATTR}}function hg(t){return new lg(t)}lg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const cg=["points","cornerRadius",...pp];class dg extends Ep{constructor(t){super(t),this.type="polygon",this.numberType=hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return zp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,cg)}needUpdateTag(t){return super.needUpdateTag(t,cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Al,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Cp;const pg=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}},gg=["width","x1","y1","height","cornerRadius",...pp];class fg extends Ep{constructor(t){super(t),this.type="rect",this.numberType=dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return zp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,gg)}needUpdateTag(t){return super.needUpdateTag(t,gg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=pg(e);return t=new Al,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fg.NOWORK_ANIMATE_ATTR}}function mg(t){return new fg(t)}fg.NOWORK_ANIMATE_ATTR=Cp;const vg=Symbol.for("EnvContribution"),yg=Symbol.for("VGlobal"),_g="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",bg={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"}},xg=!0,Sg=!1,Ag=/\w|\(|\)|-/,kg=/[.?!,;:/,。?!、;:]/,Cg=/\S/,Tg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=oh.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=wg(t,a)),a}function wg(t,e,i=!1){let s=e;for(;Ag.test(t[s-1])&&Ag.test(t[s])||kg.test(t[s]);)if(s--,s<=0)return i?Eg(t,e):e;return s}function Eg(t,e){let i=e;for(;Ag.test(t[i+1])&&Ag.test(t[i])||kg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=oh.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Pg{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=bg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Rg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Ig{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Rg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Mg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Og extends ig{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(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=ih.width,height:e=ih.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 Lg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Ig){const e=Cg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Og)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sg;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,Tg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ru(t,s,{AABBBounds:i}):s,Tg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Og)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=bg[this.direction]}store(t){if(t instanceof Og){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Lg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Og?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Ig(i,t.newLine,t.character,t.ascentDescentMode),new Ig(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Fg=!1;try{Fg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Fg=!1}const zg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...pp];class Hg extends Ep{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=pd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return zp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1)))}static splitText(t){if(Fg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Hg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),oh.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Hg.AllSingleCharacter(y)&&(y=Hg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Pg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Hg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Hg.NOWORK_ANIMATE_ATTR}}function jg(t){return new Hg(t)}Hg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);class Ng extends Qp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ug(t){return new Ng(t)}const Vg=["symbolType","size",...pp];let Wg=class t extends Ep{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=fd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return zp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Gc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Al).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Al).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Gg(t){return new Wg(t)}function Yg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Xg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Kg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);class $g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Tl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=md}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return zp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Zg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=oh.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Gc(n,o/Math.abs(r+a),!0,l),i.union(n)}return oh.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new $g(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new $g(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Yg(y,a),e=this.cache.verticalList.length*v,i=Xg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>$c(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Kc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Yg(y,a),A=x.verticalList.length*v,k=Xg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=qg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=qg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Zg.baselineMapAlign}getAlignMapBaseline(){return Zg.alignMapBaseline}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),Zg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Zg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Qg=["heightLimit","lineClamp"];class tf extends Zg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new $g(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 uf extends df{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let pf=0;class gf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=oh.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++pf,t),this.tryRunAnimationFrameNextFrame(),pf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class ff{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var mf=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 vf extends ff{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new uf(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return mf(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class yf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Td(Object.assign({nativeCanvas:oh.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Td(Object.assign({nativeCanvas:oh.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const _f=new yf,bf=Symbol.for("VWindow"),xf=Symbol.for("WindowHandlerContribution");function Sf(t){const e=oh.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Af extends ff{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(t=oh.global,e=Sf){super(),this.handlerFactory=e,this.hooks={onChange:new uf(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class kf{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=oh.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=_f.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=oh.windowFactory)||void 0===s?void 0:s.call(oh))&&void 0!==n?n:new Af(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var Cf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Cf||(Cf={}));const Tf=new Ge;class Mf{constructor(){this.matrix=new Ge}init(t){return this.mode=Cf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Cf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}scale(t,e,i){return this.mode===Cf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Cf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Tf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}translate(t,e){return this.mode===Cf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Cf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const wf=Symbol.for("@visactor/vrender-core/factory-state");function Ef(){const t=globalThis;return t[wf]||(t[wf]={pluginClasses:{}}),t[wf]}class Bf{constructor(){this.global=oh.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Pf=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 Rf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function If(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Ff{constructor(){this.time=So.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(jf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=zp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Kf(t,e,i,s)}}const zf=new Ff,Hf=new Set(["top","center","bottom"]);function jf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Nf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Uf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Uf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Nf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Gf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Hf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Yf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Xf(t){if(!t)return null;const e=Yf(t.naturalWidth,t.videoWidth,t.width),i=Yf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Kf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Xf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Gf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=_f.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),_f.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class $f{constructor(t){this.subRenderContribitions=t,this.time=So.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)}))}}class qf{constructor(){this.time=So.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Zf=new qf;class Jf{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Qf=new Jf,tm={getContributions:()=>[]};class em{constructor(t=[],e=tm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):If(e,Nl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:oh.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:tm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Su.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lf(e,i,Nl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Su.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),Su.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||function(){const t=oh.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class sm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class nm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class am{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const om={getContributions:()=>[]};class lm{constructor(t=om,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new rm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class hm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class cm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=oh.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=oh.global.getRequestAnimationFrame();this.rafId=t((()=>{oh.global.devicePixelRatio!==this.dpr&&(this.dpr=oh.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=oh.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class dm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oh.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const um=new Ve;class pm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&vo.UPDATE_PAINT)||s._updateTag&vo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(um.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(um,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let gm;function fm(){if(null==gm)try{const t=document.createElement("canvas"),e=t.getContext("2d");gm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),gm&&(gm=!!document.createElement)}catch(t){gm=!1}}function mm(){fm();const t=oh.global&&oh.global.env;return t?"browser"===t:gm}function vm(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(au(t),cu(t,t,[n+o,r+l,a+h]),cu(t,t,[y[0],y[1],y[2]]),ou(t,t,g),lu(t,t,p),cu(t,t,[-y[0],-y[1],y[2]]),uu(t,t,[c,d,u]),f){const i=Au.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]}cu(i,i,[s[0],s[1],0]),hu(i,i,f),cu(i,i,[-s[0],-s[1],0]),pu(t,t,i)}}function ym(t){const{alpha:e,beta:i}=t.attribute;return e||i}class _m{constructor(t=lf){this.creator=t,this.hooks={onAttributeUpdate:new uf(["graphic"]),onSetStage:new uf(["graphic","stage"]),onRemove:new uf(["graphic"]),onRelease:new uf(["graphic"]),onAddIncremental:new uf(["graphic","group","stage"]),onClearIncremental:new uf(["graphic","group","stage"]),beforeUpdateAABBBounds:new uf(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uf(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uf(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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=Xg(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=Yg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Gc(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;Gc(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&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const bm="white";class xm extends Qp{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:bm}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new uf(["stage"]),afterRender:new uf(["stage"]),afterClearScreen:new uf(["stage"]),afterClearRect:new uf(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:oh.global,!this.global.env&&mm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:oh.windowFactory)&&void 0!==n?n:()=>new Af(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=oh.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=oh.renderServiceFactory)||void 0===h?void 0:h.call(oh))&&void 0!==c?c:oh.renderService)&&void 0!==d?d:new im,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=oh.pluginServiceFactory)||void 0===p?void 0:p.call(oh))&&void 0!==g?g:oh.pluginService)&&void 0!==f?f:new lm,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:oh.layerService)&&void 0!==v?v:new Mm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:oh.graphicService)&&void 0!==b?b:new _m,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:bm,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,ap(s)),cp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new io(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=Cm.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=Cm.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Cm.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new hm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new cm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new dm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new pm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Cm.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Cm.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Cm.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return ap({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class Sm{constructor(t=xm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Am extends Qp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oh.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=>{oh.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)))}}class km{constructor(t=Am){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let Cm=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Tm(t){const e=oh.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}Cm._pluginClasses=Ef().pluginClasses;class Mm{static GenerateLayerId(){return`${Mm.idprefix}_${Mm.prefix_count++}`}constructor(t=oh.global,e=new km,i=Tm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Mm.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)}}Mm.idprefix="visactor_layer",Mm.prefix_count=0;const wm=Symbol.for("TransformUtil"),Em=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Pm=Symbol.for("StaticLayerHandlerContribution"),Rm=Symbol.for("DynamicLayerHandlerContribution"),Im=Symbol.for("VirtualLayerHandlerContribution"),Om=Symbol.for("@visactor/vrender-core/contribution-store-state");function Lm(){const t=globalThis;return t[Om]||(t[Om]={store:new Map}),t[Om]}const Dm=Symbol("ContributionProvider");class Fm{constructor(t,e){this.serviceIdentifier=t,this.container=e,Nm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function zm(t,e){return new Fm(t,e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).inSingletonScope().whenTargetNamed(e)}function jm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).whenTargetNamed(e)}class Nm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}Nm.store=Lm().store;class Um{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=th.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=wg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Um{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Gm({bind:t}){t(yg).toDynamicValue((({container:t})=>new vf(zm(vg,t)))).inSingletonScope(),t(bf).to(Af),t(Em).toDynamicValue((({container:t})=>new kf(zm(Vm,t)))).inSingletonScope(),t(wm).to(Mf).inSingletonScope(),t(Bm).to(Mm).inSingletonScope()}const Ym=Symbol.for("RenderService"),Xm=Symbol.for("BeforeRenderConstribution");function Km({bind:t}){t(Ym).to(im)}const $m=Symbol.for("GraphicPicker"),qm=Symbol.for("PickerService"),Zm=Symbol.for("BoundsPicker"),Jm=Symbol.for("GlobalPickerService"),Qm=Symbol.for("PickItemInterceptor"),tv=Symbol.for("PickServiceInterceptor"),ev=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ed,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},iv=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class sv extends fg{constructor(t){super(t),this.type="rect3d",this.numberType=ud}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return zp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,rv)}needUpdateTag(t){return super.needUpdateTag(t,rv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Al,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new av(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return av.NOWORK_ANIMATE_ATTR}}function ov(t){return new av(t)}av.NOWORK_ANIMATE_ATTR=Cp;class lv extends Up{constructor(t){super(t),this.type="arc3d",this.numberType=ed}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return lv.NOWORK_ANIMATE_ATTR}}function hv(t){return new lv(t)}lv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);class cv extends dg{constructor(t){super(t),this.type="pyramid3d",this.numberType=cd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return cv.NOWORK_ANIMATE_ATTR}}function dv(t){return new cv(t)}let uv,pv;function gv(t){return uv||(uv=cf("text",{})),uv.initAttributes(t),uv.AABBBounds}function fv(t){return pv||(pv=cf("richtext",{})),pv.setAttributes(t),pv.AABBBounds}cv.NOWORK_ANIMATE_ATTR=Cp;class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class vv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=zp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Su.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class _v{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=ev(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function bv({bind:t,isBound:e}){e(qm)||(t(Jm).toSelf(),t(qm).toService(Jm)),t(_v).toSelf().inSingletonScope(),t(Qm).toService(_v),t(vv).toSelf().inSingletonScope(),t(Qm).toService(vv),t(yv).toSelf().inSingletonScope(),t(Qm).toService(yv),Hm(t,Qm),t(mv).toSelf().inSingletonScope(),t(tv).toService(mv),Hm(t,tv)}function xv({bind:t}){t(vd).to(_m),t(yd).toConstantValue(lf)}const Sv=Symbol.for("AutoEnablePlugins"),Av=Symbol.for("PluginService");class kv{constructor(){this.type="static",this.offscreen=!1,this.global=oh.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Td({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()}}function Cv(t){(function({bind:t}){Hm(t,vg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),Hm(t,Vm)}({bind:t.bind}),function({bind:t}){t(kv).toSelf(),t(Pm).toService(kv)}({bind:t.bind})}const Tv=Ht/2;function Mv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Tv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Tv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Tv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Tv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function wv(t,e){return!(!t&&!e)}function Ev(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Pv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Rv(t,e){return t*e>0}function Iv(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Ov(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*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Fv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=Lv(g,f,u,p,n,t,Number(c)),l=Lv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=Lv(S,A,b,x,r,-n,Number(c)),l=Lv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const zv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Hv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=_f.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])),_f.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,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=_f.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Gg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:zv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=_f.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),_f.free(l),c}_f.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const jv=new Hv;class Nv{constructor(){this.time=So.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:nu(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Fv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Uv=new Nv,Vv=jv,Wv=zf;class Gv{constructor(){this.time=So.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Yv=new Gv,Xv=jv,Kv=zf;class $v extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(jf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const qv=new $v;function Zv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Jv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:nu(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Mv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class Qv{constructor(){this.time=So.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;Zv(p)&&(u.doStroke=!1)}}class ty{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Zv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Mv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ey=new Jv,iy=jv,sy=zf;class ny extends Jv{constructor(){super(...arguments),this.time=So.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)}}const ry=new ny,ay=zf;class oy{constructor(){this.time=So.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class ly{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const hy=new oy,cy=new ly,dy=jv,uy=zf,py=jv,gy=zf;class fy extends Hv{constructor(){super(...arguments),this.time=So.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:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class my{constructor(t){this.groupRenderContribitions=t,this.numberType=rd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:zp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Pv(p,m,g,f,c),w=Iv(p,v,g,f),E=wv(c,u),B=Ev(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Mv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===So.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},I=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(I(),R()):(R(),I()),this._groupRenderContribitions.forEach((r=>{r.time===So.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=oh.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=zp(t,null==s?void 0:s.theme).group,i=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(i,p||i,n),a.modelMatrix=i,Au.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Au.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var vy,yy=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"}(vy||(vy={}));class _y extends em{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=vy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uf([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return yy(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:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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 yy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return yy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>yy(this,void 0,void 0,(function*(){if(2!==t.count)yield Of(t,Nl.zIndex,((i,s)=>{if(this.status===vy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return yy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return yy(this,void 0,void 0,(function*(){this.rendering&&(this.status=vy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=vy.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 yy(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:()=>yy(this,void 0,void 0,(function*(){yield Of(t,Nl.zIndex,(t=>yy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const by=Symbol.for("IncrementalDrawContribution"),xy=Symbol.for("ArcRender"),Sy=Symbol.for("Arc3dRender"),Ay=Symbol.for("AreaRender"),ky=Symbol.for("CircleRender"),Cy=Symbol.for("GraphicRender"),Ty=Symbol.for("GroupRender"),My=Symbol.for("LineRender"),wy=Symbol.for("PathRender"),Ey=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Py=Symbol.for("Rect3DRender"),Ry=Symbol.for("SymbolRender"),Iy=Symbol.for("TextRender"),Oy=Symbol.for("RichTextRender"),Ly=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Fy=Symbol.for("ImageRender"),zy=Symbol.for("RenderSelector"),Hy=Symbol.for("DrawContribution"),jy=Symbol.for("StarRender"),Ny=Symbol.for("DrawItemInterceptor"),Uy=new Ve,Vy=new Ve;class Wy{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){Uy.copy(s.dirtyBounds),Vy.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,Su.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Uy),s.backupDirtyBounds.copy(Vy)),!0}}class Gy{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}}class Yy{constructor(){this.order=1,this.interceptors=[new Wy,new Ky,new Xy,new Gy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Au.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const $y=Symbol.for("ArcRenderContribution"),qy=Symbol.for("AreaRenderContribution"),Zy=Symbol.for("CircleRenderContribution"),Jy=Symbol.for("GroupRenderContribution"),Qy=Symbol.for("ImageRenderContribution"),t_=Symbol.for("PathRenderContribution"),e_=Symbol.for("PolygonRenderContribution"),i_=Symbol.for("RectRenderContribution"),s_=Symbol.for("SymbolRenderContribution"),n_=Symbol.for("TextRenderContribution"),r_=Symbol.for("StarRenderContribution"),a_=Symbol.for("CommonRenderContribution"),o_=Symbol.for("InteractiveSubRenderContribution");function l_(t){!function({bind:t}){t(Ff).toSelf().inSingletonScope(),t(Hv).toSelf().inSingletonScope(),t(Hy).to(em),t(by).to(_y),t(Ty).toDynamicValue((({container:t})=>new my(zm(Jy,t)))).inSingletonScope(),t(Cy).toService(Ty),Hm(t,Jy),Hm(t,o_),t($f).toDynamicValue((({container:t})=>new $f(zm(o_,t)))).inSingletonScope(),Hm(t,Cy),t(Yy).toSelf().inSingletonScope(),t(Ny).toService(Yy),Hm(t,Ny)}({bind:t.bind})}class h_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class c_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new h_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function d_(){return new c_}const u_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const p_=function(){const t=globalThis;return t[u_]||(t[u_]={legacyBindingContext:d_(),preloaded:!1}),t[u_]}(),g_=p_.legacyBindingContext;function f_(){p_.preloaded||(p_.preloaded=!0,Gm({bind:g_.bind}),xv({bind:g_.bind}),Km({bind:g_.bind}),bv({bind:g_.bind,isBound:g_.isBound}),function({bind:t}){t(Av).to(lm),jm(t,Sv)}({bind:g_.bind}),Cv(g_),l_(g_))}function m_(){return g_}function v_(t){f_();const[e]=g_.getAll(t);return e}function y_(t,e){return f_(),g_.getNamed(t,e)}function __(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const b_=__((()=>v_(yg)));oh.global=b_;class x_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?oh.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:oh.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Kg("text"===t.type&&t.attribute?t.attribute:zp(t).text)}getTransformOfText(t){const e=zp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=oh.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));oh.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===oh.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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&&oh.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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"===oh.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 S_=()=>{Cm.registerPlugin("HtmlAttributePlugin",x_)};class A_ extends x_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?oh.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&oh.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const k_=()=>{Cm.registerPlugin("ReactAttributePlugin",A_)};class C_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return C_.instance||(C_.instance=new C_),C_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function T_(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function M_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:w_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=T_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:w_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=T_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const I=i*x+B;I>0&&E.wait(I);let O=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(O||(O=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=O.props),D||(O||(O=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(E,e,p,L);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=T_(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:w_.builtInAnimateMap[r],m=t.custom?t.customType:T_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{M_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}w_.builtInAnimateMap={};const E_="appear",B_="disappear",P_="update",R_="highlight",I_="unhighlight";class O_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class L_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyHighlightState(t,e){this.applyState([R_],[{name:R_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([I_],[{name:I_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new L_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new O_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class F_{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-F_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*F_.bounceIn(2*t):.5*F_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){F_[t]=e}}function z_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}F_.quadIn=F_.getPowIn(2),F_.quadOut=F_.getPowOut(2),F_.quadInOut=F_.getPowInOut(2),F_.cubicIn=F_.getPowIn(3),F_.cubicOut=F_.getPowOut(3),F_.cubicInOut=F_.getPowInOut(3),F_.quartIn=F_.getPowIn(4),F_.quartOut=F_.getPowOut(4),F_.quartInOut=F_.getPowInOut(4),F_.quintIn=F_.getPowIn(5),F_.quintOut=F_.getPowOut(5),F_.quintInOut=F_.getPowInOut(5),F_.backIn=F_.getBackIn(1.7),F_.backOut=F_.getBackOut(1.7),F_.backInOut=F_.getBackInOut(1.7),F_.elasticIn=F_.getElasticIn(1,.3),F_.elasticOut=F_.getElasticOut(1,.3),F_.elasticInOut=F_.getElasticInOut(1,.3*1.5),F_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),F_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},F_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)F_[`flicker${t}`]=e=>z_(e,t);for(let t=2;t<10;t++)F_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function H_(t,e,i){return t+(e-t)*i}const j_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=H_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=H_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=H_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=H_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=H_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=H_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=H_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=H_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=H_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ru(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?zu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ru(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?zu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=H_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=H_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=H_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=H_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=H_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=H_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=H_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function N_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:_o.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=F_[s])&&void 0!==n?n:F_.linear:F_.linear,"wait"===t&&(this.onUpdate=Z_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=Z_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Bu.Get(i,Eu.Color255),r=Bu.Get(s,Eu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(j_["fill"===e?"fillPure":"strokePure"])}else j_[e]?t.push(j_[e]):t.push(N_)}else j_[e]?t.push(j_[e]):t.push(N_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tb extends Q_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();$_(this.target,t,_o.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class eb extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ib=new eb;ib.isGlobal=!0;class sb extends Q_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class nb extends sb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class rb extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class ab extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){$_(this.target,this.from,_o.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ob(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class cb{constructor(t=Va.GenAutoIncrementId(),e=ib,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(hb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new Q_(El.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tb(El.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new ab(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(hb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&$_(this.target,this._startProps,_o.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const db=new gf;class ub{constructor(){this.released=!1}tick(t,e){db.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class pb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===wl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=wl.INITIAL,oh.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),oh.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new ub;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==wl.INITIAL&&(this.status=wl.PAUSE,!0)}resume(){return this.status!==wl.INITIAL&&(this.status=wl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=wl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===wl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===wl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,oh.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function fb(){G(Ep,D_),G(Ep,gb)}function mb(){hf("arc",Vp)}function vb(){hf("arc3d",hv)}function yb(){hf("area",Yp)}function _b(){hf("circle",$p)}function bb(){hf("glyph",Zp)}function xb(){hf("group",tg)}function Sb(){hf("image",sg)}function Ab(){hf("line",ag)}function kb(){hf("path",hg)}function Cb(){hf("polygon",ug)}function Tb(){hf("pyramid3d",dv)}function Mb(){hf("rect",mg)}function wb(){hf("rect3d",nv)}function Eb(){hf("richtext",jg)}function Bb(){hf("shadowRoot",Ug)}function Pb(){hf("star",ov)}function Rb(){hf("symbol",Gg)}function Ib(){hf("text",Jg)}function Ob(){hf("wrapText",ef)}function Lb(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Fb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Zf),e(Qf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===So.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===So.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=zp(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=Bv(d,u,h),_=Rv(d,g),b=wv(h),x=Ev(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return wo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Rv(o,c),g=wv(n,r),f=Ev(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||ym(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Au.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Au.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class zb extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=td,this.builtinContributions=[Uv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=Lv(v,y,f,m,n,t,Number(u)),o=Lv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=Lv(C,T,A,k,r,-n,Number(u)),o=Lv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Gu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const Hb=new WeakSet;function jb({bind:t}){Lb(Hb,t)||(t(zb).toDynamicValue((({container:t})=>new zb(zm($y,t)))).inSingletonScope(),t(xy).toService(zb),t(Cy).toService(xy),t($y).toService($f),Hm(t,$y))}const Nb=jb;class Ub extends Fb{constructor(){super(...arguments),this.numberType=ed}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Eu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Lb(Vb,t)||(t(Ub).toDynamicValue((()=>new Ub)).inSingletonScope(),t(Sy).toService(Ub),t(Cy).toService(Sy))}const Gb=Wb;function Yb(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 Xb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?bo.ROW:bo.COLUMN,Number.isFinite(c)||(o=bo.COLUMN),Number.isFinite(d)||(o=bo.ROW);const u=i*(o===bo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Yb(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),Yb(t,l,1,s),o=!1):o=!0}t.closePath()}function $b(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function qb(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=$b(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Yb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=bo.ROW:"y"===s?u=bo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Jb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Qb=new fy,tx=zf;class ex extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Qb,tx],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=zp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,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=Sl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Sl(e,E,{curveTension:b}),n=Sl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=bo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?bo.ROW:null==y.y1?bo.COLUMN:Number.isFinite(S+A)?S>A?bo.ROW:bo.COLUMN:bo.ROW,Xb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),qb(t,i[0]?e.top:e.bottom,l,x===bo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ix=new WeakSet;function sx({bind:t}){Lb(ix,t)||(t(ex).toDynamicValue((({container:t})=>new ex(zm(qy,t)))).inSingletonScope(),t(Ay).toService(ex),t(Cy).toService(Ay),t(qy).toService($f),Hm(t,qy))}const nx=sx;class rx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[Yv,Kv,Xv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const ax=new WeakSet;function ox({bind:t}){Lb(ax,t)||(t(rx).toDynamicValue((({container:t})=>new rx(zm(Zy,t)))).inSingletonScope(),t(ky).toService(rx),t(Cy).toService(ky),t(Zy).toService($f),Hm(t,Zy))}const lx=ox;class hx{constructor(){this.numberType=nd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=zp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const cx=new WeakSet;function dx({bind:t}){Lb(cx,t)||(t(hx).toDynamicValue((()=>new hx)).inSingletonScope(),t(Dy).toService(hx),t(Cy).toService(Dy))}const ux=dx,px=["","repeat-x","repeat-y","repeat"];function gx(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?px[i]:"no-repeat"}function fx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=gx(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const mx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function vx(t){return{backgroundMode:mx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function yx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=fx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function _x(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=fx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?vx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Kf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class bx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ad,this.builtinContributions=[ry,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Mv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),_x(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},I=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},O=yx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||O;g?(I(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),I()),this.afterRenderStep(t,e,i,s,T,!1,k,!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&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=zp(t).image;this._draw(t,a,!1,i)}}const xx=new WeakSet;function Sx({bind:t}){Lb(xx,t)||(t(Fy).toDynamicValue((({container:t})=>new bx(zm(Qy,t)))).inSingletonScope(),t(Cy).toService(Fy),t(Qy).toService($f),Hm(t,Qy))}const Ax=Sx;class kx extends Fb{constructor(){super(...arguments),this.numberType=od}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();qb(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Sl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const Cx=new WeakSet;function Tx({bind:t}){Lb(Cx,t)||(t(kx).toDynamicValue((()=>new kx)).inSingletonScope(),t(My).toService(kx),t(Cy).toService(My))}const Mx=Tx,Ex=jv,Bx=zf;class Px extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ld,this.builtinContributions=[Bx,Ex],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:zp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)wo(t.pathShape.commandList,e,i,s,1,1,f);else{wo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Rx=new WeakSet;function Ix({bind:t}){Lb(Rx,t)||(t(Px).toDynamicValue((({container:t})=>new Px(zm(t_,t)))).inSingletonScope(),t(wy).toService(Px),t(Cy).toService(wy),t(t_).toService($f),Hm(t,t_))}const Ox=Ix;function Lx(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Lx(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lx(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Fx(h,y,_,d,u),A=Fx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=Dx(k,C),M=Fx(h,Dx(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const Nx=new WeakSet;function Ux({bind:t}){Lb(Nx,t)||(t(Ey).toDynamicValue((({container:t})=>new jx(zm(e_,t)))).inSingletonScope(),t(Cy).toService(Ey),t(e_).toService($f),Hm(t,e_))}const Vx=Ux;class Wx extends Fb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Eu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Gx extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=cd}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=zp(t).polygon;this._draw(t,s,!1,i)}}const Yx=new WeakSet;function Xx({bind:t}){Lb(Yx,t)||(t(Gx).toDynamicValue((()=>new Gx)).inSingletonScope(),t(Ly).toService(Gx),t(Cy).toService(Ly))}const Kx=Xx;class $x extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=dd,this.builtinContributions=[ey,sy,iy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Pv(g,f,T,M,h),E=Iv(g,v,T,M,C),B=wv(h,c),P=Ev(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Mv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const qx=new WeakSet;function Zx({bind:t}){Lb(qx,t)||(t($x).toDynamicValue((({container:t})=>new $x(zm(i_,t)))).inSingletonScope(),t(By).toService($x),t(Cy).toService(By),t(ty).toSelf(),t(Qv).toSelf(),t(i_).toService(ty),t(i_).toService(Qv),t(i_).toService($f),Hm(t,i_))}const Jx=Zx;class Qx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=ud}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=zp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Pv(v,y,A,k,d),M=Iv(v,b,A,k,S),w=wv(d),E=Ev(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=zp(t).rect;this._draw(t,s,!1,i)}}const tS=new WeakSet;function eS({bind:t}){Lb(tS,t)||(t(Qx).toDynamicValue((()=>new Qx)).inSingletonScope(),t(Py).toService(Qx),t(Cy).toService(Py))}const iS=eS;const sS=new class extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:I=l.backgroundCornerRadius}=t.attribute;let O,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),O&&e.setTransformFromMatrix(O,!0,1))};let F;"richtext"===t.type&&(O=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=gv(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 i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),I?Mv(e,F.x1,F.y1,F.width(),F.height(),I,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,I?(Mv(e,F.x1,F.y1,F.width(),F.height(),I,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),D()}};class nS extends Fb{constructor(){super(),this.numberType=pd,this.builtinContributions=[sS],this.init()}drawShape(t,e,i,s,n){const r=zp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=zp(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(),Mv(e,i-t,s-n,v,y,f,!0)),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=zp(t).richtext;this._draw(t,s,!1,i)}}const rS=new WeakSet;function aS({bind:t}){Lb(rS,t)||(t(nS).toDynamicValue((()=>new nS)).inSingletonScope(),t(Oy).toService(nS),t(Cy).toService(Oy))}const oS=aS;class lS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[gy,py],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const hS=new WeakSet;function cS({bind:t}){Lb(hS,t)||(t(lS).toDynamicValue((({container:t})=>new lS(zm(r_,t)))).inSingletonScope(),t(jy).toService(lS),t(Cy).toService(jy),Hm(t,r_))}const dS=cS;class uS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[hy,uy,dy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:zp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const pS=new WeakSet;function gS({bind:t}){Lb(pS,t)||(t(uS).toDynamicValue((({container:t})=>new uS(zm(s_,t)))).inSingletonScope(),t(Ry).toService(uS),t(Cy).toService(Ry),t(s_).toService($f),Hm(t,s_))}const fS=gS;class mS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[sS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=zp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Su.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Su.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Yg(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const vS=new WeakSet;function yS({bind:t}){Lb(vS,t)||(t(Iy).toDynamicValue((({container:t})=>new mS(zm(n_,t)))).inSingletonScope(),t(Cy).toService(Iy),t(n_).toService($f),Hm(t,n_))}const _S=yS,bS=mm();function xS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function SS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const AS=Symbol.for("MathPickerContribution"),kS=Symbol.for("MathArcPicker"),CS=Symbol.for("MathAreaPicker"),TS=Symbol.for("MathCirclePicker"),MS=Symbol.for("MathImagePicker"),wS=Symbol.for("MathLinePicker"),ES=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),PS=Symbol.for("MathSymbolPicker"),RS=Symbol.for("MathTextPicker"),IS=Symbol.for("MathPolygonPicker"),OS=Symbol.for("MathGlyphPicker"),LS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),FS=Symbol.for("CanvasArc3dPicker"),zS=Symbol.for("CanvasAreaPicker"),HS=Symbol.for("CanvasCirclePicker"),jS=Symbol.for("CanvasImagePicker"),NS=Symbol.for("CanvasGifImagePicker"),US=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),GS=Symbol.for("CanvasRectPicker"),YS=Symbol.for("CanvasRect3dPicker"),XS=Symbol.for("CanvasSymbolPicker"),KS=Symbol.for("CanvasTextPicker"),$S=Symbol.for("CanvasPolygonPicker"),qS=Symbol.for("CanvasPyramid3dPicker"),ZS=Symbol.for("CanvasRichTextPicker"),JS=Symbol.for("CanvasGlyphPicker"),QS=Symbol.for("CanvasGroupPicker"),tA=Symbol.for("CanvasStarPicker"),eA=Symbol.for("CanvasPickerContribution"),iA=m_(),sA=__((()=>v_(Em))),nA=__((()=>v_(wm))),rA=__((()=>v_(vd))),aA=__((()=>v_(Bm)));function oA(){oh.global=b_,oh.graphicUtil=sA,oh.transformUtil=nA,oh.graphicService=rA,oh.layerService=aA,oh.canvasFactory=t=>y_(kd,t),oh.context2dFactory=t=>y_(Cd,t),oh.windowFactory=()=>new Af(oh.global),oh.windowHandlerFactory=t=>function(t){const e=y_(xf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),oh.renderServiceFactory=()=>v_(Ym),oh.renderService=__((()=>v_(Ym))),oh.pluginServiceFactory=()=>v_(Av),oh.pluginService=__((()=>v_(Av))),oh.pickerServiceFactory=()=>v_(qm),oh.layerHandlerFactory=t=>v_("static"===t?Pm:"dynamic"===t?Rm:Im),oh.incrementalDrawContributionFactory=()=>v_(by)}oA();var lA=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 hA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return lA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class cA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class dA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Eu.Color1),this.ambient=i;const s=$t(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=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Bu.Get(e,Eu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const uA=()=>{Cm.registerPlugin("DirectionalLight",dA)};class pA{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=Au.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Au.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return gu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return fu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return mu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;mu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const gA=()=>{Cm.registerPlugin("OrthoCamera",pA)},fA={getContributions:()=>[]},mA={getContributions:()=>[]};class vA{constructor(t=fA,e=mA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:fA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:mA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=zp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=zp(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&&Au.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Su.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class yA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new sm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new nm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new am,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new rm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new Sm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new km,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new sf}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new im(new em([],(t=this.registry.contribution,e=Ny,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class _A{constructor(t={}){this.context=new yA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function bA(t={}){return new _A(t)}class xA extends _A{}class SA extends _A{}class AA extends ex{constructor(){super(...arguments),this.numberType=id}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=zp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=wv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=zp(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=Bv(u,p,c),y=Rv(u,g),_=wv(c),b=Ev(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{};function DA(){MA.preloaded||(MA.preloaded=!0,Gm({bind:wA.bind}),xv({bind:wA.bind}),Km({bind:wA.bind}),bv({bind:wA.bind,isBound:wA.isBound}),Cv(wA),l_(wA))}function FA(t,e){const i=NA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function zA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function HA(t,e){let i=PA.get(t);i||(i=new Map,PA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function jA(t,e,i){const s=HA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function NA(){return DA(),wA}function UA(){Nm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=MA.runtimeGlobal)&&void 0!==t||(MA.runtimeGlobal=new vf(zm(vg,wA))),MA.runtimeGlobal}function WA(t){const e=NA(),i=VA();oh.global=i,oh.canvasFactory=t=>e.getNamed(kd,t),oh.context2dFactory=t=>e.getNamed(Cd,t),oh.windowHandlerFactory=t=>FA(xf,t),oh.windowFactory=()=>new Af(i,(t=>FA(xf,t))),oh.pluginServiceFactory=()=>new lm(zm(Sv,e),{pluginRegistry:t.context.registry.plugin}),oh.incrementalDrawContributionFactory=()=>new _y([],new kA,new AA(zm(qy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,Ny))}function GA(t){var e;const i=NA();UA();const s=i.getAll(Cy),n=HA(t.registry.renderer,EA);jA(t.registry.renderer,EA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),zA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,EA)}function YA(t){var e;const i=NA();UA();const s=i.getAll(Ny),n=null!==(e=RA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,Ny,e)})),n.clear(),RA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(Ny));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(Ny,e),r.add(e)),n.add(e)}))}function XA(t,e){var i;const s=NA();UA();const n=s.getAll(e),r=HA(t.registry.picker,BA);jA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),zA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function KA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=IA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,LA,t.isBound,t.rebind),function(t,e){let i=IA.get(t);i||(i=new WeakSet,IA.set(t,i)),i.add(e)}(t,e))}function $A(t,{app:e,legacy:i=!0,targets:s}={}){KA(NA(),t),i&&(f_(),KA(m_(),t)),UA(),e&&function(t,e){const i=null!=e?e:OA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&YA(t),s&&GA(t),r.forEach((e=>{XA(t,e)}))}(e,s)}function qA(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function ZA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function JA(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 QA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ok(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=pg(t.attribute),n=hk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=hk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=hk(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{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(;n{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 _k(l,e,h),h},fk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return pk(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 pk(t,e)}return[]};const mk=t=>t.map((t=>({x:t.x,y:t.y}))),vk=(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]},yk=t=>{const e=new Ue;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 vk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return vk(t,{x:e.x1,y:n},{x:e.x2,y:n})},_k=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=yk(t);_k(n[0],s,i),_k(n[1],e-s,i)}},bk=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:mk(i)}];const s=[];return _k(i,e,s),s},xk=(t,e)=>{const i=ak(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;rObject.assign({},t))):[]}function Ak(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:Sk(t.touches),configurable:!0},changedTouches:{value:Sk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function kk(t,e){try{return t[e]}catch(t){return}}function Ck(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Ak(t),l=kk(t,"target"),h=kk(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Tk=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Ek(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:wk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Tk(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=wk(i,this.selectionStartCursorIdx),a=wk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=Mk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Ek(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),oh.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),oh.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Pk{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=wk(i,Math.ceil(t)),n=wk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=wk(i.attribute.textConfig,a),h=wk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Rk,[this.formatTextCommandCb]),this.commandCbs.set(Ik,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(oh.global.isMacOS()&&t.metaKey&&"c"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return oh.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(oh.global.isMacOS()&&t.metaKey&&"a"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},Mk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=jg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:fv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||mg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},Mk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=tg({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Ok.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=ag({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=tg({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=fv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=fv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(mg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:fv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Qk=new Jk;class tC{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const eC=()=>{Cm.registerPlugin("ViewTransform3dPlugin",tC)},iC=new Ve;class sC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=zp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nC=()=>{Cm.registerPlugin("FlexLayoutPlugin",sC)};var rC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:rh,ARC3D_NUMBER_TYPE:ed,ARC_NUMBER_TYPE:td,AREA_NUMBER_TYPE:id,AbstractGraphicRender:class{},get AnimateMode(){return Ml},get AnimateStatus(){return Bl},get AnimateStepType(){return El},AppContext:yA,Application:nh,Arc:Up,Arc3d:lv,Arc3dRender:Sy,ArcRender:xy,ArcRenderContribution:$y,Area:Gp,AreaRender:Ay,AreaRenderContribution:qy,get AttributeUpdateType(){return _o},AutoEnablePlugins:Sv,Base3dRender:Wx,BaseCanvas:wu,BaseEnvContribution:hA,BaseRender:Fb,get BaseRenderContributionTime(){return So},BaseWindowHandlerContribution:cA,Basis:$o,BeforeRenderConstribution:Xm,BoundsContext:no,BoundsPicker:Zm,BrowserEntry:_A,CIRCLE_NUMBER_TYPE:sd,CONTRIBUTION_STORE_STATE_SYMBOL:Om,Canvas3DDrawItemInterceptor:Ky,Canvas3DPickItemInterceptor:_v,CanvasFactory:kd,CanvasTextLayout:$g,Circle:Kp,CircleRender:ky,CircleRenderContribution:Zy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Eu},CommonDrawItemInterceptorContribution:Yy,CommonRenderContribution:a_,Context2dFactory:Cd,ContributionProvider:Dm,ContributionRegistry:am,ContributionStore:Nm,CubicBezierCurve:zo,CurveContext:xl,get CurveTypeEnum(){return xo},CustomEvent:qa,CustomPath2D:Al,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:_g,DebugDrawItemInterceptorContribution:Gy,DefaultArcAllocate:zk,DefaultArcAttribute:Ul,DefaultArcRenderContribution:Nv,DefaultAreaAllocate:jk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:fy,DefaultAttribute:Nl,DefaultBaseBackgroundRenderContribution:Ff,DefaultBaseClipRenderAfterContribution:Jf,DefaultBaseClipRenderBeforeContribution:qf,DefaultBaseInteractiveRenderContribution:$f,DefaultBaseTextureRenderContribution:Hv,DefaultCanvasAllocate:yf,DefaultCanvasArc3DRender:Ub,DefaultCanvasArcRender:zb,DefaultCanvasAreaRender:ex,DefaultCanvasCircleRender:rx,DefaultCanvasGroupRender:my,DefaultCanvasImageRender:bx,DefaultCanvasLineRender:kx,DefaultCanvasPathRender:Px,DefaultCanvasPolygonRender:jx,DefaultCanvasPyramid3dRender:Gx,DefaultCanvasRect3dRender:Qx,DefaultCanvasRectRender:$x,DefaultCanvasSymbolRender:uS,DefaultCanvasTextRender:mS,DefaultCircleAllocate:Uk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Gv,DefaultConnectAttribute:Hl,DefaultDebugAttribute:jl,DefaultFillStyle:Il,DefaultGlobal:vf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Yl,DefaultGraphicAllocate:Lk,DefaultGraphicMemoryManager:Jk,DefaultGraphicService:_m,DefaultGraphicUtil:kf,DefaultGroupAttribute:Gl,DefaultGroupBackgroundRenderContribution:$v,DefaultImageAttribute:ih,DefaultImageRenderContribution:ny,DefaultLayerService:Mm,DefaultLayout:Pl,DefaultLineAllocate:Wk,DefaultLineAttribute:Xl,DefaultMat4Allocate:xu,DefaultMatrixAllocate:bu,DefaultPathAllocate:Yk,DefaultPathAttribute:Kl,DefaultPickService:vA,DefaultPickStyle:Fl,DefaultPolygonAttribute:$l,DefaultRect3dAttribute:Jl,DefaultRectAllocate:Dk,DefaultRectAttribute:Zl,DefaultRectRenderContribution:Jv,DefaultRenderService:im,DefaultRichTextAttribute:eh,DefaultRichTextIconAttribute:sh,DefaultStarAttribute:ql,DefaultStrokeStyle:Ll,DefaultStyle:zl,DefaultSymbolAllocate:Kk,DefaultSymbolAttribute:Ql,DefaultSymbolClipRangeStrokeRenderContribution:ly,DefaultSymbolRenderContribution:oy,DefaultTextAllocate:qk,DefaultTextAttribute:th,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Rl,DefaultTransformUtil:Mf,DefaultWindow:Af,get Direction(){return bo},DirectionalLight:dA,DrawContribution:Hy,DrawItemInterceptor:Ny,DynamicLayerHandlerContribution:Rm,get Edge(){return ch},EditModule:Bk,EmptyContext2d:Tu,EnvContribution:vg,EventManager:Qa,EventSystem:io,EventTarget:to,FACTORY_STATE_SYMBOL:wf,FORMAT_ALL_TEXT_COMMAND:Ik,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Rk,Factory:Cm,FederatedEvent:Ya,FederatedMouseEvent:Xa,FederatedPointerEvent:Ka,FederatedWheelEvent:$a,FlexLayoutPlugin:sC,GLYPH_NUMBER_TYPE:nd,GRAPHIC_CLASS_SYMBOL:Mp,GRAPHIC_REGISTRY_SYMBOL:rf,GRAPHIC_UPDATE_TAG_KEY:pp,GROUP_NUMBER_TYPE:rd,Generator:Va,GlobalPickerService:Jm,Glyph:qp,GlyphRender:Dy,GradientParser:su,Graphic:Ep,GraphicCreator:yd,GraphicFactory:sf,GraphicPicker:$m,GraphicRender:Cy,GraphicService:vd,GraphicUtil:Em,Group:Qp,GroupRender:Ty,GroupRenderContribution:Jy,get GroupUpdateAABBBoundsMode(){return Jp},HtmlAttributePlugin:x_,get IContainPointMode(){return yo},IMAGE_NUMBER_TYPE:ad,Image:ig,ImageRender:Fy,ImageRenderContribution:Qy,IncrementalDrawContribution:by,InteractiveDrawItemInterceptorContribution:Xy,InteractivePickItemInterceptorContribution:yv,InteractiveSubRenderContribution:o_,LINE_NUMBER_TYPE:od,Layer:Am,LayerFactory:km,LayerService:Bm,Line:rg,LineRender:My,Linear:Go,LinearClosed:pl,Mat4Allocate:yu,MatrixAllocate:vu,get MeasureModeEnum(){return Tl},MiniappEntry:SA,MonotoneX:il,MonotoneY:sl,NOWORK_ANIMATE_ATTR:Cp,Node:Ga,NodeEntry:xA,OrthoCamera:pA,PATH_NUMBER_TYPE:ld,POLYGON_NUMBER_TYPE:hd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:cd,Path:lg,PathRender:wy,PathRenderContribution:t_,PerformanceRAF:gf,PickItemInterceptor:Qm,PickServiceInterceptor:tv,PickerRegistry:nm,PickerService:qm,PluginRegistry:rm,PluginService:Av,Polygon:dg,PolygonRender:Ey,PolygonRenderContribution:e_,Pyramid3d:cv,Pyramid3dRender:Ly,RECT3D_NUMBER_TYPE:ud,RECT_NUMBER_TYPE:dd,RICHTEXT_NUMBER_TYPE:pd,RUNTIME_INSTALLER_STATE_SYMBOL:CA,RafBasedSTO:Sh,ReactAttributePlugin:A_,Rect:fg,Rect3DRender:Py,Rect3d:sv,RectRender:By,RectRenderContribution:i_,ReflectSegContext:Uo,RenderSelector:zy,RenderService:Ym,RendererRegistry:sm,ResourceLoader:lh,RichText:Hg,RichTextEditPlugin:Ok,RichTextRender:Oy,STAR_NUMBER_TYPE:gd,get STATUS(){return wl},SVG_ATTRIBUTE_MAP:_d,SVG_ATTRIBUTE_MAP_KEYS:bd,SVG_PARSE_ATTRIBUTE_MAP:xd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Sd,SYMBOL_NUMBER_TYPE:fd,SegContext:No,ShadowPickServiceInterceptorContribution:mv,ShadowRoot:Ng,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:vv,SplitRectAfterRenderContribution:ty,SplitRectBeforeRenderContribution:Qv,Stage:xm,StageFactory:Sm,Star:av,StarRender:jy,StarRenderContribution:r_,StateDefinitionCompiler:$u,StateEngine:Qu,StaticLayerHandlerContribution:Pm,Step:ll,StepClosed:hl,Symbol:Wg,SymbolRender:Ry,SymbolRenderContribution:s_,TEXT_NUMBER_TYPE:md,Text:Zg,get TextDirection(){return Kc},TextMeasureContribution:Vm,TextRender:Iy,TextRenderContribution:n_,Theme:Dp,TransformUtil:wm,get UpdateTag(){return vo},VGlobal:yg,VWindow:bf,ViewTransform3dPlugin:tC,VirtualLayerHandlerContribution:Im,WILDCARD:"*",WindowHandlerContribution:xf,WrapText:tf,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Iu,addArcToBezierPath:To,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:rk,alignSubpath:QA,application:oh,applyTransformOnBezierCurves:ok,arc3dModule:Gb,arcModule:Nb,areaModule:nx,bezier:ko,bezierCurversToPath:lk,binarySplitPolygon:yk,bindArc3dRenderModule:Wb,bindArcRenderModule:jb,bindAreaRenderModule:sx,bindCircleRenderModule:ox,bindContributionProvider:Hm,bindContributionProviderNoSingletonScope:jm,bindGlyphRenderModule:dx,bindImageRenderModule:Sx,bindLineRenderModule:Tx,bindPathRenderModule:Ix,bindPolygonRenderModule:Ux,bindPyramid3dRenderModule:Xx,bindRect3dRenderModule:eS,bindRectRenderModule:Zx,bindRichtextRenderModule:aS,bindStarRenderModule:cS,bindSymbolRenderModule:gS,bindTextRenderModule:yS,boundStroke:Gc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Sl,calculateArcCornerRadius:Dv,calculateLineHeight:Ch,canvasAllocate:_f,centroidOfSubpath:ik,circleBounds:vh,circleModule:lx,clock:Za,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Nu,configureRuntimeApplicationForApp:WA,container:iA,cornerTangents:Lv,createApp:bA,createArc:Vp,createArc3d:hv,createArea:Yp,createBrowserApp:bA,createCanvasEventTransformer:function(t,e,i,s){return Ck(t.parentElement,e,i,s)},createCircle:$p,createColor:ru,createConicalGradient:Yu,createContributionProvider:zm,createEventTransformer:Ck,createGlyph:Zp,createGraphic:cf,createGroup:tg,createImage:sg,createLine:ag,createMat4:_u,createMiniappApp:function(t={}){return new SA(t)},createNodeApp:function(t={}){return new xA(t)},createPath:hg,createPolygon:ug,createPyramid3d:dv,createRect:mg,createRect3d:nv,createRectPath:Mv,createRichText:jg,createShadowRoot:Ug,createStage:function(t){return oA(),(new Sm).create(t)},createStar:ov,createSymbol:Gg,createText:Jg,createWrapText:ef,cubicCalc:Ro,cubicLength:Po,cubicPointAt:Io,cubicSubdivide:JA,defaultArcAllocate:Hk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Uv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:Nk,defaultBaseBackgroundRenderContribution:zf,defaultBaseClipRenderAfterContribution:Qf,defaultBaseClipRenderBeforeContribution:Zf,defaultBaseTextureRenderContribution:jv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Kv,defaultCircleRenderContribution:Yv,defaultCircleTextureRenderContribution:Xv,defaultGraphicMemoryManager:Qk,defaultGroupBackgroundRenderContribution:qv,defaultImageBackgroundRenderContribution:ay,defaultImageRenderContribution:ry,defaultLineAllocate:Gk,defaultPathAllocate:Xk,defaultRectAllocate:Fk,defaultRectBackgroundRenderContribution:sy,defaultRectRenderContribution:ey,defaultRectTextureRenderContribution:iy,defaultStarBackgroundRenderContribution:gy,defaultStarTextureRenderContribution:py,defaultSymbolAllocate:$k,defaultSymbolBackgroundRenderContribution:uy,defaultSymbolClipRangeStrokeRenderContribution:cy,defaultSymbolRenderContribution:hy,defaultSymbolTextureRenderContribution:dy,defaultTextAllocate:Zk,diff:ZA,divideCubic:Fo,drawArc:Co,drawArcPath:Fv,drawAreaSegments:Xb,drawBackgroundImage:Kf,drawImageWithLayout:_x,drawIncrementalAreaSegments:Jb,drawIncrementalSegments:Zb,drawSegments:qb,enumCommandMap:lo,fillVisible:Bv,findBestMorphingRotation:nk,findConfigIndexByCursorIdx:wk,findCursorIdxByConfigIndex:Ek,findNextGraphic:Lf,flatten_simplify:qA,foreach:If,foreachAsync:Of,genBasisSegments:Zo,genBasisTypeSegments:qo,genLinearClosedSegments:gl,genLinearClosedTypeSegments:fl,genLinearSegments:Yo,genLinearTypeSegments:Xo,genMonotoneXSegments:rl,genMonotoneXTypeSegments:nl,genMonotoneYSegments:ol,genMonotoneYTypeSegments:al,genNumberType:Xc,genStepClosedSegments:ul,genStepSegments:cl,genStepTypeSegments:dl,getApplicationState:ah,getAttributeFromDefaultAttrList:xh,getBackgroundImage:jf,getConicGradientAt:Gu,getContributionStoreState:Lm,getCurrentEnv:function(){return mm()?"browser":"node"},getDefaultCharacterConfig:Mk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Yg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Au.allocate();return cu(o,o,[a[0],a[1],0]),n&&ou(o,o,n),s&&lu(o,o,s),cu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Ef,getGraphicClassState:wp,getGraphicRegistryState:af,getLegacyBindingContext:m_,getModelMatrix:vm,getRichTextBounds:fv,getRuntimeInstallerBindingContext:NA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:TA,getScaledStroke:nu,getTextBounds:gv,getTheme:zp,getThemeFromGroup:Hp,globalTheme:Fp,glyphModule:ux,graphicCreator:lf,graphicService:rA,graphicUtil:sA,identityMat4:au,imageModule:Ax,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:$A,installRuntimeDrawContributionsToApp:YA,installRuntimeGraphicRenderersToApp:GA,installRuntimePickersToApp:XA,interpolateColor:Ru,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Ou,interpolateGradientRadialColor:Lu,interpolatePureColorArray:Fu,interpolatePureColorArrayToStr:zu,intersect:Ov,isBrowserEnv:mm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){fm();const t=oh.global&&oh.global.env;return t?"node"===t:!gm},isSvg:Nc,isXML:Uc,layerService:aA,lineModule:Mx,lookAt:gu,mapToCanvasPointForCanvas:function(t){var e;if(Rd(t._canvasX)&&Rd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:du,mat4Allocate:Au,matrixAllocate:Su,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:pu,newThemeObj:Ip,ortho:fu,parsePadding:gh,parseStroke:uh,parseSvgPath:mo,pathModule:Ox,pathToBezierCurves:ak,point:Ko,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:Vx,preLoadAllModule:f_,pyramid3dModule:Kx,quadCalc:Oo,quadLength:Do,quadPointAt:Lo,rafBasedSto:Ah,rect3dModule:iS,rectFillVisible:Pv,rectModule:Jx,rectStrokeVisible:Iv,recursiveCallBinarySplit:_k,refreshRuntimeInstallerContributions:UA,registerArc3dGraphic:vb,registerArcGraphic:mb,registerAreaGraphic:yb,registerCircleGraphic:_b,registerDirectionalLight:uA,registerFlexLayoutPlugin:nC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:bb,registerGraphic:hf,registerGroupGraphic:xb,registerHtmlAttributePlugin:S_,registerImageGraphic:Sb,registerLineGraphic:Ab,registerOrthoCamera:gA,registerPathGraphic:kb,registerPolygonGraphic:Cb,registerPyramid3dGraphic:Tb,registerReactAttributePlugin:k_,registerRect3dGraphic:wb,registerRectGraphic:Mb,registerRichtextGraphic:Eb,registerShadowRootGraphic:Bb,registerStarGraphic:Pb,registerSymbolGraphic:Rb,registerTextGraphic:Ib,registerViewTransform3dPlugin:eC,registerWindowEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Ob,renderCommandList:wo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:vx,resolveBackgroundPosition:Gf,resolveBackgroundSizing:Nf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:fx,resolveImageRepeatMode:gx,resolveRenderableImageSize:Xf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:oS,rotateX:ou,rotateY:lu,rotateZ:hu,runFill:wv,runStroke:Ev,scaleMat4:uu,segments:Ao,shouldClipImageByLayout:yx,shouldUseMat4:ym,snapLength:Bo,splitArc:dk,splitArea:gk,splitCircle:uk,splitLine:fk,splitPath:xk,splitPolygon:bk,splitRect:ck,splitToGrids:hk,starModule:dS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Rv,symbolModule:fS,textAttributesToStyle:Kg,textDrawOffsetX:Yg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Xg,textModule:_S,transformMat4:mu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:nA,translate:cu,verticalLayout:$c,vglobal:b_,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oh.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)}))},wrapCanvas:Td,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.context2dFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Qc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Qc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class aC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:nu(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class oC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let lC=!1;function hC(t){lC||(lC=!0,t.bind(DS).toDynamicValue((()=>new oC(xS(t,xy)))).inSingletonScope(),t.bind(eA).toService(DS))}class cC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let dC=!1;function uC(t){dC||(dC=!0,t.bind(kS).toDynamicValue((()=>new cC(xS(t,xy)))).inSingletonScope(),t.bind(AS).toService(kS))}function pC(){if(pC.__loaded)return;pC.__loaded=!0;const t=m_();mb(),Nb({bind:t.bind}),bS?hC(t):uC(t)}pC.__loaded=!1;const gC=pC;class fC extends Fb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class mC extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ed,this.themeType="arc"}}let vC=!1;function yC(t){var e;vC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Sy))&&(vC=!0,t.bind(FS).toDynamicValue((()=>new mC(xS(t,Sy)))).inSingletonScope(),t.bind(eA).toService(FS))}function _C(){if(_C.__loaded)return;_C.__loaded=!0;const t=m_();vb(),uA(),gA(),Gb({bind:t.bind}),yC(t)}_C.__loaded=!1;const bC=_C;class xC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let SC=!1;function AC(t){SC||(SC=!0,t.bind(zS).toDynamicValue((()=>new xC(xS(t,Ay)))).inSingletonScope(),t.bind(eA).toService(zS))}class kC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let CC=!1;function TC(t){CC||(CC=!0,t.bind(CS).toDynamicValue((()=>new kC(xS(t,Ay)))).inSingletonScope(),t.bind(AS).toService(CS))}function MC(){if(MC.__loaded)return;MC.__loaded=!0;const t=m_();yb(),nx({bind:t.bind}),bS?AC(t):TC(t)}MC.__loaded=!1;const wC=MC;class EC{constructor(){this.type="glyph",this.numberType=nd}contains(t,e,i){if(!t.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}}class BC extends EC{constructor(t){super(),this.canvasRenderer=t}}let PC=!1;function RC(t){PC||(PC=!0,t.bind(JS).toDynamicValue((()=>new BC(xS(t,Dy)))).inSingletonScope(),t.bind(eA).toService(JS))}class IC extends EC{constructor(t){super(),this.canvasRenderer=t}}let OC=!1;function LC(t){OC||(OC=!0,t.bind(OS).toDynamicValue((()=>new IC(xS(t,Dy)))).inSingletonScope(),t.bind(AS).toService(OS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=m_();bb(),ux({bind:t.bind}),bS?RC(t):LC(t)}DC.__loaded=!1;const FC=DC;function zC(){zC.__loaded||(zC.__loaded=!0,xb())}zC.__loaded=!1;const HC=zC;class jC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=ad}}let NC=!1;function UC(t){NC||(NC=!0,t.bind(jS).toDynamicValue((()=>new jC(xS(t,Fy)))).inSingletonScope(),t.bind(eA).toService(jS))}class VC{constructor(){this.type="image",this.numberType=ad}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function GC(t){WC||(WC=!0,t.bind(MS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(AS).toService(MS))}function YC(){if(YC.__loaded)return;YC.__loaded=!0;const t=m_();Sb(),Ax({bind:t.bind}),bS?UC(t):GC(t)}YC.__loaded=!1;const XC=YC;class KC extends Fb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class $C extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let qC=!1;function ZC(t){qC||(qC=!0,t.bind(US).toDynamicValue((()=>new $C(xS(t,My)))).inSingletonScope(),t.bind(eA).toService(US))}class JC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let QC=!1;function tT(t){QC||(QC=!0,t.bind(wS).toDynamicValue((()=>new JC(xS(t,My)))).inSingletonScope(),t.bind(AS).toService(wS))}function eT(){if(eT.__loaded)return;eT.__loaded=!0;const t=m_();Ab(),Mx({bind:t.bind}),bS?ZC(t):tT(t)}eT.__loaded=!1;const iT=eT;class sT extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let nT=!1;function rT(t){nT||(nT=!0,t.bind(WS).toDynamicValue((()=>new sT(xS(t,wy)))).inSingletonScope(),t.bind(eA).toService(WS))}class aT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let oT=!1;function lT(t){oT||(oT=!0,t.bind(ES).toDynamicValue((()=>new aT(xS(t,wy)))).inSingletonScope(),t.bind(AS).toService(ES))}function hT(){if(hT.__loaded)return;hT.__loaded=!0;const t=m_();kb(),Ox({bind:t.bind}),bS?rT(t):lT(t)}hT.__loaded=!1;const cT=hT;class dT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let uT=!1;function pT(t){uT||(uT=!0,t.bind($S).toDynamicValue((()=>new dT(xS(t,Ey)))).inSingletonScope(),t.bind(eA).toService($S))}class gT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let fT=!1;function mT(t){fT||(fT=!0,t.bind(IS).toDynamicValue((()=>new gT(xS(t,Ey)))).inSingletonScope(),t.bind(AS).toService(IS))}function vT(){if(vT.__loaded)return;vT.__loaded=!0;const t=m_();Cb(),Vx({bind:t.bind}),bS?pT(t):mT(t)}vT.__loaded=!1;const yT=vT;class _T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=cd,this.themeType="polygon"}}let bT=!1;function xT(t){var e;bT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ly))&&(bT=!0,t.bind(qS).toDynamicValue((()=>new _T(xS(t,Ly)))).inSingletonScope(),t.bind(eA).toService(qS))}function ST(){if(ST.__loaded)return;ST.__loaded=!0;const t=m_();Tb(),uA(),gA(),Kx({bind:t.bind}),xT(t)}ST.__loaded=!1;const AT=ST,kT=new Ve;class CT{constructor(){this.type="rect",this.numberType=dd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:nu(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;kT.setValue(i.x1,i.y1,i.x2,i.y2),kT.expand(-r/2),h=!kT.containsPoint(e)}}return s.highPerformanceRestore(),h}}class TT extends CT{constructor(t){super(),this.canvasRenderer=t}}let MT=!1;function wT(t){MT||(MT=!0,t.bind(GS).toDynamicValue((()=>new TT(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(GS))}class ET extends CT{constructor(t){super(),this.canvasRenderer=t}}let BT=!1;function PT(t){BT||(BT=!0,t.bind(BS).toDynamicValue((()=>new ET(xS(t,By)))).inSingletonScope(),t.bind(AS).toService(BS))}function RT(){if(RT.__loaded)return;RT.__loaded=!0;const t=m_();Mb(),Jx({bind:t.bind}),bS?wT(t):PT(t)}RT.__loaded=!1;const IT=RT;class OT extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=ud,this.themeType="rect"}}let LT=!1;function DT(t){var e;LT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Py))&&(LT=!0,t.bind(YS).toDynamicValue((()=>new OT(xS(t,Py)))).inSingletonScope(),t.bind(eA).toService(YS))}function FT(){if(FT.__loaded)return;FT.__loaded=!0;const t=m_();wb(),iS({bind:t.bind}),DT(t)}FT.__loaded=!1;const zT=FT;class HT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let jT=!1;function NT(t){jT||(jT=!0,t.bind(ZS).toDynamicValue((()=>new HT(xS(t,Oy)))).inSingletonScope(),t.bind(eA).toService(ZS))}class UT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let VT=!1;function WT(t){VT||(VT=!0,t.bind(LS).toDynamicValue((()=>new UT(xS(t,Oy)))).inSingletonScope(),t.bind(AS).toService(LS))}function GT(){if(GT.__loaded)return;GT.__loaded=!0;const t=m_();Eb(),oS({bind:t.bind}),bS?NT(t):WT(t)}GT.__loaded=!1;const YT=GT;function XT(){XT.__loaded||(XT.__loaded=!0,Bb())}XT.__loaded=!1;const KT=XT;class $T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Au.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let qT=!1;function ZT(t){qT||(qT=!0,t.bind(XS).toDynamicValue((()=>new $T(xS(t,Ry)))).inSingletonScope(),t.bind(eA).toService(XS))}class JT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}}let QT=!1;function tM(t){QT||(QT=!0,t.bind(PS).toDynamicValue((()=>new JT(xS(t,Ry)))).inSingletonScope(),t.bind(AS).toService(PS))}function eM(){if(eM.__loaded)return;eM.__loaded=!0;const t=m_();Rb(),fS({bind:t.bind}),bS?ZT(t):tM(t)}eM.__loaded=!1;const iM=eM;class sM extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Xg(a,u,n),v=Yg(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&&Au.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let nM=!1;function rM(t){nM||(nM=!0,t.bind(KS).toDynamicValue((()=>new sM(xS(t,Iy)))).inSingletonScope(),t.bind(eA).toService(KS))}class aM{constructor(){this.type="text",this.numberType=md}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let oM=!1;function lM(t){oM||(oM=!0,t.bind(RS).toDynamicValue((()=>new aM)).inSingletonScope(),t.bind(AS).toService(RS))}function hM(){if(hM.__loaded)return;hM.__loaded=!0;const t=m_();Ib(),_S({bind:t.bind}),bS?rM(t):lM(t)}hM.__loaded=!1;const cM=hM;function dM(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),gM=(t,e)=>(d(mM.warnHandler)&&mM.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),fM=(t,e,i)=>{if(!d(mM.errorHandler))throw new Error(t);mM.errorHandler.call(null,t,e)},mM={silent:!1,warnHandler:!1,errorHandler:!1},vM=mm(),yM=vM&&globalThis?globalThis.document:void 0;function _M(t){return("desktop-browser"===t||"mobile-browser"===t)&&vM}function bM(t){return xM(t)||"mobile-browser"===t}function xM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let SM=0;function AM(){return SM>=9999999&&(SM=0),SM++}function kM(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function CM(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function TM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&TM(t,e)}))}const MM=t=>!u(t)&&!1!==t.visible;function wM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function EM(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 PM=["#ffffff","#000000"];function RM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return IM(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(...PM);for(const n of a)if(t!==n&&IM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function IM(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?OM(t,e)>s:"largeText"===i?OM(t,e)>3:OM(t,e)>4.5}function OM(t,e){const i=LM(t),s=LM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function LM(t){const e=ri(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 DM(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 FM(t,e){return[t[0]*e,t[1]*e]}function zM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function HM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const jM=cf,NM={arc:t=>jM("arc",t),circle:t=>jM("circle",t),group:t=>jM("group",t),image:t=>jM("image",t),line:t=>jM("line",t),path:t=>jM("path",t),polygon:t=>jM("polygon",t),rect:t=>jM("rect",t),richtext:t=>jM("richtext",t),symbol:t=>jM("symbol",t),text:t=>jM("text",t)},UM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 GM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(GM||(GM={}));const YM={[GM.selectedReverse]:{},[GM.selected]:{},[GM.hover]:{},[GM.hoverReverse]:{}},XM={container:"",width:30,height:30,style:{}},KM="scrollDrag",$M=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:gv,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function qM(t,e,i={}){if(!t)return{width:0,height:0};const s=gv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 ZM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function JM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function QM(t,e="type"){const i=ZM(t,e);return"rich"===i?NM.richtext(JM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),NM.text(t))}function tw(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 ew=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function iw(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 sw(t,e){const{dx:i,dy:s}=iw(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const nw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},rw={size:8,stroke:"#000",lineWidth:1,zIndex:1};function aw(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Ae(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Ee(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const ow=Math.sin(Math.PI/10);function lw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function hw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function cw(t){const e={};return TM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return FM(r,(s?-1:1)*(n?-1:1)*t/zM(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function fw(t,e,i){var s;if(hw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function mw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function _w(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function bw(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function xw(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 Sw(t,e){const i=xw(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 Aw(t,e){const i=kw(t),s=kw(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 kw(t,e={x:0,y:0}){return ae.distancePP(t,e)}function Cw(t){return k(t.x)&&k(t.y)}function Tw(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 Mw(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const ww=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function Bw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&Bw(t[i],e)}}var Pw;!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"}(Pw||(Pw={}));const Rw={};function Iw(t){switch(t){case Pw.Linear:case Pw.Log:case Pw.Pow:case Pw.Sqrt:case Pw.Symlog:case Pw.Time:return!0;default:return!1}}function Ow(t){return!!Rw[t]}function Lw(t){switch(t){case Pw.Ordinal:case Pw.Point:case Pw.Band:return!0;default:return!1}}function Dw(t){return t}Object.values(Pw).forEach((t=>{Rw[t]=!0}));const Fw=t=>-Math.log(-t),zw=t=>-Math.exp(-t),Hw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,jw=t=>10===t?Hw:t===Math.E?Math.exp:e=>Math.pow(t,e),Nw=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)),Vw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Ww(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 Gw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Yw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Xw(t,e,i,s){return 1===i&&(i=0),Yw(t,i,s)*(e/(1-i))}function Kw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function $w(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Zw{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=Kw(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=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Jw=Symbol("implicit");class Qw extends Zw{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=Jw}clone(){const t=(new Qw).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!==Jw)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return tE(t,e,r,n)}class iE extends Qw{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=Xw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:eE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new iE(!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:sE}=ai;function nE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=sE(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?sE(t,e):e instanceof si?sE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class rE extends Zw{constructor(t=Dw,e=Dw){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Dw,this._piecewise=Gw,this._interpolate=nE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?$w:Gw,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:Dw),this.rescale(i)):this._clamp!==Dw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const aE=Math.sqrt(50),oE=Math.sqrt(10),lE=Math.sqrt(2),hE=[1,2,5,10],cE=(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=gE(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?uE(0,-(e-1)/s,s):uE((e-1)/s,0,s)},dE=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return cE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return cE(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=uE(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=uE(t,e,l);return n&&r.reverse(),r})),gE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=hE[0];return i>=aE?s=hE[3]:i>=oE?s=hE[2]:i>=lE&&(s=hE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function fE(t,e,i){const s=(e-t)/Math.max(0,i);return gE(s)}function mE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=fE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function yE(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 _E=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),bE=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),xE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=pE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?_E(t,e,n):_E(t,e,qw(n)),h=_E(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),SE=vt(((t,e,i,s,n)=>mE(s(t),s(e),i).map((t=>qw(n(t))))));class AE extends rE{constructor(){super(...arguments),this.type=Pw.Linear}clone(){var t;const e=new AE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return dE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=pE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function CE(t){return e=>-t(-e)}function TE(t=Number.EPSILON){return e=>Math.max(e,t)}class ME extends rE{constructor(){super(Nw(10),jw(10)),this.type=Pw.Log,this._limit=TE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new ME).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=Nw(this._base),s=jw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Fw,this.untransformer=zw):(this._logs=i,this._pows=s,this._limit=TE(),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 Dw}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return bE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(ME,kE);class wE extends AE{constructor(){super(Uw(1),Vw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new wE).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=Vw(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return bE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(wE,kE);class EE{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[lt(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new EE).domain(this._domain).range(this._range).unknown(this._unknown)}}var BE,PE,RE;function IE(t){var e,i;const{type:s}=t;return s===PE.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BE||(BE={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(PE||(PE={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(RE||(RE={}));const OE={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},LE={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DE(t,e){var i;if(!t)return[];const s=VE(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?NE(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>jE(i)?zE(t,i,e):i)).filter(p)}))):i.map((i=>jE(i)?zE(t,i,e):i)).filter(p):[]}return[]}function FE(t,e){var i,s;return NE(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 zE(t,e,i){var s;const n=VE(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=OE[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=LE[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 si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`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 HE=(t,e)=>{if(e&&jE(t)){const i=zE(e,t);if(i)return i}return t};function jE(t){return t&&"palette"===t.type&&!!t.key}function NE(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function UE(t){return _(t)?{dataScheme:t}:t}function VE(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=IE(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 WE extends Qw{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!NE(this._range))return void super.range(this._range);const t=FE(this._range,this._domain);super.range(t)}}const GE={linear:AE,band:iE,point:class extends iE{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:Qw,threshold:EE,colorOrdinal:WE};function YE(t){const e=GE[t];return e?new e:null}function XE(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function KE(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function $E(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qE(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZE(t){return!!y(t)&&(!!t.endsWith("%")&&kM(t.substring(0,t.length-1)))}function JE(t){return!!g(t)&&("percent"in t||"offset"in t)}function QE(t,e,i,s=0){var n,r;return S(t)?t:ZE(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 tB(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]=QE(t[s],e.size,i)}))})),o}function eB(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function iB(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)||ZE(t)||d(t)||JE(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function sB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const nB=(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},rB=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function aB(t,e){return t&&e.key in t?t[e.key]:e.default}function oB(t){return t&&"token"===t.type&&!!t.key}const lB={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},hB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:lB,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},cB={name:"dark",colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},dB=(t,e)=>t===e||!d(t)&&!d(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>dB(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>dB(t[i],e[i])))),uB=(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]={}),uB(t[s],e.slice(1),i))},pB=t=>t instanceof za||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function gB(t,e=["data"]){return L(t,pB,e)}function fB(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=UE(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}bB._charts=_B.charts,bB._series=_B.series,bB._components=_B.components,bB._graphicComponents=_B.graphicComponents,bB._marks=_B.marks,bB._regions=_B.regions,bB._animations=_B.animations,bB._implements=_B.implements,bB._chartPlugin=_B.chartPlugin,bB._vChartPlugin=_B.vChartPlugin,bB._componentPlugin=_B.componentPlugin,bB.transforms=_B.transforms,bB.dataParser=_B.dataParser,bB._layout=_B.layout,bB._grammarTransforms=_B.grammarTransforms,bB._stageEventPlugins=_B.stageEventPlugins,bB.registerStageEventPlugin=(t,e)=>{bB._stageEventPlugins[t]=e},bB.getStageEventPlugin=t=>bB._stageEventPlugins[t],bB._interactionTriggers=_B.interactionTriggers,bB.registerInteractionTrigger=(t,e)=>{bB._interactionTriggers[t]=e},bB._composedEventMap=_B.composedEventMap,bB.registerComposedEvent=(t,e)=>{bB._composedEventMap[t]=e},bB._tooltipProcessors=_B.tooltipProcessors,bB.registerTooltipProcessor=(t,e)=>{bB._tooltipProcessors[t]=e},bB.createTooltipProcessor=(t,e)=>{const i=bB._tooltipProcessors[t];return i?new i(e):null},bB._runtimePluginInstallers=_B.runtimePluginInstallers,bB.registerRuntimePluginInstaller=(t,e)=>{bB._runtimePluginInstallers[t]=e},bB.getRuntimePluginInstaller=t=>bB._runtimePluginInstallers[t];const AB=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},kB=AB(),CB={[hB.name]:hB},TB=hB.name,MB=new Map(Object.keys(CB).map((t=>[t,CB[t]]))),wB=new Map,EB=new Map(Object.keys(CB).map((t=>[t,t===TB]))),BB=(t,e)=>{if(!t)return;const i=OB(e);MB.set(t,i),EB.set(t,!0)},PB=(t=TB)=>(EB.has(t)&&!EB.get(t)&&BB(t,MB.get(t)),MB.get(t)),RB=t=>MB.delete(t)&&wB.delete(t)&&EB.delete(t),IB=t=>!!y(t)&&MB.has(t),OB=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:TB;return xB({},PB(i),t)};class LB{static registerInstance(t){LB.instances.set(t.id,t)}static unregisterInstance(t){LB.instances.delete(t.id)}static getInstance(t){return LB.instances.get(t)}static instanceExist(t){return LB.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return LB.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}LB.instances=new Map;class DB{static registerTheme(t,e){BB(t,e)}static getTheme(t,e=!1){return PB(t)}static removeTheme(t){return RB(t)}static themeExist(t){return IB(t)}static getDefaultTheme(){return DB.themes.get(TB)}static setCurrentTheme(t){DB.themeExist(t)&&(DB._currentThemeName=t,LB.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return DB.getTheme(DB._currentThemeName,t)}static getCurrentThemeName(){return DB._currentThemeName}}function FB(t){return y(t)?DB.themeExist(t)?DB.getTheme(t):{}:g(t)?t:{}}DB.themes=MB,DB._currentThemeName=TB;const zB=["animationThreshold","colorScheme","name","padding"];function HB(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];zB.includes(n)?s[n]=r:m(r)?jE(r)?s[n]=HE(r,e):oB(r)?s[n]=aB(i,r):s[n]=HB(r,e,i):s[n]=r})),s}function jB(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]=jB(t[s],e)}return i}return _(t)?t.map((t=>jB(t,e))):t}function NB(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]=NB(t[s],e)}return i}return _(t)?t.map((t=>NB(t,e))):t}function UB(t,...e){return d(t)?t(...e):t}const VB=(t,e,i,s)=>((t,e,i)=>$M(t,e,i,{fontFamily:lB.fontFamily,fontSize:lB.fontSize}))(e,i,s).measure(t),WB="__VCHART",GB=500,YB=500,XB=`${WB}_MEASURE_CANVAS_ID`,KB=`${WB}_DEFAULT_DATA_INDEX`,$B=`${WB}_DEFAULT_DATA_KEY`,qB=`${WB}_DEFAULT_DATA_SERIES_FIELD`,ZB=`${WB}_DEFAULT_SERIES_STYLE_NAME`,JB=`${WB}_STACK_KEY`,QB=`${WB}_STACK_START`,tP=`${WB}_STACK_END`,eP=`${WB}_STACK_START_PERCENT`,iP=`${WB}_STACK_END_PERCENT`,sP=`${WB}_STACK_START_OffsetSilhouette`,nP=`${WB}_STACK_END_OffsetSilhouette`,rP=`${WB}_STACK_TOTAL`,aP=`${WB}_STACK_TOTAL_PERCENT`,oP=`${WB}_STACK_TOTAL_TOP`,lP=`${WB}_STACK_TOTAL_BOTTOM`,hP=`${WB}_MOSAIC_VALUE_START_PERCENT`,cP=`${WB}_MOSAIC_VALUE_END_PERCENT`,dP=`${WB}_MOSAIC_CAT_START_PERCENT`,uP=`${WB}_MOSAIC_CAT_END_PERCENT`,pP=`${WB}_SEGMENT_START`,gP=`${WB}_SEGMENT_END`,fP=`${WB}_KEY`,mP=`${WB}_MAP_LOOK_UP_KEY`;function vP(t,e){for(let i=0;it.key===e))}function _P(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 bP(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},CP(t,a,n[o],l,e,r))})),s?xP(n):n}function xP(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))):xP(t[e].nodes);return t}function SP(t,e){if("values"in t&&t.values.length){const i=bw(t.values,e),s=_w(t.values,iP);t.values.forEach((t=>{t[rP]=i,t[aP]=s}))}else for(const i in t.nodes)SP(t.nodes[i],e)}function AP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][tP]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)kP(t.nodes[r],e,i,s,n)}function CP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[tP]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),CP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const TP=(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]=wP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function EP(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function BP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return OP(t(r,i,s,n));if(EP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),OP(e)}return OP(t)}function PP(t={}){const e=Object.assign({},t);if(d(t.style)||EP(t.style)?e.style=(e,i,s,n)=>BP(t.style,e,i,s,n):P(t.style)||(e.style=OP(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||EP(t.state[e])?i[e]=(i,s,n,r)=>BP(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=OP(t.state[e]))})),e.state=i}return e}function RP(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>OP(t[i](e,s,n,r)):P(t[i])||(e[i]=OP(t[i]))})),e}function IP(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),OP(i)}function OP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const LP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},DP=t=>"line"===t||"area"===t,FP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return DP(i)?e:null==e?void 0:e[0]},zP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let HP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=bB.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(bB.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var jP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(jP||(jP={}));const NP=["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 UP,VP,WP;t.ChartEvent=void 0,(UP=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",UP.rendered="rendered",UP.renderFinished="renderFinished",UP.animationFinished="animationFinished",UP.regionSeriesDataFilterOver="regionSeriesDataFilterOver",UP.afterInitData="afterInitData",UP.afterInitEvent="afterInitEvent",UP.afterInitMark="afterInitMark",UP.rawDataUpdate="rawDataUpdate",UP.viewDataFilterOver="viewDataFilterOver",UP.viewDataUpdate="viewDataUpdate",UP.viewDataStatisticsUpdate="viewDataStatisticsUpdate",UP.markDeltaYUpdate="markDeltaYUpdate",UP.viewDataLabelUpdate="viewDataLabelUpdate",UP.scaleDomainUpdate="scaleDomainUpdate",UP.scaleRawDomainUpdate="scaleRawDomainUpdate",UP.scaleUpdate="scaleUpdate",UP.dataZoomChange="dataZoomChange",UP.drill="drill",UP.layoutStart="layoutStart",UP.layoutEnd="layoutEnd",UP.layoutRectUpdate="layoutRectUpdate",UP.playerPlay="playerPlay",UP.playerPause="playerPause",UP.playerEnd="playerEnd",UP.playerChange="playerChange",UP.playerForward="playerForward",UP.playerBackward="playerBackward",UP.scrollBarChange="scrollBarChange",UP.brushStart="brushStart",UP.brushChange="brushChange",UP.brushEnd="brushEnd",UP.brushClear="brushClear",UP.brushActive="brushActive",UP.legendSelectedDataChange="legendSelectedDataChange",UP.legendFilter="legendFilter",UP.legendItemClick="legendItemClick",UP.legendItemHover="legendItemHover",UP.legendItemUnHover="legendItemUnHover",UP.tooltipShow="tooltipShow",UP.tooltipHide="tooltipHide",UP.tooltipRelease="tooltipRelease",UP.afterResize="afterResize",UP.afterRender="afterRender",UP.afterLayout="afterLayout",UP.afterMarkLayoutEnd="afterMarkLayoutEnd",UP.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(VP||(VP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(WP||(WP={}));const GP=[WP.mark,WP.model,WP.chart,WP.vchart];class YP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(WP.vchart,[]),this._levelNodes.set(WP.chart,[]),this._levelNodes.set(WP.model,[]),this._levelNodes.set(WP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const XP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class KP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>FP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||VP.chart);o.get(t)||o.set(t,new YP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||VP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||VP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||VP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?GP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[VP.chart,VP.window,VP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&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 XP[a]&&(a=XP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?WP.model:WP.vchart:WP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=VP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==WP.model&&s!==WP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=WP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case VP.chart:return this._viewBubbles;case VP.window:return this._windowBubbles;case VP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case VP.chart:return this._viewListeners;case VP.window:return this._windowListeners;case VP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return NP.includes(t)||Object.values(jP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&bB.hasInteractionTrigger(e)}}function $P(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function qP(t,e,i){t.getParser(e)||t.registerParser(e,i)}const ZP=new Map;let JP;function QP(){JP||(JP=new Fa,qP(JP,"geojson",Pa),qP(JP,"topojson",Ia),$P(JP,"simplify",Kr))}function tR(t,e,i={type:"geojson",centroid:!0}){ZP.has(t)&&gM(`map type of '${t}' already exists, will be overwritten.`),QP();const s=new za(JP),n=H({},{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}),ZP.set(t,s)}function eR(t){ZP.has(t)?ZP.delete(t):gM(`map type of '${t}' does not exists.`)}function iR(t,e=!1){let i=e;return t.latestData instanceof za&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const sR=(t,e)=>0===t.length?[]:1===t.length?iR(t[0],null==e?void 0:e.deep):t.map((t=>iR(t,null==e?void 0:e.deep)));function nR(e,i,s){$P(i=i instanceof Fa?i:e.dataSet,"copyDataView",sR);const n=new za(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function rR(t,e,i=[]){var s;if(t instanceof za)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new za(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return gM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return gM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),gM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function aR(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var oR,lR,hR,cR;t.TransformLevel=void 0,(oR=t.TransformLevel||(t.TransformLevel={}))[oR.copyDataView=-10]="copyDataView",oR[oR.treemapFilter=-8]="treemapFilter",oR[oR.treemapFlatten=-7]="treemapFlatten",oR[oR.dotObjFlat=-7]="dotObjFlat",oR[oR.linkDotInfo=-7]="linkDotInfo",oR[oR.sankeyLayout=-7]="sankeyLayout",oR[oR.dataZoomFilter=-6]="dataZoomFilter",oR[oR.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(lR||(lR={})),function(t){t.data="data",t.mark="mark"}(hR||(hR={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(cR||(cR={}));const dR=["line","area","trail"];function uR(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(fP,i?t.slice().sort(i):t.slice()),{keys:[fP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const pR=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function gR(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{gR(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function mR(t,e,i,s){const n=uR(t,(t=>i(t))),r=uR(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const vR=`${WB}_BuiltIn_CallBack_Disappear`;var yR;!function(t){t.render="render",t.disappear="disappear"}(yR||(yR={}));const _R=[0,0,0];class bR{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Il),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Ll),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Su.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&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(mu(_R,[e,i,s],this.modelMatrix),e=_R[0],i=_R[1],s=_R[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=ru(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:nu(this,a,this.dpr),r.strokeStyle=ru(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}bR.env="browser";class xR extends wu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=oh.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new bR(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 SR(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,kd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Cd,e.env));r||i.bind(kd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Cd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}xR.env="browser";const AR=SR(xR,bR);class kR extends bR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}kR.env="feishu";class CR extends wu{constructor(t){super(t)}init(){this._context=new kR(this,this._dpr)}release(...t){}}CR.env="feishu";const TR=SR(CR,kR);class MR extends bR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}MR.env="harmony";class wR extends wu{constructor(t){super(t)}init(){this._context=new MR(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}wR.env="harmony";const ER=SR(wR,MR);class BR extends bR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}BR.env="lynx";class PR extends wu{constructor(t){super(t)}init(){this._context=new BR(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}PR.env="lynx";const RR=SR(PR,BR);class IR extends bR{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}IR.env="node";class OR extends wu{constructor(t){super(t)}init(){this._context=new IR(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}OR.env="node";const LR=SR(OR,IR);class DR extends bR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(ru(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:nu(this,l,this.dpr)),r.setStrokeStyle(ru(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}DR.env="taro";class FR extends wu{constructor(t){super(t)}init(){this._context=new DR(this,this._dpr)}release(...t){}}FR.env="taro";const zR=SR(FR,DR);class HR extends kR{}HR.env="tt";class jR extends wu{constructor(t){super(t)}init(){this._context=new HR(this,this._dpr)}release(...t){}}jR.env="tt";const NR=SR(jR,HR);class UR extends bR{draw(){}createPattern(t,e){return null}}UR.env="wx";class VR extends wu{constructor(t){super(t)}init(){this._context=new UR(this,this._dpr)}release(...t){}}VR.env="wx";const WR=SR(VR,UR);class GR extends vA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=_f.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;nnew KR(xS(t,ky)))).inSingletonScope(),t.bind(eA).toService(HS))}class ZR extends CT{constructor(t){super(),this.canvasRenderer=t}}let JR=!1;class QR extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=gd}}let tI=!1;function eI(t){var e;tI||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,jy))&&(tI=!0,t.bind(tA).toDynamicValue((()=>new QR(xS(t,jy)))).inSingletonScope(),t.bind(eA).toService(tA))}const iI=Xc();Xc();class sI{constructor(){this.type="gif-image",this.numberType=iI}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let nI=!1;function rI(t){nI||(nI=!0,t.bind(NS).toDynamicValue((()=>new sI)).inSingletonScope(),t.bind(eA).toService(NS))}function aI(t){t.isBound(GR)||t.bind(GR).toDynamicValue((()=>new GR(SS(eA,t),xS(t,Hy),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(GR):t.bind(qm).toService(GR)}function oI(t){(function(t){XR||(XR=!0,t.bind(QS).toDynamicValue((()=>new YR)).inSingletonScope(),t.bind(eA).toService(QS),Hm(t.bind.bind(t),eA))})(t),hC(t),yC(t),AC(t),qR(t),RC(t),UC(t),ZC(t),function(t){JR||(JR=!0,t.bind(VS).toDynamicValue((()=>new ZR(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(VS))}(t),rT(t),pT(t),xT(t),wT(t),DT(t),NT(t),eI(t),ZT(t),rM(t),rI(t),aI(t)}class lI extends cA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${lI.idprefix}_${lI.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=oh.global,this.viewBox=new Ve,this.modelMatrix=new Ge(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(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:lI.GenerateCanvasId(),canvasControled:!0};this.canvas=new xR(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new xR({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function hI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,lI))||t.bind(lI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,lI.env))||t.bind(xf).toService(lI).whenTargetNamed(lI.env)}lI.env="browser",lI.idprefix="visactor_window",lI.prefix_count=0;var cI=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 dI{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 uI(t,e=!1){const i=document.createElement("img");if(oh.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class pI extends hA{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 dI(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return uI(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return uI(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return cI(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function gI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,pI))||(t.bind(pI).toSelf().inSingletonScope(),t.bind(vg).toService(pI))}function fI(t=m_(),e=!0){fI.__loaded||(fI.__loaded=!0,gI(t),AR(t),hI(t),e&&oI(t))}fI.__loaded=!1;class mI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new CR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 CR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function vI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,mI))||t.bind(mI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,mI.env))||t.bind(xf).toService(mI).whenTargetNamed(mI.env)}mI.env="feishu";class yI extends vA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Tu(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}}let _I=!1;class bI extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let xI=!1;function SI(t){xI||(xI=!0,t.bind(TS).toDynamicValue((()=>new bI(xS(t,ky)))).inSingletonScope(),t.bind(AS).toService(TS))}function AI(t){(function(t){_I||(_I=!0,Hm(t.bind.bind(t),AS))})(t),function(t){t.isBound(yI)||t.bind(yI).toDynamicValue((()=>new yI(SS(AS,t),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(yI):t.bind(qm).toService(yI)}(t),uC(t),TC(t),SI(t),LC(t),GC(t),tT(t),mT(t),lT(t),PT(t),WT(t),tM(t),lM(t)}class kI{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class CI{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function TI(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function MI(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new kI(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function wI(t,e,i,s){const n=TI(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new CI(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function EI(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function BI(t,e=EI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class PI extends hA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=EI(i),n=null!==(e=t.dpr)&&void 0!==e?e:BI(i,s),r=wI(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=TI(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=MI(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return BI(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function RI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,PI))||(t.bind(PI).toSelf().inSingletonScope(),t.bind(vg).toService(PI))}function II(t=m_(),e=!0){II.__loaded||(II.__loaded=!0,RI(t),TR(t),vI(t),e&&AI(t))}II.__loaded=!1;function OI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function LI(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new wR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 wR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return OI(t,"target",s),OI(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=LI(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=LI(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&DI(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),DI(t,"x",_),DI(t,"y",b),DI(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),DI(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),DI(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),DI(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),DI(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),DI(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function zI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,FI))||t.bind(FI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,FI.env))||t.bind(xf).toService(FI).whenTargetNamed(FI.env)}FI.env="harmony";const HI="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function jI(t){return"number"==typeof t&&Number.isFinite(t)}function NI(...t){for(let e=0;e({width:i,height:s})),new CI(t,l,n,i,s,e)}function YI(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=WI(e*s,i*s);if(t)return t}throw new Error(HI)}class XI extends hA{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=UI(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=UI(s),r=null!==(i=t.dpr)&&void 0!==i?i:VI(s),a=function(t,e){if(!jI(t)||!jI(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=GI(YI(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=GI(YI(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return VI(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=NI(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=NI(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function KI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,XI))||(t.bind(XI).toSelf().inSingletonScope(),t.bind(vg).toService(XI))}function $I(t=m_(),e=!0){$I.__loaded||($I.__loaded=!0,KI(t),ER(t),zI(t),e&&AI(t))}$I.__loaded=!1;function qI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function ZI(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new PR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 PR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return qI(t,"target",s),qI(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=ZI(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=ZI(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&JI(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),JI(t,"x",_),JI(t,"y",b),JI(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),JI(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),JI(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),JI(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),JI(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),JI(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function tO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,QI))||t.bind(QI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,QI.env))||t.bind(xf).toService(QI).whenTargetNamed(QI.env)}QI.env="lynx";function eO(t){return"number"==typeof t&&Number.isFinite(t)}function iO(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=nO(r),o=null!==(i=t.dpr)&&void 0!==i?i:rO(r,a),l=oO(t.width,t.height),h=lO(hO(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=nO(a),l=null!==(n=t.dpr)&&void 0!==n?n:rO(a,o),h=oO(t.width,t.height),c=Math.random().toString(),d=lO(hO(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return rO(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=iO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=iO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function dO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,cO))||(t.bind(cO).toSelf().inSingletonScope(),t.bind(vg).toService(cO))}function uO(t=m_(),e=!0){uO.__loaded||(uO.__loaded=!0,dO(t),RR(t),tO(t),e&&AI(t))}uO.__loaded=!1;class pO extends cA{get container(){return null}constructor(t=oh.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new OR(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new OR({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function gO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,pO))||t.bind(pO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,pO.env))||t.bind(xf).toService(pO).whenTargetNamed(pO.env)}pO.env="node";class fO extends hA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function mO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,fO))||(t.bind(fO).toSelf().inSingletonScope(),t.bind(vg).toService(fO))}function vO(t=m_(),e=!0){vO.__loaded||(vO.__loaded=!0,mO(t),LR(t),gO(t))}vO.__loaded=!1;class yO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new FR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 FR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function _O(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,yO))||t.bind(yO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,yO.env))||t.bind(xf).toService(yO).whenTargetNamed(yO.env)}yO.env="taro";class bO extends hA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=wI(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=TI(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=MI(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function xO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,bO))||(t.bind(bO).toSelf().inSingletonScope(),t.bind(vg).toService(bO))}function SO(t=m_(),e=!0){SO.__loaded||(SO.__loaded=!0,xO(t),zR(t),_O(t),e&&AI(t))}SO.__loaded=!1;class AO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new jR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 jR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function kO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,AO))||t.bind(AO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,AO.env))||t.bind(xf).toService(AO).whenTargetNamed(AO.env)}AO.env="tt";function CO(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function TO(t,e=CO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class MO extends hA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=CO(i),n=null!==(e=t.dpr)&&void 0!==e?e:TO(i,s),r=wI(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=TI(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=MI(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return TO(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function wO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,MO))||(t.bind(MO).toSelf().inSingletonScope(),t.bind(vg).toService(MO))}function EO(t=m_(),e=!0){EO.__loaded||(EO.__loaded=!0,wO(t),NR(t),kO(t),e&&AI(t))}EO.__loaded=!1;class BO{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={}}}function PO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class RO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="wx",this.eventManager=new BO}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new VR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 VR({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return PO(t,"target",o),PO(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function IO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,RO))||t.bind(RO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,RO.env))||t.bind(xf).toService(RO).whenTargetNamed(RO.env)}RO.env="wx";function OO(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function LO(t,e=OO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class DO extends hA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=OO(i),n=null!==(e=t.dpr)&&void 0!==e?e:LO(i,s),r=wI(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=TI(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=MI(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return LO(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function FO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,DO))||(t.bind(DO).toSelf().inSingletonScope(),t.bind(vg).toService(DO))}function zO(t=m_(),e=!0){zO.__loaded||(zO.__loaded=!0,FO(t),WR(t),IO(t),e&&AI(t))}zO.__loaded=!1;var HO={},jO={},NO={};Object.defineProperty(NO,"__esModule",{value:!0}),NO.loop=NO.conditional=NO.parse=void 0;NO.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};NO.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};NO.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var UO={};Object.defineProperty(UO,"__esModule",{value:!0}),UO.readBits=UO.readArray=UO.readUnsigned=UO.readString=UO.peekBytes=UO.readBytes=UO.peekByte=UO.readByte=UO.buildStream=void 0;UO.buildStream=function(t){return{data:t,pos:0}};var VO=function(){return function(t){return t.data[t.pos++]}};UO.readByte=VO;UO.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var WO=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};UO.readBytes=WO;UO.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};UO.readString=function(t){return function(e){return Array.from(WO(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};UO.readUnsigned=function(t){return function(e){var i=WO(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};UO.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=WO(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=tL(t),i=KO(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=tL(this.attribute.gifImage),e=KO(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=oh.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=oh.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function sL(t){return new iL(t)}class nL extends bx{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=iI,this._renderContribitions=void 0,this.builtinContributions=[rL],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=zp(t).image;this._draw(t,n,!1,i)}}const rL=new class extends Jv{constructor(){super(...arguments),this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let aL=!1;function oL(t){aL||(aL=!0,t.bind(nL).toDynamicValue((()=>new nL(SS(Qy,t)))).inSingletonScope(),t.bind(Cy).toService(nL))}function lL(){lf.RegisterGraphicCreator("gif",sL)}function hL(){if(hL.__loaded)return;hL.__loaded=!0;const t=m_();lL(),oL(t),rI(t)}hL.__loaded=!1;const cL=hL,dL=[{register:mb,bindModule:Nb},{register:vb,bindModule:Gb},{register:yb,bindModule:nx},{register:_b,bindModule:lx},{register:bb,bindModule:ux},{register:xb},{register:Sb,bindModule:Ax},{register:Ab,bindModule:Mx},{register:kb,bindModule:Ox},{register:Cb,bindModule:Vx},{register:Tb,bindModule:Kx},{register:Mb,bindModule:Jx},{register:wb,bindModule:iS},{register:Eb,bindModule:oS},{register:Bb},{register:Pb,bindModule:dS},{register:Rb,bindModule:fS},{register:Ib,bindModule:_S},{register:Ob},{register:lL}];let uL=!1;const pL=[hC,yC,AC,qR,RC,UC,ZC,rT,pT,xT,wT,DT,NT,eI,ZT,rM,rI];function gL(t){return{getContributions:t}}function fL(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function mL(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=NA();i(a),s(a),n(a),UA(),fL(e,{envParams:r,force:!0})}function vL(t,e){mL(t,"browser",{bindEnv:gI,bindCanvasModules:AR,bindWindowContribution:hI},e)}function yL(t,e){mL(t,"node",{bindEnv:mO,bindCanvasModules:LR,bindWindowContribution:gO},e)}function _L(t){WA(t),function(){if(uL)return;const t=NA();uL=!0,dL.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),oL(t),UA()}(),YA(t),GA(t)}function bL(t){WA(t);const e=NA();pL.forEach((t=>t(e))),aI(e),XA(t,eA),function(t){const e=NA(),i=gL((()=>t.registry.picker.getAll())),s=gL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=gL((()=>e.isBound(tv)?e.getAll(tv):[])),r=VA();oh.pickerServiceFactory=()=>new GR(i,{},s,n),oh.global=r}(t)}function xL(t){WA(t);AI(NA()),XA(t,AS),function(t){const e=NA(),i=gL((()=>t.registry.picker.getAll())),s=gL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=gL((()=>e.isBound(tv)?e.getAll(tv):[]));oh.pickerServiceFactory=()=>new yI(i,s,n)}(t)}function SL(){if(SL.__loaded)return;SL.__loaded=!0;const t=m_();_b(),lx({bind:t.bind}),bS?qR(t):SI(t)}SL.__loaded=!1;const AL=SL;function kL(){if(kL.__loaded)return;kL.__loaded=!0;const t=m_();Pb(),dS({bind:t.bind}),eI(t)}kL.__loaded=!1;const CL=kL;function TL(){TL.__loaded||(TL.__loaded=!0,Ob())}TL.__loaded=!1;const ML=TL;class wL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class EL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,$_(this.target,i,_o.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BL extends wL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class PL extends EL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class RL extends wL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class IL extends EL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const OL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class LL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){X_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){X_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class DL extends LL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=OL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r),this.determineUpdateFunction()}}class FL extends LL{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class zL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class HL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const jL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class NL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=jL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class UL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const VL=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class WL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(X_(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class GL extends WL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:VL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class YL extends WL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:VL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const XL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class KL extends WL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:XL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class $L extends WL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:XL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const qL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class ZL extends WL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:qL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class JL extends WL{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:qL(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const QL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class tD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class eD extends tD{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=QL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}}class iD extends tD{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const sD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class nD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=sD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oD extends aD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class lD extends aD{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class hD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,$_(this.target,{text:n})}}class cD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class dD extends cD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class uD extends cD{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class pD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&q_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),X_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class gD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class fD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const mD={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function vD(t,e){for(let i=0;imD[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&M_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(X_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class _D{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new w_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function bD(t){return new _D(t)}class xD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;$_(this.target,{text:o})}}class SD extends nb{onBind(){super.onBind();const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(q_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),q_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),q_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),q_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;q_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:xD});const i=s._titleBottom.attribute.text;q_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:xD})}else q_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),q_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;q_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());q_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class AD extends nb{onBind(){super.onBind();const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class kD extends nb{onBind(){super.onBind();const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(q_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:xD}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:xD}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class CD extends nb{onBind(){super.onBind();const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class TD extends rb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==TD.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class MD extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class wD extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==wD.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==wD.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class ED{static createTempCanvas(t,e,i){return b_.createCanvas({width:t,height:e,dpr:i||b_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=ED.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(ED.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(ED.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(ED.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(ED.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(ED.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(ED.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(ED.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class RD extends wD{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class DD extends wD{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=ED.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class FD extends TD{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=b_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=b_.createCanvas({width:i,height:s,dpr:b_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class zD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}$_(this.target,{textConfig:o})}}class HD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class jD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function WD(t,e){X_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class GD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,q_(this.target,m)}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class YD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,q_(this.target,d)}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class XD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,q_(this.target,p)}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class KD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class $D extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}}class qD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:GD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:YD,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class ZD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:GD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:XD,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class JD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class QD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class tF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class eF extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:QD,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:JD,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class iF extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:tF,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:JD,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class sF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),X_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ru(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ru(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class nF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=oh.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Al,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=oh.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Fo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Fo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function dF(t){var e,i;const s=null!==(e=m_().getAll(Cy))&&void 0!==e?e:[],n=hF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;cF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=lF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function uF(t,e){var i,s;const n=null!==(i=m_().getAll(e))&&void 0!==i?i:[],r=hF(t.registry.picker,"vrender:legacy-picker"),a=new Set;cF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=lF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const pF=vL,gF=yL,fF={taro:{installEnv:function(t,e){mL(t,"taro",{bindEnv:xO,bindCanvasModules:zR,bindWindowContribution:_O},e)},loadEnv:SO},feishu:{installEnv:function(t,e){mL(t,"feishu",{bindEnv:RI,bindCanvasModules:TR,bindWindowContribution:vI},e)},loadEnv:II},tt:{installEnv:function(t,e){mL(t,"tt",{bindEnv:wO,bindCanvasModules:NR,bindWindowContribution:kO},e)},loadEnv:EO},wx:{installEnv:function(t,e){mL(t,"wx",{bindEnv:FO,bindCanvasModules:WR,bindWindowContribution:IO},e)},loadEnv:zO},lynx:{installEnv:function(t,e){mL(t,"lynx",{bindEnv:dO,bindCanvasModules:RR,bindWindowContribution:tO},e)},loadEnv:uO},harmony:{installEnv:function(t,e){mL(t,"harmony",{bindEnv:KI,bindCanvasModules:ER,bindWindowContribution:zI},e)},loadEnv:$I}},mF=[nC,eC,S_,k_,uA,gA],vF=[()=>{w_.registerBuiltInAnimate("increaseCount",hD),w_.registerBuiltInAnimate("fromTo",ab),w_.registerBuiltInAnimate("scaleIn",pD),w_.registerBuiltInAnimate("scaleOut",gD),w_.registerBuiltInAnimate("growHeightIn",NL),w_.registerBuiltInAnimate("growHeightOut",UL),w_.registerBuiltInAnimate("growWidthIn",nD),w_.registerBuiltInAnimate("growWidthOut",rD),w_.registerBuiltInAnimate("growCenterIn",zL),w_.registerBuiltInAnimate("growCenterOut",HL),w_.registerBuiltInAnimate("clipIn",BL),w_.registerBuiltInAnimate("clipOut",PL),w_.registerBuiltInAnimate("fadeIn",RL),w_.registerBuiltInAnimate("fadeOut",IL),w_.registerBuiltInAnimate("growPointsIn",GL),w_.registerBuiltInAnimate("growPointsOut",YL),w_.registerBuiltInAnimate("growPointsXIn",KL),w_.registerBuiltInAnimate("growPointsXOut",$L),w_.registerBuiltInAnimate("growPointsYIn",ZL),w_.registerBuiltInAnimate("growPointsYOut",JL),w_.registerBuiltInAnimate("growAngleIn",DL),w_.registerBuiltInAnimate("growAngleOut",FL),w_.registerBuiltInAnimate("growRadiusIn",eD),w_.registerBuiltInAnimate("growRadiusOut",iD),w_.registerBuiltInAnimate("moveIn",oD),w_.registerBuiltInAnimate("moveOut",lD),w_.registerBuiltInAnimate("rotateIn",dD),w_.registerBuiltInAnimate("rotateOut",uD),w_.registerBuiltInAnimate("update",yD),w_.registerBuiltInAnimate("state",fD),w_.registerBuiltInAnimate("labelItemAppear",SD),w_.registerBuiltInAnimate("labelItemDisappear",AD),w_.registerBuiltInAnimate("poptipAppear",kD),w_.registerBuiltInAnimate("poptipDisappear",CD),w_.registerBuiltInAnimate("inputText",xD),w_.registerBuiltInAnimate("inputRichText",zD),w_.registerBuiltInAnimate("outputRichText",HD),w_.registerBuiltInAnimate("slideRichText",ND),w_.registerBuiltInAnimate("slideOutRichText",jD),w_.registerBuiltInAnimate("slideIn",GD),w_.registerBuiltInAnimate("growIn",YD),w_.registerBuiltInAnimate("spinIn",XD),w_.registerBuiltInAnimate("moveScaleIn",qD),w_.registerBuiltInAnimate("moveRotateIn",ZD),w_.registerBuiltInAnimate("strokeIn",KD),w_.registerBuiltInAnimate("slideOut",JD),w_.registerBuiltInAnimate("growOut",QD),w_.registerBuiltInAnimate("spinOut",tF),w_.registerBuiltInAnimate("moveScaleOut",eF),w_.registerBuiltInAnimate("moveRotateOut",iF),w_.registerBuiltInAnimate("strokeOut",$D),w_.registerBuiltInAnimate("pulse",sF),w_.registerBuiltInAnimate("MotionPath",UD),w_.registerBuiltInAnimate("streamLight",nF),w_.registerBuiltInAnimate("dissolve",PD),w_.registerBuiltInAnimate("grayscale",LD),w_.registerBuiltInAnimate("distortion",RD),w_.registerBuiltInAnimate("particle",DD),w_.registerBuiltInAnimate("glitch",OD),w_.registerBuiltInAnimate("gaussianBlur",ID),w_.registerBuiltInAnimate("pixelation",FD)},fb],yF=[gC,bC,wC,AL,FC,cL,HC,XC,iT,cT,yT,AT,IT,zT,YT,KT,iM,cM,ML,CL];function _F(){mF.forEach((t=>t())),vF.forEach((t=>t()))}function bF(t,e){if(!oF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==b_?void 0:b_.env)?b_.envParams:void 0}(e);return void 0===i?yL(t):gF(t,i),_L(t),xL(t),vO(),yF.forEach((t=>t())),dF(t),uF(t,AS),_F(),t}function xF(t,e,i){if(!oF(t,e))return t;const s=fF[e];return s.installEnv(t,i),_L(t),function(t){xL(t)}(t),s.loadEnv(),yF.forEach((t=>t())),dF(t),uF(t,AS),_F(),t}const SF=Symbol.for("visactor.vrender.sharedAppRegistry");function AF(){var t;const e=globalThis,i=null!==(t=e[SF])&&void 0!==t?t:new Map;return e[SF]=i,i}function kF(t,e){const i=AF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function CF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=AF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function TF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=kF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(CF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>CF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=kF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&CF(t,i,s))}}}(t,s,r,o)}const MF=$A,wF=[];function EF(t){wF.forEach((({module:e,options:i})=>{MF(e,Object.assign(Object.assign({},i),{app:t}))}))}var BF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),dF(t),uF(t,eA),_F(),t):t}(bA(BF(t,["envParams"])),e);return EF(i),i}var RF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},HF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},jF=(t,e)=>{const i=zF(t),s=HF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},NF=(t,e)=>{const i=TF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,FF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},UF="poptipForText";class VF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(UF))&&this._dedupeStagePlugin(UF)}initView(){var e,i,s,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:u,autoPreventDefault:f,background:m}=this._option,v=jF(l,h);b_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=zF(i.mode),n=jF(i.mode,i.modeParams);return NF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=t.releaseAppRef,null===(e=this._option.runtimePluginInstallers)||void 0===e||e.forEach((e=>e(t.app)));try{this._stage=(_=t.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:p(a)?a:!p(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=tg({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(p(c)?c:bM(l))&&!1!==d&&bB.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,g(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=cR.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!_M(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:b_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>gR(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>gR(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{gR(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===cR.before;(e||i)&&(pM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=cR.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=cR.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),pM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=fR(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=mR(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=mR(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=uR(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=uR(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:vR,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{gR(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===lR.appear))?lR.appear:e.every((t=>t===lR.disappear))?lR.disappear:lR.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===VP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=LP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=LP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:FP(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===VP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===VP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===VP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===VP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===VP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{gR(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=fR(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return _M(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{b_.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{gR(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function WF(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:fM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const GF={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}},YF={poptip:H({},GF)};function XF(t){t.crosshair=Y(t.crosshair||{}).map((e=>fB({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function KF(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}=li(l,i.width,i.height);a=t,o=e}else if(h&&_M(e.mode)){let t;t=y(h)?b_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(xM(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}}const $F=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function qF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function ZF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function JF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;$F.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function QF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var tz,ez,iz,sz,nz,rz;t.LayoutZIndex=void 0,(tz=t.LayoutZIndex||(t.LayoutZIndex={}))[tz.SeriesGroup=0]="SeriesGroup",tz[tz.Axis_Grid=50]="Axis_Grid",tz[tz.CrossHair_Grid=100]="CrossHair_Grid",tz[tz.Region=450]="Region",tz[tz.Mark=300]="Mark",tz[tz.Node=400]="Node",tz[tz.Axis=100]="Axis",tz[tz.MarkLine=500]="MarkLine",tz[tz.MarkArea=100]="MarkArea",tz[tz.MarkPoint=500]="MarkPoint",tz[tz.DataZoom=500]="DataZoom",tz[tz.ScrollBar=500]="ScrollBar",tz[tz.Player=500]="Player",tz[tz.Legend=500]="Legend",tz[tz.CrossHair=500]="CrossHair",tz[tz.Indicator=500]="Indicator",tz[tz.Title=500]="Title",tz[tz.Label=500]="Label",tz[tz.Brush=500]="Brush",tz[tz.CustomMark=500]="CustomMark",tz[tz.Interaction=700]="Interaction",t.LayoutLevel=void 0,(ez=t.LayoutLevel||(t.LayoutLevel={}))[ez.Indicator=10]="Indicator",ez[ez.Region=20]="Region",ez[ez.Axis=30]="Axis",ez[ez.DataZoom=40]="DataZoom",ez[ez.Player=40]="Player",ez[ez.ScrollBar=40]="ScrollBar",ez[ez.Legend=50]="Legend",ez[ez.Title=70]="Title",ez[ez.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(iz=t.AttributeLevel||(t.AttributeLevel={}))[iz.Default=0]="Default",iz[iz.Theme=1]="Theme",iz[iz.Chart=2]="Chart",iz[iz.Base_Series=3]="Base_Series",iz[iz.Series=4]="Series",iz[iz.Mark=5]="Mark",iz[iz.User_Chart=6]="User_Chart",iz[iz.User_Series=7]="User_Series",iz[iz.User_Mark=8]="User_Mark",iz[iz.User_SeriesStyle=9]="User_SeriesStyle",iz[iz.Built_In=99]="Built_In";class az{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,H({},az.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]))))}}az.defaultMarkInfo={};class oz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class lz{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=>fB({},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 hz extends oz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=lz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new az,this._lastLayoutRect=null,this.id=AM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new HP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${WB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=bB.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class cz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=tB(iB(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QE(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QE(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QE(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QE(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QE(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QE(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QE(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QE(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QE(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(eB(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class dz extends hz{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new cz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(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 uz extends lz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class pz extends dz{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=uz,this.modelType="region",this.specKey="region",this.type=pz.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function gz(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 fz(t,e,i){e?t.forEach((t=>{const e=X(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=X(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 mz(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 vz(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=xz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),mz(d,!0,p,l),s&&fz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function yz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=xz(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=xz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),mz(d,!1,p,o),s&&fz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function bz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=xz(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=xz(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=gz(t);n.length&&vz(n,e,i,!1,"left",s),r.length&&vz(r,e,i,!0,"left",s),a.length&&yz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=gz(t);n.length&&_z(n,e,i,!1,"top",s),r.length&&_z(r,e,i,!0,"top",s),a.length&&bz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=gz(t);n.length&&vz(n,e,i,!1,"right",s),r.length&&vz(r,e,i,!0,"right",s),a.length&&yz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=gz(t);n.length&&_z(n,e,i,!1,"bottom",s),r.length&&_z(r,e,i,!0,"bottom",s),a.length&&bz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=xz(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=xz(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:fM)("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}}}Sz.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(sz||(sz={})),t.STATE_VALUE_ENUM=void 0,(nz=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",nz.STATE_HOVER="hover",nz.STATE_HOVER_REVERSE="hover_reverse",nz.STATE_DIMENSION_HOVER="dimension_hover",nz.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",nz.STATE_SELECTED="selected",nz.STATE_SELECTED_REVERSE="selected_reverse",nz.STATE_SANKEY_EMPHASIS="selected",nz.STATE_SANKEY_EMPHASIS_REVERSE="blur",nz.STATE_HIGHLIGHT="highlight",nz.STATE_BLUR="blur",nz.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(rz||(rz={}));const Az=["linear","radial","conical"],kz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Cz={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{Cz[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class Tz extends oz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class Mz extends Tz{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,dR.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Cz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(WB)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(WB))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Iw(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class wz extends oz{constructor(){super(...arguments),this.id=AM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=bB.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Ez extends wz{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Bz=1e3,Pz="quadInOut",Rz=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Iz=(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=Ru(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Oz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ak(t):[],n=ak(e);i&&s&&(i.fromTransform&&ok(s,i.fromTransform.clone().getInverse()),ok(s,i.toTransfrom));const[r,a]=rk(s,n);return t?nk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Dz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Fz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Dz.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Eu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class zz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Oz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Iz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):$_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Hz=(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=Lz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Fz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new zz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Bz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Pz);return c.play(d),c};class jz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Oz(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&&Iz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Nz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Rz.includes(t))(i)||(e[i]=t[i])})),e},Uz=(t,e,i)=>{const s=Nz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=oh.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Vz=(t,e,i)=>{const s=[],n=i?null:Nz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Nz(t.attribute);if("rect"===t.type)ck(t,e).forEach((t=>{s.push(oh.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)dk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)uk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=fk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(oh.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?bk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?gk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&xk(t,e).forEach((t=>{"path"in t?s.push(oh.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Uz(t,s,e),s},Gz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Yz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Gz(l.delay,n,a,o),d=Gz(l.duration,n,a,o),u=Gz(l.oneByOne,n,a,o),p=Gz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Vz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Wz)(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);Hz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Vz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Wz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Lz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Fz(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:_o.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new zz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Bz,null!==(l=i.easing)&&void 0!==l?l:Pz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:_o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Bz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Pz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Hz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},Xz=(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))))},Kz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},$z=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},qz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];$z(t,a,s)},Zz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));$z(t,r,i)},Jz=Symbol("statesClearedBeforeReInit");class Qz extends wz{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Ez(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=tg("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Al)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===sz.enter||t.context.diffState===sz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&$z(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new Mz(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&fB(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Ow(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=YE(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):Az.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Ow(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},kz[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)Az.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return uR(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return bB.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[$B],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=uR(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===lR.appear))?lR.appear:t.every((t=>t===lR.disappear))?lR.disappear:t[0];return null!=e?e:lR.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{Kz(t),s.push(...t.getGraphics())})),e.forEach((t=>{Kz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Yz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=Xz(e,n),r=Xz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===lR.exit?lR.exit:i===lR.update?lR.update:lR.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===sz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===sz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=sz.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=sz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=sz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=lR.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=lR.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return pR(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=pR(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!Az.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!Ow(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,zP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=bB.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=bB.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===cR.before||(this._product||this._initProduct(),pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[Jz],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?qz(i,t,!0,a):Zz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[Jz]=e:delete s[Jz]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===sz.exit&&!e.isExiting)if(e.context.animationState===sz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===sz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:sz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=tg({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[Jz]=t.currentStates.slice())}))}}var tH;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(tH||(tH={}));class eH extends Qz{constructor(){super(...arguments),this.type=eH.type,this._marks=[],this._diffState=sz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(gM("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?(gM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return gR(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===sz.update){const t=this.hasAnimation(),e=zP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=sz.update}render(){this._isCommited&&(pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}eH.type="group";const iH={measureText:VB};class sH{static instance(){return sH.instance_||(sH.instance_=new sH),sH.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 nH{constructor(){this.id=AM(),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))?gM("不要重复添加相同的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 rH extends nH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const aH=(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"},oH=(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 lH extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=Za.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Za.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||aH(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=oH(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=Za.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=oH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=aH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Za.now()-i>this.config.press.time&&oH(s[0],t){oh.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class cH extends hH{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 C=oh.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 T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class dH extends hH{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=oh.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 uH extends sb{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&M_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(X_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));$_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const pH={type:"fadeIn"};function gH(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 pH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const fH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},mH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},vH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},yH=()=>{bB.registerAnimation("scaleInOut",(()=>mH))},_H=()=>{bB.registerAnimation("fadeInOut",(()=>vH))},bH=(t,e)=>({appear:gH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:uH,duration:fH.update.duration,easing:fH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),xH=()=>{bB.registerAnimation("line",bH)},SH=()=>{w_.registerBuiltInAnimate("growPointsIn",GL),w_.registerBuiltInAnimate("growPointsOut",YL),w_.registerBuiltInAnimate("growPointsXIn",KL),w_.registerBuiltInAnimate("growPointsXOut",$L),w_.registerBuiltInAnimate("growPointsYIn",ZL),w_.registerBuiltInAnimate("growPointsYOut",JL),w_.registerBuiltInAnimate("clipIn",BL),w_.registerBuiltInAnimate("clipOut",PL)},AH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class kH{constructor(t){this._markSet=new az,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const CH={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class TH extends kH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},CH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Zz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}TH.type="element-highlight",TH.defaultOptions=CH;const MH=()=>{bB.registerInteractionTrigger(TH.type,TH)},wH={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class EH extends kH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},wH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),qz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Zz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}EH.type="element-select",EH.defaultOptions=wH;const BH=()=>{bB.registerInteractionTrigger(EH.type,EH)};class PH extends nH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const RH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},IH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...IH(t))})),s},OH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(RH(t,r),!1)};class LH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>bB.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>bB.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>bB.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return bB.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>bB.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){bB.registerTransform(t,e)}static registerFunction(t,e){t&&e&&sH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&sH.instance().unregisterFunction(t)}static getFunction(t){return t?sH.instance().getFunction(t):null}static getFunctionList(){return sH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=bB.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=bB.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,ZP.get(e);var e}static registerSVG(t,e,i){const s=bB.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=bB.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){LB.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=AM(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=yR.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=JF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?bB.getSeriesBuiltInTheme(e):bB.getComponentBuiltInTheme(e);i=i?fB({},s,i[e]):s}s===t.length-1&&p(i)&&(i=HB({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},Bw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=_M(v);if(S?fI(iA):"node"===v&&vO(iA),S&&f&&(this._container=y(f)?b_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=DB.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=bB.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===i.type&&A.push("scrollbar");const C=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new VF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new KP(this,this._compiler),this._event=new HP(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),LB.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=fB({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=jB(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;LH.getFunctionList()&&LH.getFunctionList().length&&(t=NB(t,LH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=bB.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=bB.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=bB.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return KF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:GB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:YB})}_initDataSet(t){this._dataSet=t instanceof Fa?t:new Fa,qP(this._dataSet,"dataview",Oa),qP(this._dataSet,"array",s),$P(this._dataSet,"copyDataView",sR);for(const t in bB.transforms)$P(this._dataSet,t,bB.transforms[t]);for(const t in bB.dataParser)qP(this._dataSet,t,bB.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),qF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?lR.none:lR.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,LB.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{RH(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof za?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=rR(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?fB({},t[n][e.index],i):i):t[n]=s?fB({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?fB({},t[n][r],i):i)}else t.id===e&&(t[n]=s?fB({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=fB({},t.getSpec(),e));const r=t.updateSpec(e),a=qF(r),o=ZF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=xB({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=FB(this._currentThemeName),this._currentTheme=o(a,l);else{const t=xB({},FB(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),FB(n),FB(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(YF.poptip,GF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!_M(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return FB(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!DB.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield WF(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(!_M(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(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}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)?b_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?sB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 gM("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?sB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(gM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return sH.instance().getFunction(t)}registerFunction(t,e){t&&e&&sH.instance().registerFunction(t,e)}unregisterFunction(t){t&&sH.instance().unregisterFunction(t)}getFunctionList(){return sH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=bB.getChartPlugins();t.length>0&&(this._chartPlugin=new rH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=bB.getVChartPlugins();e.length>0&&(this._vChartPlugin=new PH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=yR.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=yR.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}LH.InstanceManager=LB,LH.ThemeManager=DB,LH.globalConfig={uniqueTooltip:!0},LH.Utils=iH,LH.vglobal=b_;bB.registerRegion("region",pz),bB.registerLayout("base",Sz),KT(),HC(),bB.registerMark(eH.type,eH),bB.registerStageEventPlugin("gesture",lH),MH(),BH(),BB(cB.name,cB);const DH="monotone",FH="linear",zH="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class HH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function jH(t,e){return e("component",t)}function NH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=bB.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const UH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},VH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},WH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},GH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=NH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},YH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const XH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function KH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=qH(GH(h,r,a,c),d,g),o.value=qH(GH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=GH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function $H(t,e,i,s,n,r,a){if(d(e)){KH(t,e(n,a),i,s,r,a)}else e&&KH(t,e,i,s,r,a)}const qH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class ZH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{$H(a,t,e,i,s,n,r)})):d(t)?$H(a,t,e,i,s,n,r):t&&KH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:GH(r.visible,t,n),value:qH(GH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:GH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=GH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&XH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const JH={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},QH=(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=vP([],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 tj(a,n,o)},tj=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{kM(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=>{kM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=JH[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},ej=(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=>{kM(t[e])||(t[e]=0)}))})),t},ij=`${WB}_HIERARCHY_DEPTH`,sj=`${WB}_HIERARCHY_ROOT`,nj=`${WB}_HIERARCHY_ROOT_INDEX`;function rj(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function aj(t,e,i){t&&(i.needDefaultSeriesField&&(t[qB]=i.defaultSeriesField),t[KB]=e,t[$B]=i.getKey(t,e,i))}function oj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function lj(t,e,i,s=0,n,r){void 0===r&&(r=e),aj(t,e,i),t[ij]=s,t[sj]=n||t[i.categoryField],t[nj]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>lj(e,s,i,t[ij]+1,t[sj],r)))}const hj={label:{name:"label",type:"text"}},cj=`${WB}_rect_x`,dj=`${WB}_rect_x1`,uj=`${WB}_rect_y`,pj=`${WB}_rect_y1`,gj={data:!0},fj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},mj=[...Object.keys(fH),"normal"];function vj(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 Sj(n)&&delete n.type,n.oneByOne&&(n=_j(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=fB({},o[e],a);return Sj(n)&&delete n.type,n.oneByOne&&(n=_j(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function yj(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),Aj(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function _j(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function bj(t,e){var i;return null!==(i=null==t?void 0:t[KB])&&void 0!==i?i:e.context.graphicIndex}function xj(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 Sj(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function Aj(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),Aj(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),Aj(t[s],e,i))}function kj(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Cj extends lz{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=IE(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=bB.getSeriesMarkMap(o)?function(t,e,i){const s=bB.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=fB({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return fB({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=fB({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>fB({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Tj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(fj[e]||(t[e]=!0),t)),{}),Mj={compileOnlyKeys:fj,dataRelatedKeys:Tj,seriesOnlyKeys:{tooltip:!0}},wj={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Ej=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,Bj=(t,e,i)=>{const s=Ej(t),n=Ej(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function Pj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class Rj extends hz{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${WB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Cj,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=kj(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&($P(this._rawData.dataSet,"invalidTravel",ej),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=rR(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=nR(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=nR(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Ez(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=tj(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){$P(this._dataSet,"dimensionStatistics",QH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new za(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&&vP(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){$P(this._dataSet,"dimensionStatistics",QH);const s=new za(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=vP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&vP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new za(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)&&($P(this._rawData.dataSet,"addVChartProperty",WH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:rj.bind(this),call:aj}},!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,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=vj({},yj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:bM(s)||xM(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=fB(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=fB(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=AH(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=AH(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=AH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:qB;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:ZB,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,ZB,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(bB.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new ZH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,Pj(i))}_getSpecUpdatePolicy(){return Mj}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},gj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Bj(t[i],e[i],wj)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Bj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?Pj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&Pj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof za||aR(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();kj(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:qB,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WE).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DE(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:qB}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,fB({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:$B}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==tP&&t!==iP&&t!==QB&&t!==eP||(t=this.getStackValueField()),null!==(e=_P(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>kM(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:qB]}}function Ij(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Iw(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 Oj(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}}}Rj.mark=hj,Rj.transformerConstructor=Cj;class Lj extends Rj{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);Iw(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:`${WB}_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(tP),this.setFieldX2(QB)):(this.setFieldY(tP),this.setFieldY2(QB))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(iP),this.setFieldX2(eP)):(this.setFieldY(iP),this.setFieldY2(eP))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(nP),this.setFieldX2(sP)):(this.setFieldY(nP),this.setFieldY2(sP))}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)&&(Ij("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Dj(t){return"bottom"===t||"top"===t}function Fj(t){return"left"===t||"right"===t}function zj(t){return"z"===t}function Hj(t,e){return qE(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function jj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Nj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Dj(t)?"linear":"band":Dj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Uj=(t,e,i)=>{var s;const n=null!==(s="band"===e?jH("axisBand",i):["linear","log","symlog"].includes(e)?jH("axisLinear",i):{})&&void 0!==s?s:{},r=Dj(t)?jH("axisX",i):Fj(t)?jH("axisY",i):jH("axisZ",i);return fB({},jH("axis",i),n,r)};class Vj{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:fM)("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:fM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Lw(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Dj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Wj extends Vj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Gj=(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))},Yj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},Xj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Lw(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:Kj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,$j=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class qj extends Vj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Gj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:VP.canvas}),callback:this.onMouseOut}),bM(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),bM(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Zj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Zj||(Zj={}));const Jj={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},Qj={sampling:!0,samplingFactor:!0};class tN{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(Jj.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:zH,curveType:FH,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===DH?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(Jj.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:xj(this._spec,Jj.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new za(this._option.dataSet,{name:`${WB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Zj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[Jj.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(Zj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,fB({},this._spec[Jj.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const eN=Object.assign(Object.assign({},hj),Jj),iN=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>iN(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},sN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class nN extends Qz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return sN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(Ow(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?iN(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:sz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[$B]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const rN=new Uint32Array(33),aN=new Uint32Array(33);aN[0]=0,rN[0]=~aN[0];for(let t=1;t<=32;++t)aN[t]=aN[t-1]<<1|1,rN[t]=~aN[t];function oN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&rN[31&o]&aN[1+(31&l)])return!0}else{if(i[h]&rN[31&o])return!0;if(i[c]&aN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,rN[31&o]&aN[1+(31&l)]);else for(s(h,rN[31&o]),s(c,aN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,aN[31&a]|rN[1+(31&o)]);else for(n(l,aN[31&a]),n(h,rN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function lN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function hN(t,e,i=!1){return i?lN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function cN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=hN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=lN(t,r)),e.getRange(r)))}function dN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return dN(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return dN(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 dN(t,e,n,s,h,c)}return!1}const pN=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],gN=["top","inside-top","inside"];function fN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const mN={mode:"same-time",duration:300,easing:"linear"};function vN(t){return 3===t||4===t}function yN(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 _N=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 bN(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)}}class xN extends nb{onBind(){const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class SN extends nb{onBind(){const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const AN=(t,e)=>Math.ceil(t)>Math.floor(e),kN=([t,e],[i,s])=>s>t&&e>i;function CN(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const TN=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class MN extends Qp{constructor(t,e){super(t),this._skipRenderAttributes=TN,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{BN(t,e,i)})),e}function PN(t,e){e&&(null==t||t.onComplete.push(e))}function RN(t){t.forEach((t=>{t()}))}function IN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var ON=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(GM.hover,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(TM(this,(t=>{P(t.states)||(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void TM(this,(t=>{P(t.states)||(t.removeState(GM.selectedReverse),t.removeState(GM.selected))}));P(e.states)||(e.addState(GM.selected,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[bN(g,f,c,d,a,o),bN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=NM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Al)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),RN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,PN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(mN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=BN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=BN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},IN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}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):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return QM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&AN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&AN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(CN([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!kN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(hN(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(hN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(hN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;EN(i,null==n?void 0:n.attribute),EN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{DN[t]=e};var zN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};HN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const jN=()=>{FN("line",HN),FN("area",HN)};var NN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}UN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const VN=()=>{FN("symbol",UN),FN("line-data",UN)};class WN extends nN{constructor(){super(...arguments),this.type=WN.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)===PE.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}WN.type="line";const GN=()=>{bB.registerMark(WN.type,WN),KT(),iT(),jN(),VN(),SH(),bB.registerGraphicComponent("line",ag)};class YN extends Qz{constructor(){super(...arguments),this.type=YN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}YN.type="symbol";const XN=()=>{bB.registerMark(YN.type,YN),KT(),iM(),VN(),bB.registerGraphicComponent("symbol",Gg)};class KN extends Cj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function $N(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function qN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function ZN(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 JN(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 QN(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 tU(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 eU=t=>t.map(((t,e)=>({index:e,value:t}))),iU=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},sU=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=$M(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return eU(v)};class aU{constructor(t){this.id=AM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class oU extends aU{constructor(){super(oU.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Iw(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&$N(c)&&$N(d)))return;const u=qN(t,c),p=qN(e,d);if(!0===u.break&&!0===p.break)return;const{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(!JN(u,p))return}else if(0===_&&0===b){if(!JN(p,u))return}else if(y||A)if(y&&!A){if(!ZN(u,p))return}else if(A&&!y){if(!ZN(p,u))return}else{if(f===b)return;if(f>b){if(!QN(u,p))return}else if(!QN(p,u))return}else{if(0===f&&0===_){if(!tU(u,p))return}else if(0===b&&0===g&&!tU(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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){$P(e.getOption().dataSet,"tickAlign",rU);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}oU.pluginType="component",oU.type="AxisSyncPlugin";const lU={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function hU(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 cU(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 dU(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const uU=t=>"band"===t||"ordinal"===t||"point"===t;function pU(t,e){return{id:t,label:t,value:e,rawValue:t}}function gU(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class fU extends nH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const mU=`${WB}_ARC_TRANSFORM_VALUE`,vU=`${WB}_ARC_RATIO`,yU=`${WB}_ARC_START_ANGLE`,_U=`${WB}_ARC_END_ANGLE`,bU=`${WB}_ARC_K`,xU=`${WB}_ARC_MIDDLE_ANGLE`,SU=`${WB}_ARC_QUADRANT`,AU=`${WB}_ARC_RADIAN`,kU=-Math.PI/2,CU=3*Math.PI/2,TU=.6,MU=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},wU=(t,e,i)=>{var s;const n=null!==(s="band"===e?jH("axisBand",i):"linear"===e?jH("axisLinear",i):{})&&void 0!==s?s:{},r=jH("angle"===t?"axisAngle":"axisRadius",i);return fB({},jH("axis",i),n,r)};function EU(t,e,i,s){switch(t){case r.cartesianBandAxis:return Uj(Hj(i,["z"]),"band",e);case r.cartesianLinearAxis:return Uj(Hj(i,["z"]),"linear",e);case r.cartesianLogAxis:return Uj(Hj(i,["z"]),"log",e);case r.cartesianSymlogAxis:return Uj(Hj(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return Uj(Hj(i),void 0,e);case r.polarBandAxis:return wU(i.orient,"band",e);case r.polarLinearAxis:return wU(i.orient,"linear",e);case r.polarAxis:return wU(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=jH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>Dj(t.orient)));let g;g=p(u)?fB({},uU(u.type)?a:o,l):l;const f=n.find((t=>Fj(t.orient)));let m;return m=p(f)?fB({},Lw(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=jH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?fB({},uU(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?fB({},Lw(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return BU(i,jH(t,e));default:return jH(t,e)}}const BU=(t,e)=>{var i;const s=fB({},e,e[jj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class PU extends lz{getTheme(t,e){return EU(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({},iB(e)),{[s]:0}))}}class RU extends dz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=PU,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof qa||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:VP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new fU(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;RH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=IH(t),s=OH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}RH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var IU,OU;RU.transformerConstructor=PU,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IU||(IU={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(OU||(OU={}));class LU extends Qz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=OH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?RH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(RH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=bB.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(jP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}LU.type="component";const DU=()=>{bB.registerMark(LU.type,LU)};var FU,zU;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(FU||(FU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(zU||(zU={}));const HU={[zU.selectedReverse]:{},[zU.selected]:{},[zU.hover]:{},[zU.hoverReverse]:{}},jU=t=>t,NU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class UU extends RU{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?IU.circleAxis:IU.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?OU.circleAxisGrid:OU.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=vj(null===(h=bB.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Ez(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&Tw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Iw(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Iw(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return Tw(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=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=Mw(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()})),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(Tw(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||NU[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=PP(s=t.domainLine)).startSymbol=PP(s.startSymbol),s.endSymbol=PP(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(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 OP(fB({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:OP(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>OP(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=OP(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return OP(fB({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:OP(t.tick.style)),t.tick.state&&(i.tick.state=RP(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 OP(fB({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:OP(t.subTick.style)),t.subTick.state&&(i.subTick.state=RP(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=lU[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:fB({},d,OP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:OP(h.style)}),h.state&&(i.title.state.shape=RP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:OP(o.style)}),o.state&&(i.title.state.background=RP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=RP(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=OP(t.background.style)),t.background.state&&(i.panel.state=RP(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:UB(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 OP(fB({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:OP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:UB(t.subGrid.alternateColor),style:OP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=NH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){qP(this._option.dataSet,"scale",jU);const i=this.registerTicksTransform();return new za(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===FU.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}UU.specKey="axes";const VU=()=>{DU(),bB.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},WU=[oU];class GU extends UU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{const e=this.getOrient();Dj(e)?gU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Fj(e)?gU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):zj(e)&&gU(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=fB({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(fB({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Dj(this.getOrient()),n=t=>{var e;return(s?!Dj(t.getOrient()):Dj(t.getOrient()))&&Iw(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&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Hj(i,["z"]),zj(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(!dU(e))return null;const{axisType:t,componentName:s}=Nj(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=>Fj(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(!dU(t))return;const{axisType:s,componentName:n}=Nj(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=bB.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Dj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):zj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(WU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Dj(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&&!Dj(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!zj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Fj(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Dj(this.getOrient())?t.fieldX:zj(this.getOrient())?t.fieldZ:t.fieldY,Iw(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Iw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(jP.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(Dj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Dj(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return Tw(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]:Dj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:zj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();Tw(this._regions,(e=>{Dj(t)?gU(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Fj(t)?gU(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):zj(t)&&gU(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Dj(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=Dj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=fB(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Dj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return pU(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Iw(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}GU.type=r.cartesianAxis,GU.specKey="axes";class YU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Ez(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=pU(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=>pU(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const XU=(t,e,i,s)=>{const n=nU(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},KU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,$U=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?eU([s[s.length-1]]):eU([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=XU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=ZU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=XU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!KU(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?$U(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function QU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=JU(e,t,!1,!!n),o=JU(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class tV extends MN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${FU.grid}-sub`:`${FU.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=JU(t,o,!1,!!a)}const u=NM.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:tV.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=gw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=NM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:tV.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}tV.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class eV{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=zM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return FM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class iV extends nb{onBind(){var t;const e=bD(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;EN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class sV extends nb{onBind(){const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;EN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function nV(){HC(),iT(),YT(),cM(),w_.registerBuiltInAnimate("axisEnter",iV),w_.registerBuiltInAnimate("axisUpdate",sV)}HC(),cT();class rV extends tV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},tV.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=UM,endAngle:r=VM}=this.attribute;i=pw(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function aV(){HC(),iT(),yT(),iM()}function oV(){HC(),iT(),gC(),iM()}G(rV,eV),aV();class lV extends MN{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},lV.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=NM.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=NM.line;Y(i)[0].cornerRadius&&(t=NM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=NM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}lV.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}}},oV();class hV extends lV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},lV.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=NM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function cV(){HC(),IT(),iM(),YT(),cM()}var dV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,I.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===I.type?I.setAttributes({x:t,textAlign:e,textConfig:Y(I.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):I.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=O+E,i=1===j?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(V(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(I.states=m.text);const{visible:W}=a,G=dV(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Al)}this._bgRect=t}this._textShape=I,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},uV.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}uV.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const pV=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(GM.hover,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.hoverReverse,!0)})),s):i},gV=(t,e,i)=>i?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),null):i,fV=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(GM.selected)?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.selectedReverse),t.removeState(GM.selected))})),null):s.name&&!P(s.states)?(s.addState(GM.selected,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.selectedReverse,!0)})),s):i},mV={type:"default",duration:300,easing:"linear"};class vV extends wN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=pV(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=gV(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=fV(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=NM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),RN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,PN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(TM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=BN(this),{delay:a=0,duration:o=mV.duration,easing:l=mV.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};EN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=BN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},IN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(mV)}_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=NM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=FU.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=NM.group({x:0,y:0,pickable:!1});t.name=FU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=NM.group({x:0,y:0,pickable:!1});i.name=FU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=NM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=FU.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=YM;else{const t=this.data[s],e=H({},YM,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=NM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=FU.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=YM;else{const i=H({},YM,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=NM.group({x:0,y:0,pickable:!1});return r.name=`${FU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=QM(this._getLabelAttribute(t,e,n,i));if(a.name=FU.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=YM;else{const s=H({},YM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new uV(Object.assign({},e));i.name=FU.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/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 f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},nw.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},TM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=ZA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},EN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const yV={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&&fw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function _V(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function bV(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:yV[n]||yV.parity;if(s.length>=3&&mw(s,r)){do{s=a(s,r)}while(s.length>=3&&mw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);fw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),bV(l,s,n,(t=>fw(t,l,r))),bV(h,s,o,(t=>fw(t,h,r)||!(!n||t===l)&&fw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function SV(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},CV(t,e.attribute.angle)),{angle:kV(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({},TV(t,e.attribute.angle)),{angle:kV(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function kV(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function CV(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=kV(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 TV(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=kV(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 MV(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=hw(h),m=lw(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function wV(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var EV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=NM.group({zIndex:999});e.name=FU.axisBreak,e.id=this._getNodeId(`${FU.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},rw,s),a=null!==(e=r.size)&&void 0!==e?e:rw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=NM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=FU.axisBreakSymbol;const h=NM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=FU.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=NM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=FU.background,n.id=this._getNodeId("background"),n.states=H({},HU,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new uV(Object.assign({},t));e.name=FU.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=EV(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},HU,l),symbol:H({},HU,l)});const d=new lV(c);d.name=FU.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=EV(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=HM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},HU,c.text),shape:H({},HU,c.shape),panel:H({},HU,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=EV(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=HM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return CV(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return TV(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=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),AV(i,t),!SV(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=hw(a),l=lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=wV(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=wV(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);MV(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&xV(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(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=NM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=FU.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=qM(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=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}BV.defaultAttributes=nw,G(BV,eV);const PV={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},RV={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}}},IV={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}}},OV={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}}};class LV extends GU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new iE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,qU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Xw(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{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),VU(),bB.registerComponent(LV.type,LV,!1)},FV=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function zV(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,jV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function NV(t,e,i="count"){const s=jV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const UV=Math.sqrt(50),VV=Math.sqrt(10),WV=Math.sqrt(2);class GV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=cU(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=Dj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(HV),e.sort(HV),{domain:zV(t,e),scope:NV(t,e,i)}}(r,dM(t),this._spec.breaks[0].scopeType);e=dM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=cU(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=UV?10:n>=VV?5:n>=WV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}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=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function YV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function XV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Iw(t.type))return eU(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return eU([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=YV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=YV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=YV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=nU(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=nU(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?$V.greedy:$V.parity;for(;l.length>=3&&mw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;fw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),XV(t,l,a,(e=>fw(e,t,i))),XV(n,l,o,(e=>fw(e,n,i)||!(!a||e===t)&&fw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return eU(m)},$V={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&fw(i,t,e)||(i=t,0))))}},qV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class ZV extends GU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!zj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Dj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=ZE(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=dM(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,KV),t}}ZV.type=r.cartesianLinearAxis,ZV.specKey="axes",ZV.builtInTheme={axis:RV,axisLinear:qV,axisX:IV,axisY:OV},G(ZV,GV);const JV=()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),VU(),bB.registerComponent(ZV.type,ZV)},QV=`${WB}_hide_`;function tW(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const eW=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[QV]&&(tW(t,!0),t[QV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[QV]=!0,tW(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},iW=()=>{bB.registerGrammarTransform("symbolOverlap",{transform:eW,runType:"afterEncode"})},sW={min:$,max:K,average:xw,sum:bw};function nW(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function rW(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 aW(t,e,i,s){return rW(t,e,i,"min",s)}function oW(t,e,i,s){return rW(t,e,i,"max",s)}function lW(t,e,i,s){return rW(t,e,i,"average",s)}function hW(t,e,i,s){return rW(t,e,i,"sum",s)}const cW=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=nW;if("min"===n?l=aW:"max"===n?l=oW:"average"===n?l=lW:"sum"===n&&(l=hW),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[]},dW=()=>{bB.registerGrammarTransform("dataSampling",{transform:cW})};class uW extends Lj{constructor(){super(...arguments),this.type=PE.line,this.transformerConstructor=KN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Qj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),yj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Oj(this);this._symbolMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),yj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}uW.type=PE.line,uW.mark=eN,uW.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},uW.transformerConstructor=KN,G(uW,tN);class pW{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{aR(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof za)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];gM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];gM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class gW{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)=>{CM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{vP(e,[{key:t,operations:Iw(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&&vP(e,[{key:i.field,operations:Iw(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?YE("colorOrdinal"):YE(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(CM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),CM(s.domain)?e.reRender=!0:V(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(!CM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Iw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Iw(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;Iw(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(Iw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Iw(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Iw(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 fW{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);qz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Zz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Zz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);qz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&qz(t,i,!0,l):a&&qz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&qz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Zz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Zz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const mW={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},vW={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class yW extends oz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=AM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:GB,height:YB},this._viewRect={width:GB,height:YB},this._viewBox={x1:0,y1:0,x2:GB,y2:YB},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._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(vW).some((t=>!u(e[t])))},this._paddingSpec=iB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new HP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new pW(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new fW;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=bB.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(vj({},yj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=bB.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=bB.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof hz)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 Qz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof Qz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&aR(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=KF(this._spec,this._option,{width:GB,height:YB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DE(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new gW(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){JF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DE(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=iB(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{JF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);ZF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),JF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);ZF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),JF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(mW[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return mW[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!mW[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;mW[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];JF(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=tB(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(jP.AFTER_MARK_RENDER_END,e)};this._event.on(jP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:FP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(DP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===Zj.dimensionHover||s===Zj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Lw(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Lw(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const _W=(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)},bW={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class xW{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},bW),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):uB(t,a,c.spec),uB(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=_W(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=_W(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}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(bB.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(bB.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=bB.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=bB.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=bB.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):UH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=UH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class SW extends xW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&fB(i,QF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class AW extends SW{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),XF(t)}}const kW=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=bP(t,!0);for(const e in o)for(const i in o[e].nodes)kP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)AP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&SP(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class TW{_beforeInit(){this._dataSet&&$P(this._dataSet,"stackSplit",kW)}_initStack(){this._stack=new CW(this),this._stack.init()}}const MW={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:Zj.dimensionHover};class wW extends kH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},MW,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=FP(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}wW.type="dimension-hover",wW.defaultOptions=MW;const EW=()=>{bB.registerInteractionTrigger(wW.type,wW)},BW=()=>{bB.registerComposedEvent(Zj.dimensionHover,qj),bB.registerComposedEvent(Zj.dimensionClick,Wj)},PW=t=>t.fieldX[0],RW=t=>t.fieldY[0],IW=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},OW=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},LW=(t,e)=>t?e?PW:IW:e?RW:OW,DW=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=$j(t,(t=>Dj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=$j(t,(t=>Fj(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Lw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=FW(t,i,LW(e,Lw(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=FW(t,i,LW(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},FW=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:zW(t,s,i)},zW=(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=Xj(e,t,"cartesian",null!=i?i:Dj(t.getOrient())?PW:RW);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},HW=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Lw(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Iw(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=hU(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};NW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&jW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),jW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=NH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},NW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},UW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=VW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},VW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},WW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return HW(c,r,e),c.xField.cacheInfo?UW(c.xField):c.yField.cacheInfo?UW(c.yField):void 0},GW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],YW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&GW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(XW(s).every((t=>{var e;return!XH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},XW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},KW={dom:`${WB}_TOOLTIP_HANDLER_DOM`,canvas:`${WB}_TOOLTIP_HANDLER_CANVAS`},$W={key:"其他",value:"..."};var qW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(qW||(qW={}));class ZW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=YW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},$W),t):$W;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&XH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class JW extends ZW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Lw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const QW=()=>{bB.registerTooltipProcessor("dimension",JW)};class tG extends ZW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,yo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(FP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const eG=()=>{bB.registerTooltipProcessor("mark",tG)};class iG extends ZW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const sG=()=>{bB.registerTooltipProcessor("group",iG)};class nG extends yW{constructor(){super(...arguments),this.transformerConstructor=AW,this.type="line",this.seriesType=PE.line}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}nG.type="line",nG.seriesType=PE.line,nG.transformerConstructor=AW,G(nG,TW);const rG=[...sN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class aG extends nN{constructor(){super(...arguments),this.type=aG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return rG}_getIgnoreAttributes(){return[]}}aG.type="area";const oG=()=>{bB.registerMark(aG.type,aG),KT(),wC(),jN(),VN(),SH(),bB.registerGraphicComponent("area",Yp)};class lG extends ZH{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 hG=Object.assign(Object.assign(Object.assign({},hj),Jj),{area:{name:"area",type:"area"}}),cG=()=>{bB.registerAnimation("area",bH),xH(),yH()};class dG extends KN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=fB({},f.style,g.style),l.state=fB({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function uG(){HC(),IT()}function pG(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const gG={debounce:St,throttle:At};uG();let fG=class t extends MN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=pG(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:gG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(KM,{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",gG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(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]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=pG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};fG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class mG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=mG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(KM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new fG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}CG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class TG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,CG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new CG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,YF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class MG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class wG extends MG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class EG extends MG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function BG(t){t.isBound(TG)||(t.bind(TG).toSelf().inSingletonScope(),t.bind(o_).toService(TG)),t.isBound(wG)||(t.bind(wG).toSelf(),t.bind(Sv).toService(wG)),t.isBound(EG)||(t.bind(EG).toSelf(),t.bind(Sv).toService(EG))}class PG extends MN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}HC(),iT();class RG extends PG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},RG.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})}}RG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HC(),IT();class IG extends PG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},IG.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})}}IG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},HC(),gC();class OG extends PG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},OG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}OG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},HC(),gC();class LG extends PG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},LG.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=UM,endAngle:s=VM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}LG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},HC(),cT();class DG extends PG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},DG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}DG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class FG{isInValidValue(t){const{startAngle:e=UM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=UM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return uw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function zG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=zG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var NG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=NM.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=NM.circle(t)}h.name=FU.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},HU,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=NG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=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:y,textAlign:"center"},l),state:{text:H({},HU,d.text),shape:H({},HU,d.shape),panel:H({},HU,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=zG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&HG(e,c,i)}else e.AABBBounds.width()>r&&HG(e,r,i)}else o>a.x&&h.x2>n.x2?(HG(e,n.x2-o,i),r&&jG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}UG.defaultAttributes=nw,G(UG,FG);const VG=(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=$M(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=dw(r,uw(s,r,e,n));return o=a,l=uw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return eU(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=VG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=GG(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 eU(c)},GG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&iU(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var YG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new $G(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):vN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=vN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=vN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=vN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?vN(t.quadrant)?"left":"right":vN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.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*(vN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),RN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,PN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}JG.defaultAttributes={pickable:!1};var QG,tY,eY,iY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(sY,FG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(QG||(QG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(tY||(tY={})),function(t){t.dataZoomChange="dataZoomChange"}(eY||(eY={}));const nY="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",rY={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:nY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:nY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},aY={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}},oY=0,lY=1,hY=2,cY=3,dY=4,uY=5,pY=5,gY=999,fY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var mY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:hY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:hY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:oY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:I}=this._getState(),{position:O,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+R*L,y:O.y-t,width:(I-R)*L,height:t,zIndex:uY},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(R+I)/2*L,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:uY},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+R*L,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},aY.horizontal),{zIndex:uY}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+I*L,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},aY.horizontal),{zIndex:uY}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+R*L-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:gY},aY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I*L-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:gY},aY.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?O.x-t:O.x+L,y:O.y+R*D,width:t,height:(I-R)*D,zIndex:uY},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?O.x-t/2:O.x+L+t/2,y:O.y+(R+I)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:uY},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+L/2,y:O.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},aY.vertical),{zIndex:uY}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+L/2,y:O.y+I*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:uY},aY.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L/2+t/2,y:O.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:gY},aY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+L/2+i/2,y:O.y+I*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:gY},aY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:cY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:cY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:lY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:dY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return qA(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=mY(c,["formatMethod"]),{formatMethod:g}=d,f=mY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:fY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:fY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:fY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:fY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:pY}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:pY}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new uV(e),s.name=i,t.add(s)),s}}const yY={debounce:St,throttle:At};class _Y extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=QG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=QG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=QG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=QG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=QG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=pG();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===QG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===QG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===QG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===QG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(tY.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(tY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(tY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===QG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(tY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(tY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:yY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=pG();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=QG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}cV(),IT(),iM(),wC(),iT();let bY=class t extends MN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new vY(this._getRendererAttrs()),this._interaction=new _Y(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(tY.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(tY.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(eY.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(tY.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(eY.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var xY,SY,AY,kY;function CY(){HC(),cV(),fb()}bY.defaultAttributes=rY,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"}(xY||(xY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(SY||(SY={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(AY||(AY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(kY||(kY={}));class TY extends MN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=pV(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=gV(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=fV(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:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},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=NM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=NM.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=NM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),RN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,PN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=BN(this);this.markerAnimate("exit");const n=BN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},IN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function MY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function wY(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;EN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function EY(t,e,i,s){t&&(wY(t.startSymbol,e,i,s),MY(t).forEach((t=>wY(t,e,i,s))),wY(t.endSymbol,e,i,s))}function BY(t,e,i,s){t&&(wY(t.getTextShape(),e,i,s),wY(t.getBgRect(),e,i,s))}function PY(t,e,i,s){var n,r,a,o;t&&(EN(t,{fillOpacity:0,strokeOpacity:0},{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 RY(t,e,i,s){t&&(PY(t.startSymbol,e,i,s),MY(t).forEach((t=>PY(t,e,i,s))),PY(t.endSymbol,e,i,s))}function IY(t,e,i,s){t&&(PY(t.getTextShape(),e,i,s),PY(t.getBgRect(),e,i,s))}function OY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;wY(t.startSymbol,s,r,n);const h=MY(t);h.forEach((t=>EN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),wY(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;wY(t.getTextShape(),e,l,n),wY(t.getBgRect(),e,l,n)}))}function LY(t,e,i,s,n){EY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}function DY(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}function FY(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}function zY(t,e,i,s,n,r){var a;EY(t,n,s,r),wY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?BY(i,n,s,r):wY(i,n,s,r)}function HY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;wY(t.startSymbol,n,o,r);const u=MY(t);u.forEach((t=>EN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),wY(e,n+o+l,h,r),wY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(wY(i.getTextShape(),n+o+l+h+c,d,r),wY(i.getBgRect(),n+o+l+c,d,r)):wY(i,n+o+l+c,d,r)}function jY(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?OY(t,e,s,r,a):"fadeIn"===i&&LY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?OY(t,e,s,n,a):"fadeIn"===i&&LY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){RY(t,s,i,n),Y(e).forEach((t=>{IY(t,s,i,n)}))}(t,e,i,s,n)}}function NY(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&&DY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&DY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){PY(t,s,i,n),Y(e).forEach((t=>{IY(t,s,i,n)}))}(t,e,i,s,n)}}function UY(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&&FY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&FY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){PY(t,s,i,n),Y(e).forEach((t=>{IY(t,s,i,n)}))}(t,e,i,s,n)}}function VY(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?zY(n,r,e,i,s,o):"callIn"===t&&HY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?zY(n,r,e,i,s,a):"callIn"===t&&HY(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;RY(t,n,s,r),PY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?IY(i,n,s,r):PY(i,n,s,r)}(n,r,e,t,i,s)}}const WY={type:"clipIn",duration:500,easing:"linear",delay:0},GY={type:"fadeIn",duration:500,easing:"linear",delay:0},YY={type:"callIn",duration:500,easing:"linear",delay:0},XY={type:"fadeOut",duration:500,easing:"linear",delay:0};class KY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new uV(Object.assign(Object.assign({},h),{state:{panel:H({},YM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},YM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},YM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},YM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class $Y extends TY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=WY,this.defaultExitAnimation=XY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;sw(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G($Y,KY);const qY=.001,ZY={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:xY.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]}},JY={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"}}},QY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:AY.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]}},tX={interactive:!0,label:{position:SY.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}},eX={interactive:!0,label:{autoRotate:!0,position:AY.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}},iX={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"}},sX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},nX={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 rX(){aX._animate=jY}CY(),aV(),fb();class aX extends $Y{markerAnimate(t){aX._animate&&this._animationConfig&&aX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},aX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(wM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return EM(Math.abs(e),Math.PI/2,qY)||EM(Math.abs(e),3*Math.PI/2,qY)?BM(i,e,t):wM(e)?JY.postiveXAxis[t]:JY.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new lV({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",aX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(aX.defaultAttributes.label)}}function oX(){lX._animate=NY}aX.defaultAttributes=ZY,CY(),yT(),fb();class lX extends TY{markerAnimate(t){lX._animate&&this._animationConfig&&lX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},lX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=GY,this.defaultExitAnimation=XY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},sX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=NM.polygon(Object.assign({points:e},i));n.states=H({},YM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",lX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},YM,null==i?void 0:i.area)),this._updateMarkLabels(lX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}lX.defaultAttributes=tX,G(lX,KY),CY(),oV(),fb();class hX extends $Y{markerAnimate(t){hX._animate&&this._animationConfig&&hX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},hX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case AY.arcInnerStart:l=n;case AY.arcOuterStart:l=n;break;case AY.arcInnerEnd:l=r;case AY.arcOuterEnd:l=r;break;case AY.center:case AY.arcInnerMiddle:case AY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return iX[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new hV({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",hX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(hX.defaultAttributes.label)}}hX.defaultAttributes=QY,CY(),gC(),fb();class cX extends TY{markerAnimate(t){cX._animate&&this._animationConfig&&cX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},cX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=GY,this.defaultExitAnimation=XY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case AY.center:h=(s+n)/2,c=(r+a)/2;break;case AY.arcInnerStart:h=s,c=r;break;case AY.arcOuterStart:h=n,c=r;break;case AY.arcInnerEnd:h=s,c=a;break;case AY.arcOuterEnd:h=n,c=a;break;case AY.arcInnerMiddle:h=s,c=(r+a)/2;break;case AY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},iX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=NM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},YM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",cX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},YM,null==o?void 0:o.area)),this._updateMarkLabels(cX.defaultAttributes.label)}isValidPoints(){return!0}}function dX(){uX._animate=VY}cX.defaultAttributes=eX,G(cX,KY),CY(),aV(),oV(),iM(),XC(),iT(),fb();class uX extends TY{markerAnimate(t){uX._animate&&this._animationConfig&&uX._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},uX.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=YY,this.defaultExitAnimation=XY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return EM(Math.abs(s),Math.PI/2,qY)||EM(Math.abs(s),3*Math.PI/2,qY)?BM(t,s,n):wM(s)?nX.postiveXAxis[n]:nX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=kY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},YM,null==p?void 0:p.textBackground),text:H({},YM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},YM,null==p?void 0:p.itemContent));const v=wM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=NM.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"text"===n?o=new uV(Object.assign(Object.assign({},i),{state:{panel:H({},YM,null==s?void 0:s.textBackground),text:H({},YM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=NM.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"image"===n?(o=NM.image(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},YM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=EM(c,0,qY)||EM(d,0,qY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=ew(e-u,t-d),o=ew(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(xX.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(xX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===xX.focus||"focus"===o){const s=a.hasState(_X.focus);a.toggleState(_X.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[_X.unSelected,_X.unSelectedHover,_X.focus],t),this._setLegendItemState(e,_X.selected,t)})):(this._setLegendItemState(a,_X.selected,t),this._removeLegendItemState(a,[_X.unSelected,_X.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[_X.selected,_X.selectedHover,_X.focus],t),this._setLegendItemState(e,_X.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(_X.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(_X.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(bX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[_X.selected,_X.selectedHover],t),this._setLegendItemState(a,_X.unSelected,t)):(this._setLegendItemState(a,_X.selected,t),this._removeLegendItemState(a,[_X.unSelected,_X.unSelectedHover],t))}else this._setLegendItemState(a,_X.selected,t),this._removeLegendItemState(a,[_X.unSelected,_X.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[_X.selected,_X.selectedHover],t),this._setLegendItemState(e,_X.unSelected,t))}))}this._dispatchLegendEvent(bX.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,_X.selected),this._removeLegendItemState(e,[_X.unSelected,_X.unSelectedHover])):(this._removeLegendItemState(e,[_X.selected,_X.selectedHover]),this._setLegendItemState(e,_X.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=mX,spaceRow:l=vX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=NM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=NM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,xX.item,t,M)):(M=NM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,xX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?_X.selected:_X.unSelected);const w=NM.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,I=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,I=R(v,"space",8);const s=NM.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,xX.itemShape,t,M,S.state),s.addState(e?_X.selected:_X.unSelected),w.add(s)}let O=0;if(d){const e=R(g,"size",10);E=NM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,xX.focus,t,M),O=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=QM(Object.assign(Object.assign({x:P/2+I,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,xX.itemLabel,t,M,A.state),D.addState(e?_X.selected:_X.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=QM(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,xX.itemValue,t,M,k.state),r.addState(e?_X.selected:_X.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-I-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-I-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.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 j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new fX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new fX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new fG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new fG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=mX,spaceRow:o=vX}=n,l=this._itemsContainer,{space:h=yX,defaultCurrent:c=1}=r,d=CX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=NM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=mX,spaceRow:a=vX}=s,o=this._itemsContainer,{space:l=yX,defaultCurrent:h=1}=n,c=CX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=NM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=NM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(_X.selected)?this._setLegendItemState(t,_X.selectedHover,e):this._setLegendItemState(t,_X.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===xX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(bX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(_X.unSelectedHover)||t.hasState(_X.selectedHover))&&(i=!0),t.removeState(_X.unSelectedHover),t.removeState(_X.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(_X.unSelectedHover)&&!t.hasState(_X.selectedHover)||(i=!0),t.removeState(_X.unSelectedHover),t.removeState(_X.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===xX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(bX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(bX.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!==xX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(bX.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!==xX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(bX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(_X.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},TX,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(_X.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var wX;function EX(t){return _(t)?t:[t,t]}function BX(t){return t?"ew-resize":"ns-resize"}MX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:mX,spaceRow:vX,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:yX,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"}(wX||(wX={})),AX();class PX extends MN{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:H({},PX.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=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=pG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=pG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(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?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:EX(d)[0],endValue:EX(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=NM.group({x:0,y:0});f.name=wX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=NM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=wX.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=NM.group({x:g?v:0,y:g?0:v});f.add(y);const _=NM.group({x:0,y:0});let b;if(_.name=wX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=NM.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=wX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=NM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=wX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=EX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":BX(p)},r));if(v.name=wX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=wX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":BX(p)},r));if(i.name=wX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=wX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=NM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=wX.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":BX(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=NM.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=wX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return NM.symbol(t)}_renderHandlerText(t,e){return NM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":BX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=NM.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=NM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=pG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===wX.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===wX.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===wX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===wX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}PX.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}}},kX(),AX();class RX extends SX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},RX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 IX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}RX.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"}}},kX(),AX(),cT();class OX extends SX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},OX.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=NM.group({x:0,y:0});this._innerView.add(x);const S=new PX({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:IX(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 C=NM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);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))}}OX.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)"}},HC(),cM(),YT();let LX=class t extends MN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:I,align:O,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:I,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},XM),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:I,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:I,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,I-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},XM),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GI&&(G=I),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(O)||p(C.align)){const t=C.align?C.align:O,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};LX.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 DX={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"}}};HC(),cM(),YT();let FX=class extends MN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(DX,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=QM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=qM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&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 zX extends Wg{constructor(t){super(t)}}var HX,jX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(HX||(HX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(jX||(jX={}));class NX extends MN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},NX.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"},NX.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"},NX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},NX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},NX.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 zX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new zX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new zX(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(HX.OnPlay)},this.pause=()=>{this._dispatchEvent(HX.OnPause)},this.forward=()=>{this._dispatchEvent(HX.OnForward)},this.backward=()=>{this._dispatchEvent(HX.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()}}NX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},NX.defaultAttributes={[jX.Start]:{},[jX.Pause]:{},[jX.Backward]:{},[jX.Forward]:{}};const UX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},VX=[200,10];var WX,GX;!function(t){t.Default="default",t.Reverse="reverse"}(WX||(WX={})),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"}(GX||(GX={}));const YX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===WX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===WX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),XX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===WX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===WX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),KX=t=>"top"===t||"bottom"===t;class $X extends MN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},$X.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(KX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:VX[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:VX[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 PX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=KX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new NX(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=KX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:VX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(KX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:KX(this._orient)?t+s:(this._size.width-r)/2,y:KX(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:KX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:KX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:KX(this._orient)?t+s:(this._size.width-r)/2,y:KX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function qX(){AX(),HC(),iM()}$X.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({},UX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},UX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},UX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},UX),{key:"backward",position:"start"})}},qX();class ZX extends $X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},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:WX.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(HX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(HX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(HX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(HX.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(GX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(YX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||XX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===WX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(GX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(GX.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(GX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(GX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(GX.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(GX.change),this.dispatchCustomEvent(GX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var JX,QX=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())}))};qX();class tK extends $X{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(HX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(HX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(HX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(HX.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(GX.change))},this.play=()=>QX(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(GX.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(GX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(GX.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(GX.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(GX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(JX||(JX={}));const eK={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},iK=5;const sK={debounce:St,throttle:At};HC(),yT();let nK=class t extends MN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=eK.updateTrigger,endTrigger:i=eK.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:sK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(JX.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=eK.trigger,resetTrigger:i=eK.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(JX.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(JX.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=iK}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(JX.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(JX.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(JX.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=iK}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(JX.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(JX.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=eK.updateTrigger,endTrigger:s=eK.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=NM.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};nK.defaultAttributes=eK;const rK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},aK=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}},oK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},lK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];HC(),IT(),iM(),cM(),YT();let hK=class t extends MN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},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=oi(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",H({symbolType:"circle"},u.shape,{visible:MM(u)&&MM(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:MM(u)&&MM(u.value)},aK(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:MM(u)&&MM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:MM(u)&&MM(u.value)},aK(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},XM),u.value),visible:MM(u)&&MM(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=MM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=MM(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]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!MM(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)+(MM(n.key)?r+n.key.spacing:0)+(MM(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&&(tw(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:MM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),tw(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(MM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(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(MM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},aK(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},aK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},XM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(MM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},aK(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},aK(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=>lK.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)&&MM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=MM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=$M(d),y=$M(u);let _=0;if(MM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(MM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return rK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return rK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};hK.defaultAttributes=oK;class cK extends ZV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{Dj(this.getOrient())?gU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):gU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=fB({},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 za(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Ez(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.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=>pU(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=>pU(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,KV),t}transformScaleDomain(){}}cK.type=r.cartesianTimeAxis,cK.specKey="axes",cK.builtInTheme={axis:RV,axisX:IV,axisY:OV};class dK extends ZV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new ME}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,KV),t}transformScaleDomain(){}}dK.type=r.cartesianLogAxis,dK.specKey="axes",dK.builtInTheme={axis:RV,axisLinear:qV,axisX:IV,axisY:OV},G(dK,GV);class uK extends ZV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new wE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,KV),t}transformScaleDomain(){}}uK.type=r.cartesianSymlogAxis,uK.specKey="axes",uK.builtInTheme={axis:RV,axisLinear:qV,axisX:IV,axisY:OV},G(uK,GV);class pK extends Lj{constructor(){super(...arguments),this.type=PE.area,this.transformerConstructor=dG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Qj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(pK.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===DH?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XE(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XE(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[tP]},"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(vj(null===(e=bB.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),yj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),yj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Oj(this);this._symbolMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),yj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new lG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}pK.type=PE.area,pK.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},pK.mark=hG,pK.transformerConstructor=dG,G(pK,tN);class gK extends SW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),XF(t)}}class fK extends yW{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="area",this.seriesType=PE.area}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}fK.type="area",fK.seriesType=PE.area,fK.transformerConstructor=gK,G(fK,TW);function mK(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 vK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:mK(t,e)}),yK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:mK(t,e)}),_K={type:"fadeIn"},bK={type:"growCenterIn"};function xK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return _K;case"scaleIn":return bK;default:return vK(t)}}class SK extends Qz{constructor(){super(...arguments),this.type=SK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}SK.type="rect";const AK=()=>{KT(),IT(),FN("rect",XG),bB.registerMark(SK.type,SK),w_.registerBuiltInAnimate("growHeightIn",NL),w_.registerBuiltInAnimate("growHeightOut",UL),w_.registerBuiltInAnimate("growWidthIn",nD),w_.registerBuiltInAnimate("growWidthOut",rD),w_.registerBuiltInAnimate("growCenterIn",zL),w_.registerBuiltInAnimate("growCenterOut",HL),bB.registerGraphicComponent("rect",mg)},kK=Object.assign(Object.assign({},hj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function CK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=nB(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[cj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):XE(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[dj]):XE(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=XE(this._dataToPosX(t),e,i),n=XE(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[uj]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XE(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[pj]):XE(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=XE(this._dataToPosY(t),e,i),n=XE(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),wK)})}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},EK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:xj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(EK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}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($P(this._option.dataSet,"addVChartProperty",WH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};$P(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new za(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:rj.bind(this),call:aj}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new Ez(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_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=pj,s=uj,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=dj,s=cj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=bP(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)CK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=XE(this[r](t),l,i),u=XE(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!KE(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[QB],n=e[tP],r=e[eP],d=e[iP];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?uj:cj],i=e[a?pj:dj];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[QB]:s,[tP]:o}),c?{[eP]:u,[iP]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(mg(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>XE(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>XE(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Oj(this);this._barMark.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),yj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=nB(this._spec.barWidth,a)),l&&(c=Math.max(c,nB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,nB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=nB(null!==(l=i[r-1])&&void 0!==l?l:X(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 _=Iw(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}EK.type=PE.bar,EK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},EK.mark=kK,EK.transformerConstructor=MK;const BK=()=>{dW(),AK(),bB.registerAnimation("bar",((t,e)=>({appear:xK(t,e),enter:vK(t,!1),exit:yK(t,!1),disappear:{duration:fH.disappear.duration}}))),DV(),JV(),bB.registerSeries(EK.type,EK)};class PK extends SW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),XF(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 RK extends yW{constructor(){super(...arguments),this.transformerConstructor=PK,this.type="bar",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}RK.type="bar",RK.seriesType=PE.bar,RK.transformerConstructor=PK,G(RK,TW);const IK=[10,20],OK=Pw.Linear,LK="circle",DK=Pw.Ordinal,FK=["circle","square","triangle","diamond","star"],zK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},HK=Object.assign(Object.assign({},hj),{point:{name:"point",type:"symbol"}});class jK extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const NK={sizeField:!0};class UK extends Lj{constructor(){super(...arguments),this.type=PE.scatter,this.transformerConstructor=jK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),NK)})}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=`${WB}_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=`${WB}_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:OK,defaultRange:IK},"size")}getShapeAttribute(t,e){return u(e)?LK:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:DK,defaultRange:FK},"shape")}initMark(){this._symbolMark=this._createMark(UK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:xj(this._spec,UK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Oj(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(vj(null===(i=bB.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),yj("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:LK},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}UK.type=PE.scatter,UK.mark=HK,UK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},UK.transformerConstructor=jK;const VK=()=>{XN(),bB.registerAnimation("scatter",((t,e)=>Object.assign({appear:zK(0,e)},mH))),DV(),JV(),bB.registerSeries(UK.type,UK)};class WK extends SW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class GK extends yW{constructor(){super(...arguments),this.transformerConstructor=WK,this.type="scatter",this.seriesType=PE.scatter}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}GK.type="scatter",GK.seriesType=PE.scatter,GK.transformerConstructor=WK,G(GK,TW);class YK extends Rj{constructor(){super(...arguments),this.type=PE.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=`${WB}_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 XK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[KB]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[mP]=a||r})),s};class KK extends ZH{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 $K extends Qz{constructor(){super(...arguments),this.type=$K.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}$K.type="path";const qK=()=>{bB.registerMark($K.type,$K),KT(),cT(),bB.registerGraphicComponent("path",hg)},ZK=Object.assign(Object.assign({},hj),{area:{name:"area",type:"path"}});class JK{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ua(i,e):ja[i]?(Ha[i]||(Ha[i]=Ua(i,ja[i])),Ha[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class QK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class t${constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function e$(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:QK}:bM(e)||xM(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:t$}:null}const i$={debounce:St,throttle:At};class s${constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=bM(this._renderMode)||xM(this._renderMode),e$(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return e$(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:WP.chart,consume:!1}];l.on(...c,i$[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,i$[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||e$(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||e$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:WP.chart,consume:!1}];l.on(...c,i$[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,i$[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){e$(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||e$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:WP.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:WP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||e$(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||e$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=i$[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=i$[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:WP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp)}))}}class n$ extends RU{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${WB}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=fB(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new JK(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===PE.map||e.type===PE.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),Tw(this._regions,(t=>{var e;if(t.type===PE.map||t.type===PE.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==PE.map&&e.type!==PE.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[mP],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}n$.type=r.geoCoordinate,G(n$,s$);const r$=()=>{bB.registerComponent(n$.type,n$)};class a$ extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class o$ extends YK{constructor(){super(...arguments),this.type=PE.map,this.transformerConstructor=a$,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 !`),ZP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),$P(this._dataSet,"copyDataView",sR),$P(this._dataSet,"map",XK),$P(this._dataSet,"lookup",VH);const s=ZP.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new za(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:mP,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new Ez(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(o$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:xj(this._spec,o$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:qB])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:qB]):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(vj(null===(t=bB.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),yj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new KK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[KB]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[KB],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return KB}getActiveMarks(){return[this._pathMark]}}o$.type=PE.map,o$.mark=ZK,o$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},o$.transformerConstructor=a$;const l$=`${WB}_waterfall_default_seriesField`,h$=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[oP]=!0:delete t[oP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=c$([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}=d$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=c$(r,t,s,o,u,c,e,i),o.push(s)})),o};function c$(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}=d$(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===l$)&&(t[l$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function d$(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?gM("total.collectCountField error"):n=e[a].start;o<0?gM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const u$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},p$={type:"fadeIn"},g$={type:"growCenterIn"};function f$(t,e){switch(e){case"fadeIn":return p$;case"scaleIn":return g$;default:return vK(t,!1)}}class m$ extends Qz{constructor(){super(...arguments),this.type=m$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return ag(t)}}m$.type="rule";const v$=()=>{bB.registerMark(m$.type,m$),KT(),iT(),bB.registerGraphicComponent("line",ag)},y$=Object.assign(Object.assign({},kK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),_$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:b$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function b$(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)=>b$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class x${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 za(e instanceof Fa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),$P(e,"dimensionTree",_$),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 S$ extends MK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const A$={rect:E$,symbol:M$,arc:P$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=M$(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:R$,line:I$,area:I$,rect3d:E$,arc3d:P$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function k$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=A$[t])&&void 0!==i?i:A$.point;return e.series.type===PE.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=T$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:O$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function C$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==PE.sankey){const{formatFunc:t,args:n}=NH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function T$(t){return d(t)?e=>t(e.data):t}function M$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=T$(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:w$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function w$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function E$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=T$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:B$(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function B$(t){const e=[{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"]}}];return e}function P$(t){var e;const{labelSpec:i}=t,s=null!==(e=T$(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 R$(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=C$(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),Jg(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 I$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[qB]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function O$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const L$={calculationMode:!0};class D$ extends EK{constructor(){super(...arguments),this.type=PE.waterfall,this.transformerConstructor=S$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&SP(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),L$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new x$(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=l$)}getSeriesKeys(){return this._seriesField===l$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),$P(this._dataSet,"waterfallFillTotal",u$),$P(this._dataSet,"waterfall",h$),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=nR(this.getViewData(),this._dataSet,{name:`${WB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Ez(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:QB,endAs:tP,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Oj(this);this._barMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),yj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),yj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(D$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return R$(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?XE(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):XE(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&KE([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}D$.type=PE.waterfall,D$.mark=y$,D$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},D$.transformerConstructor=S$;const F$=()=>{v$(),AK(),bB.registerAnimation("waterfall",((t,e)=>({appear:f$(t,e),enter:vK(t,!1),exit:yK(t,!1),disappear:{duration:fH.disappear.duration}}))),_H(),DV(),JV(),bB.registerSeries(D$.type,D$)},z$=`${WB}_BOX_PLOT_OUTLIER_VALUE`;var H$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(H$||(H$={}));const j$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[z$]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class N$ extends ZH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===H$.OUTLIER)return this.series.getOutliersField();if(t===H$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case H$.MIN:return this.series.getMinField();case H$.MAX:return this.series.getMaxField();case H$.MEDIAN:return this.series.getMedianField();case H$.Q1:return this.series.getQ1Field();case H$.Q3:return this.series.getQ3Field();case H$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===H$.OUTLIER)return e[z$];if(t===H$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case H$.MIN:return e[this.series.getMinField()];case H$.MAX:return e[this.series.getMaxField()];case H$.MEDIAN:return e[this.series.getMedianField()];case H$.Q1:return e[this.series.getQ1Field()];case H$.Q3:return e[this.series.getQ3Field()];case H$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[z$])}getDefaultContentList(t){return[{key:this.getContentKey(H$.OUTLIER),value:this.getContentValue(H$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(H$.MAX),value:this.getContentValue(H$.MAX)},{key:this.getContentKey(H$.Q3),value:this.getContentValue(H$.Q3)},{key:this.getContentKey(H$.MEDIAN),value:this.getContentValue(H$.MEDIAN)},{key:this.getContentKey(H$.Q1),value:this.getContentValue(H$.Q1)},{key:this.getContentKey(H$.MIN),value:this.getContentValue(H$.MIN)},{key:this.getContentKey(H$.SERIES_FIELD),value:this.getContentValue(H$.SERIES_FIELD)}]}}const U$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class V$ extends Qz{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==sz.enter&&t.context.diffState!==sz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{U$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Zp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=bB.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const W$=()=>{bB.registerGraphicComponent("glyph",Zp),KT(),FC()},G$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],Y$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class X$ extends V${constructor(){super(...arguments),this.type=X$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=G$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=Y$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}X$.type="boxPlot";const K$=Object.assign(Object.assign({},hj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),$$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},q$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},Z$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),J$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=Z$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=Z$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=Z$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=Z$(t,"box").attribute.width,i=Z$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=Z$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=Z$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=Z$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=Z$(t,"box").attribute.height,i=Z$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},Q$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=Z$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=Z$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=Z$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=Z$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=Z$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=Z$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=Z$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=Z$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=Z$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=Z$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class tq extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return $$(J$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class eq extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return q$(J$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class iq extends tq{computeAttribute(){return $$(Q$)(this.target,this.params,this.params.options)}}class sq extends eq{computeAttribute(){return q$(Q$)(this.target,this.params,this.params.options)}}class nq extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const rq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class aq extends Lj{constructor(){super(...arguments),this.type=PE.boxPlot,this.transformerConstructor=nq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),rq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(aq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(aq.mark.outlier,{key:KB,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}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=>XE(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XE(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XE(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XE(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XE(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>XE(e(this.getDatumPositionValues(t,z$),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>XE(e(this.getDatumPositionValues(t,z$),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;$P(this._dataSet,"foldOutlierData",j$),$P(this._dataSet,"addVChartProperty",WH);const t=new za(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${WB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:rj.bind(this),call:aj}},!1),this._outlierData=new Ez(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=nB(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,nB(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,nB(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=nB(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Iw(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Oj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=bB.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(yj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(vj(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(vj(null===(a=bB.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new N$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}aq.type=PE.boxPlot,aq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},aq.mark=K$,aq.transformerConstructor=nq;const oq=()=>{W$(),iT(),IT(),bB.registerGraphicComponent("line",(t=>ag(t))),bB.registerGraphicComponent("rect",(t=>mg(t))),bB.registerMark(X$.type,X$),XN(),yH(),DV(),JV(),w_.registerBuiltInAnimate("boxplotScaleIn",tq),w_.registerBuiltInAnimate("boxplotScaleOut",eq),w_.registerBuiltInAnimate("barBoxplotScaleIn",iq),w_.registerBuiltInAnimate("barBoxplotScaleOut",sq),bB.registerSeries(aq.type,aq)};class lq extends Qz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=lq.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?jg(t):Jg(t)}}lq.type="text";const hq=()=>{bB.registerMark(lq.type,lq),KT(),cM(),YT(),bB.registerGraphicComponent("text",Jg),bB.registerGraphicComponent("richtext",jg)};class cq extends ZH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const dq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),uq={type:"fadeIn"},pq=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function gq(t,e){return"fadeIn"===e?uq:dq(t)}const fq=Object.assign(Object.assign({},kK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class mq extends MK{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 vq extends EK{constructor(){super(...arguments),this.type=PE.rangeColumn,this._barMarkType="rect",this._barName=PE.bar,this.transformerConstructor=mq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(vq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:xj(this._spec,vq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(vq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(vq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Oj(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(vj(null===(i=bB.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),yj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),yj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(vj(null===(n=bB.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),yj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new cq(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)}}vq.type=PE.rangeColumn,vq.mark=fq,vq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},vq.transformerConstructor=mq;const yq=()=>{AK(),hq(),bB.registerAnimation("rangeColumn",((t,e)=>({appear:gq(t,e),enter:dq(t),exit:pq(t),disappear:{duration:fH.disappear.duration}}))),_H(),DV(),JV(),bB.registerSeries(vq.type,vq)};var _q,bq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(_q||(_q={})),function(t){t.middle="middle",t.start="start",t.end="end"}(bq||(bq={}));class xq extends ZH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const Sq=Object.assign({},hG);class Aq extends pK{constructor(){super(...arguments),this.type=PE.rangeArea}initMark(){this._areaMark=this._createMark(Aq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new xq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}Aq.type=PE.rangeArea,Aq.mark=Sq;class kq extends Rj{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=TU,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Iw(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:[]};Iw(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)&&Ij(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Cq(t){return kM(t)?Number.parseFloat(t):0}const Tq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&Mq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[mU],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[mU]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},Mq=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===Cq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Cq(i[e])),0)));function wq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const Eq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:wq(t,!0,lR.appear)}),Bq={type:"fadeIn"},Pq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:wq(t,!0,lR.enter)}),Rq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:wq(t,!0,lR.exit)});function Iq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Bq;case"growRadius":return Eq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Eq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Oq extends Qz{constructor(t,e){super(t,e),this.type=Lq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[xU])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Lq extends Oq{constructor(){super(...arguments),this.type=Lq.type}}Lq.type="arc";const Dq=()=>{KT(),gC(),FN("arc",qG),w_.registerBuiltInAnimate("growRadiusIn",eD),w_.registerBuiltInAnimate("growRadiusOut",iD),w_.registerBuiltInAnimate("growAngleIn",DL),w_.registerBuiltInAnimate("growAngleOut",FL),bB.registerGraphicComponent("arc",Vp),bB.registerMark(Lq.type,Lq)},Fq=Object.assign(Object.assign({},hj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class zq extends Cj{_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=fB({},this._theme,i,t);const n=(t,e)=>fB({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Hq=`${WB}_LABEL_VISIBLE`,jq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},Nq={outerRadius:!0};class Uq extends kq{constructor(){super(...arguments),this.transformerConstructor=zq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:QE(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:QE(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=kU,this._endAngle=CU,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[xU];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;$P(this._dataSet,"pie",Tq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:yU,asEndAngle:_U,asRatio:vU,asMiddleAngle:xU,asRadian:AU,asQuadrant:SU,asK:bU,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new za(this._dataSet,{name:`${WB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Ez(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Uq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:$B,groupKey:this._seriesField,isSeriesMark:!0},{morph:xj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ew(yU)(t)}endAngleScale(t){return Ew(_U)(t)}_computeLayoutRadius(){return MU((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$E(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$E(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ew(Hq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Nq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),jq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[xU];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===lR.appear)return this._startAngle;if(i===lR.disappear)return this._endAngle;const r=[lR.disappear,lR.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[KB];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[KB]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[KB])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[KB])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[xU]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[xU]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[xU]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[xU]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=vj(null===(i=bB.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Uq.transformerConstructor=zq,Uq.mark=Fq,Uq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class Vq extends Uq{constructor(){super(...arguments),this.type=PE.pie}}Vq.type=PE.pie;const Wq=()=>{Dq(),bB.registerAnimation("pie",((t,e)=>({appear:Iq(t,e),enter:Pq(t),exit:Rq(t),disappear:{duration:fH.disappear.duration}}))),bB.registerAnimation("emptyCircle",((t,e)=>({appear:Iq(t,e)}))),bB.registerSeries(Vq.type,Vq)};function Gq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const Yq=t=>({type:Gq(t.growField),options:{overall:!0}}),Xq={type:"fadeIn"},Kq=t=>({type:Gq(t.growField)}),$q=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function qq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Xq;case"growAngle":return Yq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return Yq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const Zq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class Jq extends kq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Zq)})}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(tP),this.setInnerRadiusField(QB)}setValueFieldToPercent(){this.setRadiusField(iP),this.setInnerRadiusField(eP)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const Qq=Object.assign(Object.assign({},hj),{rose:{name:"rose",type:"arc"}});class tZ extends Cj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class eZ extends UU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=bB.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=kU,this._endAngle=CU,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{"radius"===this.getOrient()?gU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):gU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QE(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QE(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:hU(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){Tw(this._regions,(t=>{"radius"===this.getOrient()?gU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):gU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Iw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Iw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>pU(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return MU((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=TU,e=0;const i=this.getChart().getSpec();return Tw(this.getRegions(),(s=>{const n=s;if(r=n.type,[PE.rose,PE.radar,PE.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(fB({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(fB({},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)}}eZ.type=r.polarAxis,eZ.specKey="axes";const iZ={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},sZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class nZ extends eZ{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,KV),t}}nZ.type=r.polarLinearAxis,nZ.specKey="axes",nZ.builtInTheme={axis:RV,axisLinear:qV,axisAngle:sZ,axisRadius:iZ},G(nZ,GV);const rZ=()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),bB.registerGraphicComponent(IU.circleAxis,((t,e)=>new UG(t,e))),bB.registerGraphicComponent(OU.circleAxisGrid,((t,e)=>new sY(t,e))),VU(),bB.registerComponent(nZ.type,nZ)};class aZ extends eZ{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new iE}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,WG),t}transformScaleDomain(){}}aZ.type=r.polarBandAxis,aZ.specKey="axes",aZ.builtInTheme={axis:RV,axisBand:PV,axisAngle:sZ,axisRadius:iZ},G(aZ,YU);const oZ=()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),bB.registerGraphicComponent(IU.circleAxis,((t,e)=>new UG(t,e))),bB.registerGraphicComponent(OU.circleAxisGrid,((t,e)=>new sY(t,e))),VU(),bB.registerComponent(aZ.type,aZ)};class lZ extends Jq{constructor(){super(...arguments),this.type=PE.rose,this.transformerConstructor=tZ,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(lZ.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:xj(this._spec,lZ.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XE(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XE(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(vj(null===(i=bB.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),yj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}lZ.type=PE.rose,lZ.mark=Qq,lZ.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},lZ.transformerConstructor=tZ;const hZ=()=>{bB.registerSeries(lZ.type,lZ),Dq(),bB.registerAnimation("rose",((t,e)=>({appear:qq(t,e),enter:Kq(t),exit:$q(t),disappear:{duration:fH.disappear.duration}}))),oZ(),rZ()};class cZ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,vw(this._fromAngle,this._toAngle)&&vw(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class dZ extends uH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!Cw(t)&&!Cw(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const uZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function pZ(t,e,i){return"fadeIn"===e?uZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function gZ(t,e,i){return"fadeIn"===e?uZ(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 fZ=(t,e)=>({custom:cH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),mZ=Object.assign(Object.assign(Object.assign({},hj),Jj),{area:{name:"area",type:"area"}});class vZ extends Jq{constructor(){super(...arguments),this.type=PE.radar,this.transformerConstructor=KN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(vZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:FH,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):kU},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(vj(null===(s=bB.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),yj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=bB.getAnimationInKey(e);t.setAnimationConfig(vj(null==i?void 0:i(n,r),yj(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}}}vZ.type=PE.radar,vZ.mark=mZ,vZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},vZ.transformerConstructor=KN,G(vZ,tN);const yZ=()=>{bB.registerSeries(vZ.type,vZ),oG(),GN(),XN(),bB.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:pZ(t,e,"in"),enter:pZ(t,e,"in"),exit:pZ(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:fH.disappear.duration},update:[{channel:["points","center"],custom:dZ,customParameters:t,duration:fH.update.duration,easing:fH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),bB.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:gZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:fH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:cZ,customParameters:t,duration:fH.update.duration,easing:fH.update.easing}]}))),bB.registerAnimation("radarGroup",((t,e)=>({appear:fZ(t,"in"),disappear:{duration:fH.disappear.duration}}))),gC(),oZ(),rZ()};class _Z extends ZH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const bZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(WB)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[KB]:r,[$B]:`${s}_${e}`})),r++}))})),n},xZ={fill:"#bbb",fillOpacity:.2},SZ=Object.assign(Object.assign({},hj),{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"}}),AZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},kZ={grid:{background:!0}};class CZ extends Lj{constructor(){super(...arguments),this.type=PE.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)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),AZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),kZ)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),$P(this._option.dataSet,"objFlat",bZ),$P(this._option.dataSet,"copyDataView",sR),qP(this._option.dataSet,"dataview",Oa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(fB(xZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(CZ.mark.group),this._containerMark=this._createMark(CZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(CZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(CZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(CZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(CZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(CZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(CZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:qB}}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 WE).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:qB}}initTooltip(){this._tooltipHelper=new _Z(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}CZ.type=PE.dot,CZ.mark=SZ,CZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class TZ extends ZH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const MZ=Object.assign(Object.assign({},hj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),wZ=(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 EZ extends Lj{constructor(){super(...arguments),this.type=PE.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),$P(this._option.dataSet,"linkDotInfo",wZ),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(EZ.mark.group),this._containerMark=this._createMark(EZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(EZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(EZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:qB}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new TZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}EZ.type=PE.link,EZ.mark=MZ,EZ.builtInTheme={link:{arrow:{style:{size:10}}}};const BZ=Object.assign(Object.assign({},hj),{group:{name:"group",type:"group"}}),PZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class RZ extends kq{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()?QB:pP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?tP:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),PZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):kU;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):CU,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=XE(this.angleAxisHelper.dataToPosition([t[QB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XE(this.angleAxisHelper.dataToPosition([t[tP]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?XE(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(RZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[mg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const DZ=()=>{bB.registerAnimation("circularProgress",((t,e)=>({appear:LZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:fH.disappear.duration}})))};class FZ extends Cj{constructor(){super(...arguments),this._supportStack=!0}}const zZ={cornerRadius:!0,roundCap:!0};class HZ extends RZ{constructor(){super(...arguments),this.type=PE.circularProgress,this.transformerConstructor=FZ,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()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),zZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(HZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:xj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(HZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?QB:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?tP: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(vj(null===(i=bB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),yj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),yj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}HZ.type=PE.circularProgress,HZ.mark=IZ,HZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},HZ.transformerConstructor=FZ;const jZ=()=>{bB.registerSeries(HZ.type,HZ),Dq(),DZ(),_H(),oZ(),rZ()};function NZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const UZ={type:"fadeIn"};function VZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?UZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:NZ(t)}))(t)}class WZ extends ZH{enableByType(t){return"dimension"!==t}}const GZ=Object.assign(Object.assign({},hj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),YZ={bandWidth:!0,cornerRadius:!0,clamp:!0},XZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class KZ extends Lj{constructor(){super(...arguments),this.type=PE.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),YZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),XZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(KZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return XE(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(KZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),yj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),yj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new WZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}KZ.type=PE.linearProgress,KZ.mark=GZ,KZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const $Z=()=>{AK(),bB.registerAnimation("linearProgress",((t,e)=>({appear:VZ(t,e),enter:VZ(t),disappear:{duration:fH.disappear.duration}}))),_H(),bB.registerSeries(KZ.type,KZ)},qZ=[0],ZZ=[20,40],JZ=[200,500],QZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},tJ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class eJ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const iJ=`${WB}_WORD_CLOUD_TEXT`,sJ=Object.assign(Object.assign({},hj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),nJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class rJ extends Rj{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=ZZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:JZ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:qZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?iJ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:QZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||_M(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:qZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!tJ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new eJ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(rJ.mark.word,{key:$B,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(rJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(vj(bB.getAnimationInKey("wordCloud")(n,s),yj("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 WE).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:qB])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new AE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new AE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[KB])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:$B,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:b_.createCanvas.bind(b_),getTextBounds:gv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:sg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}rJ.mark=sJ,rJ.builtInTheme={wordCloud:nJ};function aJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||fH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=oJ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},lJ=(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=lJ(t.children,e,t,n))})),s},hJ=(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=hJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},cJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):cJ(t.children,e,i)))})),e};function dJ(t,e){let i,s;if(gJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function gJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function yJ(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 _J(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 bJ(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 xJ(t){return{_:t,next:null,prev:null}}function SJ(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];yJ(n,s,r);let a,o,l,h,c,d,u,p=xJ(s),g=xJ(n),f=xJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=oJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:TJ.defaultOpionts.nodeSort;lJ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)lJ([o],AJ(h)),hJ([o],kJ(this._getPadding,.5,a)),lJ([o],CJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);lJ([o],AJ(TJ.defaultOpionts.setRadius)),hJ([o],kJ(It,1,a)),c&&hJ([o],kJ(this._getPadding,o.radius/t,a)),lJ([o],CJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}TJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const MJ=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=MJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function wJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){MJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function EJ(t){return t.depth}function BJ(t,e){return e-1-t.endDepth}const PJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),RJ=(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},IJ={left:EJ,right:BJ,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:EJ,end:BJ},OJ=bt(0,1);class LJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>PJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>PJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},LJ.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):IJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return wJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[RJ(s[t.source]),RJ(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*OJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(PJ),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(PJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];DJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),FJ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},zJ.defaultOpionts,t):Object.assign({},zJ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(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]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(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-(_(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=oJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function HJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:DJ,slice:HJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?HJ:DJ)(t,e,i,s,n)}};class UJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},UJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?jJ(this.options.aspectRatio):null!==(e=NJ[this.options.splitType])&&void 0!==e?e:NJ.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=oJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function VJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=VJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=WJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function ZJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Ii((function(i){return-1*JJ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},tQ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||YJ,s=e.lossFunction||GJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:QJ(f),arcs:f})}))},eQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:iQ,triangle:iQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function iQ(){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 sQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const nQ=t=>eQ[t]?eQ[t]():eQ.circle(),rQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function aQ(t){return d(t)?t:function(){return t}}class oQ{constructor(t){var e,i;switch(this.options=H({},oQ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=nQ(this.options.shape),this.getText=null!==(e=aQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=aQ(this.options.fontWeight),this.getTextFontSize=aQ(this.options.fontSize),this.getTextFontStyle=aQ(this.options.fontStyle),this.getTextFontFamily=aQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>rQ(10,50);break;case"random-light":this.getTextColor=()=>rQ(50,90);break;default:this.getTextColor=aQ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class hQ extends oQ{constructor(t){var e;super(H({},hQ.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<=hQ.defaultOptions.minFontSize&&(this.options.minFontSize=hQ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=lQ[this.options.spiral])&&void 0!==e?e:lQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=aQ(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}=sQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(pQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(uQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}pQ(p,this._size)&&(p=gQ(p,this._size))}else if(pQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||dQ(p,i))&&(!i||!cQ(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 cQ(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 dQ(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,pQ=(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 gQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},mQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},vQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},yQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=sQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=nQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)vQ(n,mQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)vQ(n,mQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)vQ(n,mQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)vQ(n,mQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)vQ(n,mQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=mQ({x:l,y:h},o,-Math.PI/2,5),e=mQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);vQ(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var C=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 M=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const w=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)};const B=Object.prototype.hasOwnProperty;function P(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(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&I.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function U(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=U(t),n=U(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(!V(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=it){const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var yt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function 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(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(d)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Ct(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const wt=4294967296;const Et=t=>e=>R(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(_(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Rt=(t,e)=>u(t)?e:y(t)?e*parseFloat(t)/100:t,It=t=>0,Ot=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Lt(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ae{static distancePP(t,e){return $t(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return $t(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=pe(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Ce(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?oe(t.angle):t.angle,s=Me(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+jt;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+jt;u>Ut&&(u-=Ut),g>Ut&&(g-=Ut);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ce(n,i)+Ce(n,s))/2>Ce(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Oe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function De(t,e={},i){i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Fe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=De(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>{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}},He=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const s=this.rotatedPoints(t,e,i);return this.clear().add(s[0],s[1]).add(s[2],s[3]).add(s[4],s[5]).add(s[6],s[7])}scale(t=0,e=0,i=0,s=0){const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(t=0,e=0){return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Ne(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Ve extends Ue{}class We extends Ue{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class Ge{constructor(t=1,e=0,i=0,s=1,n=0,r=0){this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Ge,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 Ge;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ge(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=le(r.rotateDeg),r}}class Ye{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 Xe(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 Ke(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const $e=/^#([0-9a-f]{3,8})$/,qe={transparent:4294967040},Ze={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 Je(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Qe(t){return S(t)?new ni(t>>16,t>>8&255,255&t,1):_(t)?new ni(t[0],t[1],t[2]):new ni(255,255,255)}function ti(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ei(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ii=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ni((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Qe(t):8===e?new ni(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class si{static Brighter(t,e=1){return 1===e?t:new si(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new si(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof si?t:new si(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(qe[t]))return function(t){return S(t)?new ni(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ni(t[0],t[1],t[2],t[3]):new ni(255,255,255,1)}(qe[t]);if(p(Ze[t]))return Qe(Ze[t]);const e=`${t}`.trim().toLowerCase(),i=ii(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ni(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=Xe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ni(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=si.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ni(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=Ke(this.color.r,this.color.g,this.color.b),r=Xe(u(t)?n.h:yt(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 ni(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=ii(e,!0);return null!=i?i:this}setColorName(t){const e=Ze[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new si(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ei(t.color.r),this.color.g=ei(t.color.g),this.color.b=ei(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ni{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`#${Je(this.r)+Je(this.g)+Je(this.b)+(1===this.opacity?"":Je(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}=Ke(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ri(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 ni(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:Ke});function oi(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 li(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}const hi=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase();function ci(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 di(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}const ui=1e-10;function pi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ui)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=vi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=gi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ui,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function gi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function fi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return gi(t,t-(i*i-e*e+t*t)/(2*i))+gi(e,s)}function mi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function vi(t){const e={x:0,y:0};for(let i=0;ithis.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.y=+s[0],i+s[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let bi;function xi(t,e){const i=_i(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 Si{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ai=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ki(t){let e;if(e=Ai.exec(t))return new Si({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});ot.getInstance().error("invalid format: "+t)}const Ci=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ti{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 Ti.instance||(Ti.instance=new Ti),Ti.instance}newFormat(t){const e=ki(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Mi[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal: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?Ci[8+bi/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 C=S.length+k.length+A.length,T=C>1)+S+k+A+T.slice(C);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ki(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=_i(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ci[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>xi(100*t,e),r:xi,s:function(t,e){const i=_i(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(bi=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")+_i(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 wi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(y.fx>e.fx?(Ri(_,1+c,v,-c,e),_.fx=t(_),_.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ri(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Pi(h,s.fxprime,-1);for(let e=0;e{const{callback:i}=e;return i&&(t=t.filter(i)),t};function Fi(){return new zi}function zi(){this.reset()}zi.prototype={constructor:zi,reset:function(){this.s=this.t=0},add:function(t){ji(Hi,t,this.t),ji(this,Hi.s,this.s),this.s?this.t+=Hi.t:this.s=Hi.t},valueOf:function(){return this.s}};var Hi=new zi;function ji(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var Ni=1e-6,Ui=Math.PI,Vi=Ui/2,Wi=Ui/4,Gi=2*Ui,Yi=180/Ui,Xi=Ui/180,Ki=Math.abs,$i=Math.atan,qi=Math.atan2,Zi=Math.cos,Ji=Math.exp,Qi=Math.log,ts=Math.pow,es=Math.sin,is=Math.sign||function(t){return t>0?1:t<0?-1:0},ss=Math.sqrt,ns=Math.tan;function rs(t){return t>1?0:t<-1?Ui:Math.acos(t)}function as(t){return t>1?Vi:t<-1?-Vi:Math.asin(t)}function os(){}function ls(t,e){t&&cs.hasOwnProperty(t.type)&&cs[t.type](t,e)}var hs={Feature:function(t,e){ls(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sUi?t+Math.round(-t/Gi)*Gi:t,e]}function As(t,e,i){return(t%=Gi)?e||i?xs(Cs(t),Ts(e,i)):Cs(t):e||i?Ts(e,i):Ss}function ks(t){return function(e,i){return[(e+=t)>Ui?e-Gi:e<-Ui?e+Gi:e,i]}}function Cs(t){var e=ks(t);return e.invert=ks(-t),e}function Ts(t,e){var i=Zi(t),s=es(t),n=Zi(e),r=es(e);function a(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*i+o*s;return[qi(l*n-c*r,o*i-h*s),as(c*n+l*r)]}return a.invert=function(t,e){var a=Zi(e),o=Zi(t)*a,l=es(t)*a,h=es(e),c=h*n-l*r;return[qi(l*n+h*r,o*i+c*s),as(c*i-o*s)]},a}function Ms(t,e){(e=fs(e))[0]-=t,bs(e);var i=rs(-e[1]);return((-e[2]<0?-i:i)+Gi-Ni)%Gi}function ws(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:os,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Es(t,e){return Ki(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 Rs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function zs(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 Hs(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ws(),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=zs(a);var t=function(t,e){var i=Ds(e),s=e[1],n=es(s),r=[es(i),-Zi(i),0],a=0,o=0;Ls.reset(),1===n?s=Vi+Ni:-1===n&&(s=-Vi-Ni);for(var l=0,h=t.length;l=0?1:-1,C=k*A,T=C>Ui,M=f*x;if(Ls.add(qi(M*k*es(C),m*S+M*Zi(C))),a+=T?A+k*Gi:A,T^p>=i^_>=i){var w=vs(fs(u),fs(y));bs(w);var E=vs(r,w);bs(E);var B=(T^A>=0?-1:1)*as(E[2]);(s>B||s===B&&(w[0]||w[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Ni||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(js))}return u}}function js(t){return t.length>1}function Ns(t,e){return((t=t.x)[0]<0?t[1]-Vi-Ni:Vi-t[1])-((e=e.x)[0]<0?e[1]-Vi-Ni:Vi-e[1])}1===(Is=Fs).length&&(Os=Is,Is=function(t,e){return Fs(Os(t),e)});var Us=Hs((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?Ui:-Ui,l=Ki(r-i);Ki(l-Ui)0?Vi:-Vi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Ui&&(Ki(i-n)Ni?$i((es(e)*(r=Zi(s))*es(i)-es(s)*(n=Zi(e))*es(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*Vi,s.point(-Ui,n),s.point(0,n),s.point(Ui,n),s.point(Ui,0),s.point(Ui,-n),s.point(0,-n),s.point(-Ui,-n),s.point(-Ui,0),s.point(-Ui,n);else if(Ki(t[0]-e[0])>Ni){var r=t[0]0,n=Ki(e)>Ni;function r(t,i){return Zi(t)*Zi(i)>e}function a(t,i,s){var n=[1,0,0],r=vs(fs(t),fs(i)),a=ms(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=vs(n,r),u=_s(n,h);ys(u,_s(r,c));var p=d,g=ms(u,p),f=ms(p,p),m=g*g-f*(ms(u,u)-1);if(!(m<0)){var v=ss(m),y=_s(p,(-g-v)/f);if(ys(y,u),y=gs(y),!s)return y;var _,b=t[0],x=i[0],S=t[1],A=i[1];x0^y[1]<(Ki(y[0]-b)Ui^(b<=y[0]&&y[0]<=x)){var T=_s(p,(-g+v)/f);return ys(T,u),[y,gs(T)]}}}function o(e,i){var n=s?t:Ui-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Hs(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?Ui:-Ui),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Es(e,p)||Es(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&&Es(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=Zi(e),o=es(e),l=s*i;null==n?(n=e+s*Gi,r=e-l/2):(n=Ms(a,n),r=Ms(a,r),(s>0?nr)&&(n+=s*Gi));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 Ki(s[0]-t)0?0:3:Ki(s[0]-i)0?2:1:Ki(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=ws(),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=zs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ps(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(Gs,Math.min(Ws,g)),f=Math.max(Gs,Math.min(Ws,f))],b=[r=Math.max(Gs,Math.min(Ws,r)),a=Math.max(Gs,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&&(_.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 Xs(t){return t}var Ks,$s,qs,Zs,Js=Fi(),Qs=Fi(),tn={point:os,lineStart:os,lineEnd:os,polygonStart:function(){tn.lineStart=en,tn.lineEnd=rn},polygonEnd:function(){tn.lineStart=tn.lineEnd=tn.point=os,Js.add(Ki(Qs)),Qs.reset()},result:function(){var t=Js/2;return Js.reset(),t}};function en(){tn.point=sn}function sn(t,e){tn.point=nn,Ks=qs=t,$s=Zs=e}function nn(t,e){Qs.add(Zs*t-qs*e),qs=t,Zs=e}function rn(){nn(Ks,$s)}var an=tn,on=1/0,ln=on,hn=-on,cn=hn;var dn,un,pn,gn,fn={point:function(t,e){thn&&(hn=t);ecn&&(cn=e)},lineStart:os,lineEnd:os,polygonStart:os,polygonEnd:os,result:function(){var t=[[on,ln],[hn,cn]];return hn=cn=-(ln=on=1/0),t}},mn=0,vn=0,yn=0,_n=0,bn=0,xn=0,Sn=0,An=0,kn=0,Cn={point:Tn,lineStart:Mn,lineEnd:Bn,polygonStart:function(){Cn.lineStart=Pn,Cn.lineEnd=Rn},polygonEnd:function(){Cn.point=Tn,Cn.lineStart=Mn,Cn.lineEnd=Bn},result:function(){var t=kn?[Sn/kn,An/kn]:xn?[_n/xn,bn/xn]:yn?[mn/yn,vn/yn]:[NaN,NaN];return mn=vn=yn=_n=bn=xn=Sn=An=kn=0,t}};function Tn(t,e){mn+=t,vn+=e,++yn}function Mn(){Cn.point=wn}function wn(t,e){Cn.point=En,Tn(pn=t,gn=e)}function En(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Tn(pn=t,gn=e)}function Bn(){Cn.point=Tn}function Pn(){Cn.point=In}function Rn(){On(dn,un)}function In(t,e){Cn.point=On,Tn(dn=pn=t,un=gn=e)}function On(t,e){var i=t-pn,s=e-gn,n=ss(i*i+s*s);_n+=n*(pn+t)/2,bn+=n*(gn+e)/2,xn+=n,Sn+=(n=gn*t-pn*e)*(pn+t),An+=n*(gn+e),kn+=3*n,Tn(pn=t,gn=e)}var Ln=Cn;function Dn(t){this._context=t}Dn.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,Gi)}},result:os};var Fn,zn,Hn,jn,Nn,Un=Fi(),Vn={point:os,lineStart:function(){Vn.point=Wn},lineEnd:function(){Fn&&Gn(zn,Hn),Vn.point=os},polygonStart:function(){Fn=!0},polygonEnd:function(){Fn=null},result:function(){var t=+Un;return Un.reset(),t}};function Wn(t,e){Vn.point=Gn,zn=jn=t,Hn=Nn=e}function Gn(t,e){jn-=t,Nn-=e,Un.add(ss(jn*jn+Nn*Nn)),jn=t,Nn=e}var Yn=Vn;function Xn(){this._string=[]}function Kn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function $n(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ps(t,i(s))),s.result()}return r.area=function(t){return ps(t,i(an)),an.result()},r.measure=function(t){return ps(t,i(Yn)),Yn.result()},r.bounds=function(t){return ps(t,i(fn)),fn.result()},r.centroid=function(t){return ps(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Xs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Xn):new Dn(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 qn(t){return function(e){var i=new Zn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Zn(){}function Jn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ps(i,t.stream(fn)),e(fn.result()),null!=s&&t.clipExtent(s),t}function Qn(t,e,i){return Jn(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 tr(t,e,i){return Qn(t,[[0,0],e],i)}function er(t,e,i){return Jn(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 ir(t,e,i){return Jn(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)}Xn.prototype={_radius:4.5,_circle:Kn(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=Kn(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}},Zn.prototype={constructor:Zn,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 sr=16,nr=Zi(30*Xi);function rr(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=ss(b*b+x*x+S*S),k=as(S/=A),C=Ki(Ki(S)-1)e||Ki((v*E+y*B)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Xi:0,E()):[m*Yi,v*Yi,y*Yi]},M.angle=function(t){return arguments.length?(_=t%360*Xi,E()):_*Yi},M.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},M.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},M.precision=function(t){return arguments.length?(a=rr(o,T=t*t),B()):ss(T)},M.fitExtent=function(t,e){return Qn(M,t,e)},M.fitSize=function(t,e){return tr(M,t,e)},M.fitWidth=function(t,e){return er(M,t,e)},M.fitHeight=function(t,e){return ir(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,E()}}function dr(t){var e=0,i=Ui/3,s=cr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Xi,i=t[1]*Xi):[e*Yi,i*Yi]},n}function ur(t,e){var i=es(t),s=(i+es(e))/2;if(Ki(s)2?t[2]*Xi:0),e.invert=function(e){return(e=t.invert(e[0]*Xi,e[1]*Xi))[0]*=Yi,e[1]*=Yi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===_r?[[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 xr(t){return ns((Vi+t)/2)}function Sr(t,e){var i=Zi(t),s=t===e?es(t):Qi(i/Zi(e))/Qi(xr(e)/xr(t)),n=i*ts(xr(t),s)/s;if(!s)return _r;function r(t,e){n>0?e<-Vi+Ni&&(e=-Vi+Ni):e>Vi-Ni&&(e=Vi-Ni);var i=n/ts(xr(e),s);return[i*es(s*t),n-i*Zi(s*t)]}return r.invert=function(t,e){var i=n-e,r=is(s)*ss(t*t+i*i),a=qi(t,Ki(i))*is(i);return i*s<0&&(a-=Ui*is(t)*is(i)),[a/s,2*$i(ts(n/r,1/s))-Vi]},r}function Ar(t,e){return[t,e]}function kr(t,e){var i=Zi(t),s=t===e?es(t):(i-Zi(e))/(e-t),n=i/s+t;if(Ki(s)Ni&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Ir.invert=mr(as),Or.invert=mr((function(t){return 2*$i(t)})),Lr.invert=function(t,e){return[-e,2*$i(Ji(t))-Vi]};var zr={exports:{}},Hr=function(t,e){this.p1=t,this.p2=e};Hr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Hr.prototype.run=function(){return this.p2[0]-this.p1[0]},Hr.prototype.slope=function(){return this.rise()/this.run()},Hr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Hr.prototype.isVertical=function(){return!isFinite(this.slope())},Hr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Hr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Hr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Hr.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)},Hr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var jr=Hr,Nr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new jr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Nr(t.slice(0,s),e),o=Nr(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},Ur=Nr;!function(t){var e=Ur;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r{const i=Wr(Xr,e),{tolerance:s}=i;return Vr(t,s)};var $r;!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"}($r||($r={}));const qr=(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a},Zr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(l.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),_(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let C=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/C:0,T.push(y[t])}return T},Qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",C=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],M=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],w=M.length?M:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:C,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:w});if(!T.length)return Jr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...M,...T];return Jr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},ta=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},C=null!==(n=k.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",M=null!==(o=k.mean)&&void 0!==o?o:"mean",w=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",R=null!==(p=k.min)&&void 0!==p?p:"min",I=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(y=k.values)&&void 0!==y?y:"values",z=new Map,H=new Map,j=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&H.set(r,[]),_(x)?j.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):j.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=H.get(r);t&&t.push(i)}}_(S)&&(S=[yt(Math.min.apply(null,S),0,1),yt(Math.max.apply(null,S),0,1)]);const U=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=j.get(t);if(null!==C)f[C]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[M]=o,f[w]=l,f[E]=h,f[B]=c,f[P]=d,f[R]=n,f[I]=r,f[O]=u,f[L]=p,f[D]=g,A&&(f[F]=H.get(t)||[]),U.push(f)}return U};var ea={},ia={};function sa(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function na(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ra(t,e){var i=t+"",s=i.length;return s9999?"+"+ra(e,6):ra(e,4))+"-"+ra(t.getUTCMonth()+1,2)+"-"+ra(t.getUTCDate(),2)+(r?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"."+ra(r,3)+"Z":n?"T"+ra(i,2)+":"+ra(s,2)+":"+ra(n,2)+"Z":s||i?"T"+ra(i,2)+":"+ra(s,2)+"Z":"")}function oa(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 ia;if(h)return h=!1,ea;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a{i.type=$r.DSV;const s=Wr(ca,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return oa(n).parse(t)},ua=(t,e={},i)=>(i.type=$r.DSV,la(t)),pa=(t,e={},i)=>(i.type=$r.DSV,ha(t));function ga(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return fa(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 fa(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return va(t);default:throw new Error("unknown GeoJSON type")}}function fa(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=ma(t.properties),e.geometry=va(t.geometry),e}function ma(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]=ma(s):e[i]=s})),e):e}function va(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return va(t)})),e):(e.coordinates=ya(t.coordinates),e)}function ya(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return ya(t)}))}function _a(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 ba(t){for(var e,i,s=_a(t),n=0,r=1;r0}function xa(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=ga(t));var r=[];switch(t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,s)})),t;case"FeatureCollection":return xa(t,(function(t){xa(ka(t,s),(function(t){r.push(t)}))})),di(r)}return ka(t,s)}function ka(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Sa(t,(function(t){ka(t,e)})),t;case"LineString":return Ca(_a(t),e),t;case"Polygon":return Ta(_a(t),e),t;case"MultiLineString":return _a(t).forEach((function(t){Ca(t,e)})),t;case"MultiPolygon":return _a(t).forEach((function(t){Ta(t,e)})),t;case"Point":case"MultiPoint":return t}}function Ca(t,e){ba(t)===e&&t.reverse()}function Ta(t,e){ba(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Pa=(t,e={},i)=>{i.type=$r.GEO;const s=Wr(Ea,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Ba(t))})):e.push(Ba(t))})),e})(t);let l=t.features;return o&&(l=Aa(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=wa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=wa.bounds(t);t.bbox=e}})),t.features=l,t},Ra={},Ia=(t,e,i)=>{i.type=$r.GEO;const s=Wr(Ea,Ra,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 Fr(a,t)}))}:Fr(a,o));var a,o;return Pa(r,s,i)},Oa=(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 La=0;function Da(t="dataset"){return La>1e8&&(La=0),t+"_"+La++}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:Da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}class za{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&V(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Da("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t,e=!0){if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&V(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof za||!0!==(null==e?void 0:e.clone)||(i=!0),i?L(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?H({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Zr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}$n();const Ha={},ja={albers:gr,albersusa:function(){var t,e,i,s,n,r,a=gr(),o=pr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=pr().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)}},Na=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ua(t,e){return function i(){const s=e();return s.type=t,s.path=$n().projection(s),s.copy=s.copy||function(){const t=i();return Na.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Va{static GenAutoIncrementId(){return Va.auto_increment_id++}}Va.auto_increment_id=0;var Wa=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Ga 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=Va.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}onParentSharedStateTreeChanged(t,e){}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Wa(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Ja(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 Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Za.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Ja(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(Ja(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,Ja(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ka))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Ja(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 $a))return void ot.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Za.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||(this.eventPool.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),this.eventPool.set(i,[])),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Qa(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Ka,this.rootWheelEvent=new $a,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.addEventListener("pointermove",this.onPointerMove,!0),t.addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.addEventListener("mousemove",this.onPointerMove,!0),t.addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.removeEventListener("pointermove",this.onPointerMove,!0),t.removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}const so=Nt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,fo;function mo(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;tfo){let t,e=uo;for(let s=1,r=i.length;s1&&(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 C=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),M=Math.atan2(b-T,_-C);let w=Math.atan2(S-T,x-C)-M;w<0&&1===r?w+=Nt:w>0&&0===r&&(w-=Nt);const E=Math.ceil(Math.abs(w/(jt+.001))),B=[];for(let t=0;t{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;ee.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 wo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Fo(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Xt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Ho(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new jo(i,n),new jo(n,s)]}class jo extends Eo{constructor(t,e){super(),this.type=xo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p1.x):t===bo.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class No{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new jo(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===bo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===bo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Uo extends No{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Vo(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Wo(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?bo.ROW:bo.COLUMN;return"monotoneY"===t?new Uo(t,s):new No(t,s)}class Go{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,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return Xo(new Go(n,s),t),n}function Xo(t,e){return Vo(t,e,1)}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 $o{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&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 qo(t,e){return Vo(t,e,2)}function Zo(t,e={}){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 qo(new $o(n,s),t),n}function Jo(t){return t<0?-1:1}function Qo(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(Jo(r)+Jo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function tl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function el(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 il{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:el(this,this._t0,tl(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,el(this,tl(this,e=Qo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:el(this,this._t0,e=Qo(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 sl extends il{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function nl(t,e){return Vo(t,e,2)}function rl(t,e={}){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 nl(new il(n,s),t),n}function al(t,e){return Vo(t,e,2)}function ol(t,e={}){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 al(new sl(n,s),t),n}let ll=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class hl extends ll{lineEnd(){this.context.closePath()}}function cl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new ll(r,e,n),t),r}function dl(t,e){return Vo(t,e,1)}function ul(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new No("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?bo.ROW:bo.COLUMN);return dl(new hl(r,e,n),t),r}class pl extends Go{lineEnd(){this.context.closePath()}}function gl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Wo("linear",i,t);return fl(new pl(n,s),t),n}function fl(t,e){return Vo(t,e,1)}function ml(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function vl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Yo(i,n);const o=Wo(t,r,i);return Vo(new e(o,s,a),i,2),o}}const yl=vl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const _l=vl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:ml(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class bl extends Eo{constructor(t,e,i){super(),this.type=xo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Lo(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Do(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===bo.ROW?Vt(this.p0.x-this.p2.x):t===bo.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=Xt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Lo(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new bl(i,a,r),new bl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class xl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new jo(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new bl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new zo(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Sl(t,e,i){var s,n;switch(e){case"linear":default:return Yo(t,i);case"basis":return Zo(t,i);case"monotoneX":return rl(t,i);case"monotoneY":return ol(t,i);case"step":return cl(t,.5,i);case"stepClosed":return ul(t,.5,i);case"stepBefore":return cl(t,0,i);case"stepAfter":return cl(t,1,i);case"catmullRom":return yl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return _l(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return gl(t,i)}}class Al extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.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([lo.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([lo.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([lo.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([lo.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([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new xl(this);wo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6];To(e,r,a,i,s,n,n,o);let l="";for(let t=0;t`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.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=mo(t);return this._runCommandStrList(r,e,i,s,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:s}=t.attribute;if(!e)return;const n=Sl(e,i);"x"===s?this.direction=bo.ROW:"y"===s?this.direction=bo.COLUMN:"auto"===s&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,s,n){return this.clear(),this._runCommandList(t.commandList,e,i,s,n),this._updateBounds(),this}transform(t,e,i,s){const n=this.commandList;if(!this.transformCbList){const t=[];t[lo.M]=this.moveToTransform,t[lo.L]=this.lineToTransform,t[lo.Q]=this.quadraticCurveToTransform,t[lo.C]=this.bezierCurveToTransform,t[lo.AT]=this.arcToTransform,t[lo.E]=this.ellipseTransform,t[lo.R]=this.rectTransform,t[lo.A]=this.arcTransform,t[lo.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),wo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===bo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===bo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),$l=Object.assign(Object.assign({},Nl),{points:[],cornerRadius:0,closePath:!0}),ql=Object.assign(Object.assign({},Nl),{width:100,height:100,spikes:5,thickness:.5}),Zl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Jl=Object.assign(Object.assign({},Nl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1}),Ql=Object.assign(Object.assign({},Nl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),th=Object.assign(Object.assign(Object.assign({},Nl),Dl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),eh=Object.assign(Object.assign(Object.assign({},Nl),Dl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ih=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",imageMode:void 0,image:"",width:0,height:0,maxWidth:500,maxHeight:500,imagePosition:"top-left",imageScale:1,imageOffsetX:0,imageOffsetY:0},Nl),{fill:!0,cornerRadius:0,cornerType:"round"}),sh=Object.assign(Object.assign({},ih),{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});class nh{}const rh=Symbol.for("@visactor/vrender-core/application-state");function ah(){const t=globalThis;return t[rh]||(t[rh]={application:new nh}),t[rh]}const oh=ah().application;class lh{static GetImage(t,e){var i;const s=lh.cache.get(t);s?"fail"===s.loadState?oh.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):lh.loadImage(t,e)}static GetSvg(t,e){var i;let s=lh.cache.get(t);s?"fail"===s.loadState?oh.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"},lh.cache.set(t,s),s.dataPromise=oh.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])})).catch((()=>{var e;s.loadState="fail",null===(e=s.waitingMark)||void 0===e||e.map((e=>{e.imageLoadFail(t)})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=lh.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},lh.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oh.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oh.global.loadBlob(t):"json"===e&&(i.dataPromise=oh.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!lh.isLoading&&lh.toLoadAueue.length){lh.isLoading=!0;const t=lh.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(lh.cache.set(i,n),n.dataPromise=oh.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()})).catch((t=>{console.error(t),lh.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),lh.loading()}))}}),0)}static loadImage(t,e){const i=hh(t,lh.toLoadAueue);if(-1!==i)return lh.toLoadAueue[i].marks.push(e),void lh.loading();lh.toLoadAueue.push({url:t,marks:[e]}),lh.loading()}static improveImageLoading(t){const e=hh(t,lh.toLoadAueue);if(-1!==e){const t=lh.toLoadAueue.splice(e,1);lh.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function hh(t,e){for(let i=0;i{var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)dh[s]=t,i&&(i=!(null!==(e=dh[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)dh[e]=!!t[e],i&&(i=!!dh[e]);else dh[0]=!1,dh[1]=!1,dh[2]=!1,dh[3]=!1;return{isFullStroke:i,stroke:dh}},ph=[0,0,0,0],gh=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ph[0]=t[0],ph[2]=t[0],ph[1]=t[1],ph[3]=t[1],ph):t:t:0,fh=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],mh=[1,2,3,0,1,2,3,0];function vh(t,e,i,s){for(;t>=Ut;)t-=Ut;for(;t<0;)t+=Ut;for(;t>e;)e+=Ut;fh[0].x=i,fh[1].y=i,fh[2].x=-i,fh[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Gt(t)*i,Kt(t)*i),s.add(Gt(e)*i,Kt(e)*i),n!==r||e-t>Ht){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Sh.TimeOut=1e3/60;const Ah=new Sh,kh=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ch=(t,e)=>{const i=kh(t,e);return isNaN(i)?i:Math.max(e,i)};class Th{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Mh(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var wh=new class extends Th{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 Mh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mh(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Eh=new class extends Th{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Bh(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 Ph=new class extends Th{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 Bh(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Bh(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Bh(t,this.parseSize(e)/2+n,i,s,r)}};function Rh(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Ih=new class extends Th{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Rh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rh(t,this.parseSize(e)/2+n,i,s)}};function Oh(t,e,i,s,n=0){return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Lh extends Th{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 Oh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Oh(t,this.parseSize(e)/2,i,s,n)}}var Dh=new Lh;var Fh=new class extends Lh{constructor(){super(...arguments),this.type="triangle"}};const zh=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Hh=Math.sin(Nt/10)*zh,jh=-Math.cos(Nt/10)*zh;function Nh(t,e,i,s){const n=Hh*e,r=jh*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Uh=new class extends Th{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 Nh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nh(t,this.parseSize(e)/2+n,i,s)}};const Vh=$t(3);function Wh(t,e,i,s){const n=e,r=n/Vh,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 Gh=new class extends Th{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 Wh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wh(t,this.parseSize(e)/2+n,i,s)}};function Yh(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 Xh=new class extends Th{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Yh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Yh(t,this.parseSize(e)/2+n,i,s)}};function Kh(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var $h=new class extends Th{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Kh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kh(t,this.parseSize(e)/2+n,i,s)}};const qh=-.5,Zh=$t(3)/2,Jh=1/$t(12);function Qh(t,e,i,s){const n=e/2,r=e*Jh,a=n,o=e*Jh+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(qh*n-Zh*r+i,Zh*n+qh*r+s),t.lineTo(qh*a-Zh*o+i,Zh*a+qh*o+s),t.lineTo(qh*l-Zh*h+i,Zh*l+qh*h+s),t.lineTo(qh*n+Zh*r+i,qh*r-Zh*n+s),t.lineTo(qh*a+Zh*o+i,qh*o-Zh*a+s),t.lineTo(qh*l+Zh*h+i,qh*h-Zh*l+s),t.closePath(),!1}var tc=new class extends Th{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 Qh(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qh(t,this.parseSize(e)/2+n,i,s)}};function ec(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var ic=new class extends Th{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 ec(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ec(t,this.parseSize(e)/2,i,s,n)}};function sc(t,e,i,s,n=0){return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var nc=new class extends Th{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 sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return sc(t,this.parseSize(e)/2,i,s,n)}};function rc(t,e,i,s,n=0){return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ac=new class extends Th{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 rc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rc(t,this.parseSize(e)/2,i,s,n)}};const oc=$t(3);function lc(t,e,i,s){const n=e*oc;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var hc=new class extends Th{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return lc(t,this.parseSize(e)/2/oc,i,s)}drawOffset(t,e,i,s,n){return lc(t,this.parseSize(e)/2/oc+n,i,s)}};function cc(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 dc=new class extends Th{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 cc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cc(t,this.parseSize(e)/4+n,i,s)}};function uc(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 pc=new class extends Th{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 uc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uc(t,this.parseSize(e)/4+n,i,s)}};function gc(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 fc=new class extends Th{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 gc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return gc(t,this.parseSize(e)/4+n,i,s)}};function mc(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 vc=new class extends Th{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 mc(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mc(t,this.parseSize(e)/4+n,i,s)}};function yc(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var _c=new class extends Th{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return yc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function bc(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var xc=new class extends Th{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return bc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Sc(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 Ac=new class extends Th{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 Sc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Sc(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function kc(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Cc(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Tc=new class extends Th{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)?Cc(t,e,i,s):kc(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Cc(t,e+2*n,i,s):kc(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Mc=new Ve;class wc{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),wo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(wo(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Mc.x1=i.bounds.x1*t,Mc.y1=i.bounds.y1*t,Mc.x2=i.bounds.x2*t,Mc.y2=i.bounds.y2*t,e.union(Mc)}))}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 Ec=[wh,Eh,Ph,Ih,hc,Fh,Uh,Gh,Xh,$h,tc,ic,nc,Dh,ac,dc,pc,fc,vc,Tc,_c,xc,Ac],Bc={};Ec.forEach((t=>{Bc[t.type]=t}));const Pc={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Rc{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 Ic(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Oc(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Oc(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Ic(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Oc(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 Rc(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 Rc(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 Fc(t,e){return zc(t)}function zc(t,e){const i={};for(let e=0;eqc.set(t,!0)));const Zc=new Map;function Jc(t){if(qc.has(t))return!0;if(Zc.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function Qc(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Zc.set(t,!0)));const td=Xc(),ed=Xc(),id=Xc(),sd=Xc(),nd=Xc(),rd=Xc(),ad=Xc(),od=Xc(),ld=Xc(),hd=Xc(),cd=Xc(),dd=Xc(),ud=Xc(),pd=Xc(),gd=Xc(),fd=Xc(),md=Xc(),vd=Symbol.for("GraphicService"),yd=Symbol.for("GraphicCreator"),_d={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},bd=Object.keys(_d),xd={"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"},Sd=Object.keys(xd),Ad={duration:200,easing:"cubicOut"},kd=Symbol.for("CanvasFactory"),Cd=Symbol.for("Context2dFactory");function Td(t){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.canvasFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`CanvasFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t)}const Md=1e-4,wd=Math.sqrt(3),Ed=1/3;function Bd(t){return t>-Wd&&tWd||t<-Wd}function Rd(t){return"number"==typeof t&&Number.isFinite(t)}const Id=[0,0],Od=[0,0],Ld=[0,0];function Dd(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Fd(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function zd(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 Hd(t){return(t%=Ut)<0&&(t+=Ut),t}function jd(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+=Ut);let d=Math.atan2(l,o);return d<0&&(d+=Ut),d>=s&&d<=n||d+Ut>=s&&d+Ut<=n}function Vd(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(Bd(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 Yd=[-1,-1,-1],Xd=[-1,-1];function Kd(){const t=Xd[0];Xd[0]=Xd[1],Xd[1]=t}function $d(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(Bd(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,Ed):Math.pow(i,Ed),s=s<0?-Math.pow(-s,Ed):Math.pow(s,Ed);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+wd*Math.sin(e)))/(3*a),h=(-o+i*(s-wd*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,Yd);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Kd(),p=zd(e,s,r,o,Xd[0]),u>1&&(g=zd(e,s,r,o,Xd[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Bd(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,Yd);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=Fd(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Yd[0]=-l,Yd[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ut-1e-4){s=0,n=Ut;const e=r?1:-1;return a>=Yd[0]+t&&a<=Yd[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ut,n+=Ut);let c=0;for(let e=0;e<2;e++){const i=Yd[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ut+t),(t>=s&&t<=n||t+Ut>=s&&t+Ut<=n)&&(t>Ht/2&&t<1.5*Ht&&(e=-e),c+=e)}}return c}function Jd(t){return Math.round(t/Ht*1e8)/1e8%2*Ht}function Qd(t,e){let i=Jd(t[0]);i<0&&(i+=Ut);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ut?n=i+Ut:e&&i-n>=Ut?n=i-Ut:!e&&i>n?n=i+(Ut-Jd(i-n)):e&&i1&&(i||(h+=Ie(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;tu[0]=S,tu[1]=A,Qd(tu,Boolean(a[6])),S=tu[0],A=tu[1];const k=S,C=A-S,T=!!(1-(a[6]?0:1)),M=(s-m)*y/y+m;switch(f){case lo.M:u=m,p=v,c=u,d=p;break;case lo.L:if(i){if(Vd(c,d,m,v,e,s,n))return!0}else h+=Ie(c,d,m,v,s,n)||0;c=m,d=v;break;case lo.C:if(i){if(Nd(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=$d(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(jd(c,d,m,v,y,_,e,s,n))return!0}else h+=qd(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case lo.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Ie(c,d,o,l,s,n),i){if(Ud(m,v,y,k,k+C,T,e,M,n))return!0}else h+=Zd(m,v,y,k,k+C,T,M,n);c=Math.cos(k+C)*y+m,d=Math.sin(k+C)*y+v;break;case lo.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(Vd(u,p,o,p,e,s,n)||Vd(o,p,o,l,e,s,n)||Vd(o,l,u,l,e,s,n)||Vd(u,l,u,p,e,s,n))return!0}else h+=Ie(o,p,o,l,s,n),h+=Ie(u,l,u,p,s,n);break;case lo.Z:if(i){if(Vd(c,d,u,p,e,s,n))return!0}else h+=Ie(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)0&&i("Invalid input not EOF"),t}()}}();class su{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(su.IsGradientStr(t))try{const e=iu(t)[0];if(e){if("linear"===e.type)return su.ParseLinear(e);if("radial"===e.type)return su.ParseRadial(e);if("conic"===e.type)return su.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2,n=parseFloat(e.value)/180*Ht-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ut,stops:su.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:su.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ht/2;let n="angular"===e.type?parseFloat(e.value)/180*Ht:0;for(;n<0;)n+=Ut;for(;n>=Ut;)n-=Ut;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}function au(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ou(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];return 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}function lu(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];return 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}function hu(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];return 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,t}function cu(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 du(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 uu(t,e,i){const s=i[0],n=i[1],r=i[2];return 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}function pu(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 gu(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];return Math.abs(g-b)0&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Cu),function(t,e,i){return eu(t,0,!1,e,i)}(this.path.commandList,Cu.x,Cu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Cu);const i=nu(this,this.lineWidth,this.dpr);return function(t,e,i,s){return eu(t,e,!0,i,s)}(this.path.commandList,i,Cu.x,Cu.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(ku,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}const Mu={WIDTH:500,HEIGHT:500,DPR:1};class wu{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}set nativeCanvas(t){this._nativeCanvas=t}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Mu.WIDTH,height:n=Mu.HEIGHT,dpr:r=Mu.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Eu;wu.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Eu||(Eu={}));class Bu{static Get(t,e=Eu.Color1,i=[0,0,0,1]){if(e===Eu.Color1){const e=Bu.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=si.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Bu.store1[t]=e,Bu.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=Bu.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=si.parseColorString(t);return n&&(Bu.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Bu.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===Eu.Color1){if(Bu.store1[t])return;Bu.store1[t]=i,Bu.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Bu.store255[t])return;Bu.store255[t]=i,Bu.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Pu(t,e=!1){return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Ru(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return Iu(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Iu(t,e,i,s,n)}function Iu(t,e,i,s,n){if(!t||!e)return t&&Pu(t)||e&&Pu(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Bu.Get(t,Eu.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Bu.Get(e,Eu.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:Pu(a)})))});return o?Ru(r,l,i,s,n):Ru(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 Ou(s,n,i);if("radial"===s.gradient)return Lu(s,n,i);if("conical"===s.gradient)return Du(s,n,i)}return!1}return n&&n(r,a),Pu(Fu(r,a,i),s)}function Ou(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Lu(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Du(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:Nu(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}function Fu(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]}function zu(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Bu.store255={},Bu.store1={};const Hu=[0,0,0,0],ju=[0,0,0,0];function Nu(t,e,i){return Bu.Get(t,Eu.Color255,Hu),Bu.Get(e,Eu.Color255,ju),`rgba(${Math.round(Hu[0]+(ju[0]-Hu[0])*i)},${Math.round(Hu[1]+(ju[1]-Hu[1])*i)},${Math.round(Hu[2]+(ju[2]-Hu[2])*i)},${Hu[3]+(ju[3]-Hu[3])*i})`}class Uu{static GetCanvas(){try{return Uu.canvas||(Uu.canvas=oh.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 Vu extends Ye{static getInstance(){return Vu._instance||(Vu._instance=new Vu),Vu._instance}constructor(t=[],e=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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Vu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Wu{static GetSize(t){for(let e=0;e=t)return Wu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Wu.GenKey(t,e,i,s,n),l=Wu.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=Wu.GenKey(t,e,i,s,n);Wu.cache[l]?Wu.cache[l].push({width:a,height:o,pattern:r}):Wu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}function Gu(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Ut;for(;i>Ut;)i-=Ut;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),Ru(o.color,l.color,h,!1)}function Yu(t,e,i,s,n,r,a,o,l){const h=Math.floor(180*n/Math.PI),c=Uu.GetCanvas(),d=Uu.GetCtx();if(!d)return null;const u=Wu.GetSize(o),p=Wu.GetSize(l);let g=Wu.Get(e,i,s,r,a,u,p);if(g)return g;const f=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(s,2),Math.pow(u-i,2)+Math.pow(s,2)),Math.max(Math.pow(u-i,2)+Math.pow(p-s,2),Math.pow(i,2)+Math.pow(p-s,2)))),m=h+1,v=n/Math.max(1,m-1),y=Vu.getInstance().GetOrCreate(i,s,u,p,e,m),_=2*Math.PI*f/360;c.width=u,c.height=p,d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,u,p),d.translate(i,s),d.rotate(r);for(let t=0,e=m-1;ta);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&&Wu.Set(e,i,s,r,a,g,u,p),g}Wu.cache={},Wu.ImageSize=[20,40,80,160,320,640,1280,2560];const Xu=new Set(["name","patch","priority","exclude","suppress","resolver","declaredAffectedKeys"]);function Ku(t){return null==t?void 0:t}class $u{compile(t={}){const e=Object.keys(t).map((e=>[e,this.normalizeDefinition(e,t[e])])),i=e.map((([,t])=>t)).sort(((t,e)=>{var i,s;const n=null!==(i=t.priority)&&void 0!==i?i:0,r=null!==(s=e.priority)&&void 0!==s?s:0;return n!==r?n-r:t.name.localeCompare(e.name)})),s=new Map;i.forEach(((t,e)=>{s.set(t.name,e)}));const n=new Map;return e.forEach((([,t])=>{var e,i,r,a;const o=t.declaredAffectedKeys?new Set(Array.from(t.declaredAffectedKeys)):void 0,l=t.patch?new Set(Object.keys(t.patch)):new Set,h=new Set(l);null==o||o.forEach((t=>h.add(t))),n.set(t.name,{name:t.name,priority:null!==(e=t.priority)&&void 0!==e?e:0,rank:null!==(i=s.get(t.name))&&void 0!==i?i:0,patch:Ku(t.patch),resolver:t.resolver,declaredAffectedKeys:o,exclude:new Set(null!==(r=t.exclude)&&void 0!==r?r:[]),suppress:new Set(null!==(a=t.suppress)&&void 0!==a?a:[]),hasResolver:"function"==typeof t.resolver,affectedKeys:h})})),this.expandRelationClosure(n,"exclude"),this.expandRelationClosure(n,"suppress"),n}normalizeDefinition(t,e){var i,s;if(null==e)return{name:t,priority:0,patch:void 0};if((function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}(e)?Object.keys(e):[]).some((t=>Xu.has(t)))){const n=e;return{name:null!==(i=n.name)&&void 0!==i?i:t,priority:null!==(s=n.priority)&&void 0!==s?s:0,patch:Ku(n.patch),resolver:n.resolver,declaredAffectedKeys:n.declaredAffectedKeys,exclude:n.exclude,suppress:n.suppress}}return{name:t,priority:0,patch:e}}expandRelationClosure(t,e){const i=new Map;t.forEach(((t,s)=>{i.set(s,new Set(t[e]))})),t.forEach(((t,s)=>{const n=new Set,r=(t,e)=>{const a=i.get(t);a&&a.size&&a.forEach((t=>{t===s||e.has(t)||n.has(t)||(n.add(t),e.add(t),r(t,e),e.delete(t))}))};r(s,new Set([s])),t[e]=n}))}}function qu(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}function Zu(t){if(!qu(t))return t;const e={};return Object.keys(t).forEach((i=>{e[i]=Zu(t[i])})),e}function Ju(t,e){var i;const s=null!==(i=Zu(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];qu(n)&&qu(i)?s[t]=Ju(n,i):s[t]=Zu(i)})),s}class Qu{constructor(t){var e;this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache=new Map,this.resolverCacheKey="",this.resolverCacheValid=!1,this.baseAttributes={},this.compiledDefinitions=t.compiledDefinitions,this.stateSort=t.stateSort,this.mergeMode=null!==(e=t.mergeMode)&&void 0!==e?e:"shallow"}get activeStates(){return this._activeStates}get effectiveStates(){return this._effectiveStates}get resolvedPatch(){return this._resolvedPatch}get suppressed(){return this._suppressed}setResolveContext(t,e){this.graphic===t&&this.baseAttributes===e||this.invalidateResolverCache(),this.graphic=t,this.baseAttributes=e}applyStates(t){const e=Array.from(new Set(t)),i=this.sortStates(e),s=this.adjudicate(i),n=s.active,r=n.filter((t=>!s.suppressedSet.has(t))),a=n.filter((t=>s.suppressedSet.has(t))),o=!this.sameArray(this._activeStates,n)||!this.sameArray(this._effectiveStates,r)||!this.sameArray(this._suppressed,a);return this._activeStates=n,this._effectiveStates=r,this._suppressed=a,!o&&this.resolverCacheValid||this.recomputePatch(r),{changed:o,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}}addState(t,e){if(this._activeStates.includes(t)&&(e||1===this._activeStates.length))return{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]};const i=e&&this._activeStates.length?this._activeStates.concat([t]):[t];return this.applyStates(i)}removeState(t){if(!this._activeStates.length)return{changed:!1,activeStates:[],effectiveStates:[],suppressed:[]};const e=Array.isArray(t)?this._activeStates.filter((e=>!t.includes(e))):this._activeStates.filter((e=>e!==t));return e.length===this._activeStates.length?{changed:!1,activeStates:[...this._activeStates],effectiveStates:[...this._effectiveStates],suppressed:[...this._suppressed]}:this.applyStates(e)}toggleState(t){return this.hasState(t)?this.removeState(t):this.applyStates(this._activeStates.concat([t]))}clearStates(){const t=this._activeStates.length>0||this._effectiveStates.length>0||this._suppressed.length>0;return this._activeStates=[],this._effectiveStates=[],this._suppressed=[],this._resolvedPatch={},this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1,{changed:t,activeStates:[],effectiveStates:[],suppressed:[]}}invalidateResolverCache(){this.resolverPatchCache.clear(),this.resolverCacheKey="",this.resolverCacheValid=!1}hasState(t){return!!this._activeStates.length&&(null==t||this._activeStates.includes(t))}sortStates(t){const e=[],i=[];return t.forEach((t=>{this.compiledDefinitions.has(t)?e.push(t):i.push(t)})),e.sort(((t,e)=>{const i=this.compiledDefinitions.get(t),s=this.compiledDefinitions.get(e);return i&&s?i.priority!==s.priority?i.priority-s.priority:i.rank-s.rank:0})),this.stateSort&&i.length>1&&i.sort(this.stateSort),e.concat(i)}adjudicate(t){const e=t.slice(),i=new Set;for(let t=e.length-1;t>=0;t--){const s=e[t],n=this.compiledDefinitions.get(s);n&&(n.exclude.forEach((i=>{const s=e.indexOf(i);-1!==s&&(e.splice(s,1),s{i.add(t)})))}return{active:e,suppressedSet:i}}recomputePatch(t){const e=t.join(","),i={},s=this.resolverCacheValid&&this.resolverCacheKey===e;s||(this.resolverPatchCache.clear(),this.resolverCacheKey=e),t.forEach((t=>{var e;const n=this.compiledDefinitions.get(t);if(n&&(n.patch&&this.mergeInto(i,n.patch),n.hasResolver)){const r=s?this.resolverPatchCache.get(t):null===(e=n.resolver)||void 0===e?void 0:e.call(n,{graphic:this.graphic,activeStates:this._activeStates,effectiveStates:this._effectiveStates,baseAttributes:this.baseAttributes,resolvedPatch:i});r&&(s||this.resolverPatchCache.set(t,r),this.mergeInto(i,r))}})),s||(this.resolverCacheValid=!0),this._resolvedPatch=i}mergeInto(t,e){"deep"!==this.mergeMode?Object.keys(e).forEach((i=>{t[i]=Zu(e[i])})):Object.keys(e).forEach((i=>{var s;const n=e[i],r=t[i],a=null===(s=this.baseAttributes)||void 0===s?void 0:s[i];qu(r)&&qu(n)?t[i]=Ju(r,n):!qu(r)&&qu(a)&&qu(n)?t[i]=Ju(a,n):t[i]=Zu(n)}))}sameArray(t,e){if(t.length!==e.length)return!1;for(let i=0;i(null!=t&&!1!==t)!=(null!=e&&!1!==e)?tp.PAINT|tp.BOUNDS|tp.PICK:tp.PAINT,shadowBlur:(t,e)=>{const i=Number(null!=t?t:0),s=Number(null!=e?e:0);return i!==s&&(i>0||s>0)?tp.PAINT|tp.BOUNDS:tp.PAINT}};class sp{analyzeTransition(t,e,i={}){var s,n;const r={targetAttrs:Object.assign({},t),animateAttrs:{},noAnimateAttrs:{}};if(!e)return r;const a=Object.assign(Object.assign({},null!==(s=i.noWorkAnimateAttr)&&void 0!==s?s:{}),function(t){return t?Array.isArray(t)?t.reduce(((t,e)=>(t[e]=1,t)),{}):Object.keys(t).reduce(((e,i)=>(t[i]&&(e[i]=1),e)),{}):{}}(null===(n=i.animateConfig)||void 0===n?void 0:n.noAnimateAttrs)),o=!0===i.isClear,l=i.getDefaultAttribute,h=i.shouldSkipDefaultAttribute,c=(e,i)=>{if(a[e])r.noAnimateAttrs[e]=i;else if(o&&void 0===i){if(null==h?void 0:h(e,t))return;r.animateAttrs[e]=l(e)}else r.animateAttrs[e]=i};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&c(e,t[e]);const d=i.extraAnimateAttrs;if(d)for(const e in d){const i=Object.prototype.hasOwnProperty.call(t,e);!Object.prototype.hasOwnProperty.call(d,e)||i&&void 0!==t[e]||c(e,d[e])}return r}applyTransition(t,e,i,s={}){var n,r,a;if(i){const i=null!==(n=s.animateConfig)&&void 0!==n?n:Ad;null===(r=t.applyAnimationState)||void 0===r||r.call(t,["state"],[{name:"state",animation:{type:"state",to:e.animateAttrs,duration:i.duration,easing:i.easing}}]),a=e.noAnimateAttrs,Object.keys(a).length>0&&t.setAttributesAndPreventAnimate(e.noAnimateAttrs,!1,{type:_o.STATE})}else t.stopStateAnimates(),t.setAttributesAndPreventAnimate(e.targetAttrs,!1,{type:_o.STATE});return t.finalAttribute&&Object.assign(t.finalAttribute,e.targetAttrs),t._emitCustomEvent("afterStateUpdate",{type:_o.STATE}),e}applyClearTransition(t,e,i,s={}){var n;const r=this.analyzeTransition(e,i,{noWorkAnimateAttr:t.getNoWorkAnimateAttr(),isClear:!0,getDefaultAttribute:t.getDefaultAttribute.bind(t),shouldSkipDefaultAttribute:null!==(n=s.shouldSkipDefaultAttribute)&&void 0!==n?n:t.shouldSkipStateTransitionDefaultAttribute.bind(t),animateConfig:s.animateConfig,extraAnimateAttrs:s.extraAnimateAttrs});return this.applyTransition(t,r,i,s)}}const np=new $u;function rp(t,e){return t.localStateDefinitions!==e&&(t.localStateDefinitions=e,ap(t),!0)}function ap(t,e=t.revision+1){var i;const s=(n=t.parentScope,r=t.localStateDefinitions,a=t.themeStateDefinitions,Object.assign({},n?n.effectiveSourceDefinitions:a,r));var n,r,a;return t.effectiveSourceDefinitions=s,t.effectiveCompiledDefinitions=np.compile(s),t.parentRevisionAtBuild=null===(i=t.parentScope)||void 0===i?void 0:i.revision,t.revision=e,t.dirty=!1,t}function op(t){if(t)return t.parentScope&&op(t.parentScope),(t.dirty||t.parentScope&&t.parentRevisionAtBuild!==t.parentScope.revision)&&ap(t),t}function lp(t){t&&"released"!==t.releaseStatus&&t.renderNextFrame()}function hp(t,e){var i;t&&(null!==(i=t._pendingSharedStateRefreshGraphics)&&void 0!==i?i:t._pendingSharedStateRefreshGraphics=new Set).add(e)}function cp(t,e){t.subtreeActiveDescendants.size&&(t.subtreeActiveDescendants.forEach((i=>{var s;i.sharedStateDirty=!0,hp(null!==(s=null!=e?e:i.stage)&&void 0!==s?s:t.ownerStage,i)})),lp(null!=e?e:t.ownerStage))}const dp=new Ve,up=new Ge,pp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],gp=["x","y"],fp=["scaleX","scaleY"],mp=["angle"],vp=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid","wave"]),yp=new re,_p=[],bp=tp.PAINT|tp.SHAPE|tp.BOUNDS|tp.TRANSFORM|tp.LAYOUT;function xp(t){return"object"==typeof t&&null!=t&&!Array.isArray(t)}function Sp(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Sp(s):s})),i}function Ap(t,e){return t===e||!!(xp(t)||xp(e)||Array.isArray(t)||Array.isArray(e))&&V(t,e)}function kp(t,e){var i;const s=null!==(i=Sp(t))&&void 0!==i?i:{};return Object.keys(e).forEach((t=>{const i=e[t],n=s[t];xp(n)&&xp(i)?s[t]=kp(n,i):s[t]=Sp(i)})),s}const Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Tp extends Ga{static mixin(t){const e=Object.keys(t);for(let i=0;i{t.subtreeActiveDescendants.delete(this)})),e.clear()),void(this.registeredActiveScopes=void 0);const i=new Set(function(t){const e=[];let i=t;for(;i;)e.push(i),i=i.parentScope;return e}(this.boundSharedStateScope));null==e||e.forEach((t=>{i.has(t)||t.subtreeActiveDescendants.delete(this)})),i.forEach((t=>{t.subtreeActiveDescendants.add(this)})),this.registeredActiveScopes=i}clearSharedStateActiveRegistrations(){const t=this.registeredActiveScopes;t&&(t.forEach((t=>{t.subtreeActiveDescendants.delete(this)})),t.clear()),this.registeredActiveScopes=void 0}markSharedStateDirty(){this.sharedStateDirty=!0,hp(this.stage,this),lp(this.stage)}onParentSharedStateTreeChanged(t,e){this.stage===t&&this.layer===e?this.syncSharedStateScopeBindingOnTreeChange():this.setStage(t,e)}refreshSharedStateBeforeRender(){var t;(null===(t=this.currentStates)||void 0===t?void 0:t.length)?(this.syncSharedStateScopeBindingFromTree(!1),this.boundSharedStateScope&&op(this.boundSharedStateScope),this.recomputeCurrentStatePatch(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent(),this.sharedStateDirty=!1):this.sharedStateDirty=!1}getLocalStatesVersion(){var t,e;return this.localStateDefinitionsSource!==this.states&&(this.localStateDefinitionsSource=this.states,this.localStateDefinitionsVersion=(null!==(t=this.localStateDefinitionsVersion)&&void 0!==t?t:0)+1),null!==(e=this.localStateDefinitionsVersion)&&void 0!==e?e:0}resolveEffectiveCompiledDefinitions(){this.syncSharedStateScopeBindingFromTree(!1);const t=this.boundSharedStateScope;t&&(op(t),this.boundSharedStateRevision=t.revision);const e=!!this.states&&Object.keys(this.states).length>0;if(!t){if(!e)return{compiledDefinitions:void 0};const t=`local:${this.getLocalStatesVersion()}`;return this.compiledStateDefinitions&&this.compiledStateDefinitionsCacheKey===t||(this.compiledStateDefinitions=(new $u).compile(this.states),this.compiledStateDefinitionsCacheKey=t),{compiledDefinitions:this.compiledStateDefinitions}}return{compiledDefinitions:t.effectiveCompiledDefinitions}}recomputeCurrentStatePatch(){var t,e;if(!(null===(t=this.currentStates)||void 0===t?void 0:t.length))return this.effectiveStates=[],this.resolvedStatePatch=void 0,void this.syncSharedStateActiveRegistrations();const i=this.getStateResolveBaseAttrs(),s=this.resolveUseStatesTransition(this.currentStates,i),n=null!==(e=s.effectiveStates)&&void 0!==e?e:s.states,r=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};this.currentStates=s.states,this.effectiveStates=[...n],this.resolvedStatePatch=r,this.syncSharedStateActiveRegistrations()}buildStaticAttributeSnapshot(){var t;const e=Sp(null!==(t=this.baseAttributes)&&void 0!==t?t:{}),i=this.resolvedStatePatch;return i?(Object.keys(i).forEach((t=>{const s=i[t],n=e[t];"deep"===this.stateMergeMode&&xp(n)&&xp(s)?e[t]=kp(n,s):e[t]=Sp(s)})),e):e}buildRemovedStateAnimationAttrs(t,e){const i={};if(!e)return i;const s=this.buildStaticAttributeSnapshot(),n=s;return Object.keys(e).forEach((e=>{const r=Object.prototype.hasOwnProperty.call(t,e);if(r&&void 0!==t[e])return;const a=t=>{void 0===t&&this.shouldSkipStateTransitionDefaultAttribute(e,n)||(i[e]=void 0===t?t:Sp(t))};if(r)a(this.getStateTransitionDefaultAttribute(e,n));else if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e];a(void 0===t?this.getStateTransitionDefaultAttribute(e,n):t)}else a(this.getStateTransitionDefaultAttribute(e,n))})),i}syncObjectToSnapshot(t,e,i){const s=new Map;return new Set([...Object.keys(t),...Object.keys(e)]).forEach((n=>{if(!0===(null==i?void 0:i[n]))return;const r=Object.prototype.hasOwnProperty.call(e,n),a=t[n];if(!r)return void(Object.prototype.hasOwnProperty.call(t,n)&&(s.set(n,{prev:a,next:void 0}),delete t[n]));const o=e[n];Ap(a,o)||(s.set(n,{prev:a,next:o}),t[n]=Sp(o))})),s}_syncAttribute(t){this.attribute===this.baseAttributes&&this.resolvedStatePatch&&this.detachAttributeFromBaseAttributes();const e=this.buildStaticAttributeSnapshot(),i=this.syncObjectToSnapshot(this.attribute,e,t);return this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!!t,i}_syncFinalAttributeFromStaticTruth(t){const e=this.finalAttribute;if(!e)return;const i=this.buildStaticAttributeSnapshot();this.syncObjectToSnapshot(e,i,t)}mergeAttributeDeltaCategory(t,e,i,s){var n;let r="stroke"===e||"shadowBlur"===e?function(t,e,i){var s;const n=ip[t];return n?n(e,i):null!==(s=ep[t])&&void 0!==s?s:tp.PAINT}(e,i,s):null!==(n=ep[e])&&void 0!==n?n:tp.PAINT;return r&tp.PICK&&(r|=tp.BOUNDS),r===tp.PAINT&&this.needUpdateTag(e)&&(r=tp.SHAPE|tp.BOUNDS),t|r}submitUpdateByCategory(t,e=!1){if(e)return this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),void this.addUpdateLayoutTag();(t&bp)!==bp?(t&tp.SHAPE?this.addUpdateShapeAndBoundsTag():t&tp.BOUNDS&&this.addUpdateBoundTag(),t&tp.PAINT&&this.addUpdatePaintTag(),t&tp.TRANSFORM&&this.addUpdatePositionTag(),t&tp.LAYOUT&&this.addUpdateLayoutTag()):this.addBroadUpdateTag()}submitUpdateByDelta(t,e=!1){let i=tp.NONE;t.forEach(((t,e)=>{i=this.mergeAttributeDeltaCategory(i,e,t.prev,t.next)})),this.submitUpdateByCategory(i,e)}submitTouchedKeyUpdate(t,e=!1){this.submitTouchedUpdate(e||this.needUpdateTags(t))}submitTouchedUpdate(t){!this.updateShapeAndBoundsTagSetted()&&t?this.addUpdateShapeAndBoundsTag():this.addUpdateBoundTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag()}commitBaseAttributeMutation(t=!1,e){var i,s,n;(null===(i=this.currentStates)||void 0===i?void 0:i.length)&&(this.resolverEpoch=(null!==(s=this.resolverEpoch)&&void 0!==s?s:0)+1,null===(n=this.stateEngine)||void 0===n||n.invalidateResolverCache(),this.recomputeCurrentStatePatch());const r=this._syncAttribute();this.submitUpdateByDelta(r,t),this.onAttributeUpdate(e)}canCommitBaseAttributesByTouchedKeys(){var t,e;return!((null===(t=this.currentStates)||void 0===t?void 0:t.length)||this.resolvedStatePatch||this.attributeMayContainTransientAttrs||((null===(e=this.animates)||void 0===e?void 0:e.size)||this._animationStateManager)&&this.hasAnyTrackedAnimate())}detachAttributeFromBaseAttributes(){this.attribute===this.baseAttributes&&(this._baseAttributes=this.attribute,this.attribute=function(t){if(!xp(t))return t;const e=t,i={};return Object.keys(e).forEach((t=>{const s=e[t];i[t]=xp(s)?Object.assign({},s):s})),i}(this.attribute))}commitInternalBaseAttributes(t,e){t&&Object.keys(t).length&&(this.canCommitBaseAttributesByTouchedKeys()?this.commitBaseAttributesByTouchedKeys(t,!1,e):(this.detachAttributeFromBaseAttributes(),this.applyBaseAttributes(t),this.commitBaseAttributeMutation(!1,e)))}commitBaseAttributesByTouchedKeys(t,e=!1,i){const s=t,n=this.getBaseAttributesStorage();let r=!1,a=e;for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(r=!0,n[t]=s[t],!a&&this.needUpdateTag(t)&&(a=!0));r&&(this.attribute=n,this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(a),this.onAttributeUpdate(i))}commitBaseAttributeBySingleKey(t,e,i=!1,s){this.getBaseAttributesStorage()[t]=e,this.attribute=this.getBaseAttributesStorage(),this._baseAttributes=void 0,this.valid=this.isValid(),this.attributeMayContainTransientAttrs=!1,this.submitTouchedUpdate(i||this.needUpdateTag(t)),this.onAttributeUpdate(s)}applyBaseAttributes(t){const e=Object.keys(t);for(let i=0;i0:!!(null===(t=this.animates)||void 0===t?void 0:t.size)}mayHaveTrackedAnimates(){var t;return!!(null===(t=this.animates)||void 0===t?void 0:t.size)||!!this._animationStateManager}tryUpdateAABBBounds(){if(!(this.shadowRoot||this._updateTag&vo.UPDATE_BOUNDS))return this._AABBBounds;const t="imprecise"===this.attribute.boundsMode;if(!this.shadowRoot){const e=this.getGraphicService(),i=this.getGraphicTheme();if(!e.validCheck(this.attribute,i,this._AABBBounds,this))return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;e.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const s=this.doUpdateAABBBounds(t,i);return e.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&s.clear(),s}if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),"empty"===this.attribute.boundsMode&&e.clear(),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new We),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}getClipPath(){const{clipConfig:t}=this.attribute;if(!t)return null;this.clipPathMap||(this.clipPathMap=new Map);const{shape:e}=t;let i=this.clipPathMap.get(e)||null;return i||(this.clipPathMap.size>10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Bc[t];if(e)return e;if(e=Ep.userSymbolMap[t],e)return e;if(!0===Nc(t=Pc[t]||t)){const e=new Vc,{svg:i}=e.parse(t);if(!i)return null;const s=_(i.path)?i.path:[i.path];dp.clear();const n=[];s.forEach((t=>{const e=(new Al).fromString(t.d),i={};Sd.forEach((e=>{t[e]&&(i[xd[e]]=t[e])})),n.push({path:e,attribute:i}),dp.union(e.bounds)}));const r=dp.width(),a=dp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new wc(t,n,!0);return Ep.userSymbolMap[t]=l,l}const i=(new Al).fromString(t),s=i.bounds.width(),n=i.bounds.height(),r=1/Yt(s,n);i.transform(0,0,r,r);const a=new wc(t,i);return Ep.userSymbolMap[t]=a,a}doUpdateAABBBounds(t,e){this.updateAABBBoundsStamp++;const i=null!=e?e:this.getGraphicTheme();this._AABBBounds.clear();const s=this.attribute,n=this.updateAABBBounds(s,i,this._AABBBounds,t),{boundsPadding:r=i.boundsPadding}=s,a=gh(r);return a&&n.expand(a),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return wo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ge),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&vo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&vo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&vo.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&vo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=vo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===yo.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){if(!t)return;const n=Object.keys(t);this.captureTransientFromAttrsBeforePreventAnimate(t,n,i),this.syncFinalAttributesFromUpdateContext(i),this.visitTrackedAnimates((t=>{(t.priority!==1/0||s)&&t.preventAttrs(n)})),this.applyTransientAttributes(t,e,i)}syncFinalAttributesFromUpdateContext(t){var e;const i=null==t?void 0:t.type;if(i===_o.STATE||null!=i&&i>=_o.ANIMATE_BIND&&i<=_o.ANIMATE_END)return;const s=null===(e=this.context)||void 0===e?void 0:e.finalAttrs,n=this.setFinalAttributes;s&&"function"==typeof n&&n.call(this,s)}captureTransientFromAttrsBeforePreventAnimate(t,e,i){var s,n;const r=this.context,a=null!==(s=null==r?void 0:r.diffAttrs)&&void 0!==s?s:t,o=null==i?void 0:i.type;if(!e.length||!a||o===_o.STATE||null!=o&&o>=_o.ANIMATE_BIND&&o<=_o.ANIMATE_END)return;const l=this.transientFromAttrsBeforePreventAnimateDiffAttrs===a;let h=l&&null!==(n=this.transientFromAttrsBeforePreventAnimate)&&void 0!==n?n:null;l||(this.transientFromAttrsBeforePreventAnimate=null,this.transientFromAttrsBeforePreventAnimateDiffAttrs=null);let c=!1;for(let i=0;ii[e]!==t)),n=this.sortLocalStates(t);return{changed:s,states:s?n:[...i]}}resolveLocalClearStatesTransition(){return{changed:this.hasState(),states:[]}}resolveUseStatesTransition(t,e=this.getStateResolveBaseAttrs()){const i=this.ensureStateEngine(e);return i?this.toGraphicStateTransition(i.applyStates(t)):this.resolveLocalUseStatesTransition(t)}resolveClearStatesTransition(){const t=this.ensureStateEngine();return t?this.toGraphicStateTransition(t.clearStates()):this.resolveLocalClearStatesTransition()}resolveAddStateTransition(t,e){var i;const s=this.ensureStateEngine();if(s)return this.toGraphicStateTransition(s.addState(t,e));if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return{changed:!1,states:[...this.currentStates]};const n=e&&(null===(i=this.currentStates)||void 0===i?void 0:i.length)?this.currentStates.concat([t]):[t];return this.resolveLocalUseStatesTransition(n)}resolveRemoveStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.removeState(t));if(!this.currentStates)return{changed:!1,states:[]};const i=Array.isArray(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);return s.length===this.currentStates.length?{changed:!1,states:[...this.currentStates]}:this.resolveLocalUseStatesTransition(s)}resolveToggleStateTransition(t){const e=this.ensureStateEngine();if(e)return this.toGraphicStateTransition(e.toggleState(t));if(this.hasState(t))return this.resolveRemoveStateTransition(t);const i=this.currentStates?this.currentStates.slice():[];return i.push(t),this.resolveLocalUseStatesTransition(i)}resolveGraphicStateTransition(t,e=!1){var i;const s=this.getStateResolveBaseAttrs(),n=this.ensureStateEngine(s);e&&(null==n||n.invalidateResolverCache());const r=n?this.toGraphicStateTransition(n.applyStates(t)):this.resolveLocalUseStatesTransition(t),a=this.stateEngine&&this.compiledStateDefinitions?Object.assign({},this.stateEngine.resolvedPatch):{};return{transition:r,effectiveStates:null!==(i=r.effectiveStates)&&void 0!==i?i:r.states,resolvedStateAttrs:a}}normalizeSetStatesOptions(t){return t&&"object"==typeof t?{hasAnimation:t.animate,animateSameStatePatchChange:!0===t.animateSameStatePatchChange,shouldRefreshSameStatePatch:!0}:{hasAnimation:"boolean"==typeof t?t:void 0,animateSameStatePatchChange:!1,shouldRefreshSameStatePatch:!1}}sameStatePatches(t,e){const i=null!=t?t:{},s=null!=e?e:{},n=new Set([...Object.keys(i),...Object.keys(s)]);for(const t of n){if(Object.prototype.hasOwnProperty.call(i,t)!==Object.prototype.hasOwnProperty.call(s,t))return!1;if(!Ap(i[t],s[t]))return!1}return!0}commitSameStatePatchRefresh(t,e,i=!1){var s;const n=null!==(s=this.currentStates)&&void 0!==s?s:_p,r=this.resolvedStatePatch,{transition:a,effectiveStates:o,resolvedStateAttrs:l}=this.resolveGraphicStateTransition(t,!0),h=!this.sameStatePatches(r,l);h&&!this.beforeStateUpdate(l,n,a.states,e,!1)||(this.currentStates=a.states,this.effectiveStates=[...o],this.resolvedStatePatch=l,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),h&&(e&&i?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(l,a.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(l,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent())))}resolveStateAnimateConfig(t){var e,i,s;return null!==(s=null!==(e=null!=t?t:this.stateAnimateConfig)&&void 0!==e?e:null===(i=this.context)||void 0===i?void 0:i.stateAnimateConfig)&&void 0!==s?s:Ad}applyStateAttrs(t,e,i,s,n,r){const a=i?this.resolveStateAnimateConfig(n):void 0,o=a?{animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)}:void 0;if(s)return void this.getStateTransitionOrchestrator().applyClearTransition(this,t,i,o);const l=this.getStateTransitionOrchestrator().analyzeTransition(t,i,{noWorkAnimateAttr:this.getNoWorkAnimateAttr(),animateConfig:a,extraAnimateAttrs:r,shouldSkipDefaultAttribute:this.shouldSkipStateTransitionDefaultAttribute.bind(this)});this.getStateTransitionOrchestrator().applyTransition(this,l,i,o)}updateNormalAttrs(t){}getStateTransitionDefaultAttribute(t,e){return this.getDefaultAttribute(t)}shouldSkipStateTransitionDefaultAttribute(t,e){return!1}stopStateAnimates(t="end"){const e=this.stopAnimationState;if("function"==typeof e)return void e.call(this,"state",t);if(!this.mayHaveTrackedAnimates())return;const i=[];this.visitTrackedAnimates((t=>{t.stateNames&&i.push(t)})),i.forEach((e=>e.stop(t)))}clearStates(t){var e,i,s;const n=null!==(e=this.currentStates)&&void 0!==e?e:_p,r=this.resolvedStatePatch,a=this.resolveClearStatesTransition();if(!a.changed&&0===n.length)return this.currentStates=[],this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,void this.clearSharedStateActiveRegistrations();const o=t||this.hasCustomEvent("beforeStateUpdate")?Sp(null!==(i=this.baseAttributes)&&void 0!==i?i:{}):null!==(s=this.baseAttributes)&&void 0!==s?s:{};a.changed&&!this.beforeStateUpdate(o,n,a.states,t,!0)||(this.currentStates=a.states,this.effectiveStates=[],this.resolvedStatePatch=void 0,this.sharedStateDirty=!1,this.clearSharedStateActiveRegistrations(),t?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,a.states,t,!0,void 0,this.buildRemovedStateAnimationAttrs(o,r))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(r,void 0,{type:_o.STATE}),this.emitStateUpdateEvent()))}removeState(t,e){const i=this.resolveRemoveStateTransition(t);i.changed&&this.useStates(i.states,e)}toggleState(t,e){const i=this.resolveToggleStateTransition(t);i.changed&&this.useStates(i.states,e)}addState(t,e,i){const s=this.resolveAddStateTransition(t,e);s.changed&&this.useStates(s.states,i)}setStates(t,e){var i,s,n;const{hasAnimation:r,animateSameStatePatchChange:a,shouldRefreshSameStatePatch:o}=this.normalizeSetStatesOptions(e),l=(null==t?void 0:t.length)?t:_p,h=!!((null===(i=this.currentStates)||void 0===i?void 0:i.length)||(null===(s=this.effectiveStates)||void 0===s?void 0:s.length)||this.resolvedStatePatch||(null===(n=this.registeredActiveScopes)||void 0===n?void 0:n.size));if(l.length){if(this.sameStateNames(this.currentStates,l))return o?void this.commitSameStatePatchRefresh(l,r,a):void(this.sharedStateDirty&&this.refreshSharedStateBeforeRender());this.useStates(l,r)}else{if(!h&&!this.sharedStateDirty)return;this.clearStates(r)}}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=null!==(i=this.currentStates)&&void 0!==i?i:_p,n=this.resolvedStatePatch,{transition:r,effectiveStates:a,resolvedStateAttrs:o}=this.resolveGraphicStateTransition(t);!r.changed&&this.sameStateNames(s,r.states)||this.beforeStateUpdate(o,s,r.states,e,!1)&&(this.currentStates=r.states,this.effectiveStates=[...a],this.resolvedStatePatch=o,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),e?(this._syncFinalAttributeFromStaticTruth(),this.applyStateAttrs(o,r.states,e,!1,void 0,this.buildRemovedStateAnimationAttrs(o,n))):(this.stopStateAnimates(),this.attributeMayContainTransientAttrs?this._restoreAttributeFromStaticTruth({type:_o.STATE}):this.restoreAttributeFromStatePatchDelta(n,this.resolvedStatePatch,{type:_o.STATE}),this.emitStateUpdateEvent()))}invalidateResolver(){var t,e;if(!this.stateEngine||!(null===(t=this.currentStates)||void 0===t?void 0:t.length)||!this.compiledStateDefinitions)return;this.syncStateResolveContext(),this.resolverEpoch=(null!==(e=this.resolverEpoch)&&void 0!==e?e:0)+1,this.stateEngine.invalidateResolverCache();const i=this.stateEngine.applyStates(this.currentStates),s=Object.assign({},this.stateEngine.resolvedPatch);this.effectiveStates=[...i.effectiveStates],this.resolvedStatePatch=s,this.sharedStateDirty=!1,this.syncSharedStateActiveRegistrations(),this.stopStateAnimates(),this._restoreAttributeFromStaticTruth({type:_o.STATE}),this.emitStateUpdateEvent()}sameStateNames(t,e){const i=null!=t?t:[],s=null!=e?e:[];if(i.length!==s.length)return!1;for(let t=0;t{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,scaleX:i=Rl.scaleX,scaleY:s=Rl.scaleY,angle:n=Rl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Gt(a),f=Kt(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,!0),oh.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Rl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=up.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){var i,s,n,r,a,o,l,h,c,d;const u=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,p=this.stage;if(this.stage!==t||this.layer!==e){if(this.stage=t,this.layer=e,((null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0),this.setStageToShadowRoot(t,e),this.mayHaveTrackedAnimates()&&this.hasAnyTrackedAnimate()){const e=null===(o=null==p?void 0:p.getTimeline)||void 0===o?void 0:o.call(p),i=null===(l=null==t?void 0:t.getTimeline)||void 0===l?void 0:l.call(t),s=[];this.visitTrackedAnimates((t=>{(e&&t.timeline===e||t.timeline.isGlobal)&&(i?t.timeline!==i&&(e&&t.timeline===e&&e.removeAnimate(t,!1),t.setTimeline(i),i.addAnimate(t)):e&&t.timeline===e&&(e.removeAnimate(t,!1),s.push(t)))})),s.length&&(s.forEach((t=>{var e;t.stop();const i=this.untrackAnimate;"function"==typeof i?i.call(this,t.id):null===(e=this.animates)||void 0===e||e.delete(t.id)})),this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END}))}return this._onSetStage&&this._onSetStage(this,t,e),void(null===(h=null==u?void 0:u.onSetStage)||void 0===h||h.call(u,this,t))}((null===(c=this.currentStates)||void 0===c?void 0:c.length)||this.boundSharedStateScope||(null===(d=this.registeredActiveScopes)||void 0===d?void 0:d.size)||this.sharedStateDirty)&&this.syncSharedStateScopeBindingOnTreeChange(!0)}detachStageForRelease(){var t,e,i;(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates(),this.boundSharedStateScope=void 0,this.boundSharedStateRevision=void 0,this.compiledStateDefinitions=void 0,this.compiledStateDefinitionsCacheKey=void 0,this.stateEngine=void 0,this.stateEngineCompiledDefinitions=void 0,this.sharedStateDirty=!1,this.stage=null,this.layer=null,this.shadowRoot&&(null===(i=(e=this.shadowRoot).detachStageForRelease)||void 0===i||i.call(e))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){this._restoreAttributeFromStaticTruth({type:_o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){var e,i,s;return t&&(t.shadowHost=this),this.shadowRoot=null!==(s=null!=t?t:null===(i=(e=oh.graphicService.creator).shadowRoot)||void 0===i?void 0:i.call(e,this))&&void 0!==s?s:require("./shadow-root").createShadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Al).fromString(t):this.pathProxy=new Al,this.pathProxy}loadImage(t,e=!1){if(e&&(null==t?void 0:t.background)&&(t=t.background),e&&(!t||function(t){return"string"==typeof t?!(t.startsWith("{t.push(e)})),t.forEach((t=>{t.stop()}))}stopAnimates(t=!1){this._stopAnimates(),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){var t,e,i,s;this.releaseStatus="released",(null===(t=this.registeredActiveScopes)||void 0===t?void 0:t.size)&&this.clearSharedStateActiveRegistrations(),(this.mayHaveTrackedAnimates()||this.shadowRoot)&&this.stopAnimates();const n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.graphicService)&&void 0!==i?i:oh.graphicService;null===(s=null==n?void 0:n.onRelease)||void 0===s||s.call(n,this),super.release()}hasCustomEvent(t){return!!this._events&&t in this._events}_dispatchCustomEvent(t,e){var i,s;if(this.hasCustomEvent(t)){const n=new qa(t,e);n.bubbles=!1;const r=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager;return r?(n.manager=r,this.dispatchEvent(n)):Ga.prototype.dispatchEvent.call(this,n)}return!0}beforeStateUpdate(t,e,i,s,n){return!this.hasCustomEvent("beforeStateUpdate")||this._dispatchCustomEvent("beforeStateUpdate",{type:_o.STATE,attrs:Object.assign({},t),prevStates:e.slice(),nextStates:i.slice(),hasAnimation:!!s,isClear:!!n})}emitStateUpdateEvent(){this.hasCustomEvent("afterStateUpdate")&&this._emitCustomEvent("afterStateUpdate",{type:_o.STATE})}_emitCustomEvent(t,e){this._dispatchCustomEvent(t,e)}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||oh.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Tu(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}Tp.userSymbolMap={};const Mp=Symbol.for("@visactor/vrender-core/graphic-class");function wp(){var t;const e=globalThis;return null!==(t=e[Mp])&&void 0!==t||(e[Mp]={Graphic:Tp}),e[Mp]}const Ep=wp().Graphic;function Bp(t){return!!t&&("string"==typeof t?!vp.has(t)&&(t.startsWith("{t[i]=e[i]}))}const Lp=Ip();class Dp{constructor(){this.initTheme(),this.dirty=!1}get stateDefinitions(){return this._stateDefinitions}set stateDefinitions(t){var e;this._stateDefinitions!==t&&(this._stateDefinitions=t,null===(e=this.onStateDefinitionsChange)||void 0===e||e.call(this))}initTheme(){this._defaultTheme={},Rp.forEach((t=>{this._defaultTheme[t]=Object.create(Lp[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Rp.forEach((s=>{const n=Object.create(Lp[s]);t&&t[s]&&Op(n,t[s]),i[s]&&Op(n,i[s]),e[s]&&Op(n,e[s]),this.combinedTheme[s]=n})),e.common&&Rp.forEach((t=>{Op(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 Fp=new Dp;function zp(t,e){return t.glyphHost?zp(t.glyphHost):e?(t.isContainer,e):Hp(t)||t.attachedThemeGraphic&&zp(t.attachedThemeGraphic)||Fp.getTheme()}function Hp(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)):Fp.getTheme()}return null}const jp=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},Np=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","clipRange","cap",...pp];class Up extends Ep{constructor(t){super(t),this.type="arc",this.numberType=td}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap,clipRange:n=t.clipRange}=this.attribute,r=i-e>=0?1:-1;let a=i-e;if(a*=Math.max(0,Math.min(n,1)),e=he(e),i=e+a,s&&Vt(a)>zt&&Vt(a)zt&&o>zt)return{startAngle:e-r*u*n,endAngle:i+r*u*a,sc:r*u*n,ec:r*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Kt(g)),n=Zt(Number(l)/a*Kt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return zp(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Ut-zt?i.set(-s,-s,s,s):(vh(l,o,s,i),vh(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Np)}needUpdateTag(t){return super.needUpdateTag(t,Np)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ut-zt)n.moveTo(0+h*Gt(a),0+h*Kt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Kt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Kt(a),i=l*Gt(o),s=l*Kt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Up(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Up.NOWORK_ANIMATE_ATTR}}function Vp(t){return new Up(t)}Up.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const Wp=["segments","points","curveType","curveTension",...pp];class Gp extends Ep{constructor(t){super(t),this.type="area",this.numberType=id}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return zp(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Wp)}needUpdateTag(t){return super.needUpdateTag(t,Wp)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Al;const e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new Gp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gp.NOWORK_ANIMATE_ATTR}}function Yp(t){return new Gp(t)}Gp.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Xp=["radius","startAngle","endAngle",...pp];class Kp extends Ep{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=sd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return zp(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ut-zt?i.set(-r,-r,r,r):vh(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,Xp)}needUpdateTag(t){return super.needUpdateTag(t,Xp)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Al,s.arc(0,0,r,a,o),s}clone(){return new Kp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kp.NOWORK_ANIMATE_ATTR}}function $p(t){return new Kp(t)}Kp.NOWORK_ANIMATE_ATTR=Cp;class qp extends Ep{constructor(t){super(t),this.type="glyph",this.numberType=nd,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t,e=!1,i){super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return zp(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);const s=this.currentStates?this.currentStates.slice():[];if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates(),this.stateSort&&(t=t.sort(this.stateSort));const n={};t.forEach((e=>{const i=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];i&&Object.assign(n,i.attributes)})),this.beforeStateUpdate(n,s,t,e,!1)&&(this.currentStates=t,this.applyStateAttrs(n,t,e))}clearStates(t){this.stopStateAnimates();const e=this.currentStates?this.currentStates.slice():[];if(this.hasState()&&this.normalAttrs){if(!this.beforeStateUpdate(this.normalAttrs,e,[],t,!0))return;this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)}else this.currentStates=[]}clone(){const t=new qp(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return qp.NOWORK_ANIMATE_ATTR}}function Zp(t){return new qp(t)}var Jp;qp.NOWORK_ANIMATE_ATTR=Cp,function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Jp||(Jp={}));let Qp=class t extends Ep{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rd,this._childUpdateTag=vo.UPDATE_BOUNDS}get sharedStateDefinitions(){return this._sharedStateDefinitions}set sharedStateDefinitions(t){if(this._sharedStateDefinitions===t)return;const e=this.sharedStateScope;this._sharedStateDefinitions=t,this.ensureSharedStateScopeBound(),this.sharedStateScope&&(rp(this.sharedStateScope,t),cp(this.sharedStateScope,this.stage)),e!==this.sharedStateScope&&this.notifyChildrenSharedStateTreeChanged()}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Dp),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Dp)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===yo.GLOBAL){const i=new re(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&vo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Rl.x,y:e=Rl.y,dx:i=Rl.dx,dy:s=Rl.dy,scaleX:n=Rl.scaleX,scaleY:r=Rl.scaleY,angle:a=Rl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return zp(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=vo.CLEAR_BOUNDS,this._childUpdateTag&=vo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&vo.UPDATE_BOUNDS||(this._childUpdateTag|=vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return e&&this.syncChildSharedStateTreeBinding(e),this.addUpdateBoundTag(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return t&&this.syncChildSharedStateTreeBinding(t),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return i&&e&&this.syncChildSharedStateTreeBinding(i),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t,e=!1){const i=super.removeChild(t);return i?e?(t.detachStageForRelease(),i):(this.getGraphicService().onRemove(t),t.setStage(null,null),this.addUpdateBoundTag(),i):i}removeAllChild(t=!1){const e=this.children.slice();this.forEachChildren((e=>{this.getGraphicService().onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),e.forEach((t=>{t.setStage(null,null)})),this.addUpdateBoundTag()}setStage(t,e){var i,s,n,r,a,o;const l=null!==(n=null!==(i=null==t?void 0:t.graphicService)&&void 0!==i?i:null===(s=this.stage)||void 0===s?void 0:s.graphicService)&&void 0!==n?n:oh.graphicService,h=this.hasSharedStateDefinitions()||this.sharedStateScope||(null===(r=this.currentStates)||void 0===r?void 0:r.length)||this.boundSharedStateScope||(null===(a=this.registeredActiveScopes)||void 0===a?void 0:a.size)||this.sharedStateDirty;if(this.stage!==t)return this.stage=t,this.layer=e,h&&(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0)),this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),null===(o=null==l?void 0:l.onSetStage)||void 0===o||o.call(l,this,t),void this.notifyChildrenSharedStateTreeChanged();const c=this.layer!==e;c&&(this.layer=e),h?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!0),this.notifyChildrenSharedStateTreeChanged()):c&&this.notifyChildrenSharedStateTreeChanged()}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&vo.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=oh.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}detachStageForRelease(){super.detachStageForRelease(),this.sharedStateScope=void 0,this.forEachChildren((t=>{t.detachStageForRelease()}))}ensureSharedStateScopeBound(){var t,e,i;if(!this.hasSharedStateDefinitions())return void(this.sharedStateScope=void 0);const s=null!==(e=null===(t=this.parent)||void 0===t?void 0:t.sharedStateScope)&&void 0!==e?e:null===(i=this.stage)||void 0===i?void 0:i.rootSharedStateScope;this.sharedStateScope?(this.sharedStateScope.ownerStage=this.stage,function(t,e){t.parentScope!==e&&(t.parentScope=e,t.dirty=!0)}(this.sharedStateScope,s),this.sharedStateScope.localStateDefinitions!==this._sharedStateDefinitions&&rp(this.sharedStateScope,this._sharedStateDefinitions)):this.sharedStateScope=function(t,e,i){return ap({ownerStage:t.stage,parentScope:e,localStateDefinitions:i,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,s,this._sharedStateDefinitions)}hasSharedStateDefinitions(){return!!this._sharedStateDefinitions&&Object.keys(this._sharedStateDefinitions).length>0}notifyChildrenSharedStateTreeChanged(){this.forEachChildren((t=>{this.syncChildSharedStateTreeBinding(t)}))}syncChildSharedStateTreeBinding(t){t.onParentSharedStateTreeChanged(this.stage,this.layer)}onParentSharedStateTreeChanged(t,e){var i;this.stage===t&&this.layer===e?(this.ensureSharedStateScopeBound(),this.syncSharedStateScopeBindingOnTreeChange(!!(null===(i=this.currentStates)||void 0===i?void 0:i.length)),this.notifyChildrenSharedStateTreeChanged()):this.setStage(t,e)}};function tg(t){return new Qp(t)}Qp.NOWORK_ANIMATE_ATTR=Cp;const eg=["width","height","image","imageMode","imagePosition","imageScale","imageOffsetX","imageOffsetY",...pp];class ig extends Ep{constructor(t){super(t),this.type="image",this.numberType=ad,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()})),this.addUpdateBoundTag()}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return zp(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ih[t]}needUpdateTags(t){return super.needUpdateTags(t,eg)}needUpdateTag(t){return super.needUpdateTag(t,eg)}clone(){return new ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ig.NOWORK_ANIMATE_ATTR}}function sg(t){return new ig(t)}ig.NOWORK_ANIMATE_ATTR=Object.assign({image:1,imageMode:1,repeatX:1,repeatY:1},Cp);const ng=["segments","points","curveType","curveTension",...pp];let rg=class t extends Ep{constructor(t={}){super(t),this.type="line",this.numberType=od}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=bh(i,s,e))}getGraphicTheme(){return zp(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,ng)}needUpdateTag(t){return super.needUpdateTag(t,ng)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Al;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function ag(t){return new rg(t)}rg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const og=["path","customPath",...pp];class lg extends Ep{constructor(t){super(t),this.type="path",this.numberType=ld}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Al?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Al?this.cache:t.path)}getGraphicTheme(){return zp(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Al).fromString(t.path):t.customPath&&(this.cache=new Al,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,og)}needUpdateTag(t){return super.needUpdateTag(t,og)}toCustomPath(){return(new Al).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new lg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lg.NOWORK_ANIMATE_ATTR}}function hg(t){return new lg(t)}lg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const cg=["points","cornerRadius",...pp];class dg extends Ep{constructor(t){super(t),this.type="polygon",this.numberType=hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return zp(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),oh.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=bh(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,cg)}needUpdateTag(t){return super.needUpdateTag(t,cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Al,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dg.NOWORK_ANIMATE_ATTR}}function ug(t){return new dg(t)}dg.NOWORK_ANIMATE_ATTR=Cp;const pg=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}},gg=["width","x1","y1","height","cornerRadius",...pp];class fg extends Ep{constructor(t){super(t),this.type="rect",this.numberType=dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return zp(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return jp(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,gg)}needUpdateTag(t){return super.needUpdateTag(t,gg)}shouldSkipStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>null!=s[t],r=t=>null==s[t];switch(t){case"width":return r("width")&&n("x")&&n("x1");case"height":return r("height")&&n("y")&&n("y1");case"x1":return r("x1")&&n("x")&&n("width");case"y1":return r("y1")&&n("y")&&n("height");default:return!1}}getStateTransitionDefaultAttribute(t,e){var i;const s=null!==(i=null!=e?e:this.baseAttributes)&&void 0!==i?i:this.attribute,n=t=>{const e=s[t];return"number"==typeof e&&Number.isFinite(e)?e:void 0},r=n("x"),a=n("y"),o=n("x1"),l=n("y1"),h=n("width"),c=n("height");switch(t){case"width":if(null==h&&null!=r&&null!=o)return o-r;break;case"height":if(null==c&&null!=a&&null!=l)return l-a;break;case"x1":if(null==o&&null!=r&&null!=h)return r+h;break;case"y1":if(null==l&&null!=a&&null!=c)return a+c}return super.getStateTransitionDefaultAttribute(t,e)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=pg(e);return t=new Al,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fg.NOWORK_ANIMATE_ATTR}}function mg(t){return new fg(t)}fg.NOWORK_ANIMATE_ATTR=Cp;const vg=Symbol.for("EnvContribution"),yg=Symbol.for("VGlobal"),_g="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",bg={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"}},xg=!0,Sg=!1,Ag=/\w|\(|\)|-/,kg=/[.?!,;:/,。?!、;:]/,Cg=/\S/,Tg=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mg(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=oh.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=wg(t,a)),a}function wg(t,e,i=!1){let s=e;for(;Ag.test(t[s-1])&&Ag.test(t[s])||kg.test(t[s]);)if(s--,s<=0)return i?Eg(t,e):e;return s}function Eg(t,e){let i=e;for(;Ag.test(t[i+1])&&Ag.test(t[i])||kg.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bg(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=oh.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}class Pg{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=bg[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}function Rg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Ig{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ch(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bg(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r:0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Bg(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Rg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mg(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Rg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Mg(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bg(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}class Og extends ig{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=gh(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=gh(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=ih.width,height:e=ih.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 Lg{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Og?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bg[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Ig){const e=Cg.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Og)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bg(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Og)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sg;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,Tg(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xg;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ru(t,s,{AABBBounds:i}):s,Tg(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Og)break;const{width:n}=Bg(t,s.character,s.ascentDescentMode),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Og?t.width:t.getWidthWithEllips(this.direction)})),i}}class Dg{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=bg[this.direction]}store(t){if(t instanceof Og){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Lg(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof Og?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),(0!==t.text.length||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mg(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Ig(i,t.newLine,t.character,t.ascentDescentMode),new Ig(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Fg=!1;try{Fg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Fg=!1}const zg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...pp];class Hg extends Ep{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=pd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.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:eh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return zp(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&Hg.splitText(t.text).length>1)))}static splitText(t){if(Fg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Hg.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),oh.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Hg.AllSingleCharacter(y)&&(y=Hg.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),C="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Pg(0,0,(k?n:x?i:0)||0,(C?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!C&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),M=new Dg(T);if(M.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):M.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,M.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,M.lineWidth=0),M.send()}}else for(let t=0;t<_.length;t++)M.deal(_[t]);if(M.send(),!("horizontal"===T.layoutDirection?k:C)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Hg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Hg.NOWORK_ANIMATE_ATTR}}function jg(t){return new Hg(t)}Hg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);class Ng extends Qp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Ug(t){return new Ng(t)}const Vg=["symbolType","size",...pp];let Wg=class t extends Ep{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=fd}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return zp(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=oh.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Gc(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return oh.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Al).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Al).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Gg(t){return new Wg(t)}function Yg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Xg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Kg(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[hi(i)]=t[i])})),["fontSize","lineHeight"].forEach((s=>{const n=hi(s);u(t[s])||(e[n]=i(t[s]))})),p(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&y(t.fill)&&(e.color=t.fill),e}Wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);class $g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Tl.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(a)?a.join(""):a).toString()!==t}return"vertical"===n.direction&&(null===(i=this.cache)||void 0===i?void 0:i.verticalList)&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){var t;return this.tryUpdateAABBBounds(),null===(t=this.cache)||void 0===t?void 0:t.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=md}getOrCreateCache(){return this.cache||(this.cache={}),this.cache}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return zp(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Zg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=oh.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Gc(n,o/Math.abs(r+a),!0,l),i.union(n)}return oh.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||oh.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ne(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.getOrCreateCache(),i=e.layoutData;if(i&&i.lines&&i.lines.length){const t=i.lines[0];e.clipedText=t.str,e.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new $g(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:k}=A;return this.getOrCreateCache().layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const C=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},M=new $g(a,T,C),w=_(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=Yg(y,a),e=this.cache.verticalList.length*v,i=Xg(_,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>$c(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Kc.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))}));const x=this.getOrCreateCache();x.verticalList=b,this.clearUpdateShapeTag(),x.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const S=Yg(y,a),A=x.verticalList.length*v,k=Xg(_,A,d);return this._AABBBounds.set(k,S,k+A,S+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ch(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=qg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=qg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Zg.baselineMapAlign}getAlignMapBaseline(){return Zg.alignMapBaseline}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),Zg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Zg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Qg=["heightLimit","lineClamp"];class tf extends Zg{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,s,n,r;const a=this.getGraphicTheme(),{fontFamily:o=a.fontFamily,textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,ellipsis:d=a.ellipsis,maxLineWidth:u,stroke:p=a.stroke,lineWidth:g=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:v=a.ignoreBuf,heightLimit:y=0,suffixPosition:_=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ch(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,S=v?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),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const A=oh.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(s=this.stage)||void 0===s?void 0:s.textMeasureId)),k=new $g(o,{fontSize:c,fontWeight:m,fontFamily:o},A),C=t.map((t=>t.toString())),T=[],M=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s!(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 uf extends df{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}let pf=0;class gf{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=oh.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++pf,t),this.tryRunAnimationFrameNextFrame(),pf}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}wait(){return new Promise((t=>{this.addAnimationFrameCb((()=>t()))}))}}class ff{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var mf=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 vf extends ff{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Va.GenAutoIncrementId(),this.hooks={onSetEnv:new uf(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedPerformanceRAF(t){return this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new gf),this._performanceRAFList[t]}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return mf(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}}class yf{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Td(Object.assign({nativeCanvas:oh.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Td(Object.assign({nativeCanvas:oh.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const _f=new yf,bf=Symbol.for("VWindow"),xf=Symbol.for("WindowHandlerContribution");function Sf(t){const e=oh.windowHandlerFactory;if(!e)throw new Error("Window handler factory is not configured.");return e(t)}class Af extends ff{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(t=oh.global,e=Sf){super(),this.handlerFactory=e,this.hooks={onChange:new uf(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(this.handlerFactory(t.env).configure(this,t),this.actived=!0)},this._uid=Va.GenAutoIncrementId(),this.global=t,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&>(this.width,t.width())&>(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}}class kf{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=oh.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=_f.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:Dl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Dl.fontFamily,fontSize:Dl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){var s,n;if(!e.defaultLayer)return null;const r=null!==(n=null===(s=oh.windowFactory)||void 0===s?void 0:s.call(oh))&&void 0!==n?n:new Af(this.global),a=t.AABBBounds,o=a.width(),l=a.height(),h=-a.x1,c=-a.y1;r.create({viewBox:{x1:h,y1:c,x2:a.x2,y2:a.y2},width:o,height:l,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const d=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=d;const u=r.getNativeHandler();return u.nativeCanvas?u.nativeCanvas:null}}var Cf;!function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Cf||(Cf={}));const Tf=new Ge;class Mf{constructor(){this.matrix=new Ge}init(t){return this.mode=Cf.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Cf.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Tf.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(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}scale(t,e,i){return this.mode===Cf.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Cf.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Tf.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Tf.a,Tf.b,Tf.c,Tf.d,Tf.e,Tf.f),this}translate(t,e){return this.mode===Cf.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Cf.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}}const wf=Symbol.for("@visactor/vrender-core/factory-state");function Ef(){const t=globalThis;return t[wf]||(t[wf]={pluginClasses:{}}),t[wf]}class Bf{constructor(){this.global=oh.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}reInit(){}configure(t,e){}pick(t,e,i){let s={graphic:null,group:null};const n=new Ge(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)n=this.pickGroup(t,e,i,s);else{const r=new re(e.x,e.y);i.transformPoint(r,r);const a=this.pickItem(t,r,i,s);a&&(n.graphic=a.graphic,n.params=a.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,s){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}}var Pf=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 Rf(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function If(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rf(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rf(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}const Df=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};class Ff{constructor(){this.time=So.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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip,backgroundPosition:k=l.backgroundPosition}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(jf(g));if(!n||"success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=zp(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S,backgroundPosition:k}),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){Kf(t,e,i,s)}}const zf=new Ff,Hf=new Set(["top","center","bottom"]);function jf(t){var e;return null!==(e=null==t?void 0:t.background)&&void 0!==e?e:t}function Nf({backgroundFit:t,backgroundKeepAspectRatio:e}){return t?e?"cover":"fill":"auto"}const Uf={"no-repeat-cover":"cover","no-repeat-contain":"contain","no-repeat-fill":"fill","no-repeat-auto":"auto"};function Vf({backgroundMode:t,backgroundFit:e,backgroundKeepAspectRatio:i}){const s=Uf[t];return s?{backgroundRepeatMode:"no-repeat",backgroundSizing:s}:{backgroundRepeatMode:t,backgroundSizing:Nf({backgroundFit:e,backgroundKeepAspectRatio:i})}}function Wf(t,e,i,s,n){if("number"==typeof t&&Number.isFinite(t))return t;const r=`${null!=t?t:""}`.trim().toLowerCase();if(!r||r===i)return 0;if(r===s)return e/2;if(r===n)return e;if(function(t){return/^-?\d+(\.\d+)?%$/.test(t)}(r))return e*parseFloat(r)/100;const a=Number(r);return Number.isFinite(a)?a:0}function Gf(t,e,i){const[s,n]=function(t){var e,i;if(Array.isArray(t))return[null!==(e=t[0])&&void 0!==e?e:"left",null!==(i=t[1])&&void 0!==i?i:"top"];const s=`${null!=t?t:"top-left"}`.trim().toLowerCase().replace(/-/g," ").split(/\s+/).filter(Boolean);if(0===s.length)return["left","top"];if(1===s.length){const t=s[0];return"center"===t?["center","center"]:Hf.has(t)?["center",t]:[t,"center"]}let n,r;const a=[];for(let t=0;t<2;t++){const e=s[t];"left"!==e&&"right"!==e?"top"!==e&&"bottom"!==e?a.push(e):r=e:n=e}return null==n&&a.length&&(n=a.shift()),null==r&&a.length&&(r=a.shift()),[null!=n?n:"left",null!=r?r:"top"]}(t);return{x:Wf(s,e,"left","center","right"),y:Wf(n,i,"top","center","bottom")}}function Yf(...t){for(const e of t)if("number"==typeof e&&Number.isFinite(e)&&e>0)return e;return null}function Xf(t){if(!t)return null;const e=Yf(t.naturalWidth,t.videoWidth,t.width),i=Yf(t.naturalHeight,t.videoHeight,t.height);return null==e||null==i?null:{width:e,height:i}}function Kf(t,e,i,s){var n,r;const{backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l,backgroundScale:h=1,backgroundOffsetX:c=0,backgroundOffsetY:d=0,backgroundPosition:u="top-left"}=s,p=i.width(),g=i.height(),f=Xf(e),{backgroundRepeatMode:m,backgroundSizing:v}=Vf({backgroundMode:a,backgroundFit:o,backgroundKeepAspectRatio:l});let y=p,_=g;if(p<=0||g<=0)return;if("no-repeat"===m){let s=null!==(n=null==f?void 0:f.width)&&void 0!==n?n:p,a=null!==(r=null==f?void 0:f.height)&&void 0!==r?r:g;if("cover"!==v&&"contain"!==v||!f)"fill"===v&&(s=p,a=g);else{const t="cover"===v?Math.max(p/f.width,g/f.height):Math.min(p/f.width,g/f.height);s=f.width*t,a=f.height*t}s*=h,a*=h;const{x:o,y:l}=Gf(u,p-s,g-a);return void t.drawImage(e,i.x1+o+c,i.y1+l+d,s,a)}if(o&&"repeat"!==m&&f){const i=f.width,s=f.height;"repeat-x"===m?(y=i*(g/s),_=g):"repeat-y"===m&&(_=s*(p/i),y=p);const n=t.dpr,r=_f.allocate({width:y,height:_,dpr:n}),a=r.getContext("2d");a&&(a.inuse=!0,a.clearMatrix(),a.setTransformForCurrent(!0),a.clearRect(0,0,y,_),a.drawImage(e,0,0,y,_),e=r.nativeCanvas),_f.free(r)}const b=t.dpr,x=t.createPattern(e,m);x.setTransform&&x.setTransform(new DOMMatrix([1/b,0,0,1/b,0,0])),t.fillStyle=x,t.translate(i.x1,i.y1),t.fillRect(0,0,p,g),t.translate(-i.x1,-i.y1)}class $f{constructor(t){this.subRenderContribitions=t,this.time=So.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)}))}}class qf{constructor(){this.time=So.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}}const Zf=new qf;class Jf{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}}const Qf=new Jf,tm={getContributions:()=>[]};class em{constructor(t=[],e=tm,i={}){var s,n,r,a,o,l;this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):If(e,Nl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ue,this.backupDirtyBounds=new Ue,this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.layerService=null!==(n=i.layerService)&&void 0!==n?n:oh.layerService,this.rendererRegistry=i.rendererRegistry,this.contributions=null!==(a=null===(r=this.rendererRegistry)||void 0===r?void 0:r.getAll())&&void 0!==a?a:this.contributions,this.drawItemInterceptorContributions=null!==(l=null!==(o=i.drawItemInterceptorContributions)&&void 0!==o?o:this.drawItemInterceptorContributions)&&void 0!==l?l:tm,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.defaultRenderMap.clear(),this.styleRenderMap.clear(),this.currentRenderMap.clear(),this.init(),this.contributions.forEach((t=>{t.reInit()}))}init(){var t,e;const i=null!==(e=null===(t=this.rendererRegistry)||void 0===t?void 0:t.getAll())&&void 0!==e?e:this.contributions;this.contributions=i,i.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Su.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lf(e,i,Nl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Df.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Su.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Df.free(n),Su.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||function(){const t=oh.incrementalDrawContributionFactory;if(!t)throw new Error("Incremental draw contribution factory is not configured.");return t()}();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{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}}class sm{constructor(){this.entries=new Map,this.cache=new Map}register(t,e){this.entries.set(t,e),this.cache.delete(t)}unregister(t){this.entries.delete(t),this.cache.delete(t)}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.entries.get(t);if(!e)return;const i=function(t){return"function"==typeof t}(e)?e():e;return this.cache.set(t,i),i}getAll(){return Array.from(this.entries.keys()).map((t=>this.get(t))).filter((t=>!!t))}clear(){this.entries.clear(),this.cache.clear()}}class nm{constructor(){this.entries=new Map}register(t,e){this.entries.set(t,e)}unregister(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class rm{constructor(){this.entries=new Map}install(t){this.entries.set(t.name,t)}uninstall(t){this.entries.delete(t)}get(t){return this.entries.get(t)}getAll(){return Array.from(this.entries.values())}clear(){this.entries.clear()}}class am{constructor(){this.entries=new Map}register(t,e){var i;const s=null!==(i=this.entries.get(t))&&void 0!==i?i:[];s.push(e),this.entries.set(t,s)}unregister(t,e){if(void 0===e)return void this.entries.delete(t);const i=this.entries.get(t);if(!i)return;const s=i.filter((t=>t!==e));s.length?this.entries.set(t,s):this.entries.delete(t)}get(t){var e;return[...null!==(e=this.entries.get(t))&&void 0!==e?e:[]]}getAll(){return Array.from(this.entries.values()).reduce(((t,e)=>(t.push(...e),t)),[])}clear(t){null!=t?this.entries.delete(t):this.entries.clear()}}const om={getContributions:()=>[]};class lm{constructor(t=om,e={}){var i;this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1,this.pluginRegistry=null!==(i=e.pluginRegistry)&&void 0!==i?i:new rm}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;(null==i?void 0:i.length)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.install(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}install(t){this.register(t)}uninstall(t){this.findPluginsByName(t).forEach((t=>{this.unRegister(t)})),this.pluginRegistry.uninstall(t)}register(t){this.pluginRegistry.install(t),"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.includes(t)||this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.includes(t)||(this.onRegisterPlugin.push(t),t.activate(this)))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin=this.onStartupFinishedPlugin.filter((e=>e!==t)):"onRegister"===t.activeEvent&&(this.onRegisterPlugin=this.onRegisterPlugin.filter((e=>e!==t))),this.pluginRegistry.get(t.name)===t&&this.pluginRegistry.uninstall(t.name),t.deactivate(this)}release(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[],this.pluginRegistry.clear()}}class hm{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class cm{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=oh.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=oh.global.getRequestAnimationFrame();this.rafId=t((()=>{oh.global.devicePixelRatio!==this.dpr&&(this.dpr=oh.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=oh.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class dm{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),e.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oh.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const um=new Ve;class pm{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.dirtyBoundsHooksRegistered=!1,this.handlePaintOnlyUpdate=t=>{var e;const i=this.pluginService.stage;if(!i||i!==t.stage||!i.renderCount)return;const s=null!==(e=t.glyphHost)&&void 0!==e?e:t;if(!(s._updateTag&vo.UPDATE_PAINT)||s._updateTag&vo.UPDATE_BOUNDS)return;const n=this.ensurePaintDirtyBoundsCache(s);n&&!n.empty()&&i.dirty(n),s.clearUpdatePaintTag();const r=s.shadowRoot;if(!r)return;const a=this.ensurePaintDirtyBoundsCache(r);a&&!a.empty()&&i.dirty(a),r.clearUpdatePaintTag()}}ensurePaintDirtyBoundsCache(t){var e;const i=t;return i._AABBBounds.empty()&&i.doUpdateAABBBounds("imprecise"===(null===(e=i.attribute)||void 0===e?void 0:e.boundsMode)),i._globalAABBBounds&&!i._globalAABBBounds.empty()||i.tryUpdateGlobalAABBBounds(),i._globalAABBBounds}getRemoveDirtyBounds(t){var e;const i=(null!==(e=t.glyphHost)&&void 0!==e?e:t)._globalAABBBounds;if(i&&!i.empty())return i}registerDirtyBoundsHooks(t){this.dirtyBoundsHooksRegistered||(t.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handlePaintOnlyUpdate),t.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&&(um.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(um,t.parent&&t.parent.globalTransMatrix)))})),t.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))})),t.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),t.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;if(!e||e!==this.pluginService.stage||!e.renderCount)return;const i=this.getRemoveDirtyBounds(t);i&&!i.empty()&&e.dirty(i)})),this.dirtyBoundsHooksRegistered=!0)}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&(t.dirtyBounds.clear(),this.registerDirtyBoundsHooks(t))}));const e=this.pluginService.stage;e&&e.renderCount&&this.registerDirtyBoundsHooks(e)}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),this.dirtyBoundsHooksRegistered=!1,e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let gm;function fm(){if(null==gm)try{const t=document.createElement("canvas"),e=t.getContext("2d");gm=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),gm&&(gm=!!document.createElement)}catch(t){gm=!1}}function mm(){fm();const t=oh.global&&oh.global.env;return t?"browser"===t:gm}function vm(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(au(t),cu(t,t,[n+o,r+l,a+h]),cu(t,t,[y[0],y[1],y[2]]),ou(t,t,g),lu(t,t,p),cu(t,t,[-y[0],-y[1],y[2]]),uu(t,t,[c,d,u]),f){const i=Au.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]}cu(i,i,[s[0],s[1],0]),hu(i,i,f),cu(i,i,[-s[0],-s[1],0]),pu(t,t,i)}}function ym(t){const{alpha:e,beta:i}=t.attribute;return e||i}class _m{constructor(t=lf){this.creator=t,this.hooks={onAttributeUpdate:new uf(["graphic"]),onSetStage:new uf(["graphic","stage"]),onRemove:new uf(["graphic"]),onRelease:new uf(["graphic"]),onAddIncremental:new uf(["graphic","group","stage"]),onClearIncremental:new uf(["graphic","group","stage"]),beforeUpdateAABBBounds:new uf(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uf(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uf(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve,this.tempAABBBoundsResult={tb1:this.tempAABBBounds1,tb2:this.tempAABBBounds2}}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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=Xg(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=Yg(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Gc(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;Gc(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&&Ne(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),this.tempAABBBoundsResult}}const bm="white";class xm extends Qp{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:bm}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={},e={}){var i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,b,x,S,A;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{const e=this._pendingSharedStateRefreshGraphics;(null==e?void 0:e.size)&&function(t){const e=t._pendingSharedStateRefreshGraphics;if(!e||!e.size)return;const i=Array.from(e.values());e.clear(),i.forEach((e=>{"released"!==e.releaseStatus&&e.stage===t&&e.sharedStateDirty&&e.refreshSharedStateBeforeRender()}))}(this),this._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Dp,this.hooks={beforeRender:new uf(["stage"]),afterRender:new uf(["stage"]),afterClearScreen:new uf(["stage"]),afterClearRect:new uf(["stage"])},this.global=null!==(i=e.global)&&void 0!==i?i:oh.global,!this.global.env&&mm()&&this.global.setEnv("browser"),this.windowFactory=null!==(n=null!==(s=e.windowFactory)&&void 0!==s?s:oh.windowFactory)&&void 0!==n?n:()=>new Af(this.global),this.pickerServiceFactory=null!==(r=e.pickerServiceFactory)&&void 0!==r?r:e.pickerService?()=>e.pickerService:null!==(a=oh.pickerServiceFactory)&&void 0!==a?a:()=>new Bf,this.window=null!==(o=e.window)&&void 0!==o?o:this.windowFactory(),this.renderService=null!==(d=null!==(c=null!==(l=e.renderService)&&void 0!==l?l:null===(h=oh.renderServiceFactory)||void 0===h?void 0:h.call(oh))&&void 0!==c?c:oh.renderService)&&void 0!==d?d:new im,this.pluginService=null!==(f=null!==(g=null!==(u=e.pluginService)&&void 0!==u?u:null===(p=oh.pluginServiceFactory)||void 0===p?void 0:p.call(oh))&&void 0!==g?g:oh.pluginService)&&void 0!==f?f:new lm,this.layerService=null!==(v=null!==(m=e.layerService)&&void 0!==m?m:oh.layerService)&&void 0!==v?v:new Mm(this.global),this.graphicService=null!==(b=null!==(_=e.graphicService)&&void 0!==_?_:oh.graphicService)&&void 0!==b?b:new _m,this.pickerService=e.pickerService,this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:null!==(x=t.canvasControled)&&void 0!==x?x:!t.canvas,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(S=t.background)&&void 0!==S?S:bm,this.stage=this,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.theme.onStateDefinitionsChange=()=>{var t;const e=null===(t=this.theme)||void 0===t?void 0:t.stateDefinitions,i=e&&Object.keys(e).length?this.ensureRootSharedStateScope(e):this.rootSharedStateScope;var s,n;i&&(n=e,(s=i).themeStateDefinitions!==n&&(s.themeStateDefinitions=n,ap(s)),cp(i,this))},this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(A=t.rafId)&&void 0!==A?A:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new io(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(t=!1){t&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,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);const k=Cm.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=Cm.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Cm.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new hm))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new cm))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new dm))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ue;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new pm,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Cm.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Cm.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Cm.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}ensureRootSharedStateScope(t){return this.rootSharedStateScope?(this.rootSharedStateScope.ownerStage=this,this.rootSharedStateScope):(this.rootSharedStateScope=function(t,e){return ap({ownerStage:t,themeStateDefinitions:e,effectiveSourceDefinitions:{},effectiveCompiledDefinitions:new Map,revision:0,dirty:!1,subtreeActiveDescendants:new Set},0)}(this,t),this.rootSharedStateScope)}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=this.windowFactory(),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=this.pickerServiceFactory()),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}class Sm{constructor(t=xm,e){this.StageCtor=t,this.depsFactory=e}create(t={}){var e;return new this.StageCtor(t,null===(e=this.depsFactory)||void 0===e?void 0:e.call(this))}}class Am extends Qp{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 Dp,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oh.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=>{oh.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)))}}class km{constructor(t=Am){this.LayerCtor=t}create({stage:t,global:e,window:i,params:s}){return new this.LayerCtor(t,e,i,s)}}let Cm=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};function Tm(t){const e=oh.layerHandlerFactory;if(!e)throw new Error("Layer handler factory is not configured.");return e(t)}Cm._pluginClasses=Ef().pluginClasses;class Mm{static GenerateLayerId(){return`${Mm.idprefix}_${Mm.prefix_count++}`}constructor(t=oh.global,e=new km,i=Tm){this.layerFactory=e,this.layerHandlerFactory=i,this.layerMap=new Map,this.global=t}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){return this.layerHandlerFactory(t)}createLayer(t,e={main:!1}){var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=this.layerFactory.create({stage:t,global:this.global,window:t.window,params:Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Mm.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)}}Mm.idprefix="visactor_layer",Mm.prefix_count=0;const wm=Symbol.for("TransformUtil"),Em=Symbol.for("GraphicUtil"),Bm=Symbol.for("LayerService"),Pm=Symbol.for("StaticLayerHandlerContribution"),Rm=Symbol.for("DynamicLayerHandlerContribution"),Im=Symbol.for("VirtualLayerHandlerContribution"),Om=Symbol.for("@visactor/vrender-core/contribution-store-state");function Lm(){const t=globalThis;return t[Om]||(t[Om]={store:new Map}),t[Om]}const Dm=Symbol("ContributionProvider");class Fm{constructor(t,e){this.serviceIdentifier=t,this.container=e,Nm.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function zm(t,e){return new Fm(t,e)}function Hm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).inSingletonScope().whenTargetNamed(e)}function jm(t,e){t(Dm).toDynamicValue((({container:t})=>zm(e,t))).whenTargetNamed(e)}class Nm{static getStore(t){var e;return null===(e=this.store.get(t))||void 0===e?void 0:e.values().next().value}static setStore(t,e){let i=this.store.get(t);i||(i=new Set,this.store.set(t,i)),i.add(e)}static refreshAllContributions(){this.store.forEach((t=>{t.forEach((t=>{t.refresh()}))}))}}Nm.store=Lm().store;class Um{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=th.fontSize}){let i=0,s=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wg(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r,a=!1){if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=wg(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}}const Vm=Symbol.for("TextMeasureContribution");class Wm extends Um{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}}function Gm({bind:t}){t(yg).toDynamicValue((({container:t})=>new vf(zm(vg,t)))).inSingletonScope(),t(bf).to(Af),t(Em).toDynamicValue((({container:t})=>new kf(zm(Vm,t)))).inSingletonScope(),t(wm).to(Mf).inSingletonScope(),t(Bm).to(Mm).inSingletonScope()}const Ym=Symbol.for("RenderService"),Xm=Symbol.for("BeforeRenderConstribution");function Km({bind:t}){t(Ym).to(im)}const $m=Symbol.for("GraphicPicker"),qm=Symbol.for("PickerService"),Zm=Symbol.for("BoundsPicker"),Jm=Symbol.for("GlobalPickerService"),Qm=Symbol.for("PickItemInterceptor"),tv=Symbol.for("PickServiceInterceptor"),ev=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===ed,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Ut;for(;o<0;)o+=Ut;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n},iv=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class sv extends fg{constructor(t){super(t),this.type="rect3d",this.numberType=ud}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:s,x:n,y:r,length:a=Xt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:s-r;for(let e=0;e0)&&(null==e||e>0)&&(null==i||i>=3&&Number.isInteger(i))}getGraphicTheme(){return zp(this).star}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:e=0,height:s=0}=t;(isFinite(e)||isFinite(s))&&i.set(0,0,e,s)}const{tb1:s,tb2:n}=oh.graphicService.updateTempAABBBounds(i);return i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getCachedPoints(){return this.shouldUpdateShape()&&(this._cachedPoints=this.getStarPoints(this.attribute,this.getGraphicTheme()),this.clearUpdateShapeTag()),this._cachedPoints}getStarPoints(t,e){const{width:i=e.width,height:s=e.height,spikes:n=e.spikes,thickness:r=e.thickness}=t,a=Math.max(3,Math.floor(n)),o=Math.max(0,Math.min(1,r)),l=[],h=Math.min(i,s)/2,c=h*(1-o),d=i/2,u=s/2;for(let t=0;t<2*a;t++){const e=t%2==0?h:c,n=Math.PI/a*t,r=i/(2*h),o=s/(2*h);l.push({x:d+Math.sin(n)*e*r,y:u-Math.cos(n)*e*o})}return this._cachedPoints=l,l}_interpolate(t,e,i,s,n){"width"!==t&&"height"!==t&&"spikes"!==t&&"thickness"!==t||(n[t]=i+(s-i)*e)}needUpdateTags(t){return super.needUpdateTags(t,rv)}needUpdateTag(t){return super.needUpdateTag(t,rv)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.getGraphicTheme(),i=this.getStarPoints(this.attribute,e);return t=new Al,i.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new av(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return av.NOWORK_ANIMATE_ATTR}}function ov(t){return new av(t)}av.NOWORK_ANIMATE_ATTR=Cp;class lv extends Up{constructor(t){super(t),this.type="arc3d",this.numberType=ed}updateAABBBounds(t,e,i){const s=this.stage;if(!s||!s.camera)return i;const{outerRadius:n=e.outerRadius,height:r=0}=t,a=n+r;return i.setValue(-a,-a,a,a),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return lv.NOWORK_ANIMATE_ATTR}}function hv(t){return new lv(t)}lv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);class cv extends dg{constructor(t){super(t),this.type="pyramid3d",this.numberType=cd}updateAABBBounds(t,e,i){const s=this.stage;return s&&s.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],s=t[1];i.add(e,s)})),oh.graphicService.updateTempAABBBounds(i),oh.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const s=3===i?t[0]:t[i+1],n=e.x-s.x;return 0===n?0:(e.y-s.y)/n})),i=t.map((t=>({p:t,d:0})));let s=!1,n=0;for(let t=0;t=0;e--){const s=t[e];i.unshift({p:s,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return cv.NOWORK_ANIMATE_ATTR}}function dv(t){return new cv(t)}let uv,pv;function gv(t){return uv||(uv=cf("text",{})),uv.initAttributes(t),uv.AABBBounds}function fv(t){return pv||(pv=cf("richtext",{})),pv.setAttributes(t),pv.AABBBounds}cv.NOWORK_ANIMATE_ATTR=Cp;class mv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}}class vv{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=zp(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Su.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}}class yv{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}}class _v{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=ev(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}}function bv({bind:t,isBound:e}){e(qm)||(t(Jm).toSelf(),t(qm).toService(Jm)),t(_v).toSelf().inSingletonScope(),t(Qm).toService(_v),t(vv).toSelf().inSingletonScope(),t(Qm).toService(vv),t(yv).toSelf().inSingletonScope(),t(Qm).toService(yv),Hm(t,Qm),t(mv).toSelf().inSingletonScope(),t(tv).toService(mv),Hm(t,tv)}function xv({bind:t}){t(vd).to(_m),t(yd).toConstantValue(lf)}const Sv=Symbol.for("AutoEnablePlugins"),Av=Symbol.for("PluginService");class kv{constructor(){this.type="static",this.offscreen=!1,this.global=oh.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({id:i.canvasId,width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Td({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()}}function Cv(t){(function({bind:t}){Hm(t,vg)})({bind:t.bind}),function({bind:t}){t(Vm).to(Wm).inSingletonScope(),Hm(t,Vm)}({bind:t.bind}),function({bind:t}){t(kv).toSelf(),t(Pm).toService(kv)}({bind:t.bind})}const Tv=Ht/2;function Mv(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Tv,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Tv,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Tv,Ht,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ht,Ht+Tv,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}function wv(t,e){return!(!t&&!e)}function Ev(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Bv(t,e,i){return i&&t*e>0}function Pv(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Rv(t,e){return t*e>0}function Iv(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Ov(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*uB*B+P*P&&(k=T,C=M),{cx:k,cy:C,x01:-c,y01:-d,x11:k*(n/x-1),y11:C*(n/x-1)}}function Dv(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Gt(c),k=n*Kt(c),C=s*Gt(u),T=s*Kt(u);let M,w,E,B;if((b>zt||y>zt)&&(M=n*Gt(d),w=n*Kt(d),E=s*Gt(p),B=s*Kt(p),r1?0:P<-1?Ht:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Xt(b,(s-l)/(o-1)),x=Xt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:M,yore:w,xire:C,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Fv(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ut-zt)e.moveTo(i+n*Gt(o),s+n*Kt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Kt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:C,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:w,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Dv(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=Xt(v,m),r=Xt(y,m),o=Lv(g,f,u,p,n,t,Number(c)),l=Lv(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Wt(o.y01,o.x01),Wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Gt(Wt(l.y01,l.x01)),s+o.cy+m*Kt(Wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Kt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Kt(C))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,C,!c)):e.moveTo(i+n*Gt(C),s+n*Kt(C));if(!(r>zt)||M<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=Xt(B,T),n=Xt(P,T),o=Lv(S,A,b,x,r,-n,Number(c)),l=Lv(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Kt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,w,E,c):e.moveTo(i+r*Gt(E),s+r*Kt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Kt(o)):e.closePath(),d}const zv=new Set(["circle","diamond","rect","vertical-line","horizontal-line","bias-lr","bias-rl","grid"]);class Hv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=_f.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])),_f.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,Ut),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h,c,d,u,p,g;const{textureRatio:f=r.textureRatio,textureOptions:m=null}=e.attribute;let v=null;const y=null!==(h=null==m?void 0:m.radius)&&void 0!==h?h:0,_=this.getPatternCacheKey(t,o,l,a,i.dpr,y);if(null!==_&&(v=this.textureMap.get(_)),!v){if("string"==typeof t)switch(t){case"circle":v=this.createCirclePattern(o,l,a,i);break;case"diamond":v=this.createDiamondPattern(o,l,a,i);break;case"rect":v=this.createRectPattern(o,l,a,i);break;case"vertical-line":v=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":v=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":v=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":v=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":v=this.createGridPattern(o,l,a,i)}v||(v=this.createResourcePattern(t,e,i,l,y)),v&&null!==_&&this.textureMap.set(_,v)}if("string"==typeof t&&m&&m.dynamicTexture){const{gridConfig:h={},useNewCanvas:d}=m,u=e.AABBBounds;s=u.x1,n=u.y1;const p=i;let g;if(d){g=_f.allocate({width:u.width(),height:u.height(),dpr:i.dpr});const t=g.getContext("2d");t.clearRect(0,0,u.width(),u.height()),s=0,n=0,i=t}if(p.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;p.setTransformFromMatrix(e.parent.globalTransMatrix),p.translate(t,i,!0)}p.setCommonStyle(e,e.attribute,s,n,r),p.clip();const v=u.width(),y=u.height(),_=l,b=o,x=h.columns?h.columns:Math.ceil(v/b),S=h.rows?h.rows:Math.ceil(y/b),A=h.gutterColumn?h.gutterColumn:2*_,k=h.gutterRow?h.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Gg({}));const C=h.columns?v/h.columns:b,T=h.rows?y/h.rows:b;this._tempSymbolGraphic.setAttributes({size:[C-A,T-k],symbolType:t});const M=this._tempSymbolGraphic.getParsedPath();for(let t=0;t0||r>0?null:t:"wave"===t?null:zv.has(t)?`builtin:${t}|size:${e}|padding:${i}|color:${s}|dpr:${n}`:`resource:${t}|padding:${i}|radius:${r}|dpr:${n}`}createResourcePattern(t,e,i,s,n){var r;const a=null===(r=e.resources)||void 0===r?void 0:r.get(t),o="success"===(null==a?void 0:a.state)?a.data:"object"==typeof t?t:null;if(!o)return null;if(s>0||n>0){const t=o.naturalWidth||o.width,e=o.naturalHeight||o.height;if(t>0&&e>0){const r=t+2*s,a=e+2*s,l=_f.allocate({width:r,height:a,dpr:i.dpr}),h=l.getContext("2d");if(h){if(h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,r,a),n>0){const i=Math.max(0,Math.min(n,Math.min(t,e)/2)),r=s,a=s,o=r+t,l=a+e;h.beginPath(),h.moveTo(r+i,a),h.lineTo(o-i,a),h.quadraticCurveTo(o,a,o,a+i),h.lineTo(o,l-i),h.quadraticCurveTo(o,l,o-i,l),h.lineTo(r+i,l),h.quadraticCurveTo(r,l,r,l-i),h.lineTo(r,a+i),h.quadraticCurveTo(r,a,r+i,a),h.closePath(),h.clip()}h.drawImage(o,s,s,t,e);const c=i.createPattern(l.nativeCanvas,"repeat");return(null==c?void 0:c.setTransform)&&c.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),_f.free(l),c}_f.free(l)}}const l=i.createPattern(o,"repeat");return(null==l?void 0:l.setTransform)&&l.setTransform(new DOMMatrix([1/i.dpr,0,0,1/i.dpr,0,0])),l}}const jv=new Hv;class Nv{constructor(){this.time=So.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,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:M=l.outerRadius}=t.attribute;M+=v,T-=m;const w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=C?o:nu(e,o,e.dpr),c=o/M,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:M+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),Fv(t,e,i,s,M+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&w(u,"outerBorder"),f&&w(p,"innerBorder"),t.setAttributes({outerRadius:M,innerRadius:T,startAngle:y,endAngle:_})}}const Uv=new Nv,Vv=jv,Wv=zf;class Gv{constructor(){this.time=So.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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder")}}const Yv=new Gv,Xv=jv,Kv=zf;class $v extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundOpacity:p=l.backgroundOpacity,opacity:g=l.opacity,backgroundMode:f=l.backgroundMode,backgroundFit:m=l.backgroundFit,backgroundKeepAspectRatio:v=l.backgroundKeepAspectRatio,backgroundScale:y=l.backgroundScale,backgroundOffsetX:_=l.backgroundOffsetX,backgroundOffsetY:b=l.backgroundOffsetY,backgroundClip:x=l.backgroundClip,backgroundPosition:S=l.backgroundPosition}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(jf(u));if(!i||"success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;e.globalAlpha=p*g,x&&e.clip(),this.doDrawImage(e,i.data,s,{backgroundMode:f,backgroundFit:m,backgroundKeepAspectRatio:v,backgroundScale:y,backgroundOffsetX:_,backgroundOffsetY:b,backgroundPosition:S}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.globalAlpha=p*g,e.fillStyle=u,e.fill(),e.highPerformanceRestore()}}const qv=new $v;function Zv(t){return Array.isArray(t)&&t.some((t=>!1===t||null===t))}class Jv{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:C,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:k-i)||0,w=(null!=w?w:C-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:nu(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,M-o*g,w-o*g)):(e.beginPath(),Mv(e,u,p,M-o*g,w-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}class Qv{constructor(){this.time=So.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;Zv(p)&&(u.doStroke=!1)}}class ty{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Zv(m)){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Mv(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}}const ey=new Jv,iy=jv,sy=zf;class ny extends Jv{constructor(){super(...arguments),this.time=So.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)}}const ry=new ny,ay=zf;class oy{constructor(){this.time=So.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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:nu(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}}class ly{constructor(){this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}}const hy=new oy,cy=new ly,dy=jv,uy=zf,py=jv,gy=zf;class fy extends Hv{constructor(){super(...arguments),this.time=So.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:xh(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:xh(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:xh(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:xh(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}}class my{constructor(t){this.groupRenderContribitions=t,this.numberType=rd}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:zp(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:C=l.x,y:T=l.y}=t.attribute,M=Pv(p,m,g,f,c),w=Iv(p,v,g,f),E=wv(c,u),B=Ev(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(M||w||a||o||u))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Mv(e,i,s,g,f,y,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(qv));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===So.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):M&&(e.setCommonStyle(t,t.attribute,C-i,T-s,l),e.fill()))},I=()=>{P.doStroke&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,C-i,T-s,l),e.stroke()))};A?(I(),R()):(R(),I()),this._groupRenderContribitions.forEach((r=>{r.time===So.afterFillStroke&&r.drawShape(t,e,i,s,E,B,M,w,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=oh.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=zp(t,null==s?void 0:s.theme).group,i=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(i,p||i,n),a.modelMatrix=i,Au.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Au.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}}var vy,yy=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"}(vy||(vy={}));class _y extends em{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=vy.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uf([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return yy(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:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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 yy(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return yy(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>yy(this,void 0,void 0,(function*(){if(2!==t.count)yield Of(t,Nl.zIndex,((i,s)=>{if(this.status===vy.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return yy(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return yy(this,void 0,void 0,(function*(){this.rendering&&(this.status=vy.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=vy.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 yy(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:()=>yy(this,void 0,void 0,(function*(){yield Of(t,Nl.zIndex,(t=>yy(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}}const by=Symbol.for("IncrementalDrawContribution"),xy=Symbol.for("ArcRender"),Sy=Symbol.for("Arc3dRender"),Ay=Symbol.for("AreaRender"),ky=Symbol.for("CircleRender"),Cy=Symbol.for("GraphicRender"),Ty=Symbol.for("GroupRender"),My=Symbol.for("LineRender"),wy=Symbol.for("PathRender"),Ey=Symbol.for("PolygonRender"),By=Symbol.for("RectRender"),Py=Symbol.for("Rect3DRender"),Ry=Symbol.for("SymbolRender"),Iy=Symbol.for("TextRender"),Oy=Symbol.for("RichTextRender"),Ly=Symbol.for("Pyramid3dRender"),Dy=Symbol.for("GlyphRender"),Fy=Symbol.for("ImageRender"),zy=Symbol.for("RenderSelector"),Hy=Symbol.for("DrawContribution"),jy=Symbol.for("StarRender"),Ny=Symbol.for("DrawItemInterceptor"),Uy=new Ve,Vy=new Ve;class Wy{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){Uy.copy(s.dirtyBounds),Vy.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,Su.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Uy),s.backupDirtyBounds.copy(Vy)),!0}}class Gy{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}}class Yy{constructor(){this.order=1,this.interceptors=[new Wy,new Ky,new Xy,new Gy]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Au.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}const $y=Symbol.for("ArcRenderContribution"),qy=Symbol.for("AreaRenderContribution"),Zy=Symbol.for("CircleRenderContribution"),Jy=Symbol.for("GroupRenderContribution"),Qy=Symbol.for("ImageRenderContribution"),t_=Symbol.for("PathRenderContribution"),e_=Symbol.for("PolygonRenderContribution"),i_=Symbol.for("RectRenderContribution"),s_=Symbol.for("SymbolRenderContribution"),n_=Symbol.for("TextRenderContribution"),r_=Symbol.for("StarRenderContribution"),a_=Symbol.for("CommonRenderContribution"),o_=Symbol.for("InteractiveSubRenderContribution");function l_(t){!function({bind:t}){t(Ff).toSelf().inSingletonScope(),t(Hv).toSelf().inSingletonScope(),t(Hy).to(em),t(by).to(_y),t(Ty).toDynamicValue((({container:t})=>new my(zm(Jy,t)))).inSingletonScope(),t(Cy).toService(Ty),Hm(t,Jy),Hm(t,o_),t($f).toDynamicValue((({container:t})=>new $f(zm(o_,t)))).inSingletonScope(),Hm(t,Cy),t(Yy).toSelf().inSingletonScope(),t(Ny).toService(Yy),Hm(t,Ny)}({bind:t.bind})}class h_{constructor(t){this.record=t}to(t){return this.record.implementationType="constructor",this.record.implementationConstructor=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toSelf(){return this.to(this.record.serviceIdentifier)}toDynamicValue(t){return this.record.implementationType="dynamic",this.record.implementationFactory=t,this.record.cached=!1,this.record.cachedValue=void 0,this}toConstantValue(t){return this.record.implementationType="constant",this.record.implementationValue=t,this.record.cached=!0,this.record.cachedValue=t,this}toService(t){return this.record.implementationType="service",this.record.linkedServiceIdentifier=t,this.record.cached=!1,this.record.cachedValue=void 0,this}inSingletonScope(){return this.record.scope="singleton",this}whenTargetNamed(t){return this.record.named=t,this}}class c_{constructor(){this.bindings=new Map,this.bind=t=>{const e={serviceIdentifier:t,scope:"transient",cached:!1},i=this.bindings.get(t);return i?i.push(e):this.bindings.set(t,[e]),new h_(e)},this.rebind=t=>(this.bindings.delete(t),this.bind(t)),this.isBound=t=>{var e,i;return(null!==(i=null===(e=this.bindings.get(t))||void 0===e?void 0:e.length)&&void 0!==i?i:0)>0},this.getAll=t=>{const e=this.bindings.get(t);return(null==e?void 0:e.length)?e.map((t=>this.resolveBinding(t))).filter((t=>void 0!==t)):[]},this.getNamed=(t,e)=>{const i=this.bindings.get(t);if(!(null==i?void 0:i.length))return;const s=i.find((t=>t.named===e));return s?this.resolveBinding(s):void 0}}resolveBinding(t){var e;if("singleton"===t.scope&&t.cached)return t.cachedValue;let i;switch(t.implementationType){case"constant":i=t.implementationValue;break;case"constructor":i=t.implementationConstructor?new t.implementationConstructor:void 0;break;case"dynamic":i=null===(e=t.implementationFactory)||void 0===e?void 0:e.call(t,{container:this});break;case"service":t.linkedServiceIdentifier&&([i]=this.getAll(t.linkedServiceIdentifier));break;default:i=void 0}return"singleton"===t.scope&&(t.cached=!0,t.cachedValue=i),i}}function d_(){return new c_}const u_=Symbol.for("@visactor/vrender-core/legacy-bootstrap-state");const p_=function(){const t=globalThis;return t[u_]||(t[u_]={legacyBindingContext:d_(),preloaded:!1}),t[u_]}(),g_=p_.legacyBindingContext;function f_(){p_.preloaded||(p_.preloaded=!0,Gm({bind:g_.bind}),xv({bind:g_.bind}),Km({bind:g_.bind}),bv({bind:g_.bind,isBound:g_.isBound}),function({bind:t}){t(Av).to(lm),jm(t,Sv)}({bind:g_.bind}),Cv(g_),l_(g_))}function m_(){return g_}function v_(t){f_();const[e]=g_.getAll(t);return e}function y_(t,e){return f_(),g_.getNamed(t,e)}function __(t){const e=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return new Proxy({},{get(t,i){const s=e()[i];return"function"==typeof s?s.bind(e()):s},set:(t,i,s)=>(e()[i]=s,!0),has:(t,i)=>i in e(),ownKeys:()=>Reflect.ownKeys(e()),getOwnPropertyDescriptor(t,i){const s=Object.getOwnPropertyDescriptor(e(),i);if(s)return Object.assign(Object.assign({},s),{configurable:!0})}})}const b_=__((()=>v_(yg)));oh.global=b_;class x_{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),this.release()}getWrapContainer(t,e,i){let s;return s=e?"string"==typeof e?oh.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:oh.global.createDom(Object.assign({tagName:"div",parent:s},i)),nativeContainer:s}}parseDefaultStyleFromGraphic(t){return Kg("text"===t.type&&t.attribute?t.attribute:zp(t).text)}getTransformOfText(t){const e=zp(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,penetrateEventList:a=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===r?"all":r||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",s.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let p=n.anchorType;if(u(p)&&(p="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===p&&(p="top-left"),"position"===p||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=ze(c,p);l=t.x,h=t.y}const f=oh.global.getElementTopLeft(s,!1),m=e.window.getTopLeft(!1),v=e.viewBox,_=l+m.left-f.left+v.x1,b=h+m.top-f.top+v.y1;if(o.left=`${_}px`,o.top=`${b}px`,"text"===t.type&&"position"===p&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),d(n.style)){const e=n.style({top:b,left:_,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else g(n.style)?o=Object.assign(Object.assign({},o),n.style):y(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),((t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const i=t.split(":");if(2===i.length){const t=i[0].trim(),s=i[1].trim();t&&s&&(e[t]=s)}}})),e})(n.style)));oh.global.updateDom(i,{width:n.width,height:n.height,style:o})}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"===oh.global.env&&(t.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Nl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Nl.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&&oh.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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"===oh.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 S_=()=>{Cm.registerPlugin("HtmlAttributePlugin",x_)};class A_ extends x_{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:s}=this.htmlMap[t];e?oh.global.getRequestAnimationFrame()((()=>{e.unmount()})):s&&s(),i&&oh.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const s=t.stage;if(!s)return;const n=s.params.ReactDOM,{element:r,container:a}=i;if(!r||!n||!n.createRoot&&!n.render)return;const o=u(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(r):n.render(r,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(s,a);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(r),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else n.render(r,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,s,l,h,i),this.htmlMap[o].renderId=this.renderId}}const k_=()=>{Cm.registerPlugin("ReactAttributePlugin",A_)};class C_{constructor(){this.transitions=new Map,this.registerDefaultTransitions()}static getInstance(){return C_.instance||(C_.instance=new C_),C_.instance}registerDefaultTransitions(){this.registerTransition("appear","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","state",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function T_(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1;if(Object.getOwnPropertyNames(t.prototype).length>1)return 1}return 2}function M_(t,e,i,s){const n=function(t,e,i,s){var n;const r=t,a=null===(n=r.context)||void 0===n?void 0:n.finalAttrs,o=r.getFinalAttribute();let l=null;for(let t=0;t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}getActiveAttrKeys(){const t=[];for(let e=0;e{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:w_.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=T_(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:w_.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=T_(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){if(Array.isArray(t)){const e=this._activeConfigList;this._activeConfigList=t;try{t.forEach((t=>this._execute(t)))}finally{this._activeConfigList=e}}else this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;this.syncFinalAttrsFromContext(e);const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:C,custom:T,customType:M,controlOptions:w}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),E.startAt(b);const I=i*x+B;I>0&&E.wait(I);let O=null,L=t.to,D=t.from;const F=this.shouldCommitAttrOutChannel(p);L||(O||(O=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),L=O.props),D||(O||(O=this.createPropsFromChannel(g,e,F,this.getAttrOutChannelExcludedKeys(e))),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,M,D,L,_,m,f,w,C,p,e),this.commitAnimatedUpdateDiffAttrsOnEnd(E,e,p,L);let z=0;x&&(z=x*(s-i-1));const H=d(y)?y(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):y;return H>0&&(z+=H),z>0&&E.wait(z),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,y,_,b;if(e&&i){i=T_(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=u.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;this.syncFinalAttrsFromContext(e);const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;const g=this.shouldCommitAttrOutChannel(r);u||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i,g,this.getAttrOutChannelExcludedKeys(i))),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const f=null!==(n=t.custom)&&void 0!==n?n:w_.builtInAnimateMap[r],m=t.custom?t.customType:T_(f);this._handleRunAnimate(e,f,m,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}shouldCommitAttrOutChannel(t){return"update"!==t}commitAnimatedUpdateDiffAttrsOnEnd(t,e,i,s){if("update"===i||!s||!this.isUpdateDiffContext(e))return;const n=this.collectAnimatedUpdateDiffAttrKeys(e,s);(null==n?void 0:n.length)&&t.onEnd((()=>{M_(e,n,t,s)}))}isUpdateDiffContext(t){const e=t.context;return"update"===(null==e?void 0:e.diffState)||"update"===(null==e?void 0:e.animationState)}collectAnimatedUpdateDiffAttrKeys(t,e){var i;const s=null===(i=t.context)||void 0===i?void 0:i.diffAttrs;if(!s)return null;let n=null;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&Object.prototype.hasOwnProperty.call(s,t)&&void 0!==s[t]&&(null!=n||(n=[]),n.push(t));return n}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e,i=!0,s){var n;const r={};let a=null;if(!t)return{from:a,props:r,attrOutChannel:null};const o=i?{}:null;let l=!1;const h=null===(n=e.context)||void 0===n?void 0:n.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===h[e]||(t[e]={to:h[e]}),t)),{})),Object.keys(t).forEach((i=>{var s,n,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?r[i]=h.to(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):r[i]=h.to),void 0!==h.from&&(a||(a={}),"function"==typeof h.from?a[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):a[i]=h.from)})),h&&o)for(const t in h){const e=h[t];void 0!==e&&(r.hasOwnProperty(t)||(null==a?void 0:a.hasOwnProperty(t))||(null==s?void 0:s[t])||(o[t]=e,l=!0))}return{from:a,props:r,attrOutChannel:l?o:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}getAttrOutChannelExcludedKeys(t){var e;const i=this._activeConfigList,s=null===(e=t.context)||void 0===e?void 0:e.diffAttrs;if(!i||i.length<=1||!s)return null;let n=null;for(let e=0;ethis._executeItem(t,e,i,s))).filter(Boolean)}finally{this._activeConfigList=n}}return[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bl.END,i.__skipRestoreStaticAttributeOnRemove=!0),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}w_.builtInAnimateMap={};const E_="appear",B_="disappear",P_="update",R_="highlight",I_="unhighlight";class O_{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class L_{constructor(t){this.stateList=null,this.graphic=t,this.trackedAnimates=new Map,this.graphic.animates=this.trackedAnimates}trackAnimate(t){this.trackedAnimates.set(t.id,t)}untrackAnimate(t){this.trackedAnimates.delete(t)}forEachTrackedAnimate(t){this.trackedAnimates.forEach(t)}getTrackedAnimates(){return this.trackedAnimates}hasTrackedAnimate(){return this.trackedAnimates.size>0}hasStateInfo(t,e){for(let i=0;i{const s={allowTransition:!0,stopOriginalTransition:!0};r.forEach((e=>{const i=n.isTransitionAllowed(e.state,t,this.graphic);s.allowTransition=s.allowTransition&&i.allowTransition})),s.allowTransition&&(o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)}),r.forEach((e=>{n.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&a.push(e)})))})):t.forEach(((t,i)=>{o.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new w_(this.graphic)})})),a.forEach((t=>{t.executor.stop(null,!1)})),o.length){o[0].executor.execute(o[0].animationConfig),this.takeOverUpdateAttrs(o[0],r,a);for(let t=0;t{var n;if(e){e.executor.execute(e.animationConfig);const t=[];this.takeOverUpdateAttrs(e,null!==(n=this.stateList)&&void 0!==n?n:[],t),t.length&&this.stateList&&(this.stateList=this.stateList.filter((e=>!this.hasStateInfo(t,e))))}this.stateList=this.stateList.filter((t=>t!==s)),t===o.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!a.includes(t))):this.stateList=[],this.stateList.push(...o)}applyAppearState(t,e){this.applyState([E_],[{name:E_,animation:t}],e)}applyDisappearState(t,e){this.applyState([B_],[{name:B_,animation:t}],e)}applyUpdateState(t,e){this.applyState([P_],[{name:P_,animation:t}],e)}applyHighlightState(t,e){this.applyState([R_],[{name:R_,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([I_],[{name:I_,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class D_{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new L_(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new O_(t)),t._animationStateStore}trackAnimate(t){this._getAnimationStateManager(this).trackAnimate(t)}untrackAnimate(t){const e=this._animationStateManager;null==e||e.untrackAnimate(t)}forEachTrackedAnimate(t){const e=this._animationStateManager;null==e||e.forEachTrackedAnimate(t)}getTrackedAnimates(){return this._getAnimationStateManager(this).getTrackedAnimates()}hasTrackedAnimate(){const t=this._animationStateManager;return!!t&&t.hasTrackedAnimate()}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return t}}class F_{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-F_.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*F_.bounceIn(2*t):.5*F_.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ut*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ut/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ut*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ut/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ut/e)*.5+1}}static registerFunc(t,e){F_[t]=e}}function z_(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}F_.quadIn=F_.getPowIn(2),F_.quadOut=F_.getPowOut(2),F_.quadInOut=F_.getPowInOut(2),F_.cubicIn=F_.getPowIn(3),F_.cubicOut=F_.getPowOut(3),F_.cubicInOut=F_.getPowInOut(3),F_.quartIn=F_.getPowIn(4),F_.quartOut=F_.getPowOut(4),F_.quartInOut=F_.getPowInOut(4),F_.quintIn=F_.getPowIn(5),F_.quintOut=F_.getPowOut(5),F_.quintInOut=F_.getPowInOut(5),F_.backIn=F_.getBackIn(1.7),F_.backOut=F_.getBackOut(1.7),F_.backInOut=F_.getBackInOut(1.7),F_.elasticIn=F_.getElasticIn(1,.3),F_.elasticOut=F_.getElasticOut(1,.3),F_.elasticInOut=F_.getElasticInOut(1,.3*1.5),F_.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),F_.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},F_.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)F_[`flicker${t}`]=e=>z_(e,t);for(let t=2;t<10;t++)F_[`aIn${t}`]=e=>t*e*e+(1-t)*e;function H_(t,e,i){return t+(e-t)*i}const j_=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=H_(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=H_(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=H_(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=H_(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=H_(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=H_(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=H_(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=H_(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=H_(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Ru(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?zu(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Ru(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?zu(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=H_(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=H_(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=H_(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=H_(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=H_(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=H_(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=H_(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=H_(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=H_(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=bh(e,i,s),r.addUpdateBoundTag()}}};function N_(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag(),this.target.onAttributeUpdate({type:_o.ANIMATE_UPDATE})},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=F_[s])&&void 0!==n?n:F_.linear:F_.linear,"wait"===t&&(this.onUpdate=Z_),this.id=Va.GenAutoIncrementId(),this.syncAttributeUpdate=Z_}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Bu.Get(i,Eu.Color255),r=Bu.Get(s,Eu.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(j_["fill"===e?"fillPure":"strokePure"])}else j_[e]?t.push(j_[e]):t.push(N_)}else j_[e]?t.push(j_[e]):t.push(N_)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}runInterpolateUpdate(t,e,i){if(this.animate.interpolateUpdateFunction)return void this.animate.interpolateUpdateFunction(t,e,i,this,this.target);const s=this.interpolateUpdateFunctions,n=this.propKeys;if(s&&n)for(let r=0;r{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate,e=this.target,i=this.propKeys;e.forEachTrackedAnimate((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const s=e.getStartProps();let n=null;for(let t=0;t{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tb extends Q_{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();$_(this.target,t,_o.ANIMATE_START)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class eb extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Va.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bl.END?this.removeAnimate(t,!0):t.status!==Bl.RUNNING&&t.status!==Bl.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ib=new eb;ib.isGlobal=!0;class sb extends Q_{constructor(t,e,i,s,n){super("customAnimate",null!=e?e:{},i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class nb extends sb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class rb extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Bl.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class ab extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}applyTransientFromAttributes(){$_(this.target,this.from,_o.ANIMATE_START)}onBind(){var t,e,i;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))})),"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=null===(e=this.params)||void 0===e?void 0:e.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.applyTransientFromAttributes()}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.applyTransientFromAttributes()}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this.from=this.removeKeysFromRecord(this.from,t)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.from,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}function ob(t,e){for(let i=0;i{var i;if(t===e||t.status===Bl.END)return;const s=null===(i=t.getEndProps)||void 0===i?void 0:i.call(t);if(s)for(const t in s)!Object.prototype.hasOwnProperty.call(s,t)||a&&Object.prototype.hasOwnProperty.call(a,t)||((null!=r?r:r=Object.create(null))[t]=!0)})),r}class cb{constructor(t=Va.GenAutoIncrementId(),e=ib,i){this.id=t,this.status=Bl.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){this.target=t;const e=this.target;return e.detachAttributeFromBaseAttributes(),e.trackAnimate(this),this.onRemove((()=>{this.stop(),this.__skipRestoreStaticAttributeOnRemove||e.restoreStaticAttribute(hb(e,this)),e.untrackAnimate(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new Q_(El.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tb(El.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new ab(t,{},e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bl.RUNNING&&(this.status=Bl.PAUSED)}resume(){this.status===Bl.PAUSED&&(this.status=Bl.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this.preventAttrs([t])}preventAttrs(t){if(!(null==t?void 0:t.length))return;for(let e=0;et())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bl.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration){null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),this.status=Bl.END;const t=this.target;return t.restoreStaticAttribute(hb(t,this)),void(this.__skipRestoreStaticAttributeOnRemove=!0)}this.status=Bl.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&$_(this.target,this._startProps,_o.ANIMATE_START);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const db=new gf;class ub{constructor(){this.released=!1}tick(t,e){db.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class pb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===wl.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=wl.INITIAL,oh.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),oh.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new ub;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==wl.INITIAL&&(this.status=wl.PAUSE,!0)}resume(){return this.status!==wl.INITIAL&&(this.status=wl.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=wl.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===wl.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===wl.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,oh.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&tt.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.visitTrackedAnimates((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.visitTrackedAnimates((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function fb(){G(Ep,D_),G(Ep,gb)}function mb(){hf("arc",Vp)}function vb(){hf("arc3d",hv)}function yb(){hf("area",Yp)}function _b(){hf("circle",$p)}function bb(){hf("glyph",Zp)}function xb(){hf("group",tg)}function Sb(){hf("image",sg)}function Ab(){hf("line",ag)}function kb(){hf("path",hg)}function Cb(){hf("polygon",ug)}function Tb(){hf("pyramid3d",dv)}function Mb(){hf("rect",mg)}function wb(){hf("rect3d",nv)}function Eb(){hf("richtext",jg)}function Bb(){hf("shadowRoot",Ug)}function Pb(){hf("star",ov)}function Rb(){hf("symbol",Gg)}function Ib(){hf("text",Jg)}function Ob(){hf("wrapText",ef)}function Lb(t,e){const i="object"==typeof e&&null!==e||"function"==typeof e?e:t;return!!t.has(i)||(t.add(i),!1)}const Db={x:0,y:0,z:0,lastModelMatrix:null};class Fb{init(t){this.builtinContributions||(this.builtinContributions=[]),this._renderContribitions=t?t.getContributions().slice():[];const e=t=>{this._renderContribitions.includes(t)||this._renderContribitions.push(t)};this.builtinContributions.forEach(e),e(Zf),e(Qf),this._renderContribitions.length?(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===So.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===So.afterFillStroke))):(this._beforeRenderContribitions=[],this._afterRenderContribitions=[])}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=zp(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=Bv(d,u,h),_=Rv(d,g),b=wv(h),x=Ev(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return wo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=Bv(o,l,n),p=Rv(o,c),g=wv(n,r),f=Ev(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Db.x=n,Db.y=r,Db.z=a,Db.lastModelMatrix=d;const p=u&&(s||ym(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Au.allocate(),n=Au.allocate();vm(n,t,e),pu(s,d||s,n),Db.x=0,Db.y=0,Db.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Au.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,Db.z=a,i.setTransformForCurrent()}else if(p)Db.x=0,Db.y=0,Db.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Db.x+=s.x,Db.y+=s.y,this.transformWithoutTranslate(i,Db.x,Db.y,Db.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Db.x=0,Db.y=0,Db.z=0;return Db}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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Au.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}class zb extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=td,this.builtinContributions=[Uv,Wv,Vv],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nzt){const t=Xt(b,_),r=Xt(x,_),a=Lv(v,y,f,m,n,t,Number(u)),o=Lv(A,k,C,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||w<.001)e.lineTo(i+C,s+T),p=!0;else if(M>zt){const t=Xt(B,M),n=Xt(P,M),a=Lv(C,T,A,k,r,-n,Number(u)),o=Lv(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),M0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Kt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:C=l.innerRadius}=t.attribute;k+=b,C-=x;let T=0;const M=(c(S)&&S||S[0])&&"conical"===h.gradient;if(M){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i)=Ut-zt){e.beginPath();const r=Math.abs(k-C)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,C,d,d+r),w||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const r=Gu(0,0,h,n);a||Bv&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}})(),u()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),M&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}}const Hb=new WeakSet;function jb({bind:t}){Lb(Hb,t)||(t(zb).toDynamicValue((({container:t})=>new zb(zm($y,t)))).inSingletonScope(),t(xy).toService(zb),t(Cy).toService(xy),t($y).toService($f),Hm(t,$y))}const Nb=jb;class Ub extends Fb{constructor(){super(...arguments),this.numberType=ed}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).arc,{fill:c=h.fill}=t.attribute,d=this.valid(t,h,a,o);if(!d)return;const{fVisible:u,sVisible:p,doFill:g,doStroke:f}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:v=h.outerPadding,innerPadding:y=h.innerPadding,height:_=10}=t.attribute;let{outerRadius:b=h.outerRadius,innerRadius:x=h.innerRadius}=t.attribute;b+=v,x-=y;const S=Bu.Get(c,Eu.Color255),{light:A}=n.stage||{},k=n.hack_pieFace,C={top:m,bottom:m+_},T={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===k||"top"===k?(e.beginPath(),function(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(r=Ut-zt)e.moveTo(i+r*Gt(o),s+r*Kt(o),n),e.arc(i,s,r,o,l,!c,n),a>zt&&(e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),v=r*Gt(p),y=r*Kt(p),_=a*Gt(f),b=a*Kt(f);h<.001?d=!0:(e.moveTo(i+v,s+y,n),e.arc(i,s,r,p,g,!c,n)),!(a>zt)||u<.001?(e.lineTo(i+_,s+b,n),d=!0):(e.lineTo(i+_,s+b,n),e.arc(i,s,a,f,m,c,n))}e.closePath()}(t,e,i,s,C[k],b,x),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke()))):"outside"!==k&&"inside"!==k||("inside"===k&&(e.save(),e.beginPath(),e.arc(i,s,x,0,Ut,!0,C.top),e.clip()),e.beginPath(),function(t,e,i,s,n,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Vt(h-l),d=h>l;let u=!1;if(a<=zt)e.moveTo(i,s,n);else if(c>=Ut-zt)e.moveTo(i+a*Gt(l),s+a*Kt(l),n),e.arc(i,s,a,l,h,!d,n),e.lineTo(i+a*Gt(h),s+a*Kt(h),r),e.arc(i,s,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Gt(c),f=a*Kt(c),m=a*Gt(p),v=a*Kt(p);t<.001?u=!0:(e.moveTo(i+g,s+f,n),e.arc(i,s,a,c,p,!d,n),e.lineTo(i+m,s+v,r),e.arc(i,s,a,p,c,d,r))}e.closePath()}(t,e,i,s,C.top,C.bottom,"outside"===k?b:x,((e,i)=>{const{outerDeltaAngle:s,innerDeltaAngle:n,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===k?{innerouterDeltaAngle:s,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),g&&(a?a(e,t.attribute,h):u&&(e.setCommonStyle(t,t.attribute,i,s,h),e.fillStyle=A?A.computeColor(T[k],S):c,e.fill())),f&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,s,h),e.stroke())),"inside"===k&&e.restore())}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}}const Vb=new WeakSet;function Wb({bind:t}){Lb(Vb,t)||(t(Ub).toDynamicValue((()=>new Ub)).inSingletonScope(),t(Sy).toService(Ub),t(Cy).toService(Sy))}const Gb=Wb;function Yb(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 Xb(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?bo.ROW:bo.COLUMN,Number.isFinite(c)||(o=bo.COLUMN),Number.isFinite(d)||(o=bo.ROW);const u=i*(o===bo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Yb(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),Yb(t,l,1,s),o=!1):o=!0}t.closePath()}function $b(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function qb(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=$b(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Yb(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=bo.ROW:"y"===s?u=bo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}function Jb(t,e,i,s){const{offsetX:n=0,offsetY:r=0}=s||{},{points:a}=i,o=[];for(let t=0;t{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()}))}const Qb=new fy,tx=zf;class ex extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=id,this.builtinContributions=[Qb,tx],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=zp(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:C=g.clipRange,closePath:T,points:M,segments:w}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===C&&!w&&!M.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,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=Sl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=w.length-1;t>=0;t--){const e=w[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=w[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Sl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!M||!M.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(M,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Sl(e,E,{curveTension:b}),n=Sl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===C){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,_,r[c],[g,t.attribute],C,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=C*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,A,v,k,_,r[u],[g,t.attribute],Xt(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,_,t.attribute,g,C,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=bo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),A=Vt(y.y-b.y);x=null==y.x1?bo.ROW:null==y.y1?bo.COLUMN:Number.isFinite(S+A)?S>A?bo.ROW:bo.COLUMN:bo.ROW,Xb(t,e,l,{offsetX:h,offsetY:c,offsetZ:d,direction:x}),this.beforeRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:k=0,x:C=0}=a;return!1!==i&&(g?g(t,a,o):s&&(t.setCommonStyle(u,a,k-h,C-c,o),t.fill())),this.afterRenderStep(u,t,h,c,!!s,!1,i,!1,o,p,g,null,{attribute:a}),(()=>{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),qb(t,i[0]?e.top:e.bottom,l,x===bo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,C-c,o),t.stroke()}})(),!1}}const ix=new WeakSet;function sx({bind:t}){Lb(ix,t)||(t(ex).toDynamicValue((({container:t})=>new ex(zm(qy,t)))).inSingletonScope(),t(Ay).toService(ex),t(Cy).toService(Ay),t(qy).toService($f),Hm(t,qy))}const nx=sx;class rx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=sd,this.builtinContributions=[Yv,Kv,Xv],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const b=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{_&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}}const ax=new WeakSet;function ox({bind:t}){Lb(ax,t)||(t(rx).toDynamicValue((({container:t})=>new rx(zm(Zy,t)))).inSingletonScope(),t(ky).toService(rx),t(Cy).toService(ky),t(Zy).toService($f),Hm(t,Zy))}const lx=ox;class hx{constructor(){this.numberType=nd}reInit(){}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=zp(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}}const cx=new WeakSet;function dx({bind:t}){Lb(cx,t)||(t(hx).toDynamicValue((()=>new hx)).inSingletonScope(),t(Dy).toService(hx),t(Cy).toService(Dy))}const ux=dx,px=["","repeat-x","repeat-y","repeat"];function gx(t,e){let i=0;return"repeat"===t&&(i|=1),"repeat"===e&&(i|=2),i?px[i]:"no-repeat"}function fx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i}){const s=gx(t,e);return{repeatMode:s,sizingMode:"no-repeat"===s&&null!=i?i:"fill"}}const mx={cover:"no-repeat-cover",contain:"no-repeat-contain",fill:"no-repeat-fill",auto:"no-repeat-auto"};function vx(t){return{backgroundMode:mx[t],backgroundFit:!1,backgroundKeepAspectRatio:!1}}function yx({repeatX:t="no-repeat",repeatY:e="no-repeat",imageMode:i,imageScale:s=1,imageOffsetX:n=0,imageOffsetY:r=0}){const{repeatMode:a,sizingMode:o}=fx({repeatX:t,repeatY:e,imageMode:i});return"no-repeat"===a&&("cover"===o||"auto"===o||1!==s||0!==n||0!==r)}function _x(t,e,i,s,n,r,{repeatX:a="no-repeat",repeatY:o="no-repeat",imageMode:l,imageScale:h=1,imageOffsetX:c=0,imageOffsetY:d=0,imagePosition:u="top-left"}){const{repeatMode:p,sizingMode:g}=fx({repeatX:a,repeatY:o,imageMode:l}),f="no-repeat"===p?vx(g):{backgroundMode:p,backgroundFit:!1,backgroundKeepAspectRatio:!1};Kf(t,e,{x1:i,y1:s,x2:i+n,y2:s+r,width:()=>n,height:()=>r},{backgroundMode:f.backgroundMode,backgroundFit:f.backgroundFit,backgroundKeepAspectRatio:f.backgroundKeepAspectRatio,backgroundScale:h,backgroundOffsetX:c,backgroundOffsetY:d,backgroundPosition:u})}class bx extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ad,this.builtinContributions=[ry,ay],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,imageMode:m=l.imageMode,imageScale:v=l.imageScale,imageOffsetX:y=l.imageOffsetX,imageOffsetY:b=l.imageOffsetY,imagePosition:x=l.imagePosition,image:S}=t.attribute,A=this.valid(t,l,a);if(!A)return;const{fVisible:k,sVisible:C,doFill:T,doStroke:M}=A;if(!S||!t.resources)return;const w=t.resources.get(S);if("success"!==w.state)return;const E=t.width,B=t.height;e.beginPath();let P=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,E,B):(Mv(e,i,s,E,B,p,"bevel"!==f),P=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{T&&(a?a(e,t.attribute,l):k&&(e.setCommonStyle(t,t.attribute,i,s,l),_x(e,w.data,i,s,E,B,{repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x})))},I=()=>{M&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))},O=yx({repeatX:h,repeatY:c,imageMode:m,imageScale:v,imageOffsetX:y,imageOffsetY:b,imagePosition:x}),L=P||O;g?(I(),L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore()):(L&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,T,!1,k,!1,l,n,a),R(),L&&e.restore(),I()),this.afterRenderStep(t,e,i,s,T,!1,k,!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&&y(s))return void lh.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=zp(t).image;this._draw(t,a,!1,i)}}const xx=new WeakSet;function Sx({bind:t}){Lb(xx,t)||(t(Fy).toDynamicValue((({container:t})=>new bx(zm(Qy,t)))).inSingletonScope(),t(Cy).toService(Fy),t(Qy).toService($f),Hm(t,Qy))}const Ax=Sx;class kx extends Fb{constructor(){super(...arguments),this.numberType=od}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f;if(!e)return;t.beginPath();qb(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Sl(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Xt(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,b,i,s,t,a,o)}}const Cx=new WeakSet;function Tx({bind:t}){Lb(Cx,t)||(t(kx).toDynamicValue((()=>new kx)).inSingletonScope(),t(My).toService(kx),t(Cy).toService(My))}const Mx=Tx,Ex=jv,Bx=zf;class Px extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ld,this.builtinContributions=[Bx,Ex],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:zp(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)wo(t.pathShape.commandList,e,i,s,1,1,f);else{wo((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}}const Rx=new WeakSet;function Ix({bind:t}){Lb(Rx,t)||(t(Px).toDynamicValue((({container:t})=>new Px(zm(t_,t)))).inSingletonScope(),t(wy).toService(Px),t(Cy).toService(wy),t(t_).toService($f),Hm(t,t_))}const Ox=Ix;function Lx(t,e,i,s){if(e&&e.length){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n0===t))?Lx(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lx(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 _=Dx(d,u),b=Dx(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Fx(h,y,_,d,u),A=Fx(h,y,b,p,g),k=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,T=Dx(k,C),M=Fx(h,Dx(y,v),T,k,C);let w=Math.atan2(S.y-M.y,S.x-M.x);const E=Math.atan2(A.y-M.y,A.x-M.x);let B=E-w;B<0&&(w=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}}const Nx=new WeakSet;function Ux({bind:t}){Lb(Nx,t)||(t(Ey).toDynamicValue((({container:t})=>new jx(zm(e_,t)))).inSingletonScope(),t(Cy).toService(Ey),t(e_).toService($f),Hm(t,e_))}const Vx=Ux;class Wx extends Fb{stroke(t,e,i,s,n){const r=s.vertices;s.edges.forEach((s=>{const a=r[s[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[s[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,s,n,r,a,o,l,h,c){const d=Bu.Get(r,Eu.Color255),u=s.vertices,p=u.map((t=>a.view(t[0],t[1],t[2])[2])),g=[];s.polygons.forEach(((t,e)=>{if(n&&!n[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,s=p[i[0]],r=p[i[1]],a=p[i[2]],o=p[i[3]];t.ave_z=s+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((s=>{const{polygon:n,normal:p}=s.polygon,g=u[n[0]],f=u[n[1]],m=u[n[2]],v=u[n[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+v[0],y:e+v[1],z:i+v[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),c?c(a,l&&l.attribute,h):(a.fillStyle=o?o.computeColor(p,d):r,a.fill())}))}}class Gx extends Wx{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=cd}drawShape(t,e,i,s,n,r,a,o){var l;const h=zp(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,face:u=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:g}=n.stage||{},f=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,s,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,s,p,f,u,n,e,g,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,s,h),this.stroke(i,s,p,f,e))}draw(t,e,i){const s=zp(t).polygon;this._draw(t,s,!1,i)}}const Yx=new WeakSet;function Xx({bind:t}){Lb(Yx,t)||(t(Gx).toDynamicValue((()=>new Gx)).inSingletonScope(),t(Ly).toService(Gx),t(Cy).toService(Ly))}const Kx=Xx;class $x extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=dd,this.builtinContributions=[ey,sy,iy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:zp(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:C=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:M}=t.attribute;T=(null!=T?T:b-S)||0,M=(null!=M?M:x-A)||0;const w=Pv(g,f,T,M,h),E=Iv(g,v,T,M,C),B=wv(h,c),P=Ev(d,m);if(!t.valid||!y)return;if(!B&&!P)return;if(!(w||E||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,M)):(e.beginPath(),Mv(e,i,s,T,M,u,"bevel"!==p));const R={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,w,E,l,n,a,o,R),k?(this._runStroke(t,e,i,s,l,R,E,S,A,o),this._runFill(t,e,i,s,l,R,w,S,A,a)):(this._runFill(t,e,i,s,l,R,w,S,A,a),this._runStroke(t,e,i,s,l,R,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,w,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}}const qx=new WeakSet;function Zx({bind:t}){Lb(qx,t)||(t($x).toDynamicValue((({container:t})=>new $x(zm(i_,t)))).inSingletonScope(),t(By).toService($x),t(Cy).toService(By),t(ty).toSelf(),t(Qv).toSelf(),t(i_).toService(ty),t(i_).toService(Qv),t(i_).toService($f),Hm(t,i_))}const Jx=Zx;class Qx extends Wx{constructor(){super(...arguments),this.type="rect3d",this.numberType=ud}drawShape(t,e,i,s,n,r,a,o){var l,h;const c=zp(t,null==r?void 0:r.theme).rect,{fill:d=c.fill,stroke:u=c.stroke,x1:p,y1:g,x:f,y:m,opacity:v=c.opacity,fillOpacity:y=c.fillOpacity,lineWidth:_=c.lineWidth,strokeOpacity:b=c.strokeOpacity,visible:x=c.visible,drawStrokeWhenZeroWH:S=null!==(l=c.drawStrokeWhenZeroWH)&&void 0!==l&&l}=t.attribute;let{width:A,height:k}=t.attribute;A=(null!=A?A:p-f)||0,k=(null!=k?k:g-m)||0;const C=null!==(h=this.z)&&void 0!==h?h:0,T=Pv(v,y,A,k,d),M=Iv(v,b,A,k,S),w=wv(d),E=Ev(u,_);if(!t.valid||!x)return;if(!w&&!E)return;if(!(T||M||a||o))return;const{light:B}=n.stage||{},P=t.findFace();if(!1!==d){e.setCommonStyle(t,t.attribute,i,s,c);let n=d;"string"!=typeof n&&(n="black"),this.fill(i,s,C,P,null,n,e,B,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,s,c),this.stroke(i,s,C,P,e))}draw(t,e,i){const s=zp(t).rect;this._draw(t,s,!1,i)}}const tS=new WeakSet;function eS({bind:t}){Lb(tS,t)||(t(Qx).toDynamicValue((()=>new Qx)).inSingletonScope(),t(Py).toService(Qx),t(Cy).toService(Py))}const iS=eS;const sS=new class extends Ff{constructor(){super(...arguments),this.time=So.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundOpacity:A=l.backgroundOpacity,opacity:k=l.opacity,backgroundMode:C=l.backgroundMode,backgroundFit:T=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio,backgroundScale:w=l.backgroundScale,backgroundOffsetX:E=l.backgroundOffsetX,backgroundOffsetY:B=l.backgroundOffsetY,backgroundPosition:P=l.backgroundPosition,backgroundClip:R=l.backgroundClip,backgroundCornerRadius:I=l.backgroundCornerRadius}=t.attribute;let O,{background:L}=t.attribute;if(!L)return;const D=()=>{"richtext"===t.type&&(e.restore(),e.save(),O&&e.setTransformFromMatrix(O,!0,1))};let F;"richtext"===t.type&&(O=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const z=g(L)&&L.background?L:null,H=t.transMatrix.onlyTranslate();if(z){const e=t.AABBBounds,i=(null!==(u=z.x)&&void 0!==u?u:e.x1)+(null!==(p=z.dx)&&void 0!==p?p:0),s=(null!==(f=z.y)&&void 0!==f?f:e.y1)+(null!==(m=z.dy)&&void 0!==m?m:0),n=null!==(v=z.width)&&void 0!==v?v:e.width(),r=null!==(y=z.height)&&void 0!==y?y:e.height();if(F=Df.allocate(i,s,i+n,s+r),L=z.background,!H){const t=F.width(),e=F.height();F.set((null!==(_=z.x)&&void 0!==_?_:0)+(null!==(b=z.dx)&&void 0!==b?b:0),(null!==(x=z.y)&&void 0!==x?x:0)+(null!==(S=z.dy)&&void 0!==S?S:0),t,e)}}else F=t.AABBBounds,H||(F=gv(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 i=t.resources.get(L);if(!i||"success"!==i.state||!i.data)return void D();e.highPerformanceSave(),H&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.globalAlpha=A*k,R&&(e.beginPath(),I?Mv(e,F.x1,F.y1,F.width(),F.height(),I,!0):e.rect(F.x1,F.y1,F.width(),F.height()),e.clip()),this.doDrawImage(e,i.data,F,{backgroundMode:C,backgroundFit:T,backgroundKeepAspectRatio:M,backgroundScale:w,backgroundOffsetX:E,backgroundOffsetY:B,backgroundPosition:P}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=A*k,e.fillStyle=L,I?(Mv(e,F.x1,F.y1,F.width(),F.height(),I,!0),e.fill()):e.fillRect(F.x1,F.y1,F.width(),F.height()),e.highPerformanceRestore();z&&Df.free(F),D()}};class nS extends Fb{constructor(){super(),this.numberType=pd,this.builtinContributions=[sS],this.init()}drawShape(t,e,i,s,n){const r=zp(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=Bv(o,l,!0),d=Bv(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=zp(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(),Mv(e,i-t,s-n,v,y,f,!0)),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=zp(t).richtext;this._draw(t,s,!1,i)}}const rS=new WeakSet;function aS({bind:t}){Lb(rS,t)||(t(nS).toDynamicValue((()=>new nS)).inSingletonScope(),t(Oy).toService(nS),t(Cy).toService(Oy))}const oS=aS;class lS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=gd,this.builtinContributions=[gy,py],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t,null==r?void 0:r.theme).star,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a,o);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=t.getCachedPoints();e.beginPath(),v&&v.length&&v.forEach(((t,n)=>{0===n?e.moveTo(i+t.x,s+t.y):e.lineTo(i+t.x,s+t.y)})),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,f,m,p,g,l,n,a,o);const y=()=>{f&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,h-i,c-s,l),e.fill()))},_=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(_(),y()):(y(),_()),this.afterRenderStep(t,e,i,s,f,m,p,g,l,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).star;this._draw(t,n,!1,i,s)}}const hS=new WeakSet;function cS({bind:t}){Lb(hS,t)||(t(lS).toDynamicValue((({container:t})=>new lS(zm(r_,t)))).inSingletonScope(),t(jy).toService(lS),t(Cy).toService(jy),Hm(t,r_))}const dS=cS;class uS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=fd,this.builtinContributions=[hy,uy,dy,cy],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:zp(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,C=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,M=s,w=C;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,C);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,M=t.y,w=void 0}!1===A.draw(e,c,T,M,w,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,A,a)):(this._runFill(t,e,i,s,l,x,y,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}}const pS=new WeakSet;function gS({bind:t}){Lb(pS,t)||(t(uS).toDynamicValue((({container:t})=>new uS(zm(s_,t)))).inSingletonScope(),t(Ry).toService(uS),t(Cy).toService(Ry),t(s_).toService($f),Hm(t,s_))}const fS=gS;class mS extends Fb{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=md,this.builtinContributions=[sS],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=zp(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute,x=null!==(l=Ch(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:C,doStroke:T}=S,M=!f,w=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,T,A,k,d,n,a,o),M&&this.transformUseContext2d(t,d,w,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Su.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Su.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,w))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,w))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,w),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,w)})))),C&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,w),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,w,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}M&&this.restoreTransformUseContext2d(t,d,w,e),this.afterRenderStep(t,e,i,s,C,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=zp(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!u(c),_=y?c.width:i.clipedWidth,b=y?0:Yg(d,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}}const vS=new WeakSet;function yS({bind:t}){Lb(vS,t)||(t(Iy).toDynamicValue((({container:t})=>new mS(zm(n_,t)))).inSingletonScope(),t(Cy).toService(Iy),t(n_).toService($f),Hm(t,n_))}const _S=yS,bS=mm();function xS(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${String(e)}.`);return i}function SS(t,e){let i;return{getContributions:()=>(i||(i=e.isBound(t)?e.getAll(t):[]),i)}}const AS=Symbol.for("MathPickerContribution"),kS=Symbol.for("MathArcPicker"),CS=Symbol.for("MathAreaPicker"),TS=Symbol.for("MathCirclePicker"),MS=Symbol.for("MathImagePicker"),wS=Symbol.for("MathLinePicker"),ES=Symbol.for("MathPathPicker"),BS=Symbol.for("MathRectPicker"),PS=Symbol.for("MathSymbolPicker"),RS=Symbol.for("MathTextPicker"),IS=Symbol.for("MathPolygonPicker"),OS=Symbol.for("MathGlyphPicker"),LS=Symbol.for("MathRichTextPicker"),DS=Symbol.for("CanvasArcPicker"),FS=Symbol.for("CanvasArc3dPicker"),zS=Symbol.for("CanvasAreaPicker"),HS=Symbol.for("CanvasCirclePicker"),jS=Symbol.for("CanvasImagePicker"),NS=Symbol.for("CanvasGifImagePicker"),US=Symbol.for("CanvasLinePicker"),VS=Symbol.for("CanvasLottiePicker"),WS=Symbol.for("CanvasPathPicker"),GS=Symbol.for("CanvasRectPicker"),YS=Symbol.for("CanvasRect3dPicker"),XS=Symbol.for("CanvasSymbolPicker"),KS=Symbol.for("CanvasTextPicker"),$S=Symbol.for("CanvasPolygonPicker"),qS=Symbol.for("CanvasPyramid3dPicker"),ZS=Symbol.for("CanvasRichTextPicker"),JS=Symbol.for("CanvasGlyphPicker"),QS=Symbol.for("CanvasGroupPicker"),tA=Symbol.for("CanvasStarPicker"),eA=Symbol.for("CanvasPickerContribution"),iA=m_(),sA=__((()=>v_(Em))),nA=__((()=>v_(wm))),rA=__((()=>v_(vd))),aA=__((()=>v_(Bm)));function oA(){oh.global=b_,oh.graphicUtil=sA,oh.transformUtil=nA,oh.graphicService=rA,oh.layerService=aA,oh.canvasFactory=t=>y_(kd,t),oh.context2dFactory=t=>y_(Cd,t),oh.windowFactory=()=>new Af(oh.global),oh.windowHandlerFactory=t=>function(t){const e=y_(xf,t);if(!e)throw new Error(`Window handler is not configured for env: ${t}`);return e}(t),oh.renderServiceFactory=()=>v_(Ym),oh.renderService=__((()=>v_(Ym))),oh.pluginServiceFactory=()=>v_(Av),oh.pluginService=__((()=>v_(Av))),oh.pickerServiceFactory=()=>v_(qm),oh.layerHandlerFactory=t=>v_("static"===t?Pm:"dynamic"===t?Rm:Im),oh.incrementalDrawContributionFactory=()=>v_(by)}oA();var lA=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 hA{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}loadFont(t,e,i){return lA(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}}class cA{constructor(){this._uid=Va.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ge(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}}class dA{constructor(t,e,i=.8){this.dir=t,this.color=e,this.colorRgb=Bu.Get(e,Eu.Color1),this.ambient=i;const s=$t(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=Xt(Yt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=y(e)?Bu.Get(e,Eu.Color1):e;const r=this.colorRgb;return`rgb(${r[0]*n[0]*s}, ${r[1]*n[1]*s}, ${r[2]*n[2]*s})`}}const uA=()=>{Cm.registerPlugin("DirectionalLight",dA)};class pA{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=Au.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Au.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return gu(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Au.allocate());const{left:t,top:e,right:i,bottom:s}=this._params;return fu(this._projectionMatrixCached,t,i,s,e,0,-2e6),this._vp||(this._vp=Au.allocate()),this._vp=pu(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:s}=this._params;return(null!=e?e:s-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const s=[0,0,0];return mu(s,[t,e,i],this._viewMatrixCached),s}vp(t,e,i){const s=[0,0,0],{pos:n}=this._params.viewParams;mu(s,[t,e,i],this._viewMatrixCached),t=s[0],e=s[1],i=s[2];const r=this.getProjectionScale(i);return{x:t*r+n[0],y:e*r+n[1]}}}const gA=()=>{Cm.registerPlugin("OrthoCamera",pA)},fA={getContributions:()=>[]},mA={getContributions:()=>[]};class vA{constructor(t=fA,e=mA,i={}){var s,n,r,a,o;this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=null!==(s=i.global)&&void 0!==s?s:oh.global,this.pickerRegistry=i.pickerRegistry,this.pickItemInterceptorContributions=null!==(r=null!==(n=i.pickItemInterceptorContributions)&&void 0!==n?n:this.pickItemInterceptorContributions)&&void 0!==r?r:fA,this.pickServiceInterceptorContributions=null!==(o=null!==(a=i.pickServiceInterceptorContributions)&&void 0!==a?a:this.pickServiceInterceptorContributions)&&void 0!==o?o:mA,this.pickerMap=new Map}reInit(){this._init()}_init(){this.pickerRegistry&&(this.pickerMap.clear(),this.pickerRegistry.getAll().forEach((t=>{this.pickerMap.set(t.numberType,t)}))),this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Ve).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Ge(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=zp(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new re(e.x,e.y);l.transformPoint(a,a);const o=zp(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&&Au.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Su.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}}class yA{constructor(t={}){var e,i,s,n,r,a,o,l,h,c,d,u,p,g;this.stageResources=new Set,this._released=!1,this.registry={renderer:null!==(i=null===(e=t.registry)||void 0===e?void 0:e.renderer)&&void 0!==i?i:new sm,picker:null!==(n=null===(s=t.registry)||void 0===s?void 0:s.picker)&&void 0!==n?n:new nm,contribution:null!==(a=null===(r=t.registry)||void 0===r?void 0:r.contribution)&&void 0!==a?a:new am,plugin:null!==(l=null===(o=t.registry)||void 0===o?void 0:o.plugin)&&void 0!==l?l:new rm},this.factory={stage:null!==(c=null===(h=t.factory)||void 0===h?void 0:h.stage)&&void 0!==c?c:new Sm(void 0,(()=>this.createStageDeps())),layer:null!==(u=null===(d=t.factory)||void 0===d?void 0:d.layer)&&void 0!==u?u:new km,graphic:null!==(g=null===(p=t.factory)||void 0===p?void 0:p.graphic)&&void 0!==g?g:new sf}}get released(){return this._released}getRegistry(t){return this.assertActive(),this.registry[t]}getFactory(t){return this.assertActive(),this.factory[t]}installPlugin(t){this.assertActive(),this.registry.plugin.install(t),t.install(this)}installPlugins(t){this.assertActive();for(const e of t)this.installPlugin(e)}uninstallPlugin(t){var e;this.assertActive();const i=this.registry.plugin.get(t);i&&(null===(e=i.uninstall)||void 0===e||e.call(i),this.registry.plugin.uninstall(t))}createStage(t={}){var e;this.assertActive();const i=this.factory.stage.create(t),s=i,n=null===(e=s.release)||void 0===e?void 0:e.bind(i);let r=!1;return n&&(s.release=()=>{r||(r=!0,this.stageResources.delete(s),n())}),this.stageResources.add(s),i}release(){var t,e;if(this._released)return;const i=this.registry.plugin.getAll();for(const e of this.stageResources)null===(t=e.release)||void 0===t||t.call(e);this.stageResources.clear();for(const t of i)null===(e=t.uninstall)||void 0===e||e.call(t);this.registry.plugin.clear(),this.registry.renderer.clear(),this.registry.picker.clear(),this.registry.contribution.clear(),this._released=!0}assertActive(){if(this._released)throw new Error("AppContext has been released")}createStageDeps(){return{renderService:new im(new em([],(t=this.registry.contribution,e=Ny,{getContributions:()=>t.get(e)}),{rendererRegistry:this.registry.renderer}))};var t,e}}class _A{constructor(t={}){this.context=new yA(t.context)}get registry(){return this.context.registry}get factory(){return this.context.factory}get released(){return this.context.released}installPlugin(t){this.context.installPlugin(t)}installPlugins(t){this.context.installPlugins(t)}uninstallPlugin(t){this.context.uninstallPlugin(t)}createStage(t={}){return this.context.createStage(t)}release(){this.context.release()}}function bA(t={}){return new _A(t)}class xA extends _A{}class SA extends _A{}class AA extends ex{constructor(){super(...arguments),this.numberType=id}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=zp(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Bv(u,d,c),f=wv(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;nl.length)return;const h=zp(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=Bv(u,p,c),y=Rv(u,g),_=wv(c),b=Ev(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{};function DA(){MA.preloaded||(MA.preloaded=!0,Gm({bind:wA.bind}),xv({bind:wA.bind}),Km({bind:wA.bind}),bv({bind:wA.bind,isBound:wA.isBound}),Cv(wA),l_(wA))}function FA(t,e){const i=NA().getNamed(t,e);if(null==i)throw new Error(`${String(t)} is not configured for ${e}`);return i}function zA(t,e,i){e.forEach(((e,s)=>{var n,r,a;const o=null!==(a=null!==(n=null==e?void 0:e.type)&&void 0!==n?n:null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)&&void 0!==a?a:`${i}-entry`;t(`${i}:${String(o)}:${s}`,e)}))}function HA(t,e){let i=PA.get(t);i||(i=new Map,PA.set(t,i));let s=i.get(e);return s||(s=new Set,i.set(e,s)),s}function jA(t,e,i){const s=HA(t,e);i&&s.forEach((t=>i(t))),s.clear()}function NA(){return DA(),wA}function UA(){Nm.refreshAllContributions()}function VA(){var t;return DA(),null!==(t=MA.runtimeGlobal)&&void 0!==t||(MA.runtimeGlobal=new vf(zm(vg,wA))),MA.runtimeGlobal}function WA(t){const e=NA(),i=VA();oh.global=i,oh.canvasFactory=t=>e.getNamed(kd,t),oh.context2dFactory=t=>e.getNamed(Cd,t),oh.windowHandlerFactory=t=>FA(xf,t),oh.windowFactory=()=>new Af(i,(t=>FA(xf,t))),oh.pluginServiceFactory=()=>new lm(zm(Sv,e),{pluginRegistry:t.context.registry.plugin}),oh.incrementalDrawContributionFactory=()=>new _y([],new kA,new AA(zm(qy,e)),function(t,e){return{getContributions:()=>t.context.registry.contribution.get(e)}}(t,Ny))}function GA(t){var e;const i=NA();UA();const s=i.getAll(Cy),n=HA(t.registry.renderer,EA);jA(t.registry.renderer,EA,null===(e=t.registry.renderer.unregister)||void 0===e?void 0:e.bind(t.registry.renderer)),zA(((e,i)=>{var s;null===(s=null==i?void 0:i.reInit)||void 0===s||s.call(i),t.registry.renderer.register(e,i),n.add(e)}),s,EA)}function YA(t){var e;const i=NA();UA();const s=i.getAll(Ny),n=null!==(e=RA.get(t.context.registry.contribution))&&void 0!==e?e:new Set;n.forEach((e=>{var i,s;null===(s=(i=t.context.registry.contribution).unregister)||void 0===s||s.call(i,Ny,e)})),n.clear(),RA.set(t.context.registry.contribution,n);const r=new Set(t.context.registry.contribution.get(Ny));s.forEach((e=>{r.has(e)||(t.context.registry.contribution.register(Ny,e),r.add(e)),n.add(e)}))}function XA(t,e){var i;const s=NA();UA();const n=s.getAll(e),r=HA(t.registry.picker,BA);jA(t.registry.picker,BA,null===(i=t.registry.picker.unregister)||void 0===i?void 0:i.bind(t.registry.picker)),zA(((e,i)=>{t.registry.picker.register(e,i),r.add(e)}),n,BA)}function KA(t,e){(function(t,e){var i,s;return null!==(s=null===(i=IA.get(t))||void 0===i?void 0:i.has(e))&&void 0!==s&&s})(t,e)||("function"==typeof e?e(t):e.registry(t.bind,LA,t.isBound,t.rebind),function(t,e){let i=IA.get(t);i||(i=new WeakSet,IA.set(t,i)),i.add(e)}(t,e))}function $A(t,{app:e,legacy:i=!0,targets:s}={}){KA(NA(),t),i&&(f_(),KA(m_(),t)),UA(),e&&function(t,e){const i=null!=e?e:OA;let s=!1,n=!1;const r=new Set;i.forEach((t=>{"graphic-renderer"===t?s=!0:"draw-contribution"===t?n=!0:function(t){return"object"==typeof t&&null!==t&&"picker"in t}(t)&&r.add(t.picker)})),n&&YA(t),s&&GA(t),r.forEach((e=>{XA(t,e)}))}(e,s)}function qA(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}function ZA(t,e,i){const s={};for(const i in e)i in t&&V(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}function JA(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 QA(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i0){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;e1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ok(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const{width:i,height:s}=pg(t.attribute),n=hk(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{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=hk(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{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=hk(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{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(;n{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 _k(l,e,h),h},fk=(t,e)=>{const i=t.attribute,s=i.points;if(s)return pk(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 pk(t,e)}return[]};const mk=t=>t.map((t=>({x:t.x,y:t.y}))),vk=(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]},yk=t=>{const e=new Ue;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 vk(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return vk(t,{x:e.x1,y:n},{x:e.x2,y:n})},_k=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=yk(t);_k(n[0],s,i),_k(n[1],e-s,i)}},bk=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:mk(i)}];const s=[];return _k(i,e,s),s},xk=(t,e)=>{const i=ak(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;rObject.assign({},t))):[]}function Ak(t){return t instanceof TouchEvent?function(t){var e;const i=Object.create(null!==(e=Object.getPrototypeOf(t))&&void 0!==e?e:Object.prototype);return Object.defineProperties(i,{type:{value:t.type,configurable:!0},touches:{value:Sk(t.touches),configurable:!0},changedTouches:{value:Sk(t.changedTouches),configurable:!0}}),i}(t):new t.constructor(t.type,t)}function kk(t,e){try{return t[e]}catch(t){return}}function Ck(t,e,i,s){return t=>{if(!(t instanceof MouseEvent||t instanceof TouchEvent||t instanceof PointerEvent))return t;const n=e();if(1===(r=n).a&&0===r.b&&0===r.c&&1===r.d&&0===r.e&&0===r.f)return t;var r;const a=i(),o=Ak(t),l=kk(t,"target"),h=kk(t,"currentTarget");if(Object.defineProperties(o,{target:{value:l},currentTarget:{value:h}}),t instanceof MouseEvent||t instanceof PointerEvent)s(t.clientX,t.clientY,n,a,o);else if(t instanceof TouchEvent){const e=o;if(t.touches.length>0){const t=e.touches[0];s(t.clientX,t.clientY,n,a,t)}if(t.changedTouches.length>0){const t=e.changedTouches[0];s(t.clientX,t.clientY,n,a,t)}}return o}}var Tk=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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=0;a++)"\n"===t[a].text?(n-=Number(r),r=!0):(n--,r=!1);return n>=0?t.length:(a-=1,e>s&&!r&&(a+=1),a)}function Ek(t,e){var i,s,n,r;let a=0;if(e<0)return-.1;let o="\n"===(null===(i=null==t?void 0:t[0])||void 0===i?void 0:i.text);for(let i=0;i<=e&&it.length-1)return"\n"===(null===(s=t[t.length-1])||void 0===s?void 0:s.text)?a+.9:a+.1;const l="\n"===(null===(n=t[e])||void 0===n?void 0:n.text);return e>=t.length-1&&l?a+1-.1:(a-=.1,l&&"\n"!==(null===(r=t[e-1])||void 0===r?void 0:r.text)&&(a+=.2),a)}class Bk{constructor(t){this.handleFocusIn=()=>{},this.handleFocusOut=()=>{},this.handleKeyDown=t=>{this.currRt&&("Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"}))},this.handleCompositionStart=()=>{if(!this.currRt)return;this.isComposing=!0;const{textConfig:t=[]}=this.currRt.attribute;if(this.composingConfigIdx=this.cursorIndex<0?0:wk(t,this.cursorIndex),this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),e),{text:""}))}else{const e=this.composingConfigIdx,i=t[e]||t[e-1];t.splice(e,0,Object.assign(Object.assign(Object.assign({fill:"black"},Mk(this.currRt.attribute)),i),{text:""}))}},this.handleCompositionEnd=()=>{this.isComposing=!1;const t=this.parseCompositionStr(this.composingConfigIdx);this.composingConfigIdx=-1,this.onChangeCbList.forEach((e=>{e(t,this.isComposing,this.cursorIndex,this.currRt)}))},this.handleInput=t=>{if(!this.currRt)return;if("historyUndo"===t.inputType)return;const e=this.currRt.attribute,{textConfig:i=[]}=e,s=Tk(e,["textConfig"]);if("Backspace"===t.type&&!i.length)return;let n=t.data;this.isComposing||"Backspace"===t.type||n||(n="\n"),this.selectionStartCursorIdx>this.cursorIndex&&([this.cursorIndex,this.selectionStartCursorIdx]=[this.selectionStartCursorIdx,this.cursorIndex]);const r=wk(i,this.selectionStartCursorIdx),a=wk(i,this.cursorIndex);let o=i[this.isComposing?this.composingConfigIdx:Math.max(r-1,0)];o||(o=Mk(s));let l=o;r!==a&&(i.splice(r,a-r),this.isComposing&&(this.composingConfigIdx=r));let h=r;if("Backspace"!==t.type||this.isComposing)this.isComposing||(l=Object.assign(Object.assign({fill:"black"},o),{text:""}),i.splice(r,0,l),h++),l.text=n,l.isComposing=this.isComposing;else if(r===a){if(r<=0)return;i.splice(r-1,1),h=Math.max(r-1,0)}this.currRt.setAttributes({textConfig:i});let c=this.cursorIndex;n&&n.length>1&&!this.isComposing?(this.parseCompositionStr(h-1),c=this.cursorIndex):(c=Ek(i,h),this.isComposing?this.cursorIndex=this.selectionStartCursorIdx:this.cursorIndex=c),this.isComposing?this.onInputCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)})):this.onChangeCbList.forEach((t=>{t(n,this.isComposing,c,this.currRt)}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.spellcheck=!1,e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.composingConfigIdx=-1,this.onInputCbList=[],this.onChangeCbList=[],this.onFocusInList=[],this.onFocusOutList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}onFocusIn(t){this.onFocusInList.push(t)}onFocusOut(t){this.onFocusOutList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;opacity: 0;pointer-events: none;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),t.addEventListener("focusin",this.handleFocusIn),t.addEventListener("focusout",this.handleFocusOut),oh.global.addEventListener("keydown",this.handleKeyDown)}parseCompositionStr(t){var e;if(!this.currRt)return"";const{textConfig:i=[]}=this.currRt.attribute,s=null!==(e=i[t])&&void 0!==e?e:{};i.splice(t,1);const n=s.text,r=n?Array.from(n.toString()):[];for(let e=0;e{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=s,this.selectionStartCursorIdx=n}release(){var t;this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),this.textAreaDom.removeEventListener("focusin",this.handleFocusOut),this.textAreaDom.removeEventListener("focusout",this.handleFocusOut),oh.global.removeEventListener("keydown",this.handleKeyDown),null===(t=this.textAreaDom.parentElement)||void 0===t||t.removeChild(this.textAreaDom),this.textAreaDom=null}}class Pk{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}getSelectionPureText(){const t=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),e=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(t===e)return"";const i=this.rt.attribute.textConfig,s=wk(i,Math.ceil(t)),n=wk(i,Math.floor(e));let r="";for(let t=s;t<=n;t++)r+=i[t].text;return r}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;let s=Math.round(e);const n=this.rt.attribute.textConfig;if(!n.length)return null;for(let e=0;e{const i=e.currRt;if(!i)return;const s=e.getSelection();if(!s)return;const{selectionStartCursorIdx:n,curCursorIdx:r}=s,a=Math.min(n,r),o=Math.max(n,r),l=wk(i.attribute.textConfig,a),h=wk(i.attribute.textConfig,o),c=i.attribute.textConfig.slice(l,h);this._formatTextCommand(t,c,i)},this.formatAllTextCommandCb=(t,e)=>{const i=e.currRt;if(!i)return;const s=i.attribute.textConfig;this._formatTextCommand(t,s,i)},this.handleKeyDown=t=>{this.currRt&&this.editing&&(this.copyToClipboard(t)||this.fullSelectionKeyHandler(t)||this.directKeyHandler(t))},this.handleInput=(t,e,i,s)=>{this.currRt&&(this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.hideSelection(),this.updateCbs.forEach((t=>t("input",this))))},this.handleChange=(t,e,i,s)=>{if(!this.currRt)return;this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,s);this.setCursorAndTextArea(n.x,n.y1,n.y2,s),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleFocusIn=()=>{throw new Error("不会走到这里 handleFocusIn")},this.handleFocusOut=()=>{throw new Error("不会走到这里 handleFocusOut")},this.handleMove=t=>{this.currRt&&!this.currRt.attribute.editable&&this.deFocus(!0),this.isEditableRichtext(t)?(this.handleEnter(),t.target.once("pointerleave",this.handleLeave,{capture:!0}),this.tryShowSelection(t,!1)):this.handleLeave()},this.handleEnter=()=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=()=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing&&this.isEditableRichtext(t)?this.onFocus(t):this.deFocus(!0),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleDBLClick=t=>{this.editing&&this.tryShowSelection(t,!0)},this.commandCbs=new Map,this.commandCbs.set(Rk,[this.formatTextCommandCb]),this.commandCbs.set(Ik,[this.formatAllTextCommandCb]),this.updateCbs=[],this.deltaX=0,this.deltaY=0}_formatTextCommand(t,e,i){"bold"===t?e.forEach((t=>t.fontWeight="bold")):"italic"===t?e.forEach((t=>t.fontStyle="italic")):"underline"===t?e.forEach((t=>t.underline=!0)):"lineThrough"===t?e.forEach((t=>t.lineThrough=!0)):g(t)&&e.forEach((e=>H(e,t))),i.setAttributes(i.attribute);const s=i.getFrameCache();s&&(this.selectionRangeByCursorIdx(this.selectionStartCursorIdx,this.curCursorIdx,s),this.tryShowInputBounds())}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}removeCommand(t,e){const i=this.commandCbs.get(t)||[],s=i.indexOf(e);s>-1&&i.splice(s,1)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}removeUpdateListener(t){const e=this.updateCbs||[],i=e.indexOf(t);i>-1&&e.splice(i,1)}activate(t){this.pluginService=t,this.editModule=new Bk,t.stage.on("pointermove",this.handleMove,{capture:!0}),t.stage.on("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.on("pointerup",this.handlePointerUp,{capture:!0}),t.stage.on("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.on("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange),this.editModule.onFocusOut(this.handleFocusOut),this.timeline=this.createTimeline&&this.createTimeline(),this.ticker=this.createTicker&&this.createTicker(t.stage)}copyToClipboard(t){if(oh.global.isMacOS()&&t.metaKey&&"c"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"c"===t.key){const e=this.getSelection().getSelectionPureText();return oh.global.copyToClipBoard(e),t.preventDefault(),!0}return!1}selectionRange(t,e){const i=this.currRt;if(!i)return;const s=i.getFrameCache();if(!s)return;const{lines:n}=s,r=n.reduce(((t,e)=>t+e.paragraphs.length),0)-1;t>e&&([t,e]=[e,t]),t=Math.min(Math.max(t,-.1),r+.1),e=Math.min(Math.max(e,-.1),r+.1),this.selectionRangeByCursorIdx(t,e,s)}selectionRangeByCursorIdx(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t;const{x:s,y1:n,y2:r}=this.computedCursorPosByCursorIdx(this.selectionStartCursorIdx,this.currRt);this.startCursorPos={x:s,y:(n+r)/2};const a=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(a.x,a.y1,a.y2,this.currRt),this._tryShowSelection(a,i)}fullSelection(){const t=this.currRt;if(!t)return;const e=t.getFrameCache();if(!e)return;const{lines:i}=e;if(!i.length||!i[0].paragraphs.length)return;const s=i.reduce(((t,e)=>t+e.paragraphs.length),0)-1;this.selectionRange(-.1,s+.1)}fullSelectionKeyHandler(t){return!!(oh.global.isMacOS()&&t.metaKey&&"a"===t.key||!oh.global.isMacOS()&&t.ctrlKey&&"a"===t.key)&&(this.fullSelection(),t.preventDefault(),!0)}directKeyHandler(t){if("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return!1;const e=this.currRt.getFrameCache();if(!e)return!1;let i=0,s=0;"ArrowUp"===t.key?s=-1:"ArrowDown"===t.key?s=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:r}=this.getColumnByIndex(e,Math.round(this.curCursorIdx)),{lines:a}=e,o=a.reduce(((t,e)=>t+e.paragraphs.length),0)-1;if(i){i>0&&r===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx0&&r===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&r===n.paragraphs[0]&&this.curCursorIdxo+.1&&(this.curCursorIdx=o+.1),this.selectionStartCursorIdx=this.curCursorIdx;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(s){if(s>0&&n===e.lines[e.lines.length-1])return;if(s<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+s;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),r=i.x;let a=(i.y1+i.y2)/2;a+=s*n.height;const l=e.lines[t],{columnInfo:h,delta:c}=this.getColumnAndIndexByLinePoint(l,{x:r,y:a});if(!h)return;let d=this.getColumnIndex(e,h)+c;const u=this.computedCursorPosByCursorIdx(d,this.currRt);d<-.1?d=-.1:d>o+.1&&(d=o+.1),this.curCursorIdx=d,this.selectionStartCursorIdx=d,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}return!0}tryShowShadowPlaceholder(){if(!this.currRt)return;const t=this.currRt.shadowRoot;if(t){const e=t.getElementsByType("richtext")[0];e&&t.removeChild(e)}const{textConfig:e,editOptions:i={}}=this.currRt.attribute;if(e&&e.length)return;if(!i||!i.placeholder)return;const{placeholder:s,placeholderColor:n="rgba(0, 0, 0, 0.6)",placeholderFontFamily:r,placeholderFontSize:a}=i,o=this.getShadow(this.currRt),l=Object.assign(Object.assign({},Mk(this.currRt.attribute)),{text:s});n&&(l.fill=n),r&&(l.fontFamily=r),a&&(l.fontSize=a),this.shadowPlaceHolder=jg(Object.assign(Object.assign({},this.currRt.attribute),{x:0,y:0,dx:-this.deltaX,dy:-this.deltaY,angle:0,textConfig:[l]})),o.add(this.shadowPlaceHolder)}getRichTextAABBBounds(t){const{attribute:e}=t;return e.textConfig.length?t.AABBBounds:fv(Object.assign(Object.assign({},this.shadowPlaceHolder.attribute),{x:e.x,y:e.y,textAlign:e.textAlign,boundsMode:"accurate"}))}tryShowInputBounds(){var t,e;if(!this.currRt||!this.focusing)return;const{editOptions:i={}}=this.currRt.attribute,{boundsStrokeWhenInput:s}=i;if(!i||!s)return;this.offsetShadowRoot();const n=this.getRichTextAABBBounds(this.currRt),r=n.height(),a=n.width();this.shadowBounds=this.shadowBounds||mg({}),this.shadowBounds.setAttributes({x:0,y:0,scaleX:1/(null!==(t=this.currRt.attribute.scaleX)&&void 0!==t?t:1),scaleY:1/(null!==(e=this.currRt.attribute.scaleY)&&void 0!==e?e:1),width:a,height:r,fill:!1,stroke:s,lineWidth:1,zIndex:-1});const o=this.getShadow(this.currRt);this.addEditLineOrBgOrBounds(this.shadowBounds,o),this.offsetLineBgAndShadowBounds()}trySyncPlaceholderToTextConfig(){if(!this.currRt)return;const{textConfig:t,editOptions:e}=this.currRt.attribute;if(t&&t.length)return;if(!(e&&e.placeholder&&e.syncPlaceholderToTextConfig))return;const{placeholder:i}=e;this.currRt.setAttributes({textConfig:[Object.assign({text:i},Mk(this.currRt.attribute))]})}deactivate(t){t.stage.off("pointermove",this.handleMove,{capture:!0}),t.stage.off("pointerdown",this.handlePointerDown,{capture:!0}),t.stage.off("pointerup",this.handlePointerUp,{capture:!0}),t.stage.off("pointerleave",this.handlePointerUp,{capture:!0}),t.stage.off("dblclick",this.handleDBLClick,{capture:!0}),oh.global.addEventListener("keydown",this.handleKeyDown)}stopPropagation(t){t.stopPropagation()}addEditLineOrBgOrBounds(t,e){let i=e.getElementById("emptyBoundsContainer");i||(i=tg({x:0,y:0,width:0,height:0,boundsMode:"empty"}),i.id="emptyBoundsContainer",e.add(i)),i.add(t)}removeEditLineOrBgOrBounds(t,e){const i=e.getElementById("emptyBoundsContainer");i&&i.removeChild(t)}onFocus(t,e){this.updateCbs&&this.updateCbs.forEach((t=>t("beforeOnfocus",this))),this.deFocus(!1),this.focusing=!0,this.editing=!0;const i=t.target;if(!i||"richtext"!==i.type)return;this.currRt=i,Ok.tryUpdateRichtext(i);const s=this.getShadow(i),n=i.getFrameCache();if(!n)return;const{editOptions:r={}}=this.currRt.attribute;if(r.stopPropagation&&i.addEventListener("*",this.stopPropagation),this.offsetShadowRoot(i),!this.editLine){const t=ag({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker&&this.ticker.start(!0);const e=tg({x:0,y:0,width:0,height:0});this.editBg=e,this.addEditLineOrBgOrBounds(this.editLine,s),this.addEditLineOrBgOrBounds(this.editBg,s)}if(e=e||this.computedCursorPosByEvent(t,n)){const{x:t,y1:s,y2:n,cursorIndex:r}=e;this.startCursorPos={x:t,y:(s+n)/2},this.curCursorIdx=r,this.selectionStartCursorIdx=r,this.setCursorAndTextArea(t,s,n,i)}else{const t=0,e=0,s=fv(Object.assign(Object.assign({},i.attribute),{textConfig:[{text:"a"}],scaleX:1,scaleY:1})).height();this.startCursorPos={x:t,y:(e+s)/2},this.curCursorIdx=-.1,this.selectionStartCursorIdx=-.1,this.setCursorAndTextArea(t,e,s,i)}this.tryShowShadowPlaceholder(),this.tryShowInputBounds(),this.currRt.addUpdateBoundTag()}offsetShadowRoot(t){if(!(t=t||this.currRt))return;const e=this.getShadow(t);if(!e)return;const i=t.getFrameCache();i&&(this.computeGlobalDelta(i),e.setAttributes({shadowRootIdx:1,pickable:!1,x:this.deltaX,y:this.deltaY}),this.shadowPlaceHolder&&this.shadowPlaceHolder.setAttributes({dx:-this.deltaX,dy:-this.deltaY}))}offsetLineBgAndShadowBounds(){const t=this.currRt,{textBaseline:e}=t.attribute;let i,s=0,n=t.attribute;"middle"!==e&&"bottom"!==e||(n.textConfig.length||(n=Object.assign(Object.assign({},n),{textConfig:[{text:"a"}]})),i=fv(Object.assign(Object.assign({},n),{scaleX:1,scaleY:1}))),"middle"===e?s=-i.height()/2:"bottom"===e&&(s=-i.height()),this.editLine&&this.editLine.setAttributes({dy:s}),this.editBg&&this.editBg.setAttributes({dy:s}),this.shadowBounds&&this.shadowBounds.setAttributes({dy:s})}deFocus(t=!1){this.editing=!1,this.updateCbs&&this.updateCbs.forEach((e=>e("beforeDefocus",this,{trulyDeFocus:t})));const e=this.currRt;if(!e)return;const{editOptions:i={}}=e.attribute;i.stopPropagation&&e.removeEventListener("*",this.stopPropagation),t&&(this.trySyncPlaceholderToTextConfig(),e.detachShadow()),this.currRt=null,this.editModule.currRt=null;const s=this.getShadow(e);this.editLine&&(this.removeEditLineOrBgOrBounds(this.editLine,s),this.editLine.release(),this.editLine=null,this.removeEditLineOrBgOrBounds(this.editBg,s),this.editBg.release(),this.editBg=null),t&&(this.shadowBounds&&(this.removeEditLineOrBgOrBounds(this.shadowBounds,s),this.shadowBounds.release(),this.shadowBounds=null),this.shadowPlaceHolder&&(this.shadowPlaceHolder.parent&&this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder),this.shadowPlaceHolder.release(),this.shadowPlaceHolder=null)),this.focusing=!1,e.removeEventListener("pointerleave",this.handleLeave)}addAnimateToLine(t){if(!t.animate)return;t.setAttributes({opacity:1});const e=t.getTrackedAnimates&&t.getTrackedAnimates()||t.animates;e&&e.forEach((t=>{t.stop(),t.release()})),t.animate({timeline:this.timeline}).to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t,e){const i=t.target.getFrameCache();if(i&&this.editBg&&this.startCursorPos)if(e){const e=this.computedCursorPosByEvent(t,i);if(!e)return;const s=e.lineInfo,n=s.paragraphs.findIndex((t=>t===e.columnInfo));if(n<0)return;const r=s.paragraphs.reduce(((t,e)=>t+e.text),"");let a=0;for(let t=0;t=t.length)););return s=Math.min(s+1,t.length),{startIdx:i,endIdx:s}}(r,n);this.selectionRange(a+o-.1,a+l-.1)}else if(this.pointerDown){const e=this.computedCursorPosByEvent(t,i);if(!e)return;this.curCursorIdx=e.cursorIndex,this._tryShowSelection(e,i)}}_tryShowSelection(t,e){let i=this.startCursorPos,s={x:t.x,y:(t.y1+t.y2)/2},n=this.getLineByPoint(e,i),r=this.getLineByPoint(e,s);if((i.y>s.y||i.y===s.y&&i.x>s.x)&&([i,s]=[s,i],[r,n]=[n,r]),this.hideSelection(),n===r)this.editBg.setAttributes({x:i.x,y:n.top,width:s.x-i.x,height:n.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:n.top,width:0,height:0});const t=e.lines.findIndex((t=>t===n)),a=e.lines.findIndex((t=>t===r));let o=0;for(let n=t;n<=a;n++){const r=e.lines[n];if(n===t){const t=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:i.x,y:o,width:t.left+t.width-i.x,height:r.height,fill:"#336df4",fillOpacity:.2}))}else if(n===a){const t=r.paragraphs[0];this.editBg.add(mg({x:t.left,y:o,width:s.x-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}else{const t=r.paragraphs[0],e=r.paragraphs[r.paragraphs.length-1];this.editBg.add(mg({x:t.left,y:o,width:e.left+e.width-t.left,height:r.height,fill:"#336df4",fillOpacity:.2}))}o+=r.height}}this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getShadow(t){const e=t.shadowRoot||t.attachShadow();return e.setAttributes({width:0,height:0}),e}getLineByPoint(t,e){let i=t.lines[0];for(let s=0;s=e.y);s++)i=t.lines[s+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],s=0;if(t.paragraphs.length){const n=t.paragraphs[0],r=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(s=-.1,i=n):e.x>=r.left+r.width&&(s=.1,i=r)}if(!s)for(let n=0;n=e.x){s=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:s}}getColumnIndex(t,e){let i=-1;for(let s=0;sMath.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-s/2:"right"===t.globalAlign&&(this.deltaX=-s),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY;const s=this.currRt,{textBaseline:n}=s.attribute;let r=0;return"middle"===n?r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()/2:"bottom"===n&&(r=fv(Object.assign(Object.assign({},s.attribute),{scaleX:1,scaleY:1})).height()),i.y+=r,i}setCursorAndTextArea(t,e,i,s){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};s.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:r,top:a}=this.pluginService.stage.window.getBoundingClientRect();n.x+=r,n.y+=a,this.offsetLineBgAndShadowBounds(),this.offsetShadowRoot(),this.editModule.moveTo(n.x,n.y,s,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),s=this.getLineByPoint(e,i);if(!s)return;const{columnInfo:n,delta:r}=this.getColumnAndIndexByLinePoint(s,i);if(!n)return;const a=s.top,o=s.top+s.height;let l=this.getColumnIndex(e,n);return l+=r,{x:n.left+(r>0?n.width:0),y1:a,y2:o,cursorIndex:l,lineInfo:s,columnInfo:n}}computedCursorPosByCursorIdx(t,e){var i,s,n;const r=Math.round(t),a=t-r,o=e.getFrameCache(),l=this.getColumnByIndex(o,r),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(s=e.attribute.textConfig)||void 0===s?void 0:s[0])||void 0===n?void 0:n.fontSize;if(!l)return o.lines.length?{x:0,y1:0,y2:h}:{x:0,y1:0,y2:fv(Object.assign(Object.assign({},e.attribute),{textConfig:[{text:"a"}]})).height()};const{lineInfo:c,columnInfo:d}=l,u=c.top,p=c.top+c.height;return{x:d.left+(a<0?0:d.width),y1:u,y2:p,lineInfo:c,columnInfo:d}}getColumnByIndex(t,e){for(let i=0,s=0;ithis.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const Qk=new Jk;class tC{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Va.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)}}const eC=()=>{Cm.registerPlugin("ViewTransform3dPlugin",tC)},iC=new Ve;class sC{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Va.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new Ve}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t,e=!0){if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const s=zp(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((({mainLen:i,crossLen:s},n)=>{t+i>f.len?0===t?(b.push({idx:n,mainLen:t+i,crossLen:s}),t=0,e=0):(b.push({idx:n-1,mainLen:t,crossLen:e}),t=i,e=s):(t+=i,e=Math.max(e,s))})),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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),e.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&iC.copy(s)})),e.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(iC.equals(i)||this.tryLayout(t,!1))})),e.graphicService.hooks.onSetStage.tap(this.key,((t,e)=>{e&&e===this.pluginService.stage&&(t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1))})))}deactivate(t){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.taps=e.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onSetStage.taps=e.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key)))}}const nC=()=>{Cm.registerPlugin("FlexLayoutPlugin",sC)};var rC=Object.freeze({__proto__:null,APPLICATION_STATE_SYMBOL:rh,ARC3D_NUMBER_TYPE:ed,ARC_NUMBER_TYPE:td,AREA_NUMBER_TYPE:id,AbstractGraphicRender:class{},get AnimateMode(){return Ml},get AnimateStatus(){return Bl},get AnimateStepType(){return El},AppContext:yA,Application:nh,Arc:Up,Arc3d:lv,Arc3dRender:Sy,ArcRender:xy,ArcRenderContribution:$y,Area:Gp,AreaRender:Ay,AreaRenderContribution:qy,get AttributeUpdateType(){return _o},AutoEnablePlugins:Sv,Base3dRender:Wx,BaseCanvas:wu,BaseEnvContribution:hA,BaseRender:Fb,get BaseRenderContributionTime(){return So},BaseWindowHandlerContribution:cA,Basis:$o,BeforeRenderConstribution:Xm,BoundsContext:no,BoundsPicker:Zm,BrowserEntry:_A,CIRCLE_NUMBER_TYPE:sd,CONTRIBUTION_STORE_STATE_SYMBOL:Om,Canvas3DDrawItemInterceptor:Ky,Canvas3DPickItemInterceptor:_v,CanvasFactory:kd,CanvasTextLayout:$g,Circle:Kp,CircleRender:ky,CircleRenderContribution:Zy,ColorInterpolate:Vu,ColorStore:Bu,get ColorType(){return Eu},CommonDrawItemInterceptorContribution:Yy,CommonRenderContribution:a_,Context2dFactory:Cd,ContributionProvider:Dm,ContributionRegistry:am,ContributionStore:Nm,CubicBezierCurve:zo,CurveContext:xl,get CurveTypeEnum(){return xo},CustomEvent:qa,CustomPath2D:Al,CustomSymbolClass:wc,DEFAULT_TEXT_FONT_FAMILY:_g,DebugDrawItemInterceptorContribution:Gy,DefaultArcAllocate:zk,DefaultArcAttribute:Ul,DefaultArcRenderContribution:Nv,DefaultAreaAllocate:jk,DefaultAreaAttribute:Vl,DefaultAreaTextureRenderContribution:fy,DefaultAttribute:Nl,DefaultBaseBackgroundRenderContribution:Ff,DefaultBaseClipRenderAfterContribution:Jf,DefaultBaseClipRenderBeforeContribution:qf,DefaultBaseInteractiveRenderContribution:$f,DefaultBaseTextureRenderContribution:Hv,DefaultCanvasAllocate:yf,DefaultCanvasArc3DRender:Ub,DefaultCanvasArcRender:zb,DefaultCanvasAreaRender:ex,DefaultCanvasCircleRender:rx,DefaultCanvasGroupRender:my,DefaultCanvasImageRender:bx,DefaultCanvasLineRender:kx,DefaultCanvasPathRender:Px,DefaultCanvasPolygonRender:jx,DefaultCanvasPyramid3dRender:Gx,DefaultCanvasRect3dRender:Qx,DefaultCanvasRectRender:$x,DefaultCanvasSymbolRender:uS,DefaultCanvasTextRender:mS,DefaultCircleAllocate:Uk,DefaultCircleAttribute:Wl,DefaultCircleRenderContribution:Gv,DefaultConnectAttribute:Hl,DefaultDebugAttribute:jl,DefaultFillStyle:Il,DefaultGlobal:vf,DefaultGlobalPickerService:Bf,DefaultGlyphAttribute:Yl,DefaultGraphicAllocate:Lk,DefaultGraphicMemoryManager:Jk,DefaultGraphicService:_m,DefaultGraphicUtil:kf,DefaultGroupAttribute:Gl,DefaultGroupBackgroundRenderContribution:$v,DefaultImageAttribute:ih,DefaultImageRenderContribution:ny,DefaultLayerService:Mm,DefaultLayout:Pl,DefaultLineAllocate:Wk,DefaultLineAttribute:Xl,DefaultMat4Allocate:xu,DefaultMatrixAllocate:bu,DefaultPathAllocate:Yk,DefaultPathAttribute:Kl,DefaultPickService:vA,DefaultPickStyle:Fl,DefaultPolygonAttribute:$l,DefaultRect3dAttribute:Jl,DefaultRectAllocate:Dk,DefaultRectAttribute:Zl,DefaultRectRenderContribution:Jv,DefaultRenderService:im,DefaultRichTextAttribute:eh,DefaultRichTextIconAttribute:sh,DefaultStarAttribute:ql,DefaultStrokeStyle:Ll,DefaultStyle:zl,DefaultSymbolAllocate:Kk,DefaultSymbolAttribute:Ql,DefaultSymbolClipRangeStrokeRenderContribution:ly,DefaultSymbolRenderContribution:oy,DefaultTextAllocate:qk,DefaultTextAttribute:th,DefaultTextMeasureContribution:Wm,DefaultTextStyle:Dl,DefaultTransform:Rl,DefaultTransformUtil:Mf,DefaultWindow:Af,get Direction(){return bo},DirectionalLight:dA,DrawContribution:Hy,DrawItemInterceptor:Ny,DynamicLayerHandlerContribution:Rm,get Edge(){return ch},EditModule:Bk,EmptyContext2d:Tu,EnvContribution:vg,EventManager:Qa,EventSystem:io,EventTarget:to,FACTORY_STATE_SYMBOL:wf,FORMAT_ALL_TEXT_COMMAND:Ik,FORMAT_ELEMENT_COMMAND:"FORMAT_ELEMENT_COMMAND",FORMAT_TEXT_COMMAND:Rk,Factory:Cm,FederatedEvent:Ya,FederatedMouseEvent:Xa,FederatedPointerEvent:Ka,FederatedWheelEvent:$a,FlexLayoutPlugin:sC,GLYPH_NUMBER_TYPE:nd,GRAPHIC_CLASS_SYMBOL:Mp,GRAPHIC_REGISTRY_SYMBOL:rf,GRAPHIC_UPDATE_TAG_KEY:pp,GROUP_NUMBER_TYPE:rd,Generator:Va,GlobalPickerService:Jm,Glyph:qp,GlyphRender:Dy,GradientParser:su,Graphic:Ep,GraphicCreator:yd,GraphicFactory:sf,GraphicPicker:$m,GraphicRender:Cy,GraphicService:vd,GraphicUtil:Em,Group:Qp,GroupRender:Ty,GroupRenderContribution:Jy,get GroupUpdateAABBBoundsMode(){return Jp},HtmlAttributePlugin:x_,get IContainPointMode(){return yo},IMAGE_NUMBER_TYPE:ad,Image:ig,ImageRender:Fy,ImageRenderContribution:Qy,IncrementalDrawContribution:by,InteractiveDrawItemInterceptorContribution:Xy,InteractivePickItemInterceptorContribution:yv,InteractiveSubRenderContribution:o_,LINE_NUMBER_TYPE:od,Layer:Am,LayerFactory:km,LayerService:Bm,Line:rg,LineRender:My,Linear:Go,LinearClosed:pl,Mat4Allocate:yu,MatrixAllocate:vu,get MeasureModeEnum(){return Tl},MiniappEntry:SA,MonotoneX:il,MonotoneY:sl,NOWORK_ANIMATE_ATTR:Cp,Node:Ga,NodeEntry:xA,OrthoCamera:pA,PATH_NUMBER_TYPE:ld,POLYGON_NUMBER_TYPE:hd,PURE_STYLE_KEY:["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],PYRAMID3D_NUMBER_TYPE:cd,Path:lg,PathRender:wy,PathRenderContribution:t_,PerformanceRAF:gf,PickItemInterceptor:Qm,PickServiceInterceptor:tv,PickerRegistry:nm,PickerService:qm,PluginRegistry:rm,PluginService:Av,Polygon:dg,PolygonRender:Ey,PolygonRenderContribution:e_,Pyramid3d:cv,Pyramid3dRender:Ly,RECT3D_NUMBER_TYPE:ud,RECT_NUMBER_TYPE:dd,RICHTEXT_NUMBER_TYPE:pd,RUNTIME_INSTALLER_STATE_SYMBOL:CA,RafBasedSTO:Sh,ReactAttributePlugin:A_,Rect:fg,Rect3DRender:Py,Rect3d:sv,RectRender:By,RectRenderContribution:i_,ReflectSegContext:Uo,RenderSelector:zy,RenderService:Ym,RendererRegistry:sm,ResourceLoader:lh,RichText:Hg,RichTextEditPlugin:Ok,RichTextRender:Oy,STAR_NUMBER_TYPE:gd,get STATUS(){return wl},SVG_ATTRIBUTE_MAP:_d,SVG_ATTRIBUTE_MAP_KEYS:bd,SVG_PARSE_ATTRIBUTE_MAP:xd,SVG_PARSE_ATTRIBUTE_MAP_KEYS:Sd,SYMBOL_NUMBER_TYPE:fd,SegContext:No,ShadowPickServiceInterceptorContribution:mv,ShadowRoot:Ng,ShadowRootDrawItemInterceptorContribution:Wy,ShadowRootPickItemInterceptorContribution:vv,SplitRectAfterRenderContribution:ty,SplitRectBeforeRenderContribution:Qv,Stage:xm,StageFactory:Sm,Star:av,StarRender:jy,StarRenderContribution:r_,StateDefinitionCompiler:$u,StateEngine:Qu,StaticLayerHandlerContribution:Pm,Step:ll,StepClosed:hl,Symbol:Wg,SymbolRender:Ry,SymbolRenderContribution:s_,TEXT_NUMBER_TYPE:md,Text:Zg,get TextDirection(){return Kc},TextMeasureContribution:Vm,TextRender:Iy,TextRenderContribution:n_,Theme:Dp,TransformUtil:wm,get UpdateTag(){return vo},VGlobal:yg,VWindow:bf,ViewTransform3dPlugin:tC,VirtualLayerHandlerContribution:Im,WILDCARD:"*",WindowHandlerContribution:xf,WrapText:tf,XMLParser:Vc,_calculateLineHeight:kh,_interpolateColor:Iu,addArcToBezierPath:To,addAttributeToPrototype:function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},alignBezierCurves:rk,alignSubpath:QA,application:oh,applyTransformOnBezierCurves:ok,arc3dModule:Gb,arcModule:Nb,areaModule:nx,bezier:ko,bezierCurversToPath:lk,binarySplitPolygon:yk,bindArc3dRenderModule:Wb,bindArcRenderModule:jb,bindAreaRenderModule:sx,bindCircleRenderModule:ox,bindContributionProvider:Hm,bindContributionProviderNoSingletonScope:jm,bindGlyphRenderModule:dx,bindImageRenderModule:Sx,bindLineRenderModule:Tx,bindPathRenderModule:Ix,bindPolygonRenderModule:Ux,bindPyramid3dRenderModule:Xx,bindRect3dRenderModule:eS,bindRectRenderModule:Zx,bindRichtextRenderModule:aS,bindStarRenderModule:cS,bindSymbolRenderModule:gS,bindTextRenderModule:yS,boundStroke:Gc,builtInSymbolStrMap:Pc,builtinSymbols:Ec,builtinSymbolsMap:Bc,calcLineCache:Sl,calculateArcCornerRadius:Dv,calculateLineHeight:Ch,canvasAllocate:_f,centroidOfSubpath:ik,circleBounds:vh,circleModule:lx,clock:Za,colorEqual:function(t,e){const i=si.parseColorString(t),s=si.parseColorString(e);return!(!i||!s)&&i.r===s.r&&i.g===s.g&&i.b===s.b&&i.opacity===s.opacity},colorStringInterpolationToStr:Nu,configureRuntimeApplicationForApp:WA,container:iA,cornerTangents:Lv,createApp:bA,createArc:Vp,createArc3d:hv,createArea:Yp,createBrowserApp:bA,createCanvasEventTransformer:function(t,e,i,s){return Ck(t.parentElement,e,i,s)},createCircle:$p,createColor:ru,createConicalGradient:Yu,createContributionProvider:zm,createEventTransformer:Ck,createGlyph:Zp,createGraphic:cf,createGroup:tg,createImage:sg,createLine:ag,createMat4:_u,createMiniappApp:function(t={}){return new SA(t)},createNodeApp:function(t={}){return new xA(t)},createPath:hg,createPolygon:ug,createPyramid3d:dv,createRect:mg,createRect3d:nv,createRectPath:Mv,createRichText:jg,createShadowRoot:Ug,createStage:function(t){return oA(),(new Sm).create(t)},createStar:ov,createSymbol:Gg,createText:Jg,createWrapText:ef,cubicCalc:Ro,cubicLength:Po,cubicPointAt:Io,cubicSubdivide:JA,defaultArcAllocate:Hk,defaultArcBackgroundRenderContribution:Wv,defaultArcRenderContribution:Uv,defaultArcTextureRenderContribution:Vv,defaultAreaAllocate:Nk,defaultBaseBackgroundRenderContribution:zf,defaultBaseClipRenderAfterContribution:Qf,defaultBaseClipRenderBeforeContribution:Zf,defaultBaseTextureRenderContribution:jv,defaultCircleAllocate:Vk,defaultCircleBackgroundRenderContribution:Kv,defaultCircleRenderContribution:Yv,defaultCircleTextureRenderContribution:Xv,defaultGraphicMemoryManager:Qk,defaultGroupBackgroundRenderContribution:qv,defaultImageBackgroundRenderContribution:ay,defaultImageRenderContribution:ry,defaultLineAllocate:Gk,defaultPathAllocate:Xk,defaultRectAllocate:Fk,defaultRectBackgroundRenderContribution:sy,defaultRectRenderContribution:ey,defaultRectTextureRenderContribution:iy,defaultStarBackgroundRenderContribution:gy,defaultStarTextureRenderContribution:py,defaultSymbolAllocate:$k,defaultSymbolBackgroundRenderContribution:uy,defaultSymbolClipRangeStrokeRenderContribution:cy,defaultSymbolRenderContribution:hy,defaultSymbolTextureRenderContribution:dy,defaultTextAllocate:Zk,diff:ZA,divideCubic:Fo,drawArc:Co,drawArcPath:Fv,drawAreaSegments:Xb,drawBackgroundImage:Kf,drawImageWithLayout:_x,drawIncrementalAreaSegments:Jb,drawIncrementalSegments:Zb,drawSegments:qb,enumCommandMap:lo,fillVisible:Bv,findBestMorphingRotation:nk,findConfigIndexByCursorIdx:wk,findCursorIdxByConfigIndex:Ek,findNextGraphic:Lf,flatten_simplify:qA,foreach:If,foreachAsync:Of,genBasisSegments:Zo,genBasisTypeSegments:qo,genLinearClosedSegments:gl,genLinearClosedTypeSegments:fl,genLinearSegments:Yo,genLinearTypeSegments:Xo,genMonotoneXSegments:rl,genMonotoneXTypeSegments:nl,genMonotoneYSegments:ol,genMonotoneYTypeSegments:al,genNumberType:Xc,genStepClosedSegments:ul,genStepSegments:cl,genStepTypeSegments:dl,getApplicationState:ah,getAttributeFromDefaultAttrList:xh,getBackgroundImage:jf,getConicGradientAt:Gu,getContributionStoreState:Lm,getCurrentEnv:function(){return mm()?"browser":"node"},getDefaultCharacterConfig:Mk,getExtraModelMatrix:function(t,e,i){const{alpha:s,beta:n}=i.attribute;if(!s&&!n)return null;const{anchor3d:r=i.attribute.anchor}=i.attribute,a=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=r[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=Yg(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Au.allocate();return cu(o,o,[a[0],a[1],0]),n&&ou(o,o,n),s&&lu(o,o,s),cu(o,o,[-a[0],-a[1],0]),o},getFactoryState:Ef,getGraphicClassState:wp,getGraphicRegistryState:af,getLegacyBindingContext:m_,getModelMatrix:vm,getRichTextBounds:fv,getRuntimeInstallerBindingContext:NA,getRuntimeInstallerGlobal:VA,getRuntimeInstallerState:TA,getScaledStroke:nu,getTextBounds:gv,getTheme:zp,getThemeFromGroup:Hp,globalTheme:Fp,glyphModule:ux,graphicCreator:lf,graphicService:rA,graphicUtil:sA,identityMat4:au,imageModule:Ax,incrementalAddTo:function(t,e){t.incrementalAppendChild(e)},installRuntimeContributionModule:$A,installRuntimeDrawContributionsToApp:YA,installRuntimeGraphicRenderersToApp:GA,installRuntimePickersToApp:XA,interpolateColor:Ru,interpolateGradientConicalColor:Du,interpolateGradientLinearColor:Ou,interpolateGradientRadialColor:Lu,interpolatePureColorArray:Fu,interpolatePureColorArrayToStr:zu,intersect:Ov,isBrowserEnv:mm,isNoRepeatSizingMode:function(t){return"string"==typeof t&&t.startsWith("no-repeat-")},isNodeEnv:function(){fm();const t=oh.global&&oh.global.env;return t?"node"===t:!gm},isSvg:Nc,isXML:Uc,layerService:aA,lineModule:Mx,lookAt:gu,mapToCanvasPointForCanvas:function(t){var e;if(Rd(t._canvasX)&&Rd(t._canvasY))return{x:t._canvasX,y:t._canvasY};if(t.changedTouches){const i=null!==(e=t.changedTouches[0])&&void 0!==e?e:{};return{x:i._canvasX,y:i._canvasY}}return{x:t._canvasX||0,y:t._canvasY||0}},mat3Tomat4:du,mat4Allocate:Au,matrixAllocate:Su,multiplyMat4Mat3:function(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i.a,b=i.b,x=0,S=0;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.c,b=i.d,x=0,S=0,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,_=0,b=0,x=1,S=0,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.e,b=i.f,x=0,S=1,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},multiplyMat4Mat4:pu,newThemeObj:Ip,ortho:fu,parsePadding:gh,parseStroke:uh,parseSvgPath:mo,pathModule:Ox,pathToBezierCurves:ak,point:Ko,pointEqual:yh,pointInterpolation:_h,pointInterpolationHighPerformance:function(t,e,i,s){const{x:n,y:r}=Jt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Jt(t.x1,t.y1,e.x1,e.y1,i);return s.x=n,s.y=r,s.x1=a,s.y1=o,s.defined=e.defined,s},pointsEqual:function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>yh(t,e[i]))):!Number.isNaN(t.x+t.y)&&yh(t,e))},pointsInterpolation:bh,polygonModule:Vx,preLoadAllModule:f_,pyramid3dModule:Kx,quadCalc:Oo,quadLength:Do,quadPointAt:Lo,rafBasedSto:Ah,rect3dModule:iS,rectFillVisible:Pv,rectModule:Jx,rectStrokeVisible:Iv,recursiveCallBinarySplit:_k,refreshRuntimeInstallerContributions:UA,registerArc3dGraphic:vb,registerArcGraphic:mb,registerAreaGraphic:yb,registerCircleGraphic:_b,registerDirectionalLight:uA,registerFlexLayoutPlugin:nC,registerGlobalEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerGlyphGraphic:bb,registerGraphic:hf,registerGroupGraphic:xb,registerHtmlAttributePlugin:S_,registerImageGraphic:Sb,registerLineGraphic:Ab,registerOrthoCamera:gA,registerPathGraphic:kb,registerPolygonGraphic:Cb,registerPyramid3dGraphic:Tb,registerReactAttributePlugin:k_,registerRect3dGraphic:wb,registerRectGraphic:Mb,registerRichtextGraphic:Eb,registerShadowRootGraphic:Bb,registerStarGraphic:Pb,registerSymbolGraphic:Rb,registerTextGraphic:Ib,registerViewTransform3dPlugin:eC,registerWindowEventTransformer:function(t,e,i,s,n){const r=Ck(0,i,s,n);t.setEventListenerTransformer(r)},registerWrapTextGraphic:Ob,renderCommandList:wo,resolveBackgroundDrawMode:Vf,resolveBackgroundParamsByImageSizing:vx,resolveBackgroundPosition:Gf,resolveBackgroundSizing:Nf,resolveContainerBinding:function(t,e){const[i]=t.getAll(e);if(null==i)throw new Error(`No binding found for ${function(t){return"string"==typeof t?t:"symbol"==typeof t?t.toString():"function"==typeof t&&t.name?t.name:"unknown service identifier"}(e)}.`);return i},resolveImageMode:fx,resolveImageRepeatMode:gx,resolveRenderableImageSize:Xf,rewriteProto:function(t,e){Object.setPrototypeOf(t,e)},richtextModule:oS,rotateX:ou,rotateY:lu,rotateZ:hu,runFill:wv,runStroke:Ev,scaleMat4:uu,segments:Ao,shouldClipImageByLayout:yx,shouldUseMat4:ym,snapLength:Bo,splitArc:dk,splitArea:gk,splitCircle:uk,splitLine:fk,splitPath:xk,splitPolygon:bk,splitRect:ck,splitToGrids:hk,starModule:dS,strCommandMap:["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],strokeVisible:Rv,symbolModule:fS,textAttributesToStyle:Kg,textDrawOffsetX:Yg,textDrawOffsetY:function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},textLayoutOffsetY:Xg,textModule:_S,transformMat4:mu,transformPointForCanvas:function(t,e,i,s,n){const r={x:t,y:e};i.transformPoint(r,r),Object.defineProperties(n,{_canvasX:{value:r.x},_canvasY:{value:r.y}})},transformUtil:nA,translate:cu,verticalLayout:$c,vglobal:b_,waitForAllSubLayers:function(t){return Wc(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oh.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)}))},wrapCanvas:Td,wrapContext:function(t,e){return function(){var t,e;const i=null===(t=oh.global)||void 0===t?void 0:t.env,s=i?null===(e=oh.context2dFactory)||void 0===e?void 0:e.call(oh,i):void 0;if(!s)throw new Error(`Context2dFactory is not configured for env "${null!=i?i:"unknown"}"`);return s}()(t,e)},xul:function(t){const e=_(t)?t[0]:t,i=[];if(!e)return i;if(!0===Uc(e)){const t=(new Vc).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};Qc(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};Qc(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}});class aC{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:nu(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}class oC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let lC=!1;function hC(t){lC||(lC=!0,t.bind(DS).toDynamicValue((()=>new oC(xS(t,xy)))).inSingletonScope(),t.bind(eA).toService(DS))}class cC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=td}}let dC=!1;function uC(t){dC||(dC=!0,t.bind(kS).toDynamicValue((()=>new cC(xS(t,xy)))).inSingletonScope(),t.bind(AS).toService(kS))}function pC(){if(pC.__loaded)return;pC.__loaded=!0;const t=m_();mb(),Nb({bind:t.bind}),bS?hC(t):uC(t)}pC.__loaded=!1;const gC=pC;class fC extends Fb{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class mC extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ed,this.themeType="arc"}}let vC=!1;function yC(t){var e;vC||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Sy))&&(vC=!0,t.bind(FS).toDynamicValue((()=>new mC(xS(t,Sy)))).inSingletonScope(),t.bind(eA).toService(FS))}function _C(){if(_C.__loaded)return;_C.__loaded=!0;const t=m_();vb(),uA(),gA(),Gb({bind:t.bind}),yC(t)}_C.__loaded=!1;const bC=_C;class xC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let SC=!1;function AC(t){SC||(SC=!0,t.bind(zS).toDynamicValue((()=>new xC(xS(t,Ay)))).inSingletonScope(),t.bind(eA).toService(zS))}class kC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=id}}let CC=!1;function TC(t){CC||(CC=!0,t.bind(CS).toDynamicValue((()=>new kC(xS(t,Ay)))).inSingletonScope(),t.bind(AS).toService(CS))}function MC(){if(MC.__loaded)return;MC.__loaded=!0;const t=m_();yb(),nx({bind:t.bind}),bS?AC(t):TC(t)}MC.__loaded=!1;const wC=MC;class EC{constructor(){this.type="glyph",this.numberType=nd}contains(t,e,i){if(!t.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}}class BC extends EC{constructor(t){super(),this.canvasRenderer=t}}let PC=!1;function RC(t){PC||(PC=!0,t.bind(JS).toDynamicValue((()=>new BC(xS(t,Dy)))).inSingletonScope(),t.bind(eA).toService(JS))}class IC extends EC{constructor(t){super(),this.canvasRenderer=t}}let OC=!1;function LC(t){OC||(OC=!0,t.bind(OS).toDynamicValue((()=>new IC(xS(t,Dy)))).inSingletonScope(),t.bind(AS).toService(OS))}function DC(){if(DC.__loaded)return;DC.__loaded=!0;const t=m_();bb(),ux({bind:t.bind}),bS?RC(t):LC(t)}DC.__loaded=!1;const FC=DC;function zC(){zC.__loaded||(zC.__loaded=!0,xb())}zC.__loaded=!1;const HC=zC;class jC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=ad}}let NC=!1;function UC(t){NC||(NC=!0,t.bind(jS).toDynamicValue((()=>new jC(xS(t,Fy)))).inSingletonScope(),t.bind(eA).toService(jS))}class VC{constructor(){this.type="image",this.numberType=ad}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let WC=!1;function GC(t){WC||(WC=!0,t.bind(MS).toDynamicValue((()=>new VC)).inSingletonScope(),t.bind(AS).toService(MS))}function YC(){if(YC.__loaded)return;YC.__loaded=!0;const t=m_();Sb(),Ax({bind:t.bind}),bS?UC(t):GC(t)}YC.__loaded=!1;const XC=YC;class KC extends Fb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Au.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}class $C extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let qC=!1;function ZC(t){qC||(qC=!0,t.bind(US).toDynamicValue((()=>new $C(xS(t,My)))).inSingletonScope(),t.bind(eA).toService(US))}class JC extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=od}}let QC=!1;function tT(t){QC||(QC=!0,t.bind(wS).toDynamicValue((()=>new JC(xS(t,My)))).inSingletonScope(),t.bind(AS).toService(wS))}function eT(){if(eT.__loaded)return;eT.__loaded=!0;const t=m_();Ab(),Mx({bind:t.bind}),bS?ZC(t):tT(t)}eT.__loaded=!1;const iT=eT;class sT extends KC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let nT=!1;function rT(t){nT||(nT=!0,t.bind(WS).toDynamicValue((()=>new sT(xS(t,wy)))).inSingletonScope(),t.bind(eA).toService(WS))}class aT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ld}}let oT=!1;function lT(t){oT||(oT=!0,t.bind(ES).toDynamicValue((()=>new aT(xS(t,wy)))).inSingletonScope(),t.bind(AS).toService(ES))}function hT(){if(hT.__loaded)return;hT.__loaded=!0;const t=m_();kb(),Ox({bind:t.bind}),bS?rT(t):lT(t)}hT.__loaded=!1;const cT=hT;class dT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let uT=!1;function pT(t){uT||(uT=!0,t.bind($S).toDynamicValue((()=>new dT(xS(t,Ey)))).inSingletonScope(),t.bind(eA).toService($S))}class gT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hd}}let fT=!1;function mT(t){fT||(fT=!0,t.bind(IS).toDynamicValue((()=>new gT(xS(t,Ey)))).inSingletonScope(),t.bind(AS).toService(IS))}function vT(){if(vT.__loaded)return;vT.__loaded=!0;const t=m_();Cb(),Vx({bind:t.bind}),bS?pT(t):mT(t)}vT.__loaded=!1;const yT=vT;class _T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=cd,this.themeType="polygon"}}let bT=!1;function xT(t){var e;bT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Ly))&&(bT=!0,t.bind(qS).toDynamicValue((()=>new _T(xS(t,Ly)))).inSingletonScope(),t.bind(eA).toService(qS))}function ST(){if(ST.__loaded)return;ST.__loaded=!0;const t=m_();Tb(),uA(),gA(),Kx({bind:t.bind}),xT(t)}ST.__loaded=!1;const AT=ST,kT=new Ve;class CT{constructor(){this.type="rect",this.numberType=dd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:nu(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;kT.setValue(i.x1,i.y1,i.x2,i.y2),kT.expand(-r/2),h=!kT.containsPoint(e)}}return s.highPerformanceRestore(),h}}class TT extends CT{constructor(t){super(),this.canvasRenderer=t}}let MT=!1;function wT(t){MT||(MT=!0,t.bind(GS).toDynamicValue((()=>new TT(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(GS))}class ET extends CT{constructor(t){super(),this.canvasRenderer=t}}let BT=!1;function PT(t){BT||(BT=!0,t.bind(BS).toDynamicValue((()=>new ET(xS(t,By)))).inSingletonScope(),t.bind(AS).toService(BS))}function RT(){if(RT.__loaded)return;RT.__loaded=!0;const t=m_();Mb(),Jx({bind:t.bind}),bS?wT(t):PT(t)}RT.__loaded=!1;const IT=RT;class OT extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=ud,this.themeType="rect"}}let LT=!1;function DT(t){var e;LT||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,Py))&&(LT=!0,t.bind(YS).toDynamicValue((()=>new OT(xS(t,Py)))).inSingletonScope(),t.bind(eA).toService(YS))}function FT(){if(FT.__loaded)return;FT.__loaded=!0;const t=m_();wb(),iS({bind:t.bind}),DT(t)}FT.__loaded=!1;const zT=FT;class HT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let jT=!1;function NT(t){jT||(jT=!0,t.bind(ZS).toDynamicValue((()=>new HT(xS(t,Oy)))).inSingletonScope(),t.bind(eA).toService(ZS))}class UT{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=pd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let VT=!1;function WT(t){VT||(VT=!0,t.bind(LS).toDynamicValue((()=>new UT(xS(t,Oy)))).inSingletonScope(),t.bind(AS).toService(LS))}function GT(){if(GT.__loaded)return;GT.__loaded=!0;const t=m_();Eb(),oS({bind:t.bind}),bS?NT(t):WT(t)}GT.__loaded=!1;const YT=GT;function XT(){XT.__loaded||(XT.__loaded=!0,Bb())}XT.__loaded=!1;const KT=XT;class $T extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:nu(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Au.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}}let qT=!1;function ZT(t){qT||(qT=!0,t.bind(XS).toDynamicValue((()=>new $T(xS(t,Ry)))).inSingletonScope(),t.bind(eA).toService(XS))}class JT extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=fd}}let QT=!1;function tM(t){QT||(QT=!0,t.bind(PS).toDynamicValue((()=>new JT(xS(t,Ry)))).inSingletonScope(),t.bind(AS).toService(PS))}function eM(){if(eM.__loaded)return;eM.__loaded=!0;const t=m_();Rb(),fS({bind:t.bind}),bS?ZT(t):tM(t)}eM.__loaded=!1;const iM=eM;class sM extends fC{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=md}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=Xg(a,u,n),v=Yg(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&&Au.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}}let nM=!1;function rM(t){nM||(nM=!0,t.bind(KS).toDynamicValue((()=>new sM(xS(t,Iy)))).inSingletonScope(),t.bind(eA).toService(KS))}class aM{constructor(){this.type="text",this.numberType=md}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}}let oM=!1;function lM(t){oM||(oM=!0,t.bind(RS).toDynamicValue((()=>new aM)).inSingletonScope(),t.bind(AS).toService(RS))}function hM(){if(hM.__loaded)return;hM.__loaded=!0;const t=m_();Ib(),_S({bind:t.bind}),bS?rM(t):lM(t)}hM.__loaded=!1;const cM=hM;function dM(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),gM=(t,e)=>(d(mM.warnHandler)&&mM.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),fM=(t,e,i)=>{if(!d(mM.errorHandler))throw new Error(t);mM.errorHandler.call(null,t,e)},mM={silent:!1,warnHandler:!1,errorHandler:!1},vM=mm(),yM=vM&&globalThis?globalThis.document:void 0;function _M(t){return("desktop-browser"===t||"mobile-browser"===t)&&vM}function bM(t){return xM(t)||"mobile-browser"===t}function xM(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let SM=0;function AM(){return SM>=9999999&&(SM=0),SM++}function kM(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function CM(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}function TM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&TM(t,e)}))}const MM=t=>!u(t)&&!1!==t.visible;function wM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function EM(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 PM=["#ffffff","#000000"];function RM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new si(t).toHex(),o=new si(e).toHex();return IM(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(...PM);for(const n of a)if(t!==n&&IM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function IM(t,e,i,s,n){if("lightness"===n){const i=si.getColorBrightness(new si(e));return si.getColorBrightness(new si(t))<.5?i>=.5:i<.5}return s?OM(t,e)>s:"largeText"===i?OM(t,e)>3:OM(t,e)>4.5}function OM(t,e){const i=LM(t),s=LM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function LM(t){const e=ri(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 DM(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 FM(t,e){return[t[0]*e,t[1]*e]}function zM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function HM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const jM=cf,NM={arc:t=>jM("arc",t),circle:t=>jM("circle",t),group:t=>jM("group",t),image:t=>jM("image",t),line:t=>jM("line",t),path:t=>jM("path",t),polygon:t=>jM("polygon",t),rect:t=>jM("rect",t),richtext:t=>jM("richtext",t),symbol:t=>jM("symbol",t),text:t=>jM("text",t)},UM=-.5*Math.PI,VM=1.5*Math.PI,WM="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 GM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(GM||(GM={}));const YM={[GM.selectedReverse]:{},[GM.selected]:{},[GM.hover]:{},[GM.hoverReverse]:{}},XM={container:"",width:30,height:30,style:{}},KM="scrollDrag",$M=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:WM,fontSize:14},s),getTextBounds:i?void 0:gv,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function qM(t,e,i={}){if(!t)return{width:0,height:0};const s=gv({text:t,fontFamily:e.fontFamily||i.fontFamily||WM,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 ZM(t,e="type"){var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function JM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function QM(t,e="type"){const i=ZM(t,e);return"rich"===i?NM.richtext(JM(t)):("html"===i?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),NM.text(t))}function tw(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 ew=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function iw(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 sw(t,e){const{dx:i,dy:s}=iw(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}const nw={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}}},rw={size:8,stroke:"#000",lineWidth:1,zIndex:1};function aw(t,e){var i,s;return(null===(i=t.OBBBounds)||void 0===i?void 0:i.empty())||(null===(s=e.OBBBounds)||void 0===s?void 0:s.empty())?Ae(t.AABBBounds,e.AABBBounds,!1)&&(!t.rotatedBounds||!e.rotatedBounds||Ee(t.rotatedBounds,e.rotatedBounds,!0)):t.OBBBounds.intersects(e.OBBBounds)}const ow=Math.sin(Math.PI/10);function lw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function hw(t,e=ow){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function cw(t){const e={};return TM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function dw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function uw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return FM(r,(s?-1:1)*(n?-1:1)*t/zM(r))}function pw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function fw(t,e,i){var s;if(hw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>He(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>He(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function mw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function _w(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function bw(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function xw(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 Sw(t,e){const i=xw(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 Aw(t,e){const i=kw(t),s=kw(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 kw(t,e={x:0,y:0}){return ae.distancePP(t,e)}function Cw(t){return k(t.x)&&k(t.y)}function Tw(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 Mw(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const ww=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function Bw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&Bw(t[i],e)}}var Pw;!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"}(Pw||(Pw={}));const Rw={};function Iw(t){switch(t){case Pw.Linear:case Pw.Log:case Pw.Pow:case Pw.Sqrt:case Pw.Symlog:case Pw.Time:return!0;default:return!1}}function Ow(t){return!!Rw[t]}function Lw(t){switch(t){case Pw.Ordinal:case Pw.Point:case Pw.Band:return!0;default:return!1}}function Dw(t){return t}Object.values(Pw).forEach((t=>{Rw[t]=!0}));const Fw=t=>-Math.log(-t),zw=t=>-Math.exp(-t),Hw=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,jw=t=>10===t?Hw:t===Math.E?Math.exp:e=>Math.pow(t,e),Nw=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)),Vw=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Ww(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 Gw(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function Yw(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function Xw(t,e,i,s){return 1===i&&(i=0),Yw(t,i,s)*(e/(1-i))}function Kw(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function $w(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]{const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class Zw{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=Kw(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=yt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Jw=Symbol("implicit");class Qw extends Zw{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=Jw}clone(){const t=(new Qw).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!==Jw)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return tE(t,e,r,n)}class iE extends Qw{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=Xw(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1),i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:eE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return eE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new iE(!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:sE}=ai;function nE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=si.parseColorString(e)){const e=sE(si.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof ni?sE(t,e):e instanceof si?sE(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class rE extends Zw{constructor(t=Dw,e=Dw){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Dw,this._piecewise=Gw,this._interpolate=nE}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=Ct,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=bt(i[0],i[r-1])),this._piecewise=r>2?$w:Gw,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:Dw),this.rescale(i)):this._clamp!==Dw}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const aE=Math.sqrt(50),oE=Math.sqrt(10),lE=Math.sqrt(2),hE=[1,2,5,10],cE=(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=gE(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?uE(0,-(e-1)/s,s):uE((e-1)/s,0,s)},dE=vt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return cE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return cE(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=uE(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=uE(t,e,l);return n&&r.reverse(),r})),gE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=hE[0];return i>=aE?s=hE[3]:i>=oE?s=hE[2]:i>=lE&&(s=hE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function fE(t,e,i){const s=(e-t)/Math.max(0,i);return gE(s)}function mE(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e0;){if(s=fE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function yE(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 _E=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),bE=vt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),xE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=pE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?_E(t,e,n):_E(t,e,qw(n)),h=_E(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),SE=vt(((t,e,i,s,n)=>mE(s(t),s(e),i).map((t=>qw(n(t))))));class AE extends rE{constructor(){super(...arguments),this.type=Pw.Linear}clone(){var t;const e=new AE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return dE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=pE(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mE(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function CE(t){return e=>-t(-e)}function TE(t=Number.EPSILON){return e=>Math.max(e,t)}class ME extends rE{constructor(){super(Nw(10),jw(10)),this.type=Pw.Log,this._limit=TE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new ME).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=Nw(this._base),s=jw(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Fw,this.untransformer=zw):(this._logs=i,this._pows=s,this._limit=TE(),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 Dw}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return bE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}G(ME,kE);class wE extends AE{constructor(){super(Uw(1),Vw(1)),this.type=Pw.Symlog,this._const=1}clone(){return(new wE).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=Vw(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return bE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return xE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return SE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(wE,kE);class EE{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[lt(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new EE).domain(this._domain).range(this._range).unknown(this._unknown)}}var BE,PE,RE;function IE(t){var e,i;const{type:s}=t;return s===PE.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(BE||(BE={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(PE||(PE={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(RE||(RE={}));const OE={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},LE={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function DE(t,e){var i;if(!t)return[];const s=VE(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?NE(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>jE(i)?zE(t,i,e):i)).filter(p)}))):i.map((i=>jE(i)?zE(t,i,e):i)).filter(p):[]}return[]}function FE(t,e){var i,s;return NE(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 zE(t,e,i){var s;const n=VE(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=OE[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=LE[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 si(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ke(t,i,s),a=Xe(n,r,e.l),l=new si(`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 HE=(t,e)=>{if(e&&jE(t)){const i=zE(e,t);if(i)return i}return t};function jE(t){return t&&"palette"===t.type&&!!t.key}function NE(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function UE(t){return _(t)?{dataScheme:t}:t}function VE(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=IE(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 WE extends Qw{setSpecified(t){return this._specified=t?Object.assign({},t):{},this}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(!NE(this._range))return void super.range(this._range);const t=FE(this._range,this._domain);super.range(t)}}const GE={linear:AE,band:iE,point:class extends iE{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:Qw,threshold:EE,colorOrdinal:WE};function YE(t){const e=GE[t];return e?new e:null}function XE(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function KE(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function $E(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function qE(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function ZE(t){return!!y(t)&&(!!t.endsWith("%")&&kM(t.substring(0,t.length-1)))}function JE(t){return!!g(t)&&("percent"in t||"offset"in t)}function QE(t,e,i,s=0){var n,r;return S(t)?t:ZE(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 tB(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]=QE(t[s],e.size,i)}))})),o}function eB(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}function iB(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)||ZE(t)||d(t)||JE(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function sB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const nB=(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},rB=[{maxDomainLength:10,scheme:["#1664FF","#1AC6FF","#FF8A00","#3CC780","#7442D4","#FFC400","#304D77","#B48DEB","#009488","#FF7DDA"]},{scheme:["#1664FF","#B2CFFF","#1AC6FF","#94EFFF","#FF8A00","#FFCE7A","#3CC780","#B9EDCD","#7442D4","#DDC5FA","#FFC400","#FAE878","#304D77","#8B959E","#B48DEB","#EFE3FF","#009488","#59BAA8","#FF7DDA","#FFCFEE"]}];function aB(t,e){return t&&e.key in t?t[e.key]:e.default}function oB(t){return t&&"token"===t.type&&!!t.key}const lB={fontFamily:"PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,'-apple-system',segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol",fontSize:14,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},hB={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#ffffff",borderColor:"#e3e5e8",shadowColor:"rgba(33,37,44,0.1)",hoverBackgroundColor:"#f1f2f5",sliderRailColor:"#f1f3f4",sliderHandleColor:"#ffffff",sliderTrackColor:"#0040ff",popupBackgroundColor:"#ffffff",primaryFontColor:"#21252c",secondaryFontColor:"#606773",tertiaryFontColor:"#89909d",axisLabelFontColor:"#89909d",disableFontColor:"#bcc1cb",axisMarkerFontColor:"#ffffff",axisGridColor:"#f1f2f5",axisDomainColor:"#d9dde4",dataZoomHandleStrokeColor:"#aeb5be",dataZoomChartColor:"#c9ced8",playerControllerColor:"#0040ff",scrollBarSliderColor:"rgba(0,0,0,0.3)",axisMarkerBackgroundColor:"#21252c",markLabelBackgroundColor:"#f1f2f5",markLineStrokeColor:"#606773",dangerColor:"#e33232",warningColor:"#ffc528",successColor:"#07a35a",infoColor:"#3073f2",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:lB,component:{poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"primaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"popupBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"},size:0,space:12}}},mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},cB={name:"dark",colorScheme:{default:{dataScheme:rB,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"rgba(0,0,0,0.1)",hoverBackgroundColor:"#404349",sliderRailColor:"#404349",sliderHandleColor:"#202226",sliderTrackColor:"#4284FF",popupBackgroundColor:"#404349",primaryFontColor:"#fdfdfd",secondaryFontColor:"#bbbdc3",tertiaryFontColor:"#888c93",axisLabelFontColor:"#888c93",disableFontColor:"#55595f",axisMarkerFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",dataZoomHandleStrokeColor:"#bbbdc3",dataZoomChartColor:"#55595F",playerControllerColor:"#4284FF",scrollBarSliderColor:"rgba(255,255,255,0.3)",axisMarkerBackgroundColor:"#fdfdfd",markLabelBackgroundColor:"#404349",markLineStrokeColor:"#bbbdc3",dangerColor:"#eb4b4b",warningColor:"#f0bd30",successColor:"#14b267",infoColor:"#4284ff",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},dB=(t,e)=>t===e||!d(t)&&!d(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>dB(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>dB(t[i],e[i])))),uB=(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]={}),uB(t[s],e.slice(1),i))},pB=t=>t instanceof za||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function gB(t,e=["data"]){return L(t,pB,e)}function fB(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=UE(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}bB._charts=_B.charts,bB._series=_B.series,bB._components=_B.components,bB._graphicComponents=_B.graphicComponents,bB._marks=_B.marks,bB._regions=_B.regions,bB._animations=_B.animations,bB._implements=_B.implements,bB._chartPlugin=_B.chartPlugin,bB._vChartPlugin=_B.vChartPlugin,bB._componentPlugin=_B.componentPlugin,bB.transforms=_B.transforms,bB.dataParser=_B.dataParser,bB._layout=_B.layout,bB._grammarTransforms=_B.grammarTransforms,bB._stageEventPlugins=_B.stageEventPlugins,bB.registerStageEventPlugin=(t,e)=>{bB._stageEventPlugins[t]=e},bB.getStageEventPlugin=t=>bB._stageEventPlugins[t],bB._interactionTriggers=_B.interactionTriggers,bB.registerInteractionTrigger=(t,e)=>{bB._interactionTriggers[t]=e},bB._composedEventMap=_B.composedEventMap,bB.registerComposedEvent=(t,e)=>{bB._composedEventMap[t]=e},bB._tooltipProcessors=_B.tooltipProcessors,bB.registerTooltipProcessor=(t,e)=>{bB._tooltipProcessors[t]=e},bB.createTooltipProcessor=(t,e)=>{const i=bB._tooltipProcessors[t];return i?new i(e):null},bB._runtimePluginInstallers=_B.runtimePluginInstallers,bB.registerRuntimePluginInstaller=(t,e)=>{bB._runtimePluginInstallers[t]=e},bB.getRuntimePluginInstaller=t=>bB._runtimePluginInstallers[t];const AB=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}},conversionArrow:{line:{style:{stroke:"black"}},symbol:{style:{fill:"black"}},text:{style:{fontSize:12,fill:"#606773"}}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},kB=AB(),CB={[hB.name]:hB},TB=hB.name,MB=new Map(Object.keys(CB).map((t=>[t,CB[t]]))),wB=new Map,EB=new Map(Object.keys(CB).map((t=>[t,t===TB]))),BB=(t,e)=>{if(!t)return;const i=OB(e);MB.set(t,i),EB.set(t,!0)},PB=(t=TB)=>(EB.has(t)&&!EB.get(t)&&BB(t,MB.get(t)),MB.get(t)),RB=t=>MB.delete(t)&&wB.delete(t)&&EB.delete(t),IB=t=>!!y(t)&&MB.has(t),OB=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:TB;return xB({},PB(i),t)};class LB{static registerInstance(t){LB.instances.set(t.id,t)}static unregisterInstance(t){LB.instances.delete(t.id)}static getInstance(t){return LB.instances.get(t)}static instanceExist(t){return LB.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return LB.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}LB.instances=new Map;class DB{static registerTheme(t,e){BB(t,e)}static getTheme(t,e=!1){return PB(t)}static removeTheme(t){return RB(t)}static themeExist(t){return IB(t)}static getDefaultTheme(){return DB.themes.get(TB)}static setCurrentTheme(t){DB.themeExist(t)&&(DB._currentThemeName=t,LB.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return DB.getTheme(DB._currentThemeName,t)}static getCurrentThemeName(){return DB._currentThemeName}}function FB(t){return y(t)?DB.themeExist(t)?DB.getTheme(t):{}:g(t)?t:{}}DB.themes=MB,DB._currentThemeName=TB;const zB=["animationThreshold","colorScheme","name","padding"];function HB(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];zB.includes(n)?s[n]=r:m(r)?jE(r)?s[n]=HE(r,e):oB(r)?s[n]=aB(i,r):s[n]=HB(r,e,i):s[n]=r})),s}function jB(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]=jB(t[s],e)}return i}return _(t)?t.map((t=>jB(t,e))):t}function NB(t,e){var i;if(!t)return t;if(y(t))return null!==(i=e.getFunction(t))&&void 0!==i?i:t;if(m(t)){const i={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=NB(t[s],e));return i}return _(t)?t.map((t=>NB(t,e))):t}function UB(t,...e){return d(t)?t(...e):t}const VB=(t,e,i,s)=>((t,e,i)=>$M(t,e,i,{fontFamily:lB.fontFamily,fontSize:lB.fontSize}))(e,i,s).measure(t),WB="__VCHART",GB=500,YB=500,XB=`${WB}_MEASURE_CANVAS_ID`,KB=`${WB}_DEFAULT_DATA_INDEX`,$B=`${WB}_DEFAULT_DATA_KEY`,qB=`${WB}_DEFAULT_DATA_SERIES_FIELD`,ZB=`${WB}_DEFAULT_SERIES_STYLE_NAME`,JB=`${WB}_STACK_KEY`,QB=`${WB}_STACK_START`,tP=`${WB}_STACK_END`,eP=`${WB}_STACK_START_PERCENT`,iP=`${WB}_STACK_END_PERCENT`,sP=`${WB}_STACK_START_OffsetSilhouette`,nP=`${WB}_STACK_END_OffsetSilhouette`,rP=`${WB}_STACK_TOTAL`,aP=`${WB}_STACK_TOTAL_PERCENT`,oP=`${WB}_STACK_TOTAL_TOP`,lP=`${WB}_STACK_TOTAL_BOTTOM`,hP=`${WB}_MOSAIC_VALUE_START_PERCENT`,cP=`${WB}_MOSAIC_VALUE_END_PERCENT`,dP=`${WB}_MOSAIC_CAT_START_PERCENT`,uP=`${WB}_MOSAIC_CAT_END_PERCENT`,pP=`${WB}_SEGMENT_START`,gP=`${WB}_SEGMENT_END`,fP=`${WB}_KEY`,mP=`${WB}_MAP_LOOK_UP_KEY`;function vP(t,e){for(let i=0;it.key===e))}function _P(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 bP(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},CP(t,a,n[o],l,e,r))})),s?xP(n):n}function xP(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))):xP(t[e].nodes);return t}function SP(t,e){if("values"in t&&t.values.length){const i=bw(t.values,e),s=_w(t.values,iP);t.values.forEach((t=>{t[rP]=i,t[aP]=s}))}else for(const i in t.nodes)SP(t.nodes[i],e)}function AP(t){if(!t.values.length)return;const e=t.values[t.values.length-1][tP]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)kP(t.nodes[r],e,i,s,n)}function CP(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[tP]=function(t){if(k(t))return t;const e=+t;return k(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),CP(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const TP=(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]=wP(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function EP(t){return!d(t)&&!P(t)&&Object.keys(t).some((e=>d(t[e])))}function BP(t,e,i,s,n){const r=function(t){const e=null==t?void 0:t.datum;return e&&"object"==typeof e?Object.assign(Object.assign({},e),t):t}(e);if(d(t))return OP(t(r,i,s,n));if(EP(t)){const e=Object.assign({},t);return Object.keys(e).forEach((t=>{d(e[t])&&(e[t]=e[t](r,i,s,n))})),OP(e)}return OP(t)}function PP(t={}){const e=Object.assign({},t);if(d(t.style)||EP(t.style)?e.style=(e,i,s,n)=>BP(t.style,e,i,s,n):P(t.style)||(e.style=OP(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])||EP(t.state[e])?i[e]=(i,s,n,r)=>BP(t.state[e],i,s,n,r):P(t.state[e])||(i[e]=OP(t.state[e]))})),e.state=i}return e}function RP(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>OP(t[i](e,s,n,r)):P(t[i])||(e[i]=OP(t[i]))})),e}function IP(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),OP(i)}function OP(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const LP=t=>{var e;return null!==(e=null==t?void 0:t.glyphHost)&&void 0!==e?e:t},DP=t=>"line"===t||"area"===t,FP=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return DP(i)?e:null==e?void 0:e[0]},zP=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let HP=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventHandlerMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i},n=bB.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{eventType:t,event:e})}else this._eventDispatcher.register(t,s),this._addEventHandler(t,s);return this}off(t,e,i){var s,n,r;const a=null!=i?i:e;if(bB.getComposedEvent(t))if(a)null===(s=this._composedEventMap.get(a))||void 0===s||s.event.unregister(),this._composedEventMap.delete(a);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(a){const i=null!==(r=this._getEventHandler(t,a))&&void 0!==r?r:{callback:a,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i),this._removeEventHandler(t,a)}else this._eventDispatcher.unregister(t),this._eventHandlerMap.delete(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventHandlerMap.forEach(((t,e)=>{t.forEach((t=>{this._eventDispatcher.unregister(e,t)}))})),this._eventHandlerMap.clear(),this._composedEventMap.forEach((t=>{t.event.unregister()})),this._composedEventMap.clear()}_addEventHandler(t,e){e.callback&&(this._eventHandlerMap.has(t)||this._eventHandlerMap.set(t,new Map),this._eventHandlerMap.get(t).set(e.callback,e))}_getEventHandler(t,e){var i;return null===(i=this._eventHandlerMap.get(t))||void 0===i?void 0:i.get(e)}_removeEventHandler(t,e){const i=this._eventHandlerMap.get(t);i&&(i.delete(e),i.size||this._eventHandlerMap.delete(t))}};var jP;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(jP||(jP={}));const NP=["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 UP,VP,WP;t.ChartEvent=void 0,(UP=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",UP.rendered="rendered",UP.renderFinished="renderFinished",UP.animationFinished="animationFinished",UP.regionSeriesDataFilterOver="regionSeriesDataFilterOver",UP.afterInitData="afterInitData",UP.afterInitEvent="afterInitEvent",UP.afterInitMark="afterInitMark",UP.rawDataUpdate="rawDataUpdate",UP.viewDataFilterOver="viewDataFilterOver",UP.viewDataUpdate="viewDataUpdate",UP.viewDataStatisticsUpdate="viewDataStatisticsUpdate",UP.markDeltaYUpdate="markDeltaYUpdate",UP.viewDataLabelUpdate="viewDataLabelUpdate",UP.scaleDomainUpdate="scaleDomainUpdate",UP.scaleRawDomainUpdate="scaleRawDomainUpdate",UP.scaleUpdate="scaleUpdate",UP.dataZoomChange="dataZoomChange",UP.drill="drill",UP.layoutStart="layoutStart",UP.layoutEnd="layoutEnd",UP.layoutRectUpdate="layoutRectUpdate",UP.playerPlay="playerPlay",UP.playerPause="playerPause",UP.playerEnd="playerEnd",UP.playerChange="playerChange",UP.playerForward="playerForward",UP.playerBackward="playerBackward",UP.scrollBarChange="scrollBarChange",UP.brushStart="brushStart",UP.brushChange="brushChange",UP.brushEnd="brushEnd",UP.brushClear="brushClear",UP.brushActive="brushActive",UP.legendSelectedDataChange="legendSelectedDataChange",UP.legendFilter="legendFilter",UP.legendItemClick="legendItemClick",UP.legendItemHover="legendItemHover",UP.legendItemUnHover="legendItemUnHover",UP.tooltipShow="tooltipShow",UP.tooltipHide="tooltipHide",UP.tooltipRelease="tooltipRelease",UP.afterResize="afterResize",UP.afterRender="afterRender",UP.afterLayout="afterLayout",UP.afterMarkLayoutEnd="afterMarkLayoutEnd",UP.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(VP||(VP={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(WP||(WP={}));const GP=[WP.mark,WP.model,WP.chart,WP.vchart];class YP{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(WP.vchart,[]),this._levelNodes.set(WP.chart,[]),this._levelNodes.set(WP.model,[]),this._levelNodes.set(WP.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const XP={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend"};class KP{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._canvasBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>FP(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||VP.chart);o.get(t)||o.set(t,new YP);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||VP.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||VP.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||VP.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||VP.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?GP.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[VP.chart,VP.window,VP.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&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 XP[a]&&(a=XP[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?WP.model:WP.vchart:WP.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=VP.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==WP.model&&s!==WP.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=WP.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case VP.chart:return this._viewBubbles;case VP.window:return this._windowBubbles;case VP.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case VP.chart:return this._viewListeners;case VP.window:return this._windowListeners;case VP.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return NP.includes(t)||Object.values(jP).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&bB.hasInteractionTrigger(e)}}function $P(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function qP(t,e,i){t.getParser(e)||t.registerParser(e,i)}const ZP=new Map;let JP;function QP(){JP||(JP=new Fa,qP(JP,"geojson",Pa),qP(JP,"topojson",Ia),$P(JP,"simplify",Kr))}function tR(t,e,i={type:"geojson",centroid:!0}){ZP.has(t)&&gM(`map type of '${t}' already exists, will be overwritten.`),QP();const s=new za(JP),n=H({},{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}),ZP.set(t,s)}function eR(t){ZP.has(t)?ZP.delete(t):gM(`map type of '${t}' does not exists.`)}function iR(t,e=!1){let i=e;return t.latestData instanceof za&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const sR=(t,e)=>0===t.length?[]:1===t.length?iR(t[0],null==e?void 0:e.deep):t.map((t=>iR(t,null==e?void 0:e.deep)));function nR(e,i,s){$P(i=i instanceof Fa?i:e.dataSet,"copyDataView",sR);const n=new za(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function rR(t,e,i=[]){var s;if(t instanceof za)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new za(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return gM(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return gM(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),gM("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function aR(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var oR,lR,hR,cR;t.TransformLevel=void 0,(oR=t.TransformLevel||(t.TransformLevel={}))[oR.copyDataView=-10]="copyDataView",oR[oR.treemapFilter=-8]="treemapFilter",oR[oR.treemapFlatten=-7]="treemapFlatten",oR[oR.dotObjFlat=-7]="dotObjFlat",oR[oR.linkDotInfo=-7]="linkDotInfo",oR[oR.sankeyLayout=-7]="sankeyLayout",oR[oR.dataZoomFilter=-6]="dataZoomFilter",oR[oR.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(lR||(lR={})),function(t){t.data="data",t.mark="mark"}(hR||(hR={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(cR||(cR={}));const dR=["line","area","trail"];function uR(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(fP,i?t.slice().sort(i):t.slice()),{keys:[fP],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const pR=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function gR(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{gR(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function mR(t,e,i,s){const n=uR(t,(t=>i(t))),r=uR(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}const vR=`${WB}_BuiltIn_CallBack_Disappear`;var yR;!function(t){t.render="render",t.disappear="disappear"}(yR||(yR={}));const _R=[0,0,0];class bR{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t:this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):(this.nativeContext.restore(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Il),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Ll),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Dl),{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ge(1,0,0,1,0,0),this._clearMatrix=new Ge(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ge(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Su.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&&(Su.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Su.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Ut;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=cthis.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Dl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Dl.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&&(mu(_R,[e,i,s],this.modelMatrix),e=_R[0],i=_R[1],s=_R[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=ru(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:nu(this,a,this.dpr),r.strokeStyle=ru(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?this.font=t.font:this.font=De(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(t=!0,e=this.dpr){this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Su.free(t))),this.stack.length=0}}bR.env="browser";class xR extends wu{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=oh.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new bR(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 SR(t,e){return i=>{var s,n;const r=!!(null===(s=i.getNamed)||void 0===s?void 0:s.call(i,kd,t.env)),a=!!(null===(n=i.getNamed)||void 0===n?void 0:n.call(i,Cd,e.env));r||i.bind(kd).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),a||i.bind(Cd).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}}xR.env="browser";const AR=SR(xR,bR);class kR extends bR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}}kR.env="feishu";class CR extends wu{constructor(t){super(t)}init(){this._context=new kR(this,this._dpr)}release(...t){}}CR.env="feishu";const TR=SR(CR,kR);class MR extends bR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:De(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:De(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}}MR.env="harmony";class wR extends wu{constructor(t){super(t)}init(){this._context=new MR(this,this._dpr)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}release(...t){}}wR.env="harmony";const ER=SR(wR,MR);class BR extends bR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:nu(this,l,this.dpr),r.strokeStyle=ru(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||!d||(r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=oh.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,oh.global.devicePixelRatio),{width:super.measureText(t,e).width,fontBoundingBoxDescent:void 0,fontBoundingBoxAscent:void 0,actualBoundingBoxAscent:void 0,actualBoundingBoxDescent:void 0}}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}}BR.env="lynx";class PR extends wu{constructor(t){super(t)}init(){this._context=new BR(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(...t){}}PR.env="lynx";const RR=SR(PR,BR);class IR extends bR{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 Ge(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}}IR.env="node";class OR extends wu{constructor(t){super(t)}init(){this._context=new IR(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}}OR.env="node";const LR=SR(OR,IR);class DR extends bR{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_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.setGlobalAlpha(a*o),r.setFillStyle(ru(this,l,t,i,s)))}_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,lineDashOffset:u=n.lineDashOffset,lineCap:p=n.lineCap,miterLimit:g=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;r.setGlobalAlpha(a*o),r.setLineWidth(f?l:nu(this,l,this.dpr)),r.setStrokeStyle(ru(this,h,t,i,s)),r.setLineJoin(c),d&&(r.setLineDash(d),r.lineDashOffset=u),r.setLineCap(p),r.setMiterLimit(g)}}setTextStyleWithoutAlignBaseline(t,e){var i;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=De(t,e),s.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,s;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=De(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline)}createConicGradient(t,e,i,s){return null}createPattern(t,e){return null}getImageData(t,e,i,s){const n=this.nativeContext,r=n.taro;if(n&&r)return!n.getImageData&&r.canvasGetImageData?new Promise(((n,a)=>{try{r.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:s,success(t){n(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,s,n,r){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,s,n,r)}}DR.env="taro";class FR extends wu{constructor(t){super(t)}init(){this._context=new DR(this,this._dpr)}release(...t){}}FR.env="taro";const zR=SR(FR,DR);class HR extends kR{}HR.env="tt";class jR extends wu{constructor(t){super(t)}init(){this._context=new HR(this,this._dpr)}release(...t){}}jR.env="tt";const NR=SR(jR,HR);class UR extends bR{draw(){}createPattern(t,e){return null}}UR.env="wx";class VR extends wu{constructor(t){super(t)}init(){this._context=new UR(this,this._dpr)}release(...t){}}VR.env="wx";const WR=SR(VR,UR);class GR extends vA{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=_f.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;nnew KR(xS(t,ky)))).inSingletonScope(),t.bind(eA).toService(HS))}class ZR extends CT{constructor(t){super(),this.canvasRenderer=t}}let JR=!1;class QR extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="star",this.numberType=gd}}let tI=!1;function eI(t){var e;tI||(null===(e=t.isBound)||void 0===e?void 0:e.call(t,jy))&&(tI=!0,t.bind(tA).toDynamicValue((()=>new QR(xS(t,jy)))).inSingletonScope(),t.bind(eA).toService(tA))}const iI=Xc();Xc();class sI{constructor(){this.type="gif-image",this.numberType=iI}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}}let nI=!1;function rI(t){nI||(nI=!0,t.bind(NS).toDynamicValue((()=>new sI)).inSingletonScope(),t.bind(eA).toService(NS))}function aI(t){t.isBound(GR)||t.bind(GR).toDynamicValue((()=>new GR(SS(eA,t),xS(t,Hy),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(GR):t.bind(qm).toService(GR)}function oI(t){(function(t){XR||(XR=!0,t.bind(QS).toDynamicValue((()=>new YR)).inSingletonScope(),t.bind(eA).toService(QS),Hm(t.bind.bind(t),eA))})(t),hC(t),yC(t),AC(t),qR(t),RC(t),UC(t),ZC(t),function(t){JR||(JR=!0,t.bind(VS).toDynamicValue((()=>new ZR(xS(t,By)))).inSingletonScope(),t.bind(eA).toService(VS))}(t),rT(t),pT(t),xT(t),wT(t),DT(t),NT(t),eI(t),ZT(t),rM(t),rI(t),aI(t)}class lI extends cA{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${lI.idprefix}_${lI.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=oh.global,this.viewBox=new Ve,this.modelMatrix=new Ge(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(){var t;if(null===(t=this.global)||void 0===t?void 0:t.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:lI.GenerateCanvasId(),canvasControled:!0};this.canvas=new xR(s)}createWindowByCanvas(t){var e,i,s;let n;if("string"==typeof t.canvas){if(n=null===(e=this.global)||void 0===e?void 0:e.getElementById(t.canvas),n||"undefined"==typeof document||(n=document.getElementById(t.canvas)),!n)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else n=t.canvas;if(!n)throw new Error("发生错误,传入的canvas不正确");let r=t.width,a=t.height;if(null==r||null==a||!t.canvasControled){const t=n.getBoundingClientRect();r=t.width,a=t.height}let o=t.dpr;null==o&&(o=null!==(i=n.getContext("2d").pixelRatio)&&void 0!==i?i:n.width/r),this.canvas=new xR({width:r,height:a,dpr:o,nativeCanvas:n,canvasControled:null!==(s=t.canvasControled)&&void 0!==s&&s})}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)}}function hI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,lI))||t.bind(lI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,lI.env))||t.bind(xf).toService(lI).whenTargetNamed(lI.env)}lI.env="browser",lI.idprefix="visactor_window",lI.prefix_count=0;var cI=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 dI{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 uI(t,e=!1){const i=document.createElement("img");if(oh.global.isImageAnonymous&&(i.crossOrigin="anonymous"),e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}class pI extends hA{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 dI(t)}return new Ve}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return uI(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return uI(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:Va.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(...t){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}loadFont(t,e,i){return cI(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}}function gI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,pI))||(t.bind(pI).toSelf().inSingletonScope(),t.bind(vg).toService(pI))}function fI(t=m_(),e=!0){fI.__loaded||(fI.__loaded=!0,gI(t),AR(t),hI(t),e&&oI(t))}fI.__loaded=!1;class mI extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new CR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 CR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function vI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,mI))||t.bind(mI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,mI.env))||t.bind(xf).toService(mI).whenTargetNamed(mI.env)}mI.env="feishu";class yI extends vA{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Tu(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}}let _I=!1;class bI extends aC{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sd}}let xI=!1;function SI(t){xI||(xI=!0,t.bind(TS).toDynamicValue((()=>new bI(xS(t,ky)))).inSingletonScope(),t.bind(AS).toService(TS))}function AI(t){(function(t){_I||(_I=!0,Hm(t.bind.bind(t),AS))})(t),function(t){t.isBound(yI)||t.bind(yI).toDynamicValue((()=>new yI(SS(AS,t),SS(Qm,t),SS(tv,t)))).inSingletonScope(),t.isBound(qm)?t.rebind(qm).toService(yI):t.bind(qm).toService(yI)}(t),uC(t),TC(t),SI(t),LC(t),GC(t),tT(t),mT(t),lT(t),PT(t),WT(t),tM(t),lM(t)}class kI{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class CI{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}function TI(t,e,i=null==t.id){var s,n,r;return{id:null==t.id?void 0:String(t.id),width:null!==(s=t.width)&&void 0!==s?s:0,height:null!==(n=t.height)&&void 0!==n?n:0,dpr:null!==(r=t.dpr)&&void 0!==r?r:e,offscreen:i}}function MI(t,e){if(!t)throw new Error("MiniApp canvas bridge returned an empty 2d context.");const i=new kI(t.canvas||{},t,e.dpr,e.width,e.height,e.id);return t.canvas=i,i}function wI(t,e,i,s){const n=TI(t,e),r=n.id;if(null!=r){const t=i.get(r);if(t)return t}if(!s)return null;const a=function(t,e){var i;const s=null===(i=null==t?void 0:t.getContext)||void 0===i?void 0:i.call(t,"2d");if(!s)throw new Error('MiniApp canvas bridge returned a canvas without getContext("2d").');return new CI(t,s,e.dpr,e.width,e.height,e.id)}(s(n),n);return null!=r&&i.set(r,a),a}function EI(t){var e,i,s,n,r;try{return null!==(s=null!==(i=null!==(e=null==t?void 0:t.feishu)&&void 0!==e?e:null==t?void 0:t.tt)&&void 0!==i?i:null==t?void 0:t.runtime)&&void 0!==s?s:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(r=null!==(n=null==t?void 0:t.feishu)&&void 0!==n?n:null==t?void 0:t.tt)&&void 0!==r?r:null==t?void 0:t.runtime}}function BI(t,e=EI(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class PI extends hA{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.feishuEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.feishuEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.feishuEnvParams,s=EI(i),n=null!==(e=t.dpr)&&void 0!==e?e:BI(i,s),r=wI(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=TI(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Feishu canvas bridge is unavailable. VRender feishu env requires envParams.canvasFactory, a Stage canvas object, or a feishu/tt runtime that exposes createCanvasContext(id).");const o=MI(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return BI(this.feishuEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function RI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,PI))||(t.bind(PI).toSelf().inSingletonScope(),t.bind(vg).toService(PI))}function II(t=m_(),e=!0){II.__loaded||(II.__loaded=!0,RI(t),TR(t),vI(t),e&&AI(t))}II.__loaded=!1;function OI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function LI(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height,dpr:t.dpr}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new wR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 wR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){var t,e;this.eventManager.cleanEvent(),null===(e=null===(t=this.canvas)||void 0===t?void 0:t.release)||void 0===e||e.call(t)}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return OI(t,"target",s),OI(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=LI(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=LI(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&DI(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),DI(t,"x",_),DI(t,"y",b),DI(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),DI(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),DI(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),DI(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),DI(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),DI(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function zI(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,FI))||t.bind(FI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,FI.env))||t.bind(xf).toService(FI).whenTargetNamed(FI.env)}FI.env="harmony";const HI="Harmony canvas bridge is unavailable. VRender Harmony env requires envParams.canvasFactory or a Harmony runtime that exposes a global createCanvas/createOffscreenCanvas capability.";function jI(t){return"number"==typeof t&&Number.isFinite(t)}function NI(...t){for(let e=0;e({width:i,height:s})),new CI(t,l,n,i,s,e)}function YI(t,e,i,s,n,r,a){const o={id:t,width:e,height:i,dpr:s,offscreen:n};if(r.canvasFactory)return r.canvasFactory(o);if(n&&"function"==typeof(null==a?void 0:a.createOffscreenCanvas)){const t=a.createOffscreenCanvas(o);if(t)return t}if(!n&&"function"==typeof(null==a?void 0:a.createCanvas)){const t=a.createCanvas(o);if(t)return t}if(n){const t=WI(e*s,i*s);if(t)return t}throw new Error(HI)}class XI extends hA{constructor(){super(),this.type="harmony",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,this.rafSTO=new Sh(0)}configure(t,e={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.harmonyEnvParams=e,this.harmonyRuntime=UI(e))}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){var e;if("function"!=typeof(null===(e=this.harmonyRuntime)||void 0===e?void 0:e.createImage))return Promise.resolve({data:null,loadState:"fail"});const i=this.harmonyRuntime.createImage(t);return new Promise((t=>{i.onload=()=>{t({data:i,loadState:"success"})},i.onerror=()=>{t({data:null,loadState:"fail"})}}))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i;const s=null!==(e=this.harmonyEnvParams)&&void 0!==e?e:{},n=UI(s),r=null!==(i=t.dpr)&&void 0!==i?i:VI(s),a=function(t,e){if(!jI(t)||!jI(e))throw new Error("Harmony canvas size is unavailable. Pass stage width/height when creating a Harmony stage canvas.");return{width:t,height:e}}(t.width,t.height);if(null!=t.id){const e=String(t.id),i=this.canvasMap.get(e);if(i)return i;const o=GI(YI(e,a.width,a.height,r,!1,s,n),e,a.width,a.height,r);return this.canvasMap.set(e,o),o}const o=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,o)return o;const l=Math.random().toString(),h=GI(YI(l,a.width,a.height,r,!0,s,n),l,a.width,a.height,r);return this.canvasMap.set(l,h),this.freeCanvasList.push(h),h}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return VI(this.harmonyEnvParams)}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=NI(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=NI(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){var e;return null!==(e=this.canvasMap.get(t))&&void 0!==e?e:null}getRootElement(){return null}getDocument(){return null}release(...t){}}function KI(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,XI))||(t.bind(XI).toSelf().inSingletonScope(),t.bind(vg).toService(XI))}function $I(t=m_(),e=!0){$I.__loaded||($I.__loaded=!0,KI(t),ER(t),zI(t),e&&AI(t))}$I.__loaded=!1;function qI(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}function ZI(...t){for(let i=0;it===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new PR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 PR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e;const{type:i}=t;if(!this.eventManager.cache[i])return!1;const s=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return qI(t,"target",s),qI(t,"currentTarget",s),function(t){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;const y=null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0];if(!y)return;const _=ZI(t.x,t.offsetX,t.clientX,t.pageX,y.x,y.offsetX,y.clientX,y.pageX),b=ZI(t.y,t.offsetY,t.clientY,t.pageY,y.y,y.offsetY,y.clientY,y.pageY);null!=_&&null!=b&&(!t.touches&&t.changedTouches&&JI(t,"touches","touchend"===t.type||"touchcancel"===t.type?[]:t.changedTouches),JI(t,"x",_),JI(t,"y",b),JI(t,"offsetX",null!==(n=t.offsetX)&&void 0!==n?n:_),JI(t,"offsetY",null!==(r=t.offsetY)&&void 0!==r?r:b),JI(t,"clientX",null!==(a=t.clientX)&&void 0!==a?a:_),JI(t,"clientY",null!==(o=t.clientY)&&void 0!==o?o:b),JI(t,"pageX",null!==(l=t.pageX)&&void 0!==l?l:_),JI(t,"pageY",null!==(h=t.pageY)&&void 0!==h?h:b),y.x=null!==(c=y.x)&&void 0!==c?c:_,y.y=null!==(d=y.y)&&void 0!==d?d:b,y.offsetX=null!==(u=y.offsetX)&&void 0!==u?u:_,y.offsetY=null!==(p=y.offsetY)&&void 0!==p?p:b,y.clientX=null!==(g=y.clientX)&&void 0!==g?g:_,y.clientY=null!==(f=y.clientY)&&void 0!==f?f:b,y.pageX=null!==(m=y.pageX)&&void 0!==m?m:_,y.pageY=null!==(v=y.pageY)&&void 0!==v?v:b)}(t),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[i].listener&&this.eventManager.cache[i].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()}}function tO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,QI))||t.bind(QI).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,QI.env))||t.bind(xf).toService(QI).whenTargetNamed(QI.env)}QI.env="lynx";function eO(t){return"number"==typeof t&&Number.isFinite(t)}function iO(...t){for(let e=0;e{s.onload=()=>{t(s)},s.onerror=()=>{e(new Error("加载失败"))}}))}(t,!1,this.lynxRuntime).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e,i,s,n;if(null!=t.id){const s=String(t.id),n=this.canvasMap.get(s);if(n)return n;const r=null!==(e=this.lynxEnvParams)&&void 0!==e?e:{},a=nO(r),o=null!==(i=t.dpr)&&void 0!==i?i:rO(r,a),l=oO(t.width,t.height),h=lO(hO(s,l.width,l.height,o,!1,r,a),s,l.width,l.height,o);return this.canvasMap.set(s,h),h}const r=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];if(this.canvasIdx++,r)return r;const a=null!==(s=this.lynxEnvParams)&&void 0!==s?s:{},o=nO(a),l=null!==(n=t.dpr)&&void 0!==n?n:rO(a,o),h=oO(t.width,t.height),c=Math.random().toString(),d=lO(hO(c,h.width,h.height,l,!0,a,o),c,h.width,h.height,l);return this.canvasMap.set(c,d),this.freeCanvasList.push(d),d}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return rO(void 0,this.lynxRuntime)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}mapToCanvasPoint(t){var e;return null!==(e=function(t){const e=function(t){var e,i,s;return null!==(i=null===(e=null==t?void 0:t.changedTouches)||void 0===e?void 0:e[0])&&void 0!==i?i:null===(s=null==t?void 0:t.touches)||void 0===s?void 0:s[0]}(t),i=iO(null==t?void 0:t.x,null==t?void 0:t.offsetX,null==t?void 0:t.clientX,null==t?void 0:t.pageX,null==e?void 0:e.x,null==e?void 0:e.offsetX,null==e?void 0:e.clientX,null==e?void 0:e.pageX),s=iO(null==t?void 0:t.y,null==t?void 0:t.offsetY,null==t?void 0:t.clientY,null==t?void 0:t.pageY,null==e?void 0:e.y,null==e?void 0:e.offsetY,null==e?void 0:e.clientY,null==e?void 0:e.pageY);return null==i||null==s?null:{x:i,y:s}}(t))&&void 0!==e?e:t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function dO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,cO))||(t.bind(cO).toSelf().inSingletonScope(),t.bind(vg).toService(cO))}function uO(t=m_(),e=!0){uO.__loaded||(uO.__loaded=!0,dO(t),RR(t),tO(t),e&&AI(t))}uO.__loaded=!1;class pO extends cA{get container(){return null}constructor(t=oh.global){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:Va.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new OR(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new OR({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(t="image/png"){return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}}function gO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,pO))||t.bind(pO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,pO.env))||t.bind(xf).toService(pO).whenTargetNamed(pO.env)}pO.env="node";class fO extends hA{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)}getNodePackage(t,e){if(!this.pkg||e&&"function"!=typeof this.pkg[e])throw new Error(`Node env requires node-canvas package before ${t}. Use vglobal.setEnv('node', CanvasPkg) before createNodeVRenderApp(), or createNodeVRenderApp({ envParams: CanvasPkg }).`);return this.pkg}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.getNodePackage("loadImage","loadImage");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.getNodePackage("loadSvg").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){const{createCanvas:e}=this.getNodePackage("createCanvas","createCanvas");return e(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}}function mO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,fO))||(t.bind(fO).toSelf().inSingletonScope(),t.bind(vg).toService(fO))}function vO(t=m_(),e=!0){vO.__loaded||(vO.__loaded=!0,mO(t),LR(t),gO(t))}vO.__loaded=!1;class yO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new FR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 FR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function _O(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,yO))||t.bind(yO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,yO.env))||t.bind(xf).toService(yO).whenTargetNamed(yO.env)}yO.env="taro";class bO extends hA{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.pixelRatio=1,this.taroEnvParams={},this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e={}){var i;t.env===this.type&&(t.setActiveEnvContribution(this),this.taroEnvParams=e,this.taro=e.taro,this.pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:1)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e="undefined"!=typeof window?window:globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],s=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),s=e.URL.createObjectURL(i);return Promise.resolve({data:s,loadState:"success"})}return Promise.reject()}createCanvas(t){var e,i;const s=this.taroEnvParams,n=null!==(e=t.dpr)&&void 0!==e?e:this.getDevicePixelRatio(),r=wI(t,n,this.canvasMap,s.canvasFactory);if(r)return r;const a=TI(t,n,!1);if(null==a.id||"function"!=typeof(null===(i=s.taro)||void 0===i?void 0:i.createCanvasContext))throw new Error("Taro canvas bridge is unavailable. VRender taro env requires envParams.canvasFactory, a Stage canvas object, or envParams.taro.createCanvasContext(id).");const o=MI(s.taro.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}}function xO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,bO))||(t.bind(bO).toSelf().inSingletonScope(),t.bind(vg).toService(bO))}function SO(t=m_(),e=!0){SO.__loaded||(SO.__loaded=!0,xO(t),zR(t),_O(t),e&&AI(t))}SO.__loaded=!1;class AO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="tt",this.eventManager=new class{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={}}}}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new jR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 jR({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}}function kO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,AO))||t.bind(AO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,AO.env))||t.bind(xf).toService(AO).whenTargetNamed(AO.env)}AO.env="tt";function CO(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.tt)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof tt?tt:void 0}catch(e){return null!==(s=null==t?void 0:t.tt)&&void 0!==s?s:null==t?void 0:t.runtime}}function TO(t,e=CO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class MO extends hA{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.ttEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.ttEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){var e;const i=this.ttEnvParams,s=CO(i),n=null!==(e=t.dpr)&&void 0!==e?e:TO(i,s),r=wI(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=TI(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("TT canvas bridge is unavailable. VRender tt env requires envParams.canvasFactory, a Stage canvas object, or a tt runtime that exposes createCanvasContext(id).");const o=MI(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return TO(this.ttEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function wO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,MO))||(t.bind(MO).toSelf().inSingletonScope(),t.bind(vg).toService(MO))}function EO(t=m_(),e=!0){EO.__loaded||(EO.__loaded=!0,wO(t),NR(t),kO(t),e&&AI(t))}EO.__loaded=!1;class BO{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={}}}function PO(t,e,i){if(t&&i)try{t[e]=i}catch(s){Object.defineProperty(t,e,{configurable:!0,value:i})}}class RO extends cA{get container(){return null}constructor(t=oh.global){super(),this.global=t,this.type="wx",this.eventManager=new BO}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:Va.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new VR(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),e||(e=this.global.createCanvas({id:t.canvas,width:t.width,height:t.height,dpr:t.dpr})),!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 VR({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,r;const{type:a}=t;if(!this.eventManager.cache[a])return!1;const o=null===(e=this.canvas)||void 0===e?void 0:e.nativeCanvas;return PO(t,"target",o),PO(t,"currentTarget",o),t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(s=t.changedTouches[0].x)&&void 0!==s?s:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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()}}function IO(t){var e,i;(null===(e=t.isBound)||void 0===e?void 0:e.call(t,RO))||t.bind(RO).toSelf(),(null===(i=t.getNamed)||void 0===i?void 0:i.call(t,xf,RO.env))||t.bind(xf).toService(RO).whenTargetNamed(RO.env)}RO.env="wx";function OO(t){var e,i,s;try{return null!==(i=null!==(e=null==t?void 0:t.wx)&&void 0!==e?e:null==t?void 0:t.runtime)&&void 0!==i?i:"undefined"!=typeof wx?wx:void 0}catch(e){return null!==(s=null==t?void 0:t.wx)&&void 0!==s?s:null==t?void 0:t.runtime}}function LO(t,e=OO(t)){var i,s,n,r;return null!==(r=null!==(i=null==t?void 0:t.pixelRatio)&&void 0!==i?i:null===(n=null===(s=null==e?void 0:e.getSystemInfoSync)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.pixelRatio)&&void 0!==r?r:1}class DO extends hA{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.wxEnvParams={},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={}){t.env===this.type&&(t.setActiveEnvContribution(this),this.wxEnvParams=e)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.resolve({data:null,loadState:"fail"})}createCanvas(t){var e;const i=this.wxEnvParams,s=OO(i),n=null!==(e=t.dpr)&&void 0!==e?e:LO(i,s),r=wI(t,n,this.canvasMap,i.canvasFactory);if(r)return r;const a=TI(t,n,!1);if(null==a.id||"function"!=typeof(null==s?void 0:s.createCanvasContext))throw new Error("Wx canvas bridge is unavailable. VRender wx env requires envParams.canvasFactory, a Stage canvas object, or a wx runtime that exposes createCanvasContext(id).");const o=MI(s.createCanvasContext(a.id),a);return this.canvasMap.set(a.id,o),o}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return LO(this.wxEnvParams)}getRequestAnimationFrame(){return function(t){return Ah.call(t)}}getCancelAnimationFrame(){return t=>{Ah.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}}function FO(t){var e,i;(null===(i=(e=t).isBound)||void 0===i?void 0:i.call(e,DO))||(t.bind(DO).toSelf().inSingletonScope(),t.bind(vg).toService(DO))}function zO(t=m_(),e=!0){zO.__loaded||(zO.__loaded=!0,FO(t),WR(t),IO(t),e&&AI(t))}zO.__loaded=!1;var HO={},jO={},NO={};Object.defineProperty(NO,"__esModule",{value:!0}),NO.loop=NO.conditional=NO.parse=void 0;NO.parse=function t(e,i){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(i))i.forEach((function(i){return t(e,i,s,n)}));else if("function"==typeof i)i(e,s,n,t);else{var r=Object.keys(i)[0];Array.isArray(i[r])?(n[r]={},t(e,i[r],s,n[r])):n[r]=i[r](e,s,n,t)}return s};NO.conditional=function(t,e){return function(i,s,n,r){e(i,s,n)&&r(i,t,s,n)}};NO.loop=function(t,e){return function(i,s,n,r){for(var a=[],o=i.pos;e(i,s,n);){var l={};if(r(i,t,s,l),i.pos===o)break;o=i.pos,a.push(l)}return a}};var UO={};Object.defineProperty(UO,"__esModule",{value:!0}),UO.readBits=UO.readArray=UO.readUnsigned=UO.readString=UO.peekBytes=UO.readBytes=UO.peekByte=UO.readByte=UO.buildStream=void 0;UO.buildStream=function(t){return{data:t,pos:0}};var VO=function(){return function(t){return t.data[t.pos++]}};UO.readByte=VO;UO.peekByte=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(e){return e.data[e.pos+t]}};var WO=function(t){return function(e){return e.data.subarray(e.pos,e.pos+=t)}};UO.readBytes=WO;UO.peekBytes=function(t){return function(e){return e.data.subarray(e.pos,e.pos+t)}};UO.readString=function(t){return function(e){return Array.from(WO(t)(e)).map((function(t){return String.fromCharCode(t)})).join("")}};UO.readUnsigned=function(t){return function(e){var i=WO(2)(e);return t?(i[1]<<8)+i[0]:(i[0]<<8)+i[1]}};UO.readArray=function(t,e){return function(i,s,n){for(var r="function"==typeof e?e(i,s,n):e,a=WO(t),o=new Array(r),l=0;l=s){var a=s-t.pos;e.push((0,i.readBytes)(a)(t)),n+=a;break}e.push((0,i.readBytes)(r)(t)),n+=r}for(var o=new Uint8Array(n),l=0,h=0;h>=a,g-=a,c>s||c==o)break;if(c==n){r=(1<<(a=u+1))-1,s=n+2,h=-1;continue}if(-1==h){k[m++]=A[c],h=c,f=c;continue}for(l=c,c==s&&(k[m++]=f,c=h);c>n;)k[m++]=A[c],c=S[c];f=255&A[c],k[m++]=f,s<_&&(S[s]=h,A[s]=f,0==(++s&r)&&s<_&&(a++,r+=s)),h=l}m--,x[v++]=k[m],d++}for(d=v;d{const e=tL(t),i=KO(e,!0);this.renderGIF(i)})).catch((t=>{console.error("Gif load error: ",t)}));else if(this.attribute.gifImage instanceof ArrayBuffer){const t=tL(this.attribute.gifImage),e=KO(t,!0);this.renderGIF(e)}}renderGIF(t){this.loadedFrames=t,this.frameIndex=0,this.tempCanvas||(this.tempCanvas=oh.global.createCanvas({}),this.tempCtx=this.tempCanvas.getContext("2d")),this.gifCanvas||(this.gifCanvas=oh.global.createCanvas({}),this.gifCtx=this.gifCanvas.getContext("2d")),this.gifCanvas.width=t[0].dims.width,this.gifCanvas.height=t[0].dims.height,this.playing=!0,this.lastTime=(new Date).getTime();const e=this.animate();this.attribute.timeline&&e.setTimeline(this.attribute.timeline),e.to({},1e3,"linear").loop(1/0)}renderFrame(t,e,i){const s=this.loadedFrames[this.frameIndex||0];2===s.disposalType&&this.gifCtx.clearRect(0,0,this.gifCanvas.width,this.gifCanvas.height),this.drawPatch(s),this.manipulate(t,e,i);const n=(new Date).getTime()-this.lastTime;s.delay=this.loadedFrames.length&&(this.frameIndex=0)}drawPatch(t){const e=t.dims;this.frameImageData&&e.width===this.frameImageData.width&&e.height===this.frameImageData.height||(this.tempCanvas.width=e.width,this.tempCanvas.height=e.height,this.frameImageData=this.tempCtx.createImageData(e.width,e.height)),this.frameImageData.data.set(t.patch),this.tempCtx.putImageData(this.frameImageData,0,0),this.gifCtx.drawImage(this.tempCanvas,e.left,e.top)}manipulate(t,e,i){t.drawImage(this.gifCanvas,0,0,this.gifCanvas.width,this.gifCanvas.height,e,i,this.attribute.width,this.attribute.height)}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),"gifImage"===t&&this.loadGif()}setAttributes(t,e,i){super.setAttributes(t,e,i),t.gifImage&&this.loadGif()}}function sL(t){return new iL(t)}class nL extends bx{constructor(t){super(t),this.imageRenderContribitions=t,this.numberType=iI,this._renderContribitions=void 0,this.builtinContributions=[rL],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=zp(t).image,{x:h=l.x,y:c=l.y,fillStrokeOrder:d=l.fillStrokeOrder}=t.attribute,u=this.valid(t,l,a);if(!u)return;const{fVisible:p,sVisible:g,doFill:f,doStroke:m}=u,v=()=>{f&&a&&a(e,t.attribute,l)},y=()=>{m&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,h-i,c-s,l),e.stroke()))};d?(y(),e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore()):(e.save(),e.clip(),this.beforeRenderStep(t,e,i,s,f,!1,p,!1,l,n,a),v(),e.restore(),y()),this.afterRenderStep(t,e,i,s,f,!1,p,!1,l,n,a)}draw(t,e,i){const{context:s}=e.drawParams;if(!s)return;const n=zp(t).image;this._draw(t,n,!1,i)}}const rL=new class extends Jv{constructor(){super(...arguments),this.time=So.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){t.renderFrame&&t.playing&&t.renderFrame(e,i,s)}};let aL=!1;function oL(t){aL||(aL=!0,t.bind(nL).toDynamicValue((()=>new nL(SS(Qy,t)))).inSingletonScope(),t.bind(Cy).toService(nL))}function lL(){lf.RegisterGraphicCreator("gif",sL)}function hL(){if(hL.__loaded)return;hL.__loaded=!0;const t=m_();lL(),oL(t),rI(t)}hL.__loaded=!1;const cL=hL,dL=[{register:mb,bindModule:Nb},{register:vb,bindModule:Gb},{register:yb,bindModule:nx},{register:_b,bindModule:lx},{register:bb,bindModule:ux},{register:xb},{register:Sb,bindModule:Ax},{register:Ab,bindModule:Mx},{register:kb,bindModule:Ox},{register:Cb,bindModule:Vx},{register:Tb,bindModule:Kx},{register:Mb,bindModule:Jx},{register:wb,bindModule:iS},{register:Eb,bindModule:oS},{register:Bb},{register:Pb,bindModule:dS},{register:Rb,bindModule:fS},{register:Ib,bindModule:_S},{register:Ob},{register:lL}];let uL=!1;const pL=[hC,yC,AC,qR,RC,UC,ZC,rT,pT,xT,wT,DT,NT,eI,ZT,rM,rI];function gL(t){return{getContributions:t}}function fL(t,{envParams:e,force:i=!1}={}){VA().setEnv(t,i?function(t){if(null!=t&&("object"==typeof t||"function"==typeof t)){const e=Object.create(t);return e.force=!0,e}return{force:!0}}(e):e)}function mL(t,e,{bindEnv:i,bindCanvasModules:s,bindWindowContribution:n},r){WA(t);const a=NA();i(a),s(a),n(a),UA(),fL(e,{envParams:r,force:!0})}function vL(t,e){mL(t,"browser",{bindEnv:gI,bindCanvasModules:AR,bindWindowContribution:hI},e)}function yL(t,e){mL(t,"node",{bindEnv:mO,bindCanvasModules:LR,bindWindowContribution:gO},e)}function _L(t){WA(t),function(){if(uL)return;const t=NA();uL=!0,dL.forEach((({register:e,bindModule:i})=>{e(),null==i||i({bind:t.bind})})),oL(t),UA()}(),YA(t),GA(t)}function bL(t){WA(t);const e=NA();pL.forEach((t=>t(e))),aI(e),XA(t,eA),function(t){const e=NA(),i=gL((()=>t.registry.picker.getAll())),s=gL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=gL((()=>e.isBound(tv)?e.getAll(tv):[])),r=VA();oh.pickerServiceFactory=()=>new GR(i,{},s,n),oh.global=r}(t)}function xL(t){WA(t);AI(NA()),XA(t,AS),function(t){const e=NA(),i=gL((()=>t.registry.picker.getAll())),s=gL((()=>e.isBound(Qm)?e.getAll(Qm):[])),n=gL((()=>e.isBound(tv)?e.getAll(tv):[]));oh.pickerServiceFactory=()=>new yI(i,s,n)}(t)}function SL(){if(SL.__loaded)return;SL.__loaded=!0;const t=m_();_b(),lx({bind:t.bind}),bS?qR(t):SI(t)}SL.__loaded=!1;const AL=SL;function kL(){if(kL.__loaded)return;kL.__loaded=!0;const t=m_();Pb(),dS({bind:t.bind}),eI(t)}kL.__loaded=!1;const CL=kL;function TL(){TL.__loaded||(TL.__loaded=!0,Ob())}TL.__loaded=!1;const ML=TL;class wL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0})),this.target.applyFinalAttributeToAttribute(),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,a)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class EL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,$_(this.target,i,_o.ANIMATE_BIND),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BL extends wL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class PL extends EL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class RL extends wL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class IL extends EL{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const OL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class LL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:this._updateFunction="startAngle"===i?this.updateStartAngle:"endAngle"===i?this.updateEndAngle:null}updateStartAngle(t){X_(this.target,{startAngle:this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t})}updateEndAngle(t){X_(this.target,{endAngle:this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t})}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class DL extends LL{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=OL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r),this.determineUpdateFunction()}}class FL extends LL{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class zL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class HL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const jL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class NL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=jL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class UL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const VL=(t,e,i)=>{const s=t.getFinalAttribute().points,n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class WL extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(X_(this.target,{points:r.map(((t,i)=>_h(r[i],a[i],e)))}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class GL extends WL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:VL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class YL extends WL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:VL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const XL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class KL extends WL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:XL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class $L extends WL{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:XL(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const qL=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class ZL extends WL{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:qL(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}else this.valid=!1}}class JL extends WL{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:qL(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const QL=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class tD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class eD extends tD{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=QL(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}}class iD extends tD{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const sD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class nD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=sD(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n,this.target.applyFinalAttributeToAttribute(),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&q_(this.target,r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){K_(this.target,this.propKeys,this.from,this.to,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oD extends aD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,v=t.getGraphicAttribute("x"),y=t.getGraphicAttribute("y"),_=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?y:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:_},to:{x:v}};case"y":return{from:{y:b},to:{y:y}};default:return{from:{x:_,y:b},to:{x:v,y:y}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class lD extends aD{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:c}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=d(c)?c.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):c,y=v&&k(v.x)?v.x:f,_=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:y}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:_}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:y,y:_}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class hD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,$_(this.target,{text:n})}}class cD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class dD extends cD{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i,this.target.applyFinalAttributeToAttribute(),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&q_(this.target,e)}}class uD extends cD{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=gt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class pD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S;let A,k;super.onBind();const C=this.target.getFinalAttribute(),T=null!==(t=this.target.attribute)&&void 0!==t?t:{},M=null===(e=this.params)||void 0===e?void 0:e.options,w=null!==(s=null===(i=this.params)||void 0===i?void 0:i.direction)&&void 0!==s?s:null==M?void 0:M.direction,E=null!==(l=null!==(a=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromScaleX)&&void 0!==r?r:null==M?void 0:M.fromScaleX)&&void 0!==a?a:null===(o=this.params)||void 0===o?void 0:o.fromScale)&&void 0!==l?l:null==M?void 0:M.fromScale,B=null!==(p=null!==(d=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromScaleY)&&void 0!==c?c:null==M?void 0:M.fromScaleY)&&void 0!==d?d:null===(u=this.params)||void 0===u?void 0:u.fromScale)&&void 0!==p?p:null==M?void 0:M.fromScale;switch(w){case"x":A={scaleX:null!==(g=null!=E?E:T.scaleX)&&void 0!==g?g:0},k={scaleX:null!==(f=null==C?void 0:C.scaleX)&&void 0!==f?f:1},this._updateFunction=this.updateX;break;case"y":A={scaleY:null!==(m=null!=B?B:T.scaleY)&&void 0!==m?m:0},k={scaleY:null!==(v=null==C?void 0:C.scaleY)&&void 0!==v?v:1},this._updateFunction=this.updateY;break;default:A={scaleX:null!==(y=null!=E?E:T.scaleX)&&void 0!==y?y:0,scaleY:null!==(_=null!=B?B:T.scaleY)&&void 0!==_?_:0},k={scaleX:null!==(b=null==C?void 0:C.scaleX)&&void 0!==b?b:1,scaleY:null!==(x=null==C?void 0:C.scaleY)&&void 0!==x?x:1},this._updateFunction=this.updateXY}this.target.applyFinalAttributeToAttribute(),this.props=k,this.from=A,this.to=k,!1!==(null===(S=this.params.controlOptions)||void 0===S?void 0:S.immediatelyApply)&&q_(this.target,A)}onEnd(t){super.onEnd(t)}updateX(t){this.applyScaleTransientAttrs(t,!0,!1)}updateY(t){this.applyScaleTransientAttrs(t,!1,!0)}updateXY(t){this.applyScaleTransientAttrs(t,!0,!0)}applyScaleTransientAttrs(t,e,i){const s={};e&&(s.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t),i&&(s.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t),X_(this.target,s)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){var e;super.deleteSelfAttrs(t);const i=null===(e=this.propKeys)||void 0===e?void 0:e[0];this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:this._updateFunction="scaleX"===i?this.updateX:"scaleY"===i?this.updateY:null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class gD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s={};this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),X_(this.target,s),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class fD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}const mD={x:!0,y:!0,x1:!0,y1:!0,width:!0,height:!0};function vD(t,e){for(let i=0;imD[t])),this.clipPathSyncDisabled=!this.clipPathSyncKeys.length,this.syncParentClipPathToTarget()}trySyncStartProps(){const t=this.updateFromAttrs;this.propKeys.forEach((e=>{this.fromProps[e]=t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:this.animate.target.getComputedAttribute(e)}))}onEnd(t){var e;t?super.onEnd(t):(this.props&&M_(this.target,null!==(e=this.propKeys)&&void 0!==e?e:Object.keys(this.props),this.animate,this.props),this.syncParentClipPathToTarget(),super.onEnd())}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.runInterpolateUpdate(this.fromProps,this.props,s),this.syncParentClipPathToTarget(),this.onUpdate(t,s,i)}syncParentClipPathToTarget(){var t,e;if(this.clipPathSyncDisabled)return;const i=this.target,s=i.parent,n=null===(t=null==s?void 0:s.attribute)||void 0===t?void 0:t.path;if(!(null===(e=null==s?void 0:s.attribute)||void 0===e?void 0:e.clip)||!Array.isArray(n)||!n.length)return;const r=this.getClipPathSyncChildIndex(s);if(r<0||r>=n.length)return;const a=n[r];if(!(null==a?void 0:a.attribute)||a.type!==i.type||!this.isClipPathStaticTarget(a))return;const o=this.buildClipPathTransientAttrs(a);o&&(X_(a,o),a.addUpdatePositionTag(),a.addUpdateShapeAndBoundsTag())}getClipPathSyncChildIndex(t){if(this.clipPathSyncParent===t&&this.clipPathSyncChildIndex>=0)return this.clipPathSyncChildIndex;const e=this.target;let i=-1;return t.forEachChildren(((t,s)=>t===e&&(i=s,!0))),this.clipPathSyncParent=t,this.clipPathSyncChildIndex=i,i}isClipPathStaticTarget(t){var e,i;const s=this.target,n=this.getTargetFinalAttrs(),r=t.getFinalAttribute(),a=null!==(e=null!=r?r:t.baseAttributes)&&void 0!==e?e:t.attribute,o=null!==(i=this.clipPathSyncKeys)&&void 0!==i?i:[];return!!(o.length&&n&&a)&&o.every((t=>{var e,i;return this.isSameClipPathValue(a[t],null!==(e=n[t])&&void 0!==e?e:null===(i=s.attribute)||void 0===i?void 0:i[t])}))}getTargetFinalAttrs(){var t,e,i;const s=this.target;return null!==(i=null!==(e=null===(t=s.context)||void 0===t?void 0:t.finalAttrs)&&void 0!==e?e:s.getFinalAttribute())&&void 0!==i?i:null}isSameClipPathValue(t,e){return"number"==typeof t&&"number"==typeof e?Math.abs(t-e)<1e-8:t===e}buildClipPathTransientAttrs(t){var e;const i=this.target,s={};return(null!==(e=this.clipPathSyncKeys)&&void 0!==e?e:[]).forEach((e=>{var n;const r=null===(n=i.attribute)||void 0===n?void 0:n[e];Object.prototype.hasOwnProperty.call(t.attribute,e)&&void 0!==r&&!this.isSameClipPathValue(t.attribute[e],r)&&(s[e]=r)})),Object.keys(s).length?s:null}}class _D{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new w_(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttrs(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function bD(t){return new _D(t)}class xD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromText="",this.toText="",this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText)}onFirstRun(){var t,e;const i=this.getLastProps(),s=this.getEndProps(),n=null!==(t=i.text)&&void 0!==t?t:"",r=null!==(e=s.text)&&void 0!==e?e:"";this.valid=!0,this.fromText=n.toString(),this.toText=r.toString(),this.toText||""===this.toText||(this.valid=!1)}onEnd(t){super.onEnd(t),t||(this.showCursor&&!this.blinkCursor?this.target.setAttribute("text",this.beforeText+this.toText+this.cursorChar+this.afterText):this.target.setAttribute("text",this.beforeText+this.toText+this.afterText))}onUpdate(t,e,i){if(!this.valid)return;const s=this.toText.length,n=this.fromText.length;let r,a;n>s?(r=Math.round(n-(n-s)*e),a=this.fromText.substring(0,r)):(r=Math.round(n+(s-n)*e),a=this.toText.startsWith(this.fromText)?this.toText.substring(0,r):r<=n?this.fromText.substring(0,r):this.toText.substring(0,r-n+Math.min(n,r)));let o=this.beforeText+a+this.afterText;if(this.showCursor)if(this.blinkCursor){const t=.1;Math.floor(e/t)%2==0&&(o=this.beforeText+a+this.cursorChar+this.afterText)}else o=this.beforeText+a+this.cursorChar+this.afterText;$_(this.target,{text:o})}}class SD extends nb{onBind(){super.onBind();const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{symbolStartOuterType:n="scale",titleType:r="typewriter",titlePanelType:a="scale"}=this.params,o=e/10;let l,h;if(q_(s._symbolStart,{scaleX:0,scaleY:0}),t.animate(s._symbolStart,{type:"to",to:{scaleX:1,scaleY:1},duration:5*o,easing:i}),"scale"===n?(l={scaleX:0,scaleY:0},h={scaleX:1,scaleY:1}):(l={clipRange:0},h={clipRange:1}),q_(s._symbolStartOuter,l),t.animate(s._symbolStartOuter,{type:"to",to:h,duration:5*o,easing:i}),q_(s._symbolEnd,{scaleX:0,scaleY:0}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:1,scaleY:1},duration:2*o,delay:8*o,easing:i}),q_(s._line,{clipRange:0}),t.animate(s._line,{type:"to",to:{clipRange:1},duration:9*o,easing:i}),"typewriter"===r){const e=s._titleTop.attribute.text;q_(s._titleTop,{text:""}),t.animate(s._titleTop,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:e},custom:xD});const i=s._titleBottom.attribute.text;q_(s._titleBottom,{text:""}),t.animate(s._titleBottom,{type:"custom",delay:5*o,duration:4*o,easing:"linear",to:{text:i},custom:xD})}else q_(s._titleTop,{dy:s._titleTop.AABBBounds.height()+10}),t.animate(s._titleTop,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"}),q_(s._titleBottom,{dy:-(10+s._titleBottom.AABBBounds.height())}),t.animate(s._titleBottom,{type:"to",to:{dy:0},delay:5*o,duration:4*o,easing:"linear"});"scale"===a?[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{var n;const r=null!==(n=s.attribute.scaleX)&&void 0!==n?n:1;q_(s,{scaleX:0}),t.animate(s,{type:"to",to:{scaleX:r},duration:e,easing:i})})):"stroke"===a&&[s._titleTopPanel,s._titleBottomPanel].forEach((s=>{const n=s.AABBBounds,r=2*(n.width()+n.height());q_(s,{lineDash:[0,10*r]}),t.animate(s,{type:"to",to:{lineDash:[r,10*r]},duration:e,easing:i})})),this.completeBind(t)}}class AD extends nb{onBind(){super.onBind();const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{mode:n}=this.params;"scale"===n?t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}):(t.animate(s._line,{type:"to",to:{clipRange:0},duration:e,easing:i}),t.animate(s._symbolStart,{type:"to",to:{scaleX:0,scaleY:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._symbolEnd,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),t.animate(s._titleTop,{type:"to",to:{dy:s._titleTop.AABBBounds.height()+10},duration:e/2,easing:i}),t.animate(s._titleBottom,{type:"to",to:{dy:-(10+s._titleBottom.AABBBounds.height())},duration:e/2,easing:i}),t.animate(s._symbolStartOuter,{type:"to",to:{clipRange:0},duration:e/2,delay:e/2,easing:i}),t.animate(s._titleTopPanel,{type:"to",to:{scaleX:0},duration:e,easing:i}),t.animate(s._titleBottomPanel,{type:"to",to:{scaleX:0},duration:e,easing:i})),this.completeBind(t)}}class kD extends nb{onBind(){super.onBind();const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target,{wave:n}=this.params;if(q_(s,{scaleX:0,scaleY:0}),t.animate(s,{type:"to",to:{scaleX:1,scaleY:1},duration:e/3*2,easing:i}),s.titleShape&&t.animate(s.titleShape,{type:"custom",to:{text:s.titleShape.attribute.text},duration:e,easing:i,custom:xD}),s.contentShape&&t.animate(s.contentShape,{type:"custom",to:{text:s.contentShape.attribute.text},duration:e,easing:i,custom:xD}),n){const r=e/6;t.animate(s.group,{timeSlices:[{duration:r,effects:{type:"to",to:{angle:n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:-n},easing:i}},{duration:2*r,effects:{type:"to",to:{angle:n},easing:i}},{duration:r,effects:{type:"to",to:{angle:0},easing:i}}]})}this.completeBind(t)}}class CD extends nb{onBind(){super.onBind();const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,s=this.target;t.animate(s,{type:"to",to:{scaleX:0,scaleY:0},duration:e,easing:i}),this.completeBind(t)}}class TD extends rb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.webglCanvas=null,this.gl=null,this.program=null,this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}getDurationFromParent(){return this.duration||1e3}initWebGL(t){try{if(this.webglCanvas=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),!this.webglCanvas)return console.warn("WebGL canvas creation failed"),!1;this.webglCanvas.style.width=t.style.width||`${t.width}px`,this.webglCanvas.style.height=t.style.height||`${t.height}px`;let e=null;try{e=this.webglCanvas.getContext("webgl"),e||(e=this.webglCanvas.getContext("experimental-webgl"))}catch(t){console.warn("Failed to get WebGL context:",t)}if(this.gl=e,!this.gl)return console.warn("WebGL not supported"),!1;const i=this.getShaderSources();return this.program=this.createShaderProgram(i.vertex,i.fragment),null!==this.program}catch(t){return console.warn("Failed to initialize WebGL:",t),!1}}createShaderProgram(t,e){if(!this.gl)return null;const i=this.createShader(this.gl.VERTEX_SHADER,t),s=this.createShader(this.gl.FRAGMENT_SHADER,e);if(!i||!s)return null;const n=this.gl.createProgram();return n?(this.gl.attachShader(n,i),this.gl.attachShader(n,s),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error("Shader program link error:",this.gl.getProgramInfoLog(n)),null)):null}createShader(t,e){if(!this.gl)return null;const i=this.gl.createShader(t);return i?(this.gl.shaderSource(i,e),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)?i:(console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),this.gl.deleteShader(i),null)):null}setupWebGLState(t){this.gl&&this.webglCanvas&&(this.webglCanvas.width===t.width&&this.webglCanvas.height===t.height||(this.webglCanvas.width=t.width,this.webglCanvas.height=t.height),this.gl.viewport(0,0,this.webglCanvas.width,this.webglCanvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT))}createFullScreenQuad(){if(!this.gl)return null;const t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),e=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,e),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW),e}createTextureFromCanvas(t){if(!this.gl)return null;const e=this.gl.createTexture();return this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,t),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}setupVertexAttributes(){if(!this.gl||!this.program)return;const t=this.gl.getAttribLocation(this.program,"a_position"),e=this.gl.getAttribLocation(this.program,"a_texCoord");this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(e),this.gl.vertexAttribPointer(e,2,this.gl.FLOAT,!1,16,8)}createOutputCanvas(t){const e=b_.createCanvas({width:t.width,height:t.height,dpr:b_.devicePixelRatio}),i=e.getContext("2d");return i?(i.clearRect(0,0,t.width,t.height),i.drawImage(t,0,0),{canvas:e,ctx:i}):null}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==TD.prototype.applyCanvas2DEffect}release(){super.release(),this.gl&&(this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gl=null),this.webglCanvas&&(this.webglCanvas=null),this.currentAnimationRatio=0,this.animationTime=0}afterStageRender(t,e){let i=null;if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(i=this.applyWebGLEffect(e),i)return i;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(i=this.applyCanvas2DEffect(e),i)return i;console.warn("Canvas 2D特效执行失败")}return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class MD extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}}class wD extends TD{constructor(t,e,i,s,n){super(t,e,i,s,n)}getShaderSources(){return null}applyWebGLEffect(t){return null}applyCanvas2DEffect(t){return null}supportsWebGL(){return this.getShaderSources!==wD.prototype.getShaderSources&&null!==this.getShaderSources()}supportsCanvas2D(){return this.applyCanvas2DEffect!==wD.prototype.applyCanvas2DEffect}afterStageRender(t,e){var i,s;let n=null;if(!1!==(null===(s=null===(i=this.params)||void 0===i?void 0:i.options)||void 0===s?void 0:s.useWebGL)){if(this.supportsWebGL()&&(this.gl||this.initWebGL(e)||console.warn("WebGL初始化失败,尝试Canvas 2D回退"),this.gl)){if(n=this.applyWebGLEffect(e),n)return n;console.warn("WebGL特效执行失败,尝试Canvas 2D回退")}if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}}else if(this.supportsCanvas2D()){if(n=this.applyCanvas2DEffect(e),n)return n;console.warn("Canvas 2D特效执行失败")}else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);return this.supportsWebGL()||this.supportsCanvas2D()||console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`),e}}class ED{static createTempCanvas(t,e,i){return b_.createCanvas({width:t,height:e,dpr:i||b_.devicePixelRatio})}static cloneImageData(t){const e=new Uint8ClampedArray(t.data);return new ImageData(e,t.width,t.height)}static lerp(t,e,i){return t*(1-i)+e*i}static smoothstep(t,e,i){const s=Math.max(0,Math.min(1,(i-t)/(e-t)));return s*s*(3-2*s)}static distance(t,e,i,s){const n=i-t,r=s-e;return Math.sqrt(n*n+r*r)}static normalizeAngle(t){return(t+Math.PI)/(2*Math.PI)}static pixelNoise(t,e,i){if(i<=0)return 0;const s=Math.floor(t/i)*i,n=Math.floor(e/i)*i,r=43758.5453*Math.sin(12.9898*s+78.233*n);return r-Math.floor(r)}static generateNoiseTexture(t,e){const i=new Uint8Array(t*e);for(let t=0;t=0&&e<=2&&(r[t+e]=i[t+e]);return new ImageData(r,s,n)}static blendImageData(t,e,i){const{data:s,width:n,height:r}=t,{data:a}=e,o=new Uint8ClampedArray(s.length);for(let t=0;t 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return t;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return t;this.noiseData||(this.noiseData=ED.generateNoiseTexture(256,256));const i=this.gl.createTexture();this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,256,256,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,this.noiseData),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.REPEAT),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);const s=this.createFullScreenQuad();return s?(this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setUniforms(),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.deleteTexture(e),this.gl.deleteTexture(i),this.gl.deleteBuffer(s),this.webglCanvas):t}setUniforms(){if(!this.gl||!this.program||!this.webglCanvas)return;const t=this.gl.getUniformLocation(this.program,"u_texture"),e=this.gl.getUniformLocation(this.program,"u_noiseTexture"),i=this.gl.getUniformLocation(this.program,"u_time"),s=this.gl.getUniformLocation(this.program,"u_dissolveType"),n=this.gl.getUniformLocation(this.program,"u_resolution"),r=this.gl.getUniformLocation(this.program,"u_noiseScale"),a=this.gl.getUniformLocation(this.program,"u_fadeEdge");this.gl.uniform1i(t,0),this.gl.uniform1i(e,1),this.gl.uniform1f(i,this.currentAnimationRatio),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1f(r,this.dissolveConfig.noiseScale),this.gl.uniform1i(a,this.dissolveConfig.fadeEdge?1:0),this.gl.uniform1i(s,{outward:0,inward:1,radial:2,leftToRight:3,rightToLeft:4,topToBottom:5,bottomToTop:6}[this.dissolveConfig.dissolveType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return t;const{canvas:i,ctx:s}=e,n=s.getImageData(0,0,t.width,t.height),r=this.currentAnimationRatio;let a;switch(this.dissolveConfig.dissolveType){case"outward":a=this.applyOutwardDissolve(n,r);break;case"inward":a=this.applyInwardDissolve(n,r);break;case"radial":a=this.applyRadialDissolve(n,r);break;case"leftToRight":a=this.applyLeftToRightDissolve(n,r);break;case"rightToLeft":a=this.applyRightToLeftDissolve(n,r);break;case"topToBottom":a=this.applyTopToBottomDissolve(n,r);break;case"bottomToTop":a=this.applyBottomToTopDissolve(n,r);break;default:a=n}return s.putImageData(a,0,0),i}applyOutwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(ED.pixelNoise(i,t,h)-.5),p=d>u?0:1;else if(this.dissolveConfig.fadeEdge){const t=u-.15;p=du?0:1-(d-t)/(u-t)}else p=d>u?0:1;const g=4*(t*s+i);r[g+3]=Math.floor(r[g+3]*p)}return new ImageData(r,s,n)}applyInwardDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=s/2,o=n/2,l=Math.sqrt(a*a+o*o),h=this.dissolveConfig.noiseScale;for(let t=0;t0)u+=.4*(ED.pixelNoise(i,t,h)-.5),p=dt?1:(d-u)/(t-u)}else p=d0)d+=.3*(ED.pixelNoise(i,t,l)-.5),u=ct?1:(c-d)/(t-d)}else u=c0)o+=.3*(ED.pixelNoise(i,t,a)-.5),l=nt?1:(n-o)/(t-o)}else l=n0)o+=.3*(ED.pixelNoise(i,t,a)-.5),l=n>o?0:1;else if(this.dissolveConfig.fadeEdge){const t=o-.08;l=no?0:1-(n-t)/(o-t)}else l=n>o?0:1;const h=4*(t*s+i);r[h+3]=Math.floor(r[h+3]*l)}return new ImageData(r,s,n)}applyTopToBottomDissolve(t,e){const{data:i,width:s,height:n}=t,r=new Uint8ClampedArray(i.length);r.set(i);const a=this.dissolveConfig.noiseScale;for(let t=0;t0)l+=.3*(ED.pixelNoise(i,t,a)-.5),h=ot?1:(o-l)/(t-l)}else h=o0)l+=.3*(ED.pixelNoise(i,t,a)-.5),h=o>l?0:1;else if(this.dissolveConfig.fadeEdge){const t=l-.08;h=ol?0:1-(o-t)/(l-t)}else h=o>l?0:1;const c=4*(t*s+i);r[c+3]=Math.floor(r[c+3]*h)}return new ImageData(r,s,n)}}class RD extends wD{constructor(t,e,i,s,n){var r,a,o;super(t,e,i,s,n),this.distortionConfig={distortionType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.distortionType)||"wave",strength:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.strength)||.3,useWebGL:void 0===(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",fragment:"\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t);const e=this.createTextureFromCanvas(t);if(!e)return null;const i=this.createFullScreenQuad();if(!i)return this.gl.deleteTexture(e),null;try{return this.gl.useProgram(this.program),this.setupVertexAttributes(),this.setDistortionUniforms(),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.webglCanvas}finally{this.gl.deleteTexture(e),this.gl.deleteBuffer(i)}}setDistortionUniforms(){if(!this.gl||!this.program)return;const t=this.getAnimationTime(),e=this.gl.getUniformLocation(this.program,"u_time"),i=this.gl.getUniformLocation(this.program,"u_strength"),s=this.gl.getUniformLocation(this.program,"u_distortionType"),n=this.gl.getUniformLocation(this.program,"u_resolution");this.gl.uniform1f(e,t),this.gl.uniform1f(i,this.distortionConfig.strength),this.gl.uniform2f(n,this.webglCanvas.width,this.webglCanvas.height),this.gl.uniform1i(s,{wave:0,ripple:1,swirl:2}[this.distortionConfig.distortionType]||0)}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{ctx:i}=e;try{const s=i.getImageData(0,0,t.width,t.height),n=this.getAnimationTime();let r;switch(this.distortionConfig.distortionType){case"wave":r=this.applyWaveDistortion(s,this.distortionConfig.strength,n);break;case"ripple":r=this.applyRippleDistortion(s,this.distortionConfig.strength,n);break;case"swirl":r=this.applySwirlDistortion(s,this.distortionConfig.strength,n);break;default:r=s}return i.clearRect(0,0,t.width,t.height),i.putImageData(r,0,0),e.canvas}catch(t){return console.warn("Canvas 2D distortion effect failed:",t),null}}applyWaveDistortion(t,e,i){const{data:s,width:n,height:r}=t,a=new Uint8ClampedArray(s.length);for(let t=0;t=0&&c=0&&d=0&&f=0&&m=0&&g=0&&f0){const t=this.applyCSSFilter(e);if(t)return t}return super.afterStageRender(t,e)}}class DD extends wD{constructor(t,e,i,s,n){var r,a,o,l,h;super(t,e,i,s,n),this.particles=[],this.positionBuffer=null,this.colorBuffer=null,this.particleConfig={effectType:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.effectType)||"gravity",count:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.count)||4e3,size:(null===(o=null==n?void 0:n.options)||void 0===o?void 0:o.size)||20,strength:(null===(l=null==n?void 0:n.options)||void 0===l?void 0:l.strength)||1.5,useWebGL:void 0===(null===(h=null==n?void 0:n.options)||void 0===h?void 0:h.useWebGL)||n.options.useWebGL}}getShaderSources(){return{vertex:"\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",fragment:"\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "}}applyWebGLEffect(t){if(!this.gl||!this.program||!this.webglCanvas)return null;this.setupWebGLState(t),0===this.particles.length&&this.extractParticles(t),this.updateParticles(t);const e=this.gl;return e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.program),this.prepareAndDrawParticles(e),this.webglCanvas}applyCanvas2DEffect(t){const e=this.createOutputCanvas(t);if(!e)return null;const{canvas:i,ctx:s}=e,n=this.currentAnimationRatio;switch(this.particleConfig.effectType){case"explode":this.applyCanvas2DExplode(s,t,n);break;case"gravity":this.applyCanvas2DGravity(s,t,n);break;case"vortex":this.applyCanvas2DVortex(s,t,n);break;default:s.globalAlpha=Math.max(0,1-n),s.drawImage(t,0,0)}return i}extractParticles(t){const e=ED.createTempCanvas(t.width,t.height,1),i=e.getContext("2d");if(!i)return;i.drawImage(t,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height).data;this.particles=[];const n=Math.max(1,Math.floor(Math.sqrt(e.width*e.height/(1.5*this.particleConfig.count))));for(let i=0;i5){const s=r/e.width*t.width,n=i/e.height*t.height,c={x:s,y:n,originX:s,originY:n,vx:0,vy:0,r:a/255,g:o/255,b:l/255,a:Math.max(.6,h/255),life:1,size:this.particleConfig.size*(1+.5*Math.random())};this.particles.push(c)}}}updateParticles(t){const e=t.width/2,i=t.height/2,s=this.currentAnimationRatio,n=this.getDurationFromParent(),r=n<2e3,a=r?Math.max(1.5,3e3/n):1,o=r?Math.min(2,2e3/n):1;this.particles.forEach((n=>{const l=n.x-e,h=n.y-i,c=Math.sqrt(l*l+h*h),d=Math.atan2(h,l);this.applyParticleForces(n,d,c,s,o,t),this.updateParticleProperties(n,s,r,a,o)}))}applyParticleForces(t,e,i,s,n,r){const a=this.getAnimationTime();switch(this.particleConfig.effectType){case"explode":const o=s*this.particleConfig.strength*n*5;t.vx+=Math.cos(e)*o,t.vy+=Math.sin(e)*o;break;case"gravity":this.applyGravityEffect(t,s,n,r,a);break;case"vortex":this.applyVortexEffect(t,s,n,r,e,i)}}applyGravityEffect(t,e,i,s,n){const r=(t.originX+.7*t.originY)/(s.width+s.height)*.8;if(e>r){const s=(e-r)/(1-r),a=this.particleConfig.strength*s*s*12*i;t.vy+=a;const o=Math.sin(3*n+.02*t.originX)*Math.cos(2*n+.015*t.originY);t.vx+=o*this.particleConfig.strength*2*i}}applyVortexEffect(t,e,i,s,n,r){const a=s.width/2,o=s.height/2,l=n+e*Math.PI*.8,h=r+e*Math.max(s.width,s.height)*.7*1.8,c=a+Math.cos(l)*h,d=o+Math.sin(l)*h,u=e*this.particleConfig.strength*.08*i;t.vx+=(c-t.x)*u,t.vy+=(d-t.y)*u}updateParticleProperties(t,e,i,s,n){const r=i?.99:.98;if(t.vx*=r,t.vy*=r,t.x+=t.vx,t.y+=t.vy,i){const i=Math.max(.1,.5/s);t.life=Math.max(0,1-e*i),t.a=Math.max(.2,t.life*Math.min(1,1.2*t.a)),t.size=Math.max(.7*this.particleConfig.size,this.particleConfig.size*(.5+.5*t.life))}else t.life=Math.max(0,1-.2*e),t.a=Math.max(.1,t.life*Math.min(1,1.5*t.a)),t.size=Math.max(.5*this.particleConfig.size,this.particleConfig.size*(.3+.7*t.life))}prepareAndDrawParticles(t){const e=new Float32Array(2*this.particles.length),i=new Float32Array(4*this.particles.length),s=new Float32Array(this.particles.length);this.particles.forEach(((t,n)=>{e[2*n]=t.x,e[2*n+1]=t.y,i[4*n]=t.r,i[4*n+1]=t.g,i[4*n+2]=t.b,i[4*n+3]=Math.max(.1,t.a),s[n]=Math.max(6,1.5*t.size)})),this.updateParticleBuffers(t,e,i,s),this.setParticleUniforms(t),t.drawArrays(t.POINTS,0,this.particles.length),this.cleanupTempBuffers(t)}updateParticleBuffers(t,e,i,s){this.positionBuffer||(this.positionBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,e,t.DYNAMIC_DRAW);const n=t.getAttribLocation(this.program,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),this.colorBuffer||(this.colorBuffer=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.DYNAMIC_DRAW);const r=t.getAttribLocation(this.program,"a_color");t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.FLOAT,!1,0,0);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,s,t.DYNAMIC_DRAW);const o=t.getAttribLocation(this.program,"a_size");t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,0,0),this._tempSizeBuffer=a}setParticleUniforms(t){const e=t.getUniformLocation(this.program,"u_resolution"),i=t.getUniformLocation(this.program,"u_time"),s=t.getUniformLocation(this.program,"u_forceStrength"),n=t.getUniformLocation(this.program,"u_effectType");t.uniform2f(e,this.webglCanvas.width,this.webglCanvas.height),t.uniform1f(i,this.getAnimationTime()),t.uniform1f(s,this.particleConfig.strength),t.uniform1i(n,{explode:0,vortex:1,gravity:2}[this.particleConfig.effectType]||0)}cleanupTempBuffers(t){const e=this._tempSizeBuffer;e&&(t.deleteBuffer(e),delete this._tempSizeBuffer)}applyCanvas2DExplode(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n);const r=1+.5*i;t.scale(r,r),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}applyCanvas2DGravity(t,e,i){t.save(),t.globalAlpha=Math.max(0,1-i);const s=i*e.height*.3;t.drawImage(e,0,s),t.restore()}applyCanvas2DVortex(t,e,i){const s=e.width/2,n=e.height/2;t.save(),t.globalAlpha=Math.max(0,1-i),t.translate(s,n),t.rotate(i*Math.PI*2),t.translate(-s,-n),t.drawImage(e,0,0),t.restore()}}class FD extends TD{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.pixelationConfig={maxPixelSize:(null===(r=null==n?void 0:n.options)||void 0===r?void 0:r.maxPixelSize)||20,method:(null===(a=null==n?void 0:n.options)||void 0===a?void 0:a.method)||"out"}}applyDownsamplePixelation(t,e){if(e<=1)return t;const{width:i,height:s}=t,n=Math.ceil(i/e),r=Math.ceil(s/e),a=b_.createCanvas({width:n,height:r,dpr:1}),o=a.getContext("2d");if(!o)return t;const l=b_.createCanvas({width:i,height:s,dpr:b_.devicePixelRatio}),h=l.getContext("2d");return h?(o.imageSmoothingEnabled=!1,h.imageSmoothingEnabled=!1,o.drawImage(t,0,0,n,r),h.drawImage(a,0,0,i,s),l):t}updateAnimationProgress(){return"in"===this.pixelationConfig.method?this.pixelationConfig.maxPixelSize-this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1):1+this.currentAnimationRatio*(this.pixelationConfig.maxPixelSize-1)}afterStageRender(t,e){const i=this.updateAnimationProgress();return i<=1?e:this.applyDownsamplePixelation(e,i)}}class zD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.fadeInChars=!1,this.fadeInDuration=.3,this.strokeFirst=!1,this.strokeToFillRatio=.3,void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.fadeInChars)&&(this.fadeInChars=n.fadeInChars),void 0!==(null==n?void 0:n.fadeInDuration)&&(this.fadeInDuration=n.fadeInDuration),void 0!==(null==n?void 0:n.strokeFirst)&&(this.strokeFirst=n.strokeFirst),void 0!==(null==n?void 0:n.strokeToFillRatio)&&(this.strokeToFillRatio=n.strokeToFillRatio)}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=e.textConfig?[...e.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=t.textConfig&&t.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig)):this.valid=!1}onEnd(t){super.onEnd(t),t||this.target.setAttribute("textConfig",this.originalTextConfig)}onUpdate(t,e,i){if(!this.valid)return;const s=this.toTextConfig.length,n=this.fromTextConfig.length,r=this.fadeInChars?1-this.fadeInDuration:1;let a,o;if(n>s)a=Math.round(n-(n-s)*e);else if(this.fadeInChars){const t=Math.min(1,e/r);a=Math.round(n+(s-n)*t)}else a=Math.round(n+(s-n)*e);if(o=n>s?this.fromTextConfig.slice(0,a):this.toTextConfig.slice(0,a).map(((t,i)=>{if("text"in t){const n=Object.assign({},t);if(this.strokeFirst){const t=i/s*r,a=Math.max(0,e-t),o=1-t,l=Math.min(1,a/(this.strokeToFillRatio*o));if("fill"in n&&n.fill&&(n.stroke=n.fill,l<1&&(n.fillOpacity=l)),this.fadeInChars){const t=Math.min(1,a/(this.fadeInDuration*o));n.opacity=Math.max(0,Math.min(1,t))}}else if(this.fadeInChars){const t=(e-i/s*r)/this.fadeInDuration;n.opacity=Math.max(0,Math.min(1,t))}return n}return t})),this.showCursor&&a0){const t=o.length-1,e=o[t];if("text"in e)o[t]=Object.assign(Object.assign({},e),{text:String(e.text)+this.cursorChar});else{const t={text:this.cursorChar,fontSize:16};o.push(t)}}}$_(this.target,{textConfig:o})}}class HD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.showCursor=!1,this.cursorChar="|",this.blinkCursor=!0,this.beforeText="",this.afterText="",this.fadeOutChars=!1,this.fadeOutDuration=.3,this.direction="backward",void 0!==(null==n?void 0:n.showCursor)&&(this.showCursor=n.showCursor),void 0!==(null==n?void 0:n.cursorChar)&&(this.cursorChar=n.cursorChar),void 0!==(null==n?void 0:n.blinkCursor)&&(this.blinkCursor=n.blinkCursor),void 0!==(null==n?void 0:n.beforeText)&&(this.beforeText=n.beforeText),void 0!==(null==n?void 0:n.afterText)&&(this.afterText=n.afterText),void 0!==(null==n?void 0:n.fadeOutChars)&&(this.fadeOutChars=n.fadeOutChars),void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.direction)&&(this.direction=n.direction),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[]):this.valid=!1}onEnd(t){super.onEnd(t),t||(this.toTextConfig.length>0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromTextConfig.length,n=this.fadeOutChars?1-this.fadeOutDuration:1;let r;if("forward"===this.direction){if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t="forward"===this.direction?this.fromTextConfig.slice(s-r):this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}else{if(this.fadeOutChars){const t=Math.min(1,e/n);r=Math.round(s*(1-t))}else r=Math.round(s*(1-e));let t=this.fromTextConfig.slice(0,r);this.fadeOutChars&&(t=this.applyFadeEffect(t,e,s,r)),this.showCursor&&r>0&&(t=this.addCursor(t,e)),$_(this.target,{textConfig:t})}}applyFadeEffect(t,e,i,s){const n=(e-(1-this.fadeOutDuration))/this.fadeOutDuration,r=Math.max(0,1-Math.min(1,n));return t.map(((e,i)=>{if("forward"===this.direction){if(0===i&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r})}else if(i===t.length-1&&"text"in e)return Object.assign(Object.assign({},e),{opacity:r});return e}))}addCursor(t,e){let i=!0;if(this.blinkCursor){const t=.1;i=Math.floor(e/t)%2==0}if(i&&t.length>0){const e="forward"===this.direction?0:t.length-1,i=t[e];if("text"in i){const s=[...t];return"forward"===this.direction?s[e]=Object.assign(Object.assign({},i),{text:this.cursorChar+String(i.text)}):s[e]=Object.assign(Object.assign({},i),{text:String(i.text)+this.cursorChar}),s}}return t}}class jD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.fromTextConfig=[],this.toTextConfig=[],this.originalTextConfig=[],this.singleCharConfig=[],this.fadeOutDuration=.3,this.slideDirection="right",this.slideDistance=30,this.wordByWord=!1,this.wordRegex=/[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g,this.wordGroups=[],this.reverseOrder=!1,void 0!==(null==n?void 0:n.fadeOutDuration)&&(this.fadeOutDuration=n.fadeOutDuration),void 0!==(null==n?void 0:n.slideDirection)&&(this.slideDirection=n.slideDirection),void 0!==(null==n?void 0:n.slideDistance)&&(this.slideDistance=n.slideDistance),void 0!==(null==n?void 0:n.wordByWord)&&(this.wordByWord=n.wordByWord),void 0!==(null==n?void 0:n.wordRegex)&&(this.wordRegex=n.wordRegex),void 0!==(null==n?void 0:n.reverseOrder)&&(this.reverseOrder=n.reverseOrder),this.propKeys=["textConfig"]}onFirstRun(){const t=this.getLastProps(),e=this.getEndProps();this.originalTextConfig=t.textConfig?[...t.textConfig]:[],this.valid=!0,this.originalTextConfig&&0!==this.originalTextConfig.length?(this.fromTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.toTextConfig=e.textConfig&&e.textConfig.length>0?Hg.TransformTextConfig2SingleCharacter(e.textConfig):[],this.singleCharConfig=this.fromTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:1,dx:0,dy:0}):Object.assign(Object.assign({},t),{opacity:1}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.fromTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.target.setAttribute("textConfig",this.toTextConfig):this.target.setAttribute("textConfig",[]))}onUpdate(t,e,i){if(!this.valid)return;const s=1-this.fadeOutDuration;let n;n=this.wordByWord&&this.wordGroups.length>0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n0?Hg.TransformTextConfig2SingleCharacter(t.textConfig):[],this.toTextConfig=Hg.TransformTextConfig2SingleCharacter(this.originalTextConfig),this.singleCharConfig=this.toTextConfig.map((t=>"text"in t?Object.assign(Object.assign({},t),{opacity:0,dx:this.getInitialDx(),dy:this.getInitialDy()}):Object.assign(Object.assign({},t),{opacity:0}))),this.wordByWord&&this.calculateWordGroups()):this.valid=!1}calculateWordGroups(){this.wordGroups=[];let t="";const e={};let i,s=0;for((this.toTextConfig.forEach(((i,n)=>{if("text"in i){const r=String(i.text);t+=r,e[s]=n,s++}})),this.wordRegex.lastIndex=0);null!==(i=this.wordRegex.exec(t));){const t=i.index,s=i.index+i[0].length,n=[];for(let i=t;i0&&this.wordGroups.push(n)}const n=new Set;this.wordGroups.forEach((t=>{t.forEach((t=>n.add(t)))}));for(let t=0;t0?this.updateByWord(e,s):this.updateByCharacter(e,s),$_(this.target,{textConfig:n})}updateByWord(t,e){const i=this.wordGroups.length,s=[...this.singleCharConfig];for(let n=0;n{n[t]=e[t]+(i[t]-e[t])*s})),n}function WD(t,e){X_(t,e),t.addUpdatePositionTag(),t.addUpdateShapeAndBoundsTag()}class GD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d;super.onBind();const u=this.target.getFinalAttribute(),p=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",g=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,f=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0,m={opacity:f,baseOpacity:f},v={opacity:1,baseOpacity:1};"top"===p?(m.y=(null!==(n=u.y)&&void 0!==n?n:0)-g,v.y=null!==(r=u.y)&&void 0!==r?r:0,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===p?(m.y=(null!==(a=u.y)&&void 0!==a?a:0)+g,v.y=null!==(o=u.y)&&void 0!==o?o:0,this.propKeys=["opacity","baseOpacity","y"]):"left"===p?(m.x=(null!==(l=u.x)&&void 0!==l?l:0)-g,v.x=null!==(h=u.x)&&void 0!==h?h:0,this.propKeys=["opacity","baseOpacity","x"]):(m.x=(null!==(c=u.x)&&void 0!==c?c:0)+g,v.x=null!==(d=u.x)&&void 0!==d?d:0,this.propKeys=["opacity","baseOpacity","x"]),this.from=m,this.to=v,this.props=v,q_(this.target,m)}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class YD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a;super.onBind();const o=this.target.getFinalAttribute(),l=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,h=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",c=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:0,d={opacity:c,baseOpacity:c},u={opacity:1,baseOpacity:1};this.propKeys=["opacity","baseOpacity"],"x"!==h&&"xy"!==h||(d.scaleX=l,u.scaleX=null!==(r=o.scaleX)&&void 0!==r?r:1,this.propKeys.push("scaleX")),"y"!==h&&"xy"!==h||(d.scaleY=l,u.scaleY=null!==(a=o.scaleY)&&void 0!==a?a:1,this.propKeys.push("scaleY")),this.from=d,this.to=u,this.props=u,q_(this.target,d)}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class XD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l;super.onBind();const h=this.target.getFinalAttribute(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,d=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,u=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:0,p={opacity:u,baseOpacity:u,angle:c,scaleX:d,scaleY:d},g={opacity:1,baseOpacity:1,angle:null!==(a=h.angle)&&void 0!==a?a:0,scaleX:null!==(o=h.scaleX)&&void 0!==o?o:1,scaleY:null!==(l=h.scaleY)&&void 0!==l?l:1};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=p,this.to=g,this.props=g,q_(this.target,p)}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class KD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onBind(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v;if(super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const y=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,_=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",b=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,x=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,S=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g,A=null!==(m=null===(f=this.params)||void 0===f?void 0:f.fillOpacity)&&void 0!==m?m:0;this.from={lineDash:[x,x],lineDashOffset:x,lineWidth:y,stroke:_,strokeOpacity:b},this.to={lineDash:[x,x],lineDashOffset:0,lineWidth:y,stroke:_,strokeOpacity:b},S?(this.from.fillOpacity=A,this.to.fillOpacity=null!==(v=this.originalAttributes.fillOpacity)&&void 0!==v?v:1):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}onEnd(){var t;if(super.onEnd(),!(null===(t=this.params)||void 0===t?void 0:t.showFill)){const t=Object.assign({},this.originalAttributes);t.fillOpacity=0,this.target.setAttributes(t)}}}class $D extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.perimeter=0,this.originalAttributes={}}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;if(this.originalAttributes=Object.assign({},this.target.getAttributes()),"rect"===this.target.type){const i=this.target.attribute,s=null!==(t=i.width)&&void 0!==t?t:100,n=null!==(e=i.height)&&void 0!==e?e:100;this.perimeter=2*(s+n)}else if("circle"===this.target.type){const t=null!==(i=this.target.attribute.radius)&&void 0!==i?i:50;this.perimeter=2*Math.PI*t}else if("ellipse"===this.target.type){const t=this.target.attribute,e=null!==(s=t.radiusX)&&void 0!==s?s:50,i=null!==(n=t.radiusY)&&void 0!==n?n:50;this.perimeter=2*Math.PI*Math.sqrt((e*e+i*i)/2)}else this.perimeter=1e3;const m=null!==(a=null===(r=this.params)||void 0===r?void 0:r.lineWidth)&&void 0!==a?a:2,v=null!==(l=null===(o=this.params)||void 0===o?void 0:o.strokeColor)&&void 0!==l?l:"black",y=null!==(c=null===(h=this.params)||void 0===h?void 0:h.fromOpacity)&&void 0!==c?c:1,_=null!==(u=null===(d=this.params)||void 0===d?void 0:d.dashLength)&&void 0!==u?u:this.perimeter,b=null!==(g=null===(p=this.params)||void 0===p?void 0:p.showFill)&&void 0!==g&&g;this.from={lineDash:[_,_],lineDashOffset:0,lineWidth:m,stroke:v,strokeOpacity:y},this.to={lineDash:[_,_],lineDashOffset:-_,lineWidth:m,stroke:v,strokeOpacity:y},b?(this.from.fillOpacity=null!==(f=this.originalAttributes.fillOpacity)&&void 0!==f?f:1,this.to.fillOpacity=0):(this.from.fillOpacity=0,this.to.fillOpacity=0),this.propKeys=["lineDash","lineDashOffset","lineWidth","stroke","strokeOpacity","fillOpacity"],this.props=this.to,q_(this.target,this.from)}onUpdate(t,e,i){var s;const n={lineDashOffset:this.from.lineDashOffset+(this.to.lineDashOffset-this.from.lineDashOffset)*e};(null===(s=this.params)||void 0===s?void 0:s.showFill)&&(n.fillOpacity=this.from.fillOpacity+(this.to.fillOpacity-this.from.fillOpacity)*e),$_(this.target,n)}}class qD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.growInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:GD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:YD,customParameters:{fromScale:(null===(n=this.params)||void 0===n?void 0:n.fromScale)||.5,direction:(null===(r=this.params)||void 0===r?void 0:r.scaleDirection)||"xy",fromOpacity:1},duration:this.growInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class ZD extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.slideInDuration=i*a,this.spinInDuration=i*(1-a)}onBind(){var t,e,i,s,n,r;super.onBind();const a=new w_(this.target);a.execute({type:"custom",custom:GD,customParameters:{direction:(null===(t=this.params)||void 0===t?void 0:t.slideDirection)||"right",distance:(null===(e=this.params)||void 0===e?void 0:e.slideDistance)||50,fromOpacity:null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:0},duration:this.slideInDuration,easing:this.easing}),a.execute({type:"custom",custom:XD,customParameters:{fromAngle:(null===(n=this.params)||void 0===n?void 0:n.fromAngle)||Math.PI,fromScale:(null===(r=this.params)||void 0===r?void 0:r.fromScale)||.5,fromOpacity:1},duration:this.spinInDuration,easing:this.easing,delay:this.slideInDuration})}onUpdate(t,e,i){}}class JD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.target.getAttributes(),f=(null===(t=this.params)||void 0===t?void 0:t.direction)||"right",m=(null===(e=this.params)||void 0===e?void 0:e.distance)||50,v=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromOpacity)&&void 0!==s?s:1,y=null!==(r=null===(n=this.params)||void 0===n?void 0:n.toOpacity)&&void 0!==r?r:0,_={opacity:v,baseOpacity:v},b={opacity:y,baseOpacity:y};"top"===f?(_.y=null!==(a=g.y)&&void 0!==a?a:0,b.y=(null!==(o=g.y)&&void 0!==o?o:0)-m,this.propKeys=["opacity","baseOpacity","y"]):"bottom"===f?(_.y=null!==(l=g.y)&&void 0!==l?l:0,b.y=(null!==(h=g.y)&&void 0!==h?h:0)+m,this.propKeys=["opacity","baseOpacity","y"]):"left"===f?(_.x=null!==(c=g.x)&&void 0!==c?c:0,b.x=(null!==(d=g.x)&&void 0!==d?d:0)-m,this.propKeys=["opacity","baseOpacity","x"]):(_.x=null!==(u=g.x)&&void 0!==u?u:0,b.x=(null!==(p=g.x)&&void 0!==p?p:0)+m,this.propKeys=["opacity","baseOpacity","x"]),this.from=_,this.to=b,this.props=b}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class QD extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l;const h=this.target.getAttributes(),c=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromScale)&&void 0!==e?e:0,d=(null===(i=this.params)||void 0===i?void 0:i.direction)||"xy",u=null!==(n=null===(s=this.params)||void 0===s?void 0:s.fromOpacity)&&void 0!==n?n:1,p=null!==(a=null===(r=this.params)||void 0===r?void 0:r.toOpacity)&&void 0!==a?a:0,g={opacity:u,baseOpacity:u},f={opacity:p,baseOpacity:p};this.propKeys=["opacity","baseOpacity"],"x"!==d&&"xy"!==d||(g.scaleX=null!==(o=h.scaleX)&&void 0!==o?o:1,f.scaleX=c,this.propKeys.push("scaleX")),"y"!==d&&"xy"!==d||(g.scaleY=null!==(l=h.scaleY)&&void 0!==l?l:1,f.scaleY=c,this.propKeys.push("scaleY")),this.from=g,this.to=f,this.props=f}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class tF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onFirstRun(){var t,e,i,s,n,r,a,o,l,h,c;const d=this.target.getAttributes(),u=null!==(e=null===(t=this.params)||void 0===t?void 0:t.fromAngle)&&void 0!==e?e:2*Math.PI,p=null!==(s=null===(i=this.params)||void 0===i?void 0:i.fromScale)&&void 0!==s?s:0,g=null!==(r=null===(n=this.params)||void 0===n?void 0:n.fromOpacity)&&void 0!==r?r:1,f=null!==(o=null===(a=this.params)||void 0===a?void 0:a.toOpacity)&&void 0!==o?o:0,m={opacity:g,baseOpacity:g,angle:null!==(l=d.angle)&&void 0!==l?l:0,scaleX:null!==(h=d.scaleX)&&void 0!==h?h:1,scaleY:null!==(c=d.scaleY)&&void 0!==c?c:1},v={opacity:f,baseOpacity:f,angle:u,scaleX:p,scaleY:p};this.propKeys=["opacity","baseOpacity","angle","scaleX","scaleY"],this.from=m,this.to=v,this.props=v}onUpdate(t,e,i){WD(this.target,VD(this.propKeys,this.from,this.to,e))}}class eF extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.growOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:QD,customParameters:{fromScale:(null===(t=this.params)||void 0===t?void 0:t.fromScale)||.5,direction:(null===(e=this.params)||void 0===e?void 0:e.scaleDirection)||"xy",fromOpacity:1,toOpacity:1},duration:this.growOutDuration,easing:this.easing}),n.execute({type:"custom",custom:JD,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.growOutDuration})}onUpdate(t,e,i){}}class iF extends sb{constructor(t,e,i,s,n){var r;super(t,e,i,s,n);const a=null!==(r=null==n?void 0:n.slideRatio)&&void 0!==r?r:.5;this.spinOutDuration=i*(1-a),this.slideOutDuration=i*a}onFirstRun(){var t,e,i,s;const n=new w_(this.target);n.execute({type:"custom",custom:tF,customParameters:{fromAngle:(null===(t=this.params)||void 0===t?void 0:t.fromAngle)||Math.PI,fromScale:(null===(e=this.params)||void 0===e?void 0:e.fromScale)||.5,fromOpacity:1,toOpacity:1},duration:this.spinOutDuration,easing:this.easing}),n.execute({type:"custom",custom:JD,customParameters:{direction:(null===(i=this.params)||void 0===i?void 0:i.slideDirection)||"right",distance:(null===(s=this.params)||void 0===s?void 0:s.slideDistance)||50,fromOpacity:1},duration:this.slideOutDuration,easing:this.easing,delay:this.spinOutDuration})}onUpdate(t,e,i){}}class sF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.originalAttributes={},this.pulseCount=3,this.pulseOpacity=.3,this.pulseScale=1.05,this.pulseColor=null,this.pulseColorIntensity=.2,this.strokeOnly=!1,this.fillOnly=!1,this.useScale=!0,this.useOpacity=!0,this.useStroke=!0,this.useFill=!0,this.useColor=!1,this.originalFill=null,this.originalStroke=null,void 0!==(null==n?void 0:n.pulseCount)&&(this.pulseCount=n.pulseCount),void 0!==(null==n?void 0:n.pulseScale)&&(this.pulseScale=n.pulseScale),void 0!==(null==n?void 0:n.pulseColor)&&(this.pulseColor=n.pulseColor),void 0!==(null==n?void 0:n.pulseColorIntensity)&&(this.pulseColorIntensity=n.pulseColorIntensity),void 0!==(null==n?void 0:n.strokeOnly)&&(this.strokeOnly=n.strokeOnly),void 0!==(null==n?void 0:n.fillOnly)&&(this.fillOnly=n.fillOnly),void 0!==(null==n?void 0:n.useScale)&&(this.useScale=n.useScale),void 0!==(null==n?void 0:n.useOpacity)&&(this.useOpacity=n.useOpacity),void 0!==(null==n?void 0:n.useStroke)&&(this.useStroke=n.useStroke),void 0!==(null==n?void 0:n.useFill)&&(this.useFill=n.useFill),void 0!==(null==n?void 0:n.useColor)&&(this.useColor=n.useColor)}onBind(){super.onBind(),this.originalAttributes=Object.assign({},this.target.getAttributes()),this.useColor&&(this.originalFill=this.originalAttributes.fill||null,this.originalStroke=this.originalAttributes.stroke||null,this.pulseColor||(this.fillOnly&&this.originalFill?this.pulseColor=this.originalFill:this.strokeOnly&&this.originalStroke?this.pulseColor=this.originalStroke:this.originalFill?this.pulseColor=this.originalFill:this.originalStroke?this.pulseColor=this.originalStroke:this.pulseColor="#FFFFFF"))}onUpdate(t,e,i){const s=e*Math.PI*this.pulseCount,n=Math.abs(Math.sin(s)),r={};if(this.useOpacity){const t=1+(this.pulseOpacity-1)*n;this.useStroke&&(r.strokeOpacity=(this.originalAttributes.strokeOpacity||1)*t),this.useFill&&(r.fillOpacity=(this.originalAttributes.fillOpacity||1)*t)}if(this.useScale){const t=1+(this.pulseScale-1)*n;r.scaleX=(this.originalAttributes.scaleX||1)*t,r.scaleY=(this.originalAttributes.scaleY||1)*t}this.useColor&&this.pulseColor&&this.applyColorPulse(r,n),X_(this.target,r),this.target.addUpdateShapeAndBoundsTag(),this.target.addUpdatePositionTag()}applyColorPulse(t,e){const i=this.pulseColorIntensity*e;this.useFill&&this.originalFill&&this.pulseColor&&(t.fill=Ru(this.originalFill,this.pulseColor,i,!0)),this.useStroke&&this.originalStroke&&this.pulseColor&&(t.stroke=Ru(this.originalStroke,this.pulseColor,i,!0))}onEnd(){super.onEnd(),this.target.setAttributes(this.originalAttributes)}}class nF extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=oh.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Al,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=oh.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:_o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Fo(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=Fo(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;ei(t))),s.clear()}function dF(t){var e,i;const s=null!==(e=m_().getAll(Cy))&&void 0!==e?e:[],n=hF(t.registry.renderer,"vrender:legacy-renderer"),r=new Set;cF(t.registry.renderer,"vrender:legacy-renderer",null===(i=t.registry.renderer.unregister)||void 0===i?void 0:i.bind(t.registry.renderer)),s.forEach((e=>{var i;const s=lF(e,"vrender:legacy-renderer");r.has(s)||(r.add(s),null===(i=null==e?void 0:e.reInit)||void 0===i||i.call(e),t.registry.renderer.register(s,e),n.add(s))}))}function uF(t,e){var i,s;const n=null!==(i=m_().getAll(e))&&void 0!==i?i:[],r=hF(t.registry.picker,"vrender:legacy-picker"),a=new Set;cF(t.registry.picker,"vrender:legacy-picker",null===(s=t.registry.picker.unregister)||void 0===s?void 0:s.bind(t.registry.picker)),n.forEach((e=>{const i=lF(e,"vrender:legacy-picker");a.has(i)||(a.add(i),t.registry.picker.register(i,e),r.add(i))}))}const pF=vL,gF=yL,fF={taro:{installEnv:function(t,e){mL(t,"taro",{bindEnv:xO,bindCanvasModules:zR,bindWindowContribution:_O},e)},loadEnv:SO},feishu:{installEnv:function(t,e){mL(t,"feishu",{bindEnv:RI,bindCanvasModules:TR,bindWindowContribution:vI},e)},loadEnv:II},tt:{installEnv:function(t,e){mL(t,"tt",{bindEnv:wO,bindCanvasModules:NR,bindWindowContribution:kO},e)},loadEnv:EO},wx:{installEnv:function(t,e){mL(t,"wx",{bindEnv:FO,bindCanvasModules:WR,bindWindowContribution:IO},e)},loadEnv:zO},lynx:{installEnv:function(t,e){mL(t,"lynx",{bindEnv:dO,bindCanvasModules:RR,bindWindowContribution:tO},e)},loadEnv:uO},harmony:{installEnv:function(t,e){mL(t,"harmony",{bindEnv:KI,bindCanvasModules:ER,bindWindowContribution:zI},e)},loadEnv:$I}},mF=[nC,eC,S_,k_,uA,gA],vF=[()=>{w_.registerBuiltInAnimate("increaseCount",hD),w_.registerBuiltInAnimate("fromTo",ab),w_.registerBuiltInAnimate("scaleIn",pD),w_.registerBuiltInAnimate("scaleOut",gD),w_.registerBuiltInAnimate("growHeightIn",NL),w_.registerBuiltInAnimate("growHeightOut",UL),w_.registerBuiltInAnimate("growWidthIn",nD),w_.registerBuiltInAnimate("growWidthOut",rD),w_.registerBuiltInAnimate("growCenterIn",zL),w_.registerBuiltInAnimate("growCenterOut",HL),w_.registerBuiltInAnimate("clipIn",BL),w_.registerBuiltInAnimate("clipOut",PL),w_.registerBuiltInAnimate("fadeIn",RL),w_.registerBuiltInAnimate("fadeOut",IL),w_.registerBuiltInAnimate("growPointsIn",GL),w_.registerBuiltInAnimate("growPointsOut",YL),w_.registerBuiltInAnimate("growPointsXIn",KL),w_.registerBuiltInAnimate("growPointsXOut",$L),w_.registerBuiltInAnimate("growPointsYIn",ZL),w_.registerBuiltInAnimate("growPointsYOut",JL),w_.registerBuiltInAnimate("growAngleIn",DL),w_.registerBuiltInAnimate("growAngleOut",FL),w_.registerBuiltInAnimate("growRadiusIn",eD),w_.registerBuiltInAnimate("growRadiusOut",iD),w_.registerBuiltInAnimate("moveIn",oD),w_.registerBuiltInAnimate("moveOut",lD),w_.registerBuiltInAnimate("rotateIn",dD),w_.registerBuiltInAnimate("rotateOut",uD),w_.registerBuiltInAnimate("update",yD),w_.registerBuiltInAnimate("state",fD),w_.registerBuiltInAnimate("labelItemAppear",SD),w_.registerBuiltInAnimate("labelItemDisappear",AD),w_.registerBuiltInAnimate("poptipAppear",kD),w_.registerBuiltInAnimate("poptipDisappear",CD),w_.registerBuiltInAnimate("inputText",xD),w_.registerBuiltInAnimate("inputRichText",zD),w_.registerBuiltInAnimate("outputRichText",HD),w_.registerBuiltInAnimate("slideRichText",ND),w_.registerBuiltInAnimate("slideOutRichText",jD),w_.registerBuiltInAnimate("slideIn",GD),w_.registerBuiltInAnimate("growIn",YD),w_.registerBuiltInAnimate("spinIn",XD),w_.registerBuiltInAnimate("moveScaleIn",qD),w_.registerBuiltInAnimate("moveRotateIn",ZD),w_.registerBuiltInAnimate("strokeIn",KD),w_.registerBuiltInAnimate("slideOut",JD),w_.registerBuiltInAnimate("growOut",QD),w_.registerBuiltInAnimate("spinOut",tF),w_.registerBuiltInAnimate("moveScaleOut",eF),w_.registerBuiltInAnimate("moveRotateOut",iF),w_.registerBuiltInAnimate("strokeOut",$D),w_.registerBuiltInAnimate("pulse",sF),w_.registerBuiltInAnimate("MotionPath",UD),w_.registerBuiltInAnimate("streamLight",nF),w_.registerBuiltInAnimate("dissolve",PD),w_.registerBuiltInAnimate("grayscale",LD),w_.registerBuiltInAnimate("distortion",RD),w_.registerBuiltInAnimate("particle",DD),w_.registerBuiltInAnimate("glitch",OD),w_.registerBuiltInAnimate("gaussianBlur",ID),w_.registerBuiltInAnimate("pixelation",FD)},fb],yF=[gC,bC,wC,AL,FC,cL,HC,XC,iT,cT,yT,AT,IT,zT,YT,KT,iM,cM,ML,CL];function _F(){mF.forEach((t=>t())),vF.forEach((t=>t()))}function bF(t,e){if(!oF(t,"node"))return t;const i=function(t){return null!=t?t:"node"===(null==b_?void 0:b_.env)?b_.envParams:void 0}(e);return void 0===i?yL(t):gF(t,i),_L(t),xL(t),vO(),yF.forEach((t=>t())),dF(t),uF(t,AS),_F(),t}function xF(t,e,i){if(!oF(t,e))return t;const s=fF[e];return s.installEnv(t,i),_L(t),function(t){xL(t)}(t),s.loadEnv(),yF.forEach((t=>t())),dF(t),uF(t,AS),_F(),t}const SF=Symbol.for("visactor.vrender.sharedAppRegistry");function AF(){var t;const e=globalThis,i=null!==(t=e[SF])&&void 0!==t?t:new Map;return e[SF]=i,i}function kF(t,e){const i=AF(),s=i.get(t);if(s||!e)return s;const n=new Map;return i.set(t,n),n}function CF(t,e,i){i.released||(i.released=!0,i.refCount=0,function(t,e,i){const s=AF(),n=s.get(t);(null==n?void 0:n.get(e))===i&&(n.delete(e),n.size||s.delete(t))}(t,e,i),i.releaseApp())}function TF(t,e,i,s=t){var n;const r=null!==(n=e.key)&&void 0!==n?n:"default",a=kF(t,!0);let o=a.get(r);return(null==o?void 0:o.app.released)&&(CF(t,r,o),o=void 0),o||(o=function(t,e,i,s){const n=s(i),r=n.release.bind(n),a={app:n,refCount:0,released:!1,releaseApp:r};return n.release=()=>CF(t,e,a),a}(t,r,e,i),a.set(r,o)),o.refCount+=1,function(t,e,i,s){let n=!1;return{app:s.app,env:e,key:i,release(){if(n)return;n=!0;const e=kF(t,!1);(null==e?void 0:e.get(i))!==s||s.released||(s.refCount-=1,s.refCount<=0&&CF(t,i,s))}}}(t,s,r,o)}const MF=$A,wF=[];function EF(t){wF.forEach((({module:e,options:i})=>{MF(e,Object.assign(Object.assign({},i),{app:t}))}))}var BF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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())),dF(t),uF(t,eA),_F(),t):t}(bA(BF(t,["envParams"])),e);return EF(i),i}var RF=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,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{switch(e){case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony";case t.RenderModeEnum.lynx:return"lynx";default:return"browser"}},HF={lynx:["pixelRatio","lynx","runtime","canvasFactory"],harmony:["pixelRatio","harmony","runtime","canvasFactory"]},jF=(t,e)=>{const i=zF(t),s=HF[i];if(!s)return e;if(null==(n=e)||"object"!=typeof n&&"function"!=typeof n)return;var n;const r={};return s.forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),Object.keys(r).length?r:void 0},NF=(t,e)=>{const i=TF((s=Object.assign({env:t},void 0===e?{}:{envParams:e})).env,s,FF,s.env);var s;return{app:i.app,releaseAppRef:()=>i.release()}},UF="poptipForText";class VF{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._isExternalStage=!1,this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}_dedupeStagePlugin(t){var e;const i=null===(e=this._stage)||void 0===e?void 0:e.pluginService;if(!(null==i?void 0:i.findPluginsByName))return;const s=i.findPluginsByName(t);if(s.length<=1)return;const n=s[0];i.uninstall?(i.uninstall(t),i.register(n)):s.slice(1).forEach((t=>{i.unRegister(t)}))}_dedupePoptipPlugin(){var t;(null===(t=this._option.pluginList)||void 0===t?void 0:t.includes(UF))&&this._dedupeStagePlugin(UF)}initView(){var e,i,s,n,r;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:a,dpr:o,mode:l,modeParams:h,gestureConfig:c,interactive:d,clickInterval:u,autoPreventDefault:f,background:m}=this._option,v=jF(l,h);b_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(l),null!=v?v:{});const y=this._option.stage;if(this._isExternalStage=!!y,this._releaseVRenderAppRef=void 0,this._stage=y,!this._stage){const t=((t,e)=>{const i=((t,e)=>{return!t||(i=t)&&"function"==typeof i.createStage?{app:t,mode:e}:t;var i})(t,e);if(i.app)return{app:i.app};const s=zF(i.mode),n=jF(i.mode,i.modeParams);return NF(s,n)})({app:this._option.app,mode:l,modeParams:h});this._releaseVRenderAppRef=t.releaseAppRef,null===(e=this._option.runtimePluginInstallers)||void 0===e||e.forEach((e=>e(t.app)));try{this._stage=(_=t.app,b=Object.assign({background:m,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:o,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:f},ReactDOM:this._option.ReactDOM,autoRefresh:p(a)?a:!p(o)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{}),_.createStage(b))}catch(t){throw null===(r=this._releaseVRenderAppRef)||void 0===r||r.call(this),this._releaseVRenderAppRef=void 0,t}}var _,b;this._dedupePoptipPlugin(),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const x=tg({x:0,y:0,width:this._width,height:this._height});x.name="root",this._stage.defaultLayer.appendChild(x),this._rootGroup=x;const S=(p(c)?c:bM(l))&&!1!==d&&bB.getStageEventPlugin("gesture");S&&(this._gestureController=new S(this._stage,g(c)?c:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==d&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=cR.before}_isGeoRegionRoamDragEnabled(){var t,e;const i=null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getSpec)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.region;return!!_(s)&&s.some((t=>{var e;return!("geo"!==(null==t?void 0:t.coordinate)||!t.roam)&&(!0===t.roam||(null===(e=t.roam.drag)||void 0===e||e))}))}_shouldDisableCanvasTouchAction(){if(!_M(this._option.mode))return!1;return!1===(p(this._option.supportsTouchEvents)?this._option.supportsTouchEvents:b_.supportsTouchEvents)&&this._isGeoRegionRoamDragEnabled()}_setCanvasStyle(){if(this._stage&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block",t.style.touchAction=this._shouldDisableCanvasTouchAction()?"none":"")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),this._setCanvasStyle(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>gR(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>gR(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{gR(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;let e=this._hasCommitedMark();const i=this._layoutState===cR.before;(e||i)&&(pM(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),e&&this._rootMarks.forEach((t=>{t.render()})),i&&(this._layoutState=cR.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=cR.reevaluate,e=this._hasCommitedMark(),e&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),e&&(this.findProgressiveMarks(),this.updateStateAnimation()),this._doRender(!0),e&&this.doPreProgressive(),pM(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=fR(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=mR(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=mR(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=uR(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=uR(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>function(t){return"function"==typeof t&&/^class\s/.test(t.toString())}(t.callBack)?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:vR,customParameters:{callBack:t.callBack}}))):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{gR(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===lR.appear))?lR.appear:e.every((t=>t===lR.disappear))?lR.disappear:lR.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===VP.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=LP(e);if(null==i?void 0:i.context)return i;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=LP(i.parent),i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:FP(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===VP.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===VP.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===VP.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===VP.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===VP.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){const t=this._stage,e=this._rootGroup,i=!!t&&!this._isExternalStage,s=this._releaseVRenderAppRef;this.clearNextRender(),this.releaseEvent(),this.releaseGrammar(!0),t&&(i?t.release():e&&(t.defaultLayer.removeChild(e,!0),e.release())),null==s||s(),this._stage=null,this._rootGroup=null,this._isExternalStage=!1,this._releaseVRenderAppRef=void 0,this._option=this._container=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{gR(t,(t=>{t.removeProduct(!0)}),null,!0)})):this._cachedMarks=fR(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return _M(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){var t;this._stage&&(t=this._stage,new Promise((t=>{b_.getRequestAnimationFrame()((()=>{t(null)}))})).then((()=>{const e=[];return t.getChildren().forEach((t=>{var i;(null===(i=t.subLayers)||void 0===i?void 0:i.size)&&t.subLayers.forEach((t=>{const i=t.drawContribution;(null==i?void 0:i.hooks)&&i.rendering&&e.push(new Promise((t=>{i.hooks.completeDraw.tap("outWait",(()=>{i.hooks.completeDraw.taps=i.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),t(null)}))})))}))})),Promise.all(e)}))).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{gR(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function WF(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:fM)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}const GF={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}},YF={poptip:H({},GF)};function XF(t){t.crosshair=Y(t.crosshair||{}).map((e=>fB({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function KF(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}=li(l,i.width,i.height);a=t,o=e}else if(h&&_M(e.mode)){let t;t=y(h)?b_.getElementById(h):h;const{width:e,height:s}=li(t,i.width,i.height);a=e,o=s}else if(xM(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}}const $F=["remake","compile","render","layout","data","scaleDomain","series","component","animation","localOnly"];function qF(t){const e=t.effects;return!(!(null==e?void 0:e.localOnly)||t.reMake||t.reCompile||t.reRender||t.reSize||e.remake||e.compile||e.render||e.layout||e.data||e.scaleDomain||e.series||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function ZF(t){const e=t.effects;return!(!(null==e?void 0:e.component)||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.scaleDomain||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}function JF(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),function(t,...e){e.forEach((e=>{const i=null==e?void 0:e.effects;if(!i)return;t.effects||(t.effects={});const s=t.effects;$F.forEach((t=>{i[t]&&(s[t]=s[t]||i[t])}))}))}(t,...e),t}function QF(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}var tz,ez,iz,sz,nz,rz;t.LayoutZIndex=void 0,(tz=t.LayoutZIndex||(t.LayoutZIndex={}))[tz.SeriesGroup=0]="SeriesGroup",tz[tz.Axis_Grid=50]="Axis_Grid",tz[tz.CrossHair_Grid=100]="CrossHair_Grid",tz[tz.Region=450]="Region",tz[tz.Mark=300]="Mark",tz[tz.Node=400]="Node",tz[tz.Axis=100]="Axis",tz[tz.MarkLine=500]="MarkLine",tz[tz.MarkArea=100]="MarkArea",tz[tz.MarkPoint=500]="MarkPoint",tz[tz.DataZoom=500]="DataZoom",tz[tz.ScrollBar=500]="ScrollBar",tz[tz.Player=500]="Player",tz[tz.Legend=500]="Legend",tz[tz.CrossHair=500]="CrossHair",tz[tz.Indicator=500]="Indicator",tz[tz.Title=500]="Title",tz[tz.Label=500]="Label",tz[tz.Brush=500]="Brush",tz[tz.CustomMark=500]="CustomMark",tz[tz.Interaction=700]="Interaction",t.LayoutLevel=void 0,(ez=t.LayoutLevel||(t.LayoutLevel={}))[ez.Indicator=10]="Indicator",ez[ez.Region=20]="Region",ez[ez.Axis=30]="Axis",ez[ez.DataZoom=40]="DataZoom",ez[ez.Player=40]="Player",ez[ez.ScrollBar=40]="ScrollBar",ez[ez.Legend=50]="Legend",ez[ez.Title=70]="Title",ez[ez.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(iz=t.AttributeLevel||(t.AttributeLevel={}))[iz.Default=0]="Default",iz[iz.Theme=1]="Theme",iz[iz.Chart=2]="Chart",iz[iz.Base_Series=3]="Base_Series",iz[iz.Series=4]="Series",iz[iz.Mark=5]="Mark",iz[iz.User_Chart=6]="User_Chart",iz[iz.User_Series=7]="User_Series",iz[iz.User_Mark=8]="User_Mark",iz[iz.User_SeriesStyle=9]="User_SeriesStyle",iz[iz.Built_In=99]="Built_In";class az{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,H({},az.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]))))}}az.defaultMarkInfo={};class oz{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class lz{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=>fB({},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 hz extends oz{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=lz,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new az,this._lastLayoutRect=null,this.id=AM(),this.userId=t.id,this._spec=t,this.effect={},this.event=new HP(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${WB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=bB.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class cz{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}get lastComputeRect(){return this._lastComputeRect}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},this._minWidth=null,this._maxWidth=null,this._minHeight=null,this._maxHeight=null,this._lastComputeRect=null,this._lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0},this.getLayoutRect=()=>this._layoutRect,this.layoutType="normal",this._layoutOrient="left",this.layoutPaddingLeft=0,this.layoutPaddingTop=0,this.layoutPaddingRight=0,this.layoutPaddingBottom=0,this.layoutOffsetX=0,this.layoutOffsetY=0,this.layoutLevel=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=tB(iB(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:QE(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:QE(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:QE(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:QE(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:QE(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:QE(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=QE(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=QE(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=QE(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(eB(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class dz extends hz{constructor(){super(...arguments),this.layoutType="normal",this.layoutLevel=0,this.layoutZIndex=0,this._forceLayoutTag=!1,this._layout=null,this._orient=null,this._layoutRect={width:0,height:0},this._layoutStartPos={x:0,y:0},this._isLayout=!0,this.getGraphicBounds=()=>this._layout?{x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}:{x1:0,x2:0,y1:0,y2:0},this._transformLayoutRect=null,this._transformLayoutPosition=null,this._transformLayoutPadding=null}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new cz(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=H(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=H(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 uz extends lz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class pz extends dz{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=uz,this.modelType="region",this.specKey="region",this.type=pz.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()}))},this.getBoundsInRect=()=>({x1:this._layout.getLayoutStartPoint().x,y1:this._layout.getLayoutStartPoint().y,x2:this._layout.getLayoutStartPoint().x+this._layout.getLayoutRect().width,y2:this._layout.getLayoutStartPoint().y+this._layout.getLayoutRect().height}),this.userId=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function gz(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 fz(t,e,i){e?t.forEach((t=>{const e=X(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=X(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 mz(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 vz(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=xz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),mz(d,!0,p,l),s&&fz(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function yz(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=xz(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=xz(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),mz(d,!1,p,o),s&&fz(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function bz(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=xz(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=xz(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=gz(t);n.length&&vz(n,e,i,!1,"left",s),r.length&&vz(r,e,i,!0,"left",s),a.length&&yz(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=gz(t);n.length&&_z(n,e,i,!1,"top",s),r.length&&_z(r,e,i,!0,"top",s),a.length&&bz(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=gz(t);n.length&&vz(n,e,i,!1,"right",s),r.length&&vz(r,e,i,!0,"right",s),a.length&&yz(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=gz(t);n.length&&_z(n,e,i,!1,"bottom",s),r.length&&_z(r,e,i,!0,"bottom",s),a.length&&bz(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=xz(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{V(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=xz(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+c-l})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:fM)("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}}}Sz.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(sz||(sz={})),t.STATE_VALUE_ENUM=void 0,(nz=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",nz.STATE_HOVER="hover",nz.STATE_HOVER_REVERSE="hover_reverse",nz.STATE_DIMENSION_HOVER="dimension_hover",nz.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",nz.STATE_SELECTED="selected",nz.STATE_SELECTED_REVERSE="selected_reverse",nz.STATE_SANKEY_EMPHASIS="selected",nz.STATE_SANKEY_EMPHASIS_REVERSE="blur",nz.STATE_HIGHLIGHT="highlight",nz.STATE_BLUR="blur",nz.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(rz||(rz={}));const Az=["linear","radial","conical"],kz={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const Cz={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{Cz[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class Tz extends oz{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(H(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class Mz extends Tz{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,dR.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!Cz[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(WB)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(WB))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Iw(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class wz extends oz{constructor(){super(...arguments),this.id=AM(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=bB.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class Ez extends wz{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(t){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const Bz=1e3,Pz="quadInOut",Rz=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Iz=(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=Ru(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Oz=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ak(t):[],n=ak(e);i&&s&&(i.fromTransform&&ok(s,i.fromTransform.clone().getInverse()),ok(s,i.toTransfrom));const[r,a]=rk(s,n);return t?nk(r,a,10,Math.PI):a.map(((t,e)=>({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Dz=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Fz=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Dz.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Bu.Get(t,Eu.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class zz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Oz(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Iz(this.otherAttrs,i,e),t&&this.saveOnEnd?this.target.setAttributes(i):$_(this.target,i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Hz=(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=Lz(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Fz(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new zz({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Bz,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Pz);return c.play(d),c};class jz extends sb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Oz(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&&Iz(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Nz=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Rz.includes(t))(i)||(e[i]=t[i])})),e},Uz=(t,e,i)=>{const s=Nz(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=oh.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Vz=(t,e,i)=>{const s=[],n=i?null:Nz(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Nz(t.attribute);if("rect"===t.type)ck(t,e).forEach((t=>{s.push(oh.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)dk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)uk(t,e).forEach((t=>{s.push(oh.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=fk(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(oh.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?bk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?gk(t,e).forEach((t=>{s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&xk(t,e).forEach((t=>{"path"in t?s.push(oh.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(oh.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Uz(t,s,e),s},Gz=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,Yz=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=Gz(l.delay,n,a,o),d=Gz(l.duration,n,a,o),u=Gz(l.oneByOne,n,a,o),p=Gz(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Vz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Wz)(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);Hz(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Vz:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Wz)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Lz(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Fz(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:_o.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new zz({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Bz,null!==(l=i.easing)&&void 0!==l?l:Pz))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:_o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jz({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Bz,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Pz))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Hz(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},Xz=(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))))},Kz=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}},$z=(t,e,i)=>{var s;if(t.setStates)return void t.setStates(e,{animate:i,animateSameStatePatchChange:!0});const n=null!=e?e:[];((t,e)=>{const i=null!=t?t:[];return i.length===e.length&&i.every(((t,i)=>t===e[i]))})(t.currentStates,n)?null===(s=t.invalidateResolver)||void 0===s||s.call(t):n.length?t.useStates(n,i):t.clearStates(i)},qz=(t,e,i=!0,s)=>{var n;if(!e)return;const r=i&&null!==(n=t.currentStates)&&void 0!==n?n:[],a=i?Array.from(new Set([...r,e])):[e];$z(t,a,s)},Zz=(t,e,i)=>{var s;const n=(t=>Array.isArray(t)?t:t?[t]:[])(e);if(!n.length)return;const r=(null!==(s=t.currentStates)&&void 0!==s?s:[]).filter((t=>!n.includes(t)));$z(t,r,i)},Jz=Symbol("statesClearedBeforeReInit");class Qz extends wz{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new Ez(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=tg("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(t){this._product&&this._product.parent&&this._product.parent.removeChild(this._product,t),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._sharedStateDefinitionRefIds=new WeakMap,this._sharedStateDefinitionRefId=0,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Al)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{var i,s,n;const r=t.context.diffState===sz.enter||t.context.diffState===sz.update?t.context.states:void 0,a=!!((null===(i=t.currentStates)||void 0===i?void 0:i.length)||(null===(s=t.effectiveStates)||void 0===s?void 0:s.length)||t.resolvedStatePatch||(null===(n=t.registeredActiveScopes)||void 0===n?void 0:n.size));((null==r?void 0:r.length)||a)&&$z(t,r,e)},this.name=e,this.model=i.model,this.key=i.key,this.state=new Mz(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&fB(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Ow(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=YE(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):Az.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Ow(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},kz[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=si.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)Az.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=FE(DE(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return uR(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return bB.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[$B],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=uR(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===lR.appear))?lR.appear:t.every((t=>t===lR.disappear))?lR.disappear:t[0];return null!=e?e:lR.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{Kz(t),s.push(...t.getGraphics())})),e.forEach((t=>{Kz(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);Yz([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=Xz(e,n),r=Xz(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;if("update"===e&&!this._hasDiffAttrs(t))return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===lR.exit?lR.exit:i===lR.update?lR.update:lR.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===sz.exit&&(t.context.reusing=!0,t.stopAnimates())}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===sz.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=sz.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=sz.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=sz.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=lR.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=lR.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return pR(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=pR(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_getSharedStateDefinitionRefId(t){if("object"!=typeof t&&"function"!=typeof t||null===t)return`${t}`;const e=t;let i=this._sharedStateDefinitionRefIds.get(e);return i||(i=++this._sharedStateDefinitionRefId,this._sharedStateDefinitionRefIds.set(e,i)),`ref:${i}`}_getSharedStateDefinitionValueKey(t){try{const e=JSON.stringify(t);return null!=e?e:`${t}`}catch(e){return this._getSharedStateDefinitionRefId(t)}}_isStaticSharedStateAttribute(t,e){var i,s;const n=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];if(!n||n.referer||d(n.postProcess)||e in this._computeExChannel)return!1;const r=n.style;return!d(r)&&(!Az.includes(null==r?void 0:r.gradient)&&(!["outerBorder","innerBorder"].includes(e)&&!Ow(null===(s=null==r?void 0:r.scale)||void 0===s?void 0:s.type)))}_applySharedStateDefinitions(){var t;if(!this._product)return;const e=Object.keys(null!==(t=this._encoderOfState)&&void 0!==t?t:{}).filter((t=>"group"!==t&&"update"!==t));if(!e.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const i=this._stateSort?e.slice().sort(this._stateSort):e,s=new Map;i.forEach(((t,e)=>{s.set(t,e)}));const n={},r=[];if(e.forEach((t=>{var e;const i=this._encoderOfState[t],a={},o={},l=[],h=[];if(Object.keys(null!=i?i:{}).forEach((e=>{this._isStaticSharedStateAttribute(t,e)?(a[e]=this._computeAttribute(e,t)(void 0),l.push(e)):(o[e]=i[e],h.push(e))})),!l.length&&!h.length)return;const c={priority:null!==(e=s.get(t))&&void 0!==e?e:0};l.length&&(c.patch=a),h.length&&(c.declaredAffectedKeys=h,c.resolver=({graphic:t})=>this._runEncoderOfGraphic(o,t)),n[t]=c,r.push([t,c.priority,l.sort().map((t=>`${t}:${this._getSharedStateDefinitionValueKey(a[t])}`)),h.sort().map((e=>{var i;const s=null===(i=this.stateStyle[t])||void 0===i?void 0:i[e];return`${e}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.style)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.postProcess)}:${this._getSharedStateDefinitionRefId(null==s?void 0:s.referer)}`}))].join("|"))})),!r.length)return void(void 0!==this._product.sharedStateDefinitions&&(this._product.sharedStateDefinitions=void 0));const a=r.sort().join("||");a===this._sharedStateDefinitionsCacheKey&&this._sharedStateDefinitionsCache?this._product.sharedStateDefinitions!==this._sharedStateDefinitionsCache&&(this._product.sharedStateDefinitions=this._sharedStateDefinitionsCache):(this._sharedStateDefinitionsCacheKey=a,this._sharedStateDefinitionsCache=n,this._product.sharedStateDefinitions=n)}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach((t=>{var e;const i=this._runEncoderOfGraphic(null===(e=this._encoderOfState)||void 0===e?void 0:e.update,t);u(this._markConfig.interactive)||(i.pickable=this._markConfig.interactive);const n=this._transformGraphicAttributes(t,i,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=n}))}_excludeStateControlledDiffAttrs(t,e){if(!e||!Object.keys(e).length||!t.resolvedStatePatch)return e;let i;return Object.keys(t.resolvedStatePatch).forEach((t=>{t in e&&(i||(i=Object.assign({},e)),delete i[t])})),null!=i?i:e}_hasDiffAttrs(t){return!!t.context.diffAttrs&&Object.keys(t.context.diffAttrs).length>0}_commitPreventedAnimationStaticAttrs(t,e){var i,s;if(!e||!Object.keys(e).length)return;const n=t;null===(i=n.setFinalAttributes)||void 0===i||i.call(n,e),n._commitAnimationStaticAttributes?n._commitAnimationStaticAttributes(e):null===(s=n.commitInternalBaseAttributes)||void 0===s||s.call(n,e)}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r;const a=i.context.finalAttrs,o=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=this._excludeStateControlledDiffAttrs(i,zP(i,a));i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes(a),i.context.reusing=!1):o||(e?(i.setAttributesAndPreventAnimate(t),this._commitPreventedAnimationStaticAttrs(i,t)):i.setAttributes(t)),!(null===(r=this.renderContext)||void 0===r?void 0:r.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i)}else{const e=i;(i=this._createGraphic(a)).context=e.context,i.context.diffAttrs=a,i.stateSort=this._stateSort;const r=this._graphics===t?s:s+this._graphics.length-t.length;if(r>=0&&(this._graphics[r]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,o),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=bB.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=bB.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState(),this._applySharedStateDefinitions();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===cR.before||(this._product||this._initProduct(),pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{const s=i,n=s[Jz],r=null==n?void 0:n.includes(t),a=!r&&this.hasAnimationByState("state");if("in"===this.state.checkOneState(i,i.context.data,e)?qz(i,t,!0,a):Zz(i,t,a),r){const e=n.filter((e=>e!==t));e.length?s[Jz]=e:delete s[Jz]}}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===sz.exit&&!e.isExiting)if(e.context.animationState===sz.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{e.context.diffState===sz.exit&&e.isExiting&&this._graphicMap.get(i)===e&&t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:sz.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=tg({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{var e;(null===(e=t.currentStates)||void 0===e?void 0:e.length)&&(t[Jz]=t.currentStates.slice())}))}}var tH;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(tH||(tH={}));class eH extends Qz{constructor(){super(...arguments),this.type=eH.type,this._marks=[],this._diffState=sz.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(gM("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?(gM("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return gR(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.finalAttrs=i,this._product.context.diffState===sz.update){const t=this.hasAnimation(),e=zP(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?(this._product.setAttributesAndPreventAnimate(e),this._commitPreventedAnimationStaticAttrs(this._product,e)):this._product.setAttributes(e))}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=sz.update}render(){this._isCommited&&(pM(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct(!0)}}eH.type="group";const iH={measureText:VB};class sH{static instance(){return sH.instance_||(sH.instance_=new sH),sH.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 nH{constructor(){this.id=AM(),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))?gM("不要重复添加相同的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 rH extends nH{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const aH=(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"},oH=(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 lH extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=Za.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=Za.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||aH(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=oH(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=Za.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=oH(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=aH(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerleave",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Za.now()-i>this.config.press.time&&oH(s[0],t){oh.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class cH extends hH{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 C=oh.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 T,M;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},M={startAngle:x}):(T={endAngle:x},M={endAngle:x+2*Math.PI}),super("in"===b?T:M,"in"===b?M:T,i,s,{group:null==n?void 0:n.group,clipGraphic:C})}}class dH extends hH{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=oh.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 uH extends sb{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){var t,e,i,s,n;super.onBind();const r=this.target.attribute,a=null!==(t=this.from)&&void 0!==t?t:{},o=null!==(e=this.to)&&void 0!==e?e:{},l=null!==(i=this.target.context)&&void 0!==i?i:{},h=null!==(s=l.finalAttrs)&&void 0!==s?s:{},c=null!==(n=l.diffAttrs)&&void 0!==n?n:{},d=this.target.getFinalAttribute();this.from={},this.to={},Object.prototype.hasOwnProperty.call(a,"points")?this.from.points=a.points:Object.prototype.hasOwnProperty.call(r,"points")&&(this.from.points=r.points),Object.prototype.hasOwnProperty.call(a,"segments")?this.from.segments=a.segments:Object.prototype.hasOwnProperty.call(r,"segments")&&(this.from.segments=r.segments),Object.prototype.hasOwnProperty.call(o,"points")?this.to.points=o.points:Object.prototype.hasOwnProperty.call(h,"points")?this.to.points=h.points:Object.prototype.hasOwnProperty.call(c,"points")?this.to.points=c.points:d&&Object.prototype.hasOwnProperty.call(d,"points")&&(this.to.points=d.points),Object.prototype.hasOwnProperty.call(o,"segments")?this.to.segments=o.segments:Object.prototype.hasOwnProperty.call(h,"segments")?this.to.segments=h.segments:Object.prototype.hasOwnProperty.call(c,"segments")?this.to.segments=c.segments:d&&Object.prototype.hasOwnProperty.call(d,"segments")&&(this.to.segments=d.segments),this.props=this.to;const u=this.getPoints(this.from),p=this.getPoints(this.to,!0);this.fromPoints=u?Array.isArray(u)?u:[u]:[],this.toPoints=p?Array.isArray(p)?p:[p]:[];const g=new Map;this.fromPoints.forEach((t=>{t.context&&g.set(t.context,t)}));let f,m,v=1/0,y=-1/0;for(let t=0;t=0;t-=1)if(g.has(this.toPoints[t].context)){y=t,m=g.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(y)?(this.clipRange=this.toPoints[y][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[y][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=yt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let _=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=g.get(t.context);return i?(_=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ey&&m?[m,t]:[_,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onEnd(t){t?super.onEnd(t):(this.to&&M_(this.target,Object.keys(this.to),this.animate,this.to),super.onEnd())}applyPointTransientAttributes(t){const e={};Object.keys(t).forEach((i=>{this.animate.validAttr(i)&&(e[i]=t[i])})),Object.keys(e).length&&(X_(this.target,e),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}onUpdate(t,e,i){if(t)this.applyPointTransientAttributes(this.to);else{if(this.points=this.points.map(((t,i)=>{const s=_h(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));$_(this.target,{clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.applyPointTransientAttributes({segments:e})}else this.applyPointTransientAttributes({points:this.points})}}}const pH={type:"fadeIn"};function gH(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 pH;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const fH={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},mH={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},vH={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},yH=()=>{bB.registerAnimation("scaleInOut",(()=>mH))},_H=()=>{bB.registerAnimation("fadeInOut",(()=>vH))},bH=(t,e)=>({appear:gH(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:uH,duration:fH.update.duration,easing:fH.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),xH=()=>{bB.registerAnimation("line",bH)},SH=()=>{w_.registerBuiltInAnimate("growPointsIn",GL),w_.registerBuiltInAnimate("growPointsOut",YL),w_.registerBuiltInAnimate("growPointsXIn",KL),w_.registerBuiltInAnimate("growPointsXOut",$L),w_.registerBuiltInAnimate("growPointsYIn",ZL),w_.registerBuiltInAnimate("growPointsYOut",JL),w_.registerBuiltInAnimate("clipIn",BL),w_.registerBuiltInAnimate("clipOut",PL)},AH=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class kH{constructor(t){this._markSet=new az,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e))}}const CH={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class TH extends kH{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},CH,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Zz(t,[this.options.highlightState,this.options.blurState]):this.resetAll(e)}}TH.type="element-highlight",TH.defaultOptions=CH;const MH=()=>{bB.registerInteractionTrigger(TH.type,TH)},wH={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class EH extends kH{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},wH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),qz(t,i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&Zz(t,[this.options.state,this.options.reverseState]):this.resetAll(e)}}EH.type="element-select",EH.defaultOptions=wH;const BH=()=>{bB.registerInteractionTrigger(EH.type,EH)};class PH extends nH{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const RH=(t,e=!0)=>{var i,s,n,r,a;const o=t.parent;null===(i=t.release)||void 0===i||i.call(t,!0),null===(n=(s=t).removeAllChild)||void 0===n||n.call(s,!0),e&&(null===(a=null!==(r=t.parent)&&void 0!==r?r:o)||void 0===a||a.removeChild(t,!0))},IH=t=>{var e,i;const s=[t];return null===(i=(e=t).forEachChildren)||void 0===i||i.call(e,(t=>{s.push(...IH(t))})),s},OH=(t,e={})=>{var i,s;const{enableExitAnimation:n=!0,removeFromParent:r=!0,onComplete:a}=e;return!(!n||!(null===(s=(i=t).releaseWithExitAnimation)||void 0===s?void 0:s.call(i,{removeFromParent:r,onComplete:a})))||(RH(t,r),!1)};class LH{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>bB.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>bB.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>bB.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return bB.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>bB.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){bB.registerTransform(t,e)}static registerFunction(t,e){t&&e&&sH.instance().registerFunction(t,e)}static unregisterFunction(t){t&&sH.instance().unregisterFunction(t)}static getFunction(t){return t?sH.instance().getFunction(t):null}static getFunctionList(){return sH.instance().getFunctionNameList()}static registerMap(t,e,i){const s=bB.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=bB.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,ZP.get(e);var e}static registerSVG(t,e,i){const s=bB.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=bB.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){LB.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=AM(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=yR.render,this._disableDimensionHoverEvent=!1,this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;if(this._isReleased)return;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(n.theme,this._spec.theme)?V(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=JF(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{var n;if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?bB.getSeriesBuiltInTheme(e):bB.getComponentBuiltInTheme(e);i=i?fB({},s,i[e]):s}s===t.length-1&&p(i)&&(i=HB({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e],(null===(n=this.getFunctionList())||void 0===n?void 0:n.length)&&(i=NB(i,this)))})),this._cachedProcessedTheme[e]=i,i},Bw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=_M(v);if(S?fI(iA):"node"===v&&vO(iA),S&&f&&(this._container=y(f)?b_.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=DB.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[],k=[];if(!1!==b){const t=bB.getRuntimePluginInstaller("poptipForText");t&&(t(),k.push(t)),A.push("poptipForText")}"sankey"===i.type&&A.push("scrollbar");const C=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(C),(null===(o=this._option)||void 0===o?void 0:o.onError)&&C.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._compiler=new VF({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A,runtimePluginInstallers:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new KP(this,this._compiler),this._event=new HP(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),LB.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=fB({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=jB(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;LH.getFunctionList()&&LH.getFunctionList().length&&(t=NB(t,LH)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=bB.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=bB.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=bB.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.observe(this._container))}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}getCurrentSize(){var t,e,i,s;return KF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:GB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:YB})}_initDataSet(t){this._dataSet=t instanceof Fa?t:new Fa,qP(this._dataSet,"dataview",Oa),qP(this._dataSet,"array",s),$P(this._dataSet,"copyDataView",sR);for(const t in bB.transforms)$P(this._dataSet,t,bB.transforms[t]);for(const t in bB.dataParser)qP(this._dataSet,t,bB.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t,i.morphConfig),qF(t)?this:e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t,e.morphConfig),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;const h=t.reMake&&!!this._chart;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(!1),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake){const t=this.isAnimationEnable()&&!1!==(null==e?void 0:e.morph);null===(n=this._compiler)||void 0===n||n.releaseGrammar(!t),h&&this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)}))}else t.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this}));if(t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?lR.none:lR.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,this._forceReleaseExitingVRenderComponents(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._cachedProcessedTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,LB.unregisterInstance(this)}_registerExitingVRenderComponent(t){var e;this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,this._exitingVRenderComponents.add(t)}_unregisterExitingVRenderComponent(t){var e;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t)}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{RH(t)})),this._exitingVRenderComponents.clear())}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._isReleased?this:(this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this))}updateFullDataSync(t,e=!0,i){if(this._isReleased)return this;if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof za?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=rR(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?fB({},t[n][e.index],i):i):t[n]=s?fB({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?fB({},t[n][r],i):i)}else t.id===e&&(t[n]=s?fB({},t[n],i):i)}))}(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=fB({},t.getSpec(),e));const r=t.updateSpec(e),a=qF(r),o=ZF(r);return a||(t.reInit(e),!o&&(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow()),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i,this),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=xB({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=FB(this._currentThemeName),this._currentTheme=o(a,l);else{const t=xB({},FB(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),FB(n),FB(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),H(YF.poptip,GF,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!_M(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return FB(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!DB.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield WF(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(!_M(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(){this._chart&&this._compiler&&!this._isReleased&&(this._chart.resetLayoutItemTag(),this._chart.setLayoutTag(!0,null,!1),this._compiler.render(),this._chart.onEvaluateEnd())}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)?b_.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?sB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 gM("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?sB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(gM("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return sH.instance().getFunction(t)}registerFunction(t,e){t&&e&&sH.instance().registerFunction(t,e)}unregisterFunction(t){t&&sH.instance().unregisterFunction(t)}getFunctionList(){return sH.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=bB.getChartPlugins();t.length>0&&(this._chartPlugin=new rH(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=bB.getVChartPlugins();e.length>0&&(this._vChartPlugin=new PH(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=yR.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){var t,e;!this._isReleased&&this._compiler&&(this._renderState=yR.render,null===(e=null===(t=this.getStage())||void 0===t?void 0:t.eventSystem)||void 0===e||e.resumeTriggerEvent())}}LH.InstanceManager=LB,LH.ThemeManager=DB,LH.globalConfig={uniqueTooltip:!0},LH.Utils=iH,LH.vglobal=b_;bB.registerRegion("region",pz),bB.registerLayout("base",Sz),KT(),HC(),bB.registerMark(eH.type,eH),bB.registerStageEventPlugin("gesture",lH),MH(),BH(),BB(cB.name,cB);const DH="monotone",FH="linear",zH="bevel";t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));class HH{constructor(){this.released=!1,this.currentTime=-1}tick(t,e){this.currentTime<0&&(this.currentTime=0),this.currentTime+=t,e(this)}release(){this.released=!0}getTime(){return this.currentTime}tickTo(t,e){this.currentTime<0&&(this.currentTime=0);const i=t-this.currentTime;this.tick(i,e)}}function jH(t,e){return e("component",t)}function NH(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=bB.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const UH=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},VH=(t,e)=>{var i;const s=null===(i=e.from)||void 0===i?void 0:i.call(e);if(!s)return t;const n=(r=e.fields,d(r)?r():r);var r;const a=e.key,o=e.values,l=e.default,h=e.as||[n],c=s.reduce((function(t,e){return e[n]&&t.set(`${e[n]}`,e),t}),new Map);let g;if(d(e.set))g=function(t){const i=c.get(`${t[a]}`);e.set(t,i)};else if(o){const t=o.length;g=function(e){const i=c.get(`${e[a]}`);if(u(i))for(let i=0;i(g(t),t)))},WH=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},GH=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=NH(void 0,s,t,e);i&&r&&(n=i(...r))}return n},YH=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const XH=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function KH(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=qH(GH(h,r,a,c),d,g),o.value=qH(GH(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=GH(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function $H(t,e,i,s,n,r,a){if(d(e)){KH(t,e(n,a),i,s,r,a)}else e&&KH(t,e,i,s,r,a)}const qH=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=yi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class ZH{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{$H(a,t,e,i,s,n,r)})):d(t)?$H(a,t,e,i,s,n,r):t&&KH(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:GH(r.visible,t,n),value:qH(GH(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:GH(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=GH(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&XH(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const JH={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?K(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?K(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},QH=(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=vP([],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 tj(a,n,o)},tj=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{kM(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=>{kM(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=JH[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},ej=(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=>{kM(t[e])||(t[e]=0)}))})),t},ij=`${WB}_HIERARCHY_DEPTH`,sj=`${WB}_HIERARCHY_ROOT`,nj=`${WB}_HIERARCHY_ROOT_INDEX`;function rj(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function aj(t,e,i){t&&(i.needDefaultSeriesField&&(t[qB]=i.defaultSeriesField),t[KB]=e,t[$B]=i.getKey(t,e,i))}function oj(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function lj(t,e,i,s=0,n,r){void 0===r&&(r=e),aj(t,e,i),t[ij]=s,t[sj]=n||t[i.categoryField],t[nj]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>lj(e,s,i,t[ij]+1,t[sj],r)))}const hj={label:{name:"label",type:"text"}},cj=`${WB}_rect_x`,dj=`${WB}_rect_x1`,uj=`${WB}_rect_y`,pj=`${WB}_rect_y1`,gj={data:!0},fj={animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},mj=[...Object.keys(fH),"normal"];function vj(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 Sj(n)&&delete n.type,n.oneByOne&&(n=_j(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bj,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=fB({},o[e],a);return Sj(n)&&delete n.type,n.oneByOne&&(n=_j(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bj,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function yj(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=L(t,null,i),Aj(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function _j(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):k(n)?n:0,h=d(r)?r(t,i,a):k(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):k(n)?n:0,c=d(a)?a(t,r,o):k(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function bj(t,e){var i;return null!==(i=null==t?void 0:t[KB])&&void 0!==i?i:e.context.graphicIndex}function xj(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 Sj(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function Aj(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),Aj(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),Aj(t[s],e,i))}function kj(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class Cj extends lz{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=IE(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=bB.getSeriesMarkMap(o)?function(t,e,i){const s=bB.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=fB({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return fB({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=fB({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>fB({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}const Tj=Object.keys({xField:!0,yField:!0,invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0}).reduce(((t,e)=>(fj[e]||(t[e]=!0),t)),{}),Mj={compileOnlyKeys:fj,dataRelatedKeys:Tj,seriesOnlyKeys:{tooltip:!0}},wj={interactive:!0,zIndex:!0,visible:!0,style:!0,state:!0,stateSort:!0,customShape:!0},Ej=t=>(t=>g(t)&&!_(t)&&!d(t))(t)?t:u(t)?{}:null,Bj=(t,e,i)=>{const s=Ej(t),n=Ej(e);if(!s||!n)return!1;let r=!1;const a=Array.from(new Set([...Object.keys(n),...Object.keys(s)]));for(const t of a)if(!V(s[t],n[t])){if(!i[t])return!1;r=!0}return r};function Pj(t,e=!1){t.effects=Object.assign(Object.assign({},t.effects),{series:!0,compile:!0,layout:!0,render:!0}),e&&(t.effects.data=!0,t.effects.scaleDomain=!0)}class Rj extends hz{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${WB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Cj,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=kj(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&($P(this._rawData.dataSet,"invalidTravel",ej),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=rR(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=nR(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=nR(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new Ez(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=K(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=tj(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=H(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){$P(this._dataSet,"dimensionStatistics",QH);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new za(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&&vP(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){$P(this._dataSet,"dimensionStatistics",QH);const s=new za(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=vP(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&vP(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new za(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)&&($P(this._rawData.dataSet,"addVChartProperty",WH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:rj.bind(this),call:aj}},!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,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=vj({},yj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:bM(s)||xM(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=fB(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=fB(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=AH(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=AH(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=AH(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:qB;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:ZB,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,ZB,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.includes("seriesGroup"))}))}_getMarkSpecNamesForCompare(){const t=new Set;return this.getMarksWithoutRoot().forEach((e=>{e.name&&t.add(e.name)})),Object.values(bB.getSeriesMarkMap(this.type)).forEach((e=>{(null==e?void 0:e.name)&&t.add(e.name)})),Array.from(t)}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent()}initTooltip(){this._tooltipHelper=new ZH(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||!1===e.visible&&t[i].visible))?i.reMake=!0:(!i.reCompile&&e.some(((e,i)=>e.visible&&!1===t[i].visible))||!i.reCompile&&e.some(((e,i)=>!V(e,t[i]))))&&(i.reCompile=!0,Pj(i))}_getSpecUpdatePolicy(){return Mj}_compareSpec(t,e,i){var s,n,r,a,o;const l=super._compareSpec(t,e),h=Object.keys(e||{}).sort();if(!V(h,Object.keys(t||{}).sort()))return l.reMake=!0,l;const c=this._getSpecUpdatePolicy(),d=null!==(s=c.compileOnlyKeys)&&void 0!==s?s:{},u=null!==(n=c.dataRelatedKeys)&&void 0!==n?n:{},p=null!==(r=c.compileOnlySubKeys)&&void 0!==r?r:{},g=null!==(a=c.seriesOnlyKeys)&&void 0!==a?a:{},f=Object.assign(Object.assign({},d),u),m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},gj),f),g),i),{extensionMark:!0,label:!0,totalLabel:!0});if(this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),l),!l.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),l),!l.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),l),l.reMake)return l;const v=this._getMarkSpecNamesForCompare().filter((i=>Bj(t[i],e[i],wj)));v.forEach((t=>{m[t]=!0})),!l.reCompile&&v.length&&(l.reCompile=!0);const y=h.filter((i=>f[i]&&!V(t[i],e[i]))),_=h.filter((i=>g[i]&&!V(t[i],e[i]))),b=h.filter((i=>p[i]&&Bj(t[i],e[i],p[i])));var x;return b.forEach((t=>{m[t]=!0})),l.reCompile||!y.length&&!b.length||(l.reCompile=!0),y.some((t=>u[t]))?Pj(l,!0):l.reCompile&&!(null===(o=l.effects)||void 0===o?void 0:o.series)&&(y.length||b.length||v.length)&&Pj(l),_.length&&((x=l).change=!0,x.effects=Object.assign(Object.assign({},x.effects),{series:!0,render:!0})),h.some((i=>!m[i]&&!V(t[i],e[i])))?(l.reMake=!0,l):l}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof za||aR(this._rawData,this._spec.data,!1)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),this.initMarkState(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();kj(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){var i;const s=this.getDefaultShapeType(),n=null===(i=this.getRawData())||void 0===i?void 0:i.latestData,r=new Map;return null==n||n.forEach((e=>{const i=this.getSeriesFieldValue(e,t);r.has(i)||r.set(i,e)})),e.map((e=>{var i;const n=null!==(i=r.get(e))&&void 0!==i?i:{[t]:e};return{key:e,originalKey:e,datum:n,style:this.getSeriesStyle(n),shapeType:s}}))}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:qB,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new WE).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return DE(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:qB}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),u(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),u(h)||_.setGroupKey(h);const l=null!==(s=i.morph)&&void 0!==s&&s,p=this.getMarks().filter((t=>"group"===t.type||t.getMarkConfig().morph)).length+(l?1:0),m=(null===(n=e.morph)||void 0===n?void 0:n.morphKey)||(l?`${this.getSpecIndex()}_${p}`:void 0),y=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:l,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:m,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(y),this.initMarkStyleWithSpec(_,fB({},d,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:$B}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getSeriesField(),s=this.getDimensionField(),n=i?t[i]:void 0;let r,a=!1;for(let n=0;n0?"_":""}${u(l)?"":l}`,a||(a=o===i),r=l}return!i||a||s.length>1&&r===n||(e+=`_${n}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==tP&&t!==iP&&t!==QB&&t!==eP||(t=this.getStackValueField()),null!==(e=_P(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>kM(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:qB]}}function Ij(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Iw(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 Oj(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}}}Rj.mark=hj,Rj.transformerConstructor=Cj;class Lj extends Rj{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);Iw(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:`${WB}_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(tP),this.setFieldX2(QB)):(this.setFieldY(tP),this.setFieldY2(QB))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(iP),this.setFieldX2(eP)):(this.setFieldY(iP),this.setFieldY2(eP))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(nP),this.setFieldX2(sP)):(this.setFieldY(nP),this.setFieldY2(sP))}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)&&(Ij("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}function Dj(t){return"bottom"===t||"top"===t}function Fj(t){return"left"===t||"right"===t}function zj(t){return"z"===t}function Hj(t,e){return qE(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function jj(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Nj(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?Dj(t)?"linear":"band":Dj(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const Uj=(t,e,i)=>{var s;const n=null!==(s="band"===e?jH("axisBand",i):["linear","log","symlog"].includes(e)?jH("axisLinear",i):{})&&void 0!==s?s:{},r=Dj(t)?jH("axisX",i):Fj(t)?jH("axisY",i):jH("axisZ",i);return fB({},jH("axis",i),n,r)};class Vj{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:fM)("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:fM)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),r=n.filter((t=>Lw(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return Dj(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Wj extends Vj{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Gj=(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))},Yj=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},Xj=(t,e,i,s)=>{var n;const r=e.getScale(),a=Lw(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),o.push({series:h,datum:e,key:Kj(h,s)})}else if(p(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,$j=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null};class qj extends Vj{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Gj(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:VP.canvas}),callback:this.onMouseOut}),bM(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:VP.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),bM(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Zj;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Zj||(Zj={}));const Jj={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}},Qj={sampling:!0,samplingFactor:!0};class tN{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(Jj.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:zH,curveType:FH,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===DH?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(Jj.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:xj(this._spec,Jj.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new za(this._option.dataSet,{name:`${WB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Zj.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[Jj.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(Zj.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,fB({},this._spec[Jj.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const eN=Object.assign(Object.assign({},hj),Jj),iN=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>iN(t,e[i])));if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))},sN=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class nN extends Qz{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return sN}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(Ow(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?iN(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n;const r=e.context.data,a=[],o=[],l={},h=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,c=h&&0===h.currentIndex;if(r.forEach(((e,i)=>{var s;o[i]={},a[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?o[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!h?a[i][s]=t[s](e):0!==i||h&&!c||(l[s]=t[s](e))})),o[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),h){const t=(null===(n=e.attribute)||void 0===n?void 0:n.segments)?[...e.attribute.segments]:[];return t.push({points:o}),c?Object.assign(Object.assign({},l),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(a,o);if(t)return Object.assign(Object.assign(Object.assign({},l),a[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},l),a[0]),{points:o,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:sz.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[$B]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}const rN=new Uint32Array(33),aN=new Uint32Array(33);aN[0]=0,rN[0]=~aN[0];for(let t=1;t<=32;++t)aN[t]=aN[t-1]<<1|1,rN[t]=~aN[t];function oN(t,e,i={top:0,left:0,right:0,bottom:0}){const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&rN[31&o]&aN[1+(31&l)])return!0}else{if(i[h]&rN[31&o])return!0;if(i[c]&aN[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,rN[31&o]&aN[1+(31&l)]);else for(s(h,rN[31&o]),s(c,aN[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,aN[31&a]|rN[1+(31&o)]);else for(n(l,aN[31&a]),n(h,rN[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=t,toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function lN(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=yt(i,-o,t.width+l),d=yt(s,-o,t.width+l),u=yt(n,-a,t.height+h),p=yt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function hN(t,e,i=!1){return i?lN(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function cN(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=hN(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=lN(t,r)),e.getRange(r)))}function dN(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return dN(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return dN(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 dN(t,e,n,s,h,c)}return!1}const pN=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],gN=["top","inside-top","inside"];function fN(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let y=0,_=0;return u<0-h?y=-u:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const mN={mode:"same-time",duration:300,easing:"linear"};function vN(t){return 3===t||4===t}function yN(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 _N=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 bN(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)}}class xN extends nb{onBind(){const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,{prevText:s,curText:n,prevLabelLine:r,curLabelLine:a,increaseEffect:o=!0}=this.params,l={};for(const t in n.attribute)s.attribute[t]!==n.attribute[t]&&(l[t]=n.attribute[t]);const h=Object.assign({},l);delete h.text,t.animate(s,{type:"to",to:h,duration:e,easing:i}),!1!==o&&t.animate(s,{type:"increaseCount",to:{text:n.attribute.text},duration:e,easing:i}),r&&t.animate(r,{type:"to",to:a.attribute,duration:e,easing:i}),this.completeBind(t)}tryPreventConflict(){}}class SN extends nb{onBind(){const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,{relatedGraphic:s,relatedGraphics:n,config:r}=this.params,{mode:a,type:o="fadeIn"}=r,l=this.target;let h=0;"after"===a?s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const AN=(t,e)=>Math.ceil(t)>Math.floor(e),kN=([t,e],[i,s])=>s>t&&e>i;function CN(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}const TN=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class MN extends Qp{constructor(t,e){super(t),this._skipRenderAttributes=TN,(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(((t,e)=>{e&&(this.render(),this.bindEvents())}))}setAttribute(t,e,i,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?H(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{t&&!i.has(t)&&(i.add(t),e.push(t))})),null===(o=(a=t).forEachChildren)||void 0===o||o.call(a,(t=>{BN(t,e,i)})),e}function PN(t,e){e&&(null==t||t.onComplete.push(e))}function RN(t){t.forEach((t=>{t()}))}function IN(t,e,i){const s=t=>{const s=e();s&&!s.finalized&&s.pendingAnimates.has(t)&&(s.pendingAnimates.delete(t),s.pendingAnimates.size||i())};t.forEach((t=>{t.onEnd((()=>s(t))),t.onRemove((()=>s(t)))}))}var ON=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(GM.hover,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(TM(this,(t=>{P(t.states)||(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void TM(this,(t=>{P(t.states)||(t.removeState(GM.selectedReverse),t.removeState(GM.selected))}));P(e.states)||(e.addState(GM.selected,!0),TM(this,(t=>{t===e||P(t.states)||t.addState(GM.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[bN(g,f,c,d,a,o),bN(-g,-f,u,p,l,h)]}(t.AABBBounds,this.getGraphicFinalLayoutBounds(e))}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=NM.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Al)}const r=e&&this.getGraphicFinalLayoutAttributes(e);return(null==r?void 0:r.fill)&&s.setAttribute("stroke",r.fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}_finalizeExitRelease(){var t,e,i,s;const n=this._exitReleaseState;if(null==n?void 0:n.finalized)return;n&&(n.finalized=!0);const r=this.parent,a=!!(null==n?void 0:n.removeFromParent),o=null!==(t=null==n?void 0:n.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._graphicToText=new Map,null===(e=this._idToGraphic)||void 0===e||e.clear(),null===(i=this._idToPoint)||void 0===i||i.clear(),this._baseMarks=void 0,this.removeAllChild(!0),super.release(!0),a&&(null===(s=null!=r?r:this.parent)||void 0===s||s.removeChild(this)),RN(o)}_runExitAnimationBeforeRelease(t={}){var e,i;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,PN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!(null===(e=this._graphicToText)||void 0===e?void 0:e.size))return!1;if(this._prepareAnimate(mN),!(null===(i=this._animationConfig)||void 0===i?void 0:i.exit))return!1;const s=new Set;if(this._graphicToText.forEach((t=>{(null==t?void 0:t.text)&&s.add(t.text),(null==t?void 0:t.labelLine)&&s.add(t.labelLine)})),!s.size)return!1;const n=BN(this);s.forEach((t=>{var e;t.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:null!==(e=this._animationConfig.exit.type)&&void 0!==e?e:"fadeOut",selfOnly:!0})}])}));const r=BN(this).filter((t=>!n.includes(t)));if(!r.length)return!1;this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease";const a=new Set(r);return this._exitReleaseState={pendingAnimates:a,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},IN(r,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){if(this._exitReleaseState)return;if(this._finalLayoutBoundsCache=void 0,this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;this._finalLayoutBoundsCache=new Map;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;if(d(i)&&(r=i(r)),r&&r.length){const t=new Set;r=r.filter((e=>!t.has(e.id)&&t.add(e.id)))}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):this._layout(a);const o=[],l=a;if(!c(t)&&d(null==t?void 0:t.filterBeforeOverlap)){const e=this.getRelatedGraphic.bind(this);a.forEach((i=>{t.filterBeforeOverlap(i,e,this)?l.push(i):o.push(i)}))}d(n)?a=n(l,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(o):!1!==t&&(a=this._overlapping(l).concat(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a),this._finalLayoutBoundsCache=void 0}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return QM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&AN(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&AN(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(CN([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!kN([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{const e=this.getGraphicFinalLayoutBounds(t);e&&s.setRange(hN(i,e,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(hN(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(hN(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){if(t){const e=this.shouldUseGraphicFinalLayoutAttributes(t)?this.getGraphicFinalLayoutAttributes(t):t.attribute;if(!1!==e.visible)return this.getGraphicFinalLayoutBounds(t);const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:s,y:n}=e;return{x1:s,x2:s,y1:n,y2:n}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;EN(i,null==n?void 0:n.attribute),EN(s,null==r?void 0:r.attribute),i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{labelLine:i}=t,{text:s,labelLine:n}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(s.attribute),i&&n&&t.labelLine.setAttributes(n.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{DN[t]=e};var zN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=0){if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,i,s)}};HN.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const jN=()=>{FN("line",HN),FN("area",HN)};var NN=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}UN.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const VN=()=>{FN("symbol",UN),FN("line-data",UN)};class WN extends nN{constructor(){super(...arguments),this.type=WN.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)===PE.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}WN.type="line";const GN=()=>{bB.registerMark(WN.type,WN),KT(),iT(),jN(),VN(),SH(),bB.registerGraphicComponent("line",ag)};class YN extends Qz{constructor(){super(...arguments),this.type=YN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}YN.type="symbol";const XN=()=>{bB.registerMark(YN.type,YN),KT(),iM(),VN(),bB.registerGraphicComponent("symbol",Gg)};class KN extends Cj{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function $N(t){return t.length>=2&&k(t[0])&&k(X(t))&&X(t)>=t[0]}function qN(t,e){var i;const s=X(e)-e[0],n=X(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=X(e)>0?X(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):X(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function ZN(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 JN(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 QN(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 tU(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 eU=t=>t.map(((t,e)=>({index:e,value:t}))),iU=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},sU=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=$M(a),y=t.range();let _=[];for(let i=0;i{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=X(p)-p[0];if(0===g)return t;const f=c.domain(),m=X(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return eU(v)};class aU{constructor(t){this.id=AM(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class oU extends aU{constructor(){super(oU.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Iw(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&$N(c)&&$N(d)))return;const u=qN(t,c),p=qN(e,d);if(!0===u.break&&!0===p.break)return;const{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(!JN(u,p))return}else if(0===_&&0===b){if(!JN(p,u))return}else if(y||A)if(y&&!A){if(!ZN(u,p))return}else if(A&&!y){if(!ZN(p,u))return}else{if(f===b)return;if(f>b){if(!QN(u,p))return}else if(!QN(p,u))return}else{if(0===f&&0===_){if(!tU(u,p))return}else if(0===b&&0===g&&!tU(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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){$P(e.getOption().dataSet,"tickAlign",rU);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}oU.pluginType="component",oU.type="AxisSyncPlugin";const lU={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function hU(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 cU(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 dU(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const uU=t=>"band"===t||"ordinal"===t||"point"===t;function pU(t,e){return{id:t,label:t,value:e,rawValue:t}}function gU(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class fU extends nH{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const mU=`${WB}_ARC_TRANSFORM_VALUE`,vU=`${WB}_ARC_RATIO`,yU=`${WB}_ARC_START_ANGLE`,_U=`${WB}_ARC_END_ANGLE`,bU=`${WB}_ARC_K`,xU=`${WB}_ARC_MIDDLE_ANGLE`,SU=`${WB}_ARC_QUADRANT`,AU=`${WB}_ARC_RADIAN`,kU=-Math.PI/2,CU=3*Math.PI/2,TU=.6,MU=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},wU=(t,e,i)=>{var s;const n=null!==(s="band"===e?jH("axisBand",i):"linear"===e?jH("axisLinear",i):{})&&void 0!==s?s:{},r=jH("angle"===t?"axisAngle":"axisRadius",i);return fB({},jH("axis",i),n,r)};function EU(t,e,i,s){switch(t){case r.cartesianBandAxis:return Uj(Hj(i,["z"]),"band",e);case r.cartesianLinearAxis:return Uj(Hj(i,["z"]),"linear",e);case r.cartesianLogAxis:return Uj(Hj(i,["z"]),"log",e);case r.cartesianSymlogAxis:return Uj(Hj(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return Uj(Hj(i),void 0,e);case r.polarBandAxis:return wU(i.orient,"band",e);case r.polarLinearAxis:return wU(i.orient,"linear",e);case r.polarAxis:return wU(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=jH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>Dj(t.orient)));let g;g=p(u)?fB({},uU(u.type)?a:o,l):l;const f=n.find((t=>Fj(t.orient)));let m;return m=p(f)?fB({},Lw(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=jH(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?fB({},uU(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?fB({},Lw(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return BU(i,jH(t,e));default:return jH(t,e)}}const BU=(t,e)=>{var i;const s=fB({},e,e[jj(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class PU extends lz{getTheme(t,e){return EU(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({},iB(e)),{[s]:0}))}}class RU extends dz{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=PU,this._forceReleaseVRenderComponents=!1,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof qa||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:VP.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new fU(this)}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}beforeRelease(){super.beforeRelease(),this._forceReleaseVRenderComponents=!0,this._forceReleaseExitingVRenderComponents()}release(){var t;this._shouldReleaseVRenderComponentsImmediately()&&this._forceReleaseExitingVRenderComponents(),this.clear(),super.release(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}_shouldReleaseVRenderComponentsImmediately(){return this._forceReleaseVRenderComponents}_forceReleaseExitingVRenderComponents(){var t;(null===(t=this._exitingVRenderComponents)||void 0===t?void 0:t.size)&&(this._exitingVRenderComponents.forEach((t=>{var e,i,s;RH(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._unregisterExitingVRenderComponent)||void 0===s||s.call(i,t)})),this._exitingVRenderComponents.clear())}_releaseVRenderComponent(t){var e;if(!this._shouldReleaseVRenderComponentsImmediately()){const i=IH(t),s=OH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{i.forEach((t=>{var e,i,s,n;null===(e=this._exitingVRenderComponents)||void 0===e||e.delete(t),null===(n=null===(s=null===(i=this._option)||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s._unregisterExitingVRenderComponent)||void 0===n||n.call(s,t)}))}});return s?(this._exitingVRenderComponents=null!==(e=this._exitingVRenderComponents)&&void 0!==e?e:new Set,void i.forEach((t=>{var e,i,s;this._exitingVRenderComponents.add(t),null===(s=null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i._registerExitingVRenderComponent)||void 0===s||s.call(i,t)}))):void 0}RH(t)}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{t&&this._releaseVRenderComponent(t)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}getDatum(t){}}var IU,OU;RU.transformerConstructor=PU,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IU||(IU={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(OU||(OU={}));class LU extends Qz{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}_clearExitingComponent(t){this._exitingComponent===t&&(this._unregisterExitingComponent(t),this._exitingComponent=void 0,this._exitingProduct=void 0)}_removeProductAfterExit(t,e){e.parent&&e.parent.removeChild(e,!0),this._product===e&&(this._product=null,this._compiledProductId=null),this._clearExitingComponent(t)}_registerExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._registerExitingVRenderComponent)||void 0===r||r.call(n,t)}_unregisterExitingComponent(t){var e,i,s,n,r;null===(r=null===(n=null===(s=null===(i=null===(e=this.model)||void 0===e?void 0:e.getOption)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.globalInstance)||void 0===n?void 0:n._unregisterExitingVRenderComponent)||void 0===r||r.call(n,t)}_releaseComponentWithExitAnimation(t,e){var i,s;const n=this._product;if(!t||(null===(s=null===(i=this.model)||void 0===i?void 0:i._shouldReleaseVRenderComponentsImmediately)||void 0===s?void 0:s.call(i)))return!1;const r=OH(t,{enableExitAnimation:!0,removeFromParent:!0,onComplete:()=>{e&&n?this._removeProductAfterExit(t,n):this._clearExitingComponent(t)}});return r&&(this._exitingComponent=t,this._exitingProduct=e?n:void 0,this._registerExitingComponent(t)),r}clearComponent(){var t,e;const i=this._component;i&&((null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?RH(i):this._releaseComponentWithExitAnimation(i,!1),this._component=null)}releaseWithExitAnimation(){const t=this._component;return!!this._releaseComponentWithExitAnimation(t,!0)&&(this._component=null,this._exitingComponent=t,!0)}forceReleaseExitAnimation(){var t;this._exitingComponent&&(RH(this._exitingComponent),this._unregisterExitingComponent(this._exitingComponent),(null===(t=this._exitingProduct)||void 0===t?void 0:t.parent)&&this._exitingProduct.parent.removeChild(this._exitingProduct,!0),this._exitingComponent=void 0,this._exitingProduct=void 0)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?(this._component.setAttributes(i),this._product&&this._component.parent!==this._product&&this._product.appendChild(this._component)):(this._component=bB.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(jP.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){var t,e;return(null===(e=null===(t=this.model)||void 0===t?void 0:t._shouldReleaseVRenderComponentsImmediately)||void 0===e?void 0:e.call(t))?(this.forceReleaseExitAnimation(),super.release(),void this.removeProduct(!0)):this._exitingComponent?(this._releaseComponentWithExitAnimation(this._exitingComponent,!0)||this.removeProduct(!0),void super.release()):void(this.releaseWithExitAnimation()?super.release():(super.release(),this.removeProduct(!0)))}}LU.type="component";const DU=()=>{bB.registerMark(LU.type,LU)};var FU,zU;!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.labelHoverOnAxis="axis-label-hover-on-axis",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(FU||(FU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(zU||(zU={}));const HU={[zU.selectedReverse]:{},[zU.selected]:{},[zU.hover]:{},[zU.hoverReverse]:{}},jU=t=>t,NU={grid:!0,subGrid:!0,tick:!0,subTick:!0,label:!0,domainLine:!0,title:!0,maxWidth:!0,minWidth:!0,maxHeight:!0,minHeight:!0};class UU extends RU{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?IU.circleAxis:IU.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?OU.circleAxisGrid:OU.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=vj(null===(h=bB.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick||this._specVisible&&this._hideWhenEmpty}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new Ez(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&Tw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Iw(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!Iw(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return Tw(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=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=Mw(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()})),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(Tw(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=K(t.map((t=>t.fields.length)));for(let t=1;tV(null==e?void 0:e[i],null==t?void 0:t[i])||NU[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=PP(s=t.domainLine)).startSymbol=PP(s.startSymbol),s.endSymbol=PP(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=j(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 OP(fB({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:OP(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>OP(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=OP(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return OP(fB({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:OP(t.tick.style)),t.tick.state&&(i.tick.state=RP(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 OP(fB({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:OP(t.subTick.style)),t.subTick.state&&(i.subTick.state=RP(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=lU[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:fB({},d,OP(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:OP(h.style)}),h.state&&(i.title.state.shape=RP(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:OP(o.style)}),o.state&&(i.title.state.background=RP(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=RP(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=OP(t.background.style)),t.background.state&&(i.panel.state=RP(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:UB(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 OP(fB({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:OP(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:UB(t.subGrid.alternateColor),style:OP(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=NH(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){qP(this._option.dataSet,"scale",jU);const i=this.registerTicksTransform();return new za(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}getDatum(t){var e;return t&&t.name===FU.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}UU.specKey="axes";const VU=()=>{DU(),bB.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},WU=[oU];class GU extends UU{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.Axis,this._orient="left",this._autoIndentOnce=!1,this._hasAutoIndent=!1,this._scales=[],this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this._innerOffset={top:0,bottom:0,left:0,right:0},this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{const e=this.getOrient();Dj(e)?gU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Fj(e)?gU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):zj(e)&&gU(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._clearContinuousBarBandwidthCache=()=>{this._continuousBarBandwidthCache=void 0},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=fB({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(fB({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=Dj(this.getOrient()),n=t=>{var e;return(s?!Dj(t.getOrient()):Dj(t.getOrient()))&&Iw(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&&X(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=Hj(i,["z"]),zj(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(!dU(e))return null;const{axisType:t,componentName:s}=Nj(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=>Fj(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(!dU(t))return;const{axisType:s,componentName:n}=Nj(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=bB.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return Dj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):zj(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(WU.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){Dj(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&&!Dj(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!zj(this.getOrient())&&this._spec.innerOffset){const t=this._spec;Fj(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=QE(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=Dj(this.getOrient())?t.fieldX:zj(this.getOrient())?t.fieldZ:t.fieldY,Iw(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:Iw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getBandwidth:(t=0)=>this._getContinuousBarBandwidth(t),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}_getContinuousBarBandwidth(t=0){if(0!==t||!Iw(this._scale.type))return;const e=this._scales[0],i=e.domain(),s=e.range(),n=+(null==i?void 0:i[0]),r=+(null==i?void 0:i[i.length-1]),a=+(null==s?void 0:s[0]),o=+(null==s?void 0:s[s.length-1]);if(!(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(a)&&Number.isFinite(o)&&n!==r))return;const l=this._continuousBarBandwidthCache;if(l&&l.scale===e&&l.domainStart===n&&l.domainEnd===r&&l.rangeStart===a&&l.rangeEnd===o)return l.bandWidth;const h=new Set,c=this.getOrient();Tw(this._regions,(t=>{var e,i,s,n;if(t.type!==PE.bar)return;const r=t,a=Dj(c)&&"vertical"===r.direction?r.fieldX[0]:Fj(c)&&"horizontal"===r.direction?r.fieldY[0]:void 0,o=a?null===(n=null===(s=null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.latestData)||void 0===s?void 0:s[a])||void 0===n?void 0:n.values:void 0;null==o||o.forEach((t=>{const e=+t;Number.isFinite(e)&&h.add(e)}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const d=Array.from(h).sort(((t,e)=>t-e));if(d.length<2)return;let u=1/0,p=d[0];for(let t=1;t0&&i{if(t===this._axisMark&&!1===this._isLayout&&(Dj(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=Dj(this._orient)?{x:K(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return Tw(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]:Dj(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:zj(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();Tw(this._regions,(e=>{Dj(t)?gU(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):Fj(t)?gU(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):zj(t)&&gU(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=Dj(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=Dj(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=fB(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ue).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=Dj(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?yt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):yt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-X(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=a.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return pU(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Iw(this._scale.type)?i>=s[0]&&i<=X(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),Tw(this._regions,(t=>{var e,i;null===(i=null===(e=t.getViewDataStatistics)||void 0===e?void 0:e.call(t))||void 0===i||i.target.addListener("change",this._clearContinuousBarBandwidthCache)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._specVisible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}GU.type=r.cartesianAxis,GU.specKey="axes";class YU{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new Ez(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=pU(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=>pU(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const XU=(t,e,i,s)=>{const n=nU(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},KU=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,$U=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?eU([s[s.length-1]]):eU([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(g),a=K(g);if(s.length<=f/n){const i=XU(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=ZU(s,i,o,e.labelLastVisible,Math.floor(n/l),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=XU(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!KU(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?$U(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function QU(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=gw(t,!!n),o=gw(r,!!n);const h=ae.distancePP(s,l),c=ae.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=JU(e,t,!1,!!n),o=JU(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=gw(t,!!n),o=gw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class tV extends MN{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=H({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${FU.grid}-sub`:`${FU.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=gw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=JU(t,o,!1,!!a)}const u=NM.path(Object.assign({path:c,z:l},d(r)?H({},this.skipDefault?null:tV.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=gw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),y=NM.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ht/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?H({},this.skipDefault?null:tV.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}tV.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};class eV{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=zM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return FM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class iV extends nb{onBind(){var t;const e=bD(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;EN(this.target,{x:n,y:h},{x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class sV extends nb{onBind(){const t=bD(this.target);this._animator=t;const e=this.duration,i=this.easing,{diffAttrs:s}=this.params;EN(this.target,Object.assign({},s)),t.animate(this.target,{type:"to",to:Object.assign({},s),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},s)}}),this.completeBind(t)}deleteSelfAttr(t){this.deleteSelfAttrs([t])}deleteSelfAttrs(t){super.deleteSelfAttrs(t),this._animator.deleteSelfAttrs(t)}tryPreventConflict(){}}function nV(){HC(),iT(),YT(),cM(),w_.registerBuiltInAnimate("axisEnter",iV),w_.registerBuiltInAnimate("axisUpdate",sV)}HC(),cT();class rV extends tV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},tV.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=UM,endAngle:r=VM}=this.attribute;i=pw(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=H({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function aV(){HC(),iT(),yT(),iM()}function oV(){HC(),iT(),gC(),iM()}G(rV,eV),aV();class lV extends MN{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},lV.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=NM.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),P(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=NM.line;Y(i)[0].cornerRadius&&(t=NM.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),P(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=NM.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?k(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}lV.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}}},oV();class hV extends lV{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},lV.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=NM.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}function cV(){HC(),IT(),iM(),YT(),cM()}var dV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nh&&(T=h,I.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,C=0;let j=0;"left"===z||"start"===z?j=1:"right"===z||"end"===z?j=-1:"center"===z&&(j=0),j?j<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):j>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const N="right"===_||"end"===_,U="left"===_||"start"===_,V=(t,e)=>{"richtext"===I.type?I.setAttributes({x:t,textAlign:e,textConfig:Y(I.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):I.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&j){const t=T-b[1]-b[3],e=O+E,i=1===j?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(V(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(U&&1!==j){const t=T-b[1]-b[3],e=0===j?-t/2+E/2:-T+b[3]+b[1]+E;if(V(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==j){const t=T-b[1]-b[3],e=0===j?t/2+E/2:t;if(V(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===H?(C-=M/2,A&&A.setAttribute("y",0)):"bottom"===H?(C-=M,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===H&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(I.states=m.text);const{visible:W}=a,G=dV(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:M,x:k,y:C}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Al)}this._bgRect=t}this._textShape=I,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:H({},uV.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}uV.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const pV=(t,e,i)=>{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(GM.hover,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.hoverReverse,!0)})),s):i},gV=(t,e,i)=>i?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.hoverReverse),t.removeState(GM.hover))})),null):i,fV=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(GM.selected)?(TM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(GM.selectedReverse),t.removeState(GM.selected))})),null):s.name&&!P(s.states)?(s.addState(GM.selected,!0),TM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(GM.selectedReverse,!0)})),s):i},mV={type:"default",duration:300,easing:"linear"};class vV extends wN{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=pV(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=gV(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=fV(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=NM.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._prevInnerView=null,this._innerView=null,this.axisLabelsContainer=null,this.axisContainer=null,this.removeAllChild(!0),super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this)),RN(r)}_runExitAnimationBeforeRelease(t={}){var e,i,s;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,PN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._innerView)return!1;if(this._prepare(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const n=new Set;if(TM(this._innerView,(t=>{"group"!==t.type&&n.add(t)})),!n.size)return!1;const r=BN(this),{delay:a=0,duration:o=mV.duration,easing:l=mV.easing}=this._animationConfig.exit;n.forEach((t=>{var e,i,s;const n={opacity:0,fillOpacity:0,strokeOpacity:0};EN(t,n,{opacity:null!==(e=t.attribute.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.attribute.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.attribute.strokeOpacity)&&void 0!==s?s:1}),t.animate().wait(a).to(n,o,l)}));const h=BN(this).filter((t=>!r.includes(t)));if(!h.length)return!1;this.setAttribute("childrenPickable",!1),null===(s=(i=this._innerView).removeAllEventListeners)||void 0===s||s.call(i),this.releaseStatus="willRelease";const c=new Set(h);return this._exitReleaseState={pendingAnimates:c,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},IN(h,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeRelease(t)}render(){this._exitReleaseState||(this._prepare(),this._prevInnerView=this._innerView&&cw(this._innerView),this.removeAllChild(!0),this._innerView=NM.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation())}_prepare(){this._prepareAnimate(mV)}_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=NM.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=FU.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=NM.group({x:0,y:0,pickable:!1});t.name=FU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=NM.group({x:0,y:0,pickable:!1});i.name=FU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=NM.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=FU.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=YM;else{const t=this.data[s],e=H({},YM,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=NM.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=FU.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=YM;else{const i=H({},YM,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=NM.group({x:0,y:0,pickable:!1});return r.name=`${FU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=QM(this._getLabelAttribute(t,e,n,i));if(a.name=FU.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=YM;else{const s=H({},YM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new uV(Object.assign({},e));i.name=FU.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return dw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Vt(s[0])>Vt(s[1])?o=Ht/2*(l.x>e.x?1:-1):h=Ht/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 f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?H({},nw.label.style,y(t,e,i,s)):y;y=H(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return d(_)&&(_=_(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y),{react:_})}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},TM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(r){r.release();const i=L(r.attribute),a=L(e.attribute),o=ZA(i,a);let l=Object.keys(o).length>0;"opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l&&(this._newElementAttrMap[e.id]={state:"update",node:e,attrs:a},EN(e,a,i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}]))}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(t){this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),t&&this.removeAllChild(!0),this._prevInnerView=null,this._innerView=null)}}const yV={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&&fw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function _V(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function bV(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:yV[n]||yV.parity;if(s.length>=3&&mw(s,r)){do{s=a(s,r)}while(s.length>=3&&mw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=X(i);fw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),bV(l,s,n,(t=>fw(t,l,r))),bV(h,s,o,(t=>fw(t,h,r)||!(!n||t===l)&&fw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function SV(t){for(let e=1;e{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},CV(t,e.attribute.angle)),{angle:kV(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({},TV(t,e.attribute.angle)),{angle:kV(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function kV(t=0){if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function CV(t,e=0){let i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=kV(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 TV(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=kV(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 MV(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=hw(h),m=lw(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function wV(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}var EV=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=NM.group({zIndex:999});e.name=FU.axisBreak,e.id=this._getNodeId(`${FU.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=H({},rw,s),a=null!==(e=r.size)&&void 0!==e?e:rw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=NM.symbol(Object.assign({x:s.x,y:s.y},o));l.name=FU.axisBreakSymbol;const h=NM.symbol(Object.assign({x:n.x,y:n.y},o));h.name=FU.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=NM.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=FU.background,n.id=this._getNodeId("background"),n.states=H({},HU,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new uV(Object.assign({},t));e.name=FU.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=EV(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:H({},HU,l),symbol:H({},HU,l)});const d=new lV(c);d.name=FU.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=EV(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),C=this.getVerticalVector(S,!1,{x:0,y:0});let T,M,{angle:w}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=HM(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;M=1==-1*t?"bottom":"top"}else T=this.getTextAlign(C),M=this.getTextBaseline(C,!1);let E=d;if(u(E)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));E=t<1e-6?1/0:this.attribute.end.x/t}else E=s-S;else if(w&&0!==w){const t=Math.abs(Math.sin(w));E=t<1e-6?1/0:this.attribute.end.y/t}else E=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:M},a),state:{text:H({},HU,c.text),shape:H({},HU,c.shape),panel:H({},HU,c.background)}});return B.angle=w,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=EV(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(u(b)&&a){b=HM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return CV(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return TV(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=X(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),AV(i,t),!SV(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=hw(a),l=lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=wV(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Xt(c,i))}}else{if(l){const i=wV(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Xt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&k(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);MV(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&xV(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(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=NM.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=FU.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=qM(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=oi(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(t){super.release(t),this._breaks=null}}BV.defaultAttributes=nw,G(BV,eV);const PV={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},RV={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}}},IV={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}}},OV={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}}};class LV extends GU{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new iE}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,qU),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=Xw(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{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),VU(),bB.registerComponent(LV.type,LV,!1)},FV=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function zV(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,jV=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function NV(t,e,i="count"){const s=jV(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const UV=Math.sqrt(50),VV=Math.sqrt(10),WV=Math.sqrt(2);class GV{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=cU(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(X(t)-t[0]);if(1===s&&this._option){s=Dj(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}this._lastNiceAxisLength=s,e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}reTransformDomainByLayout(){var t;if(!this._nice||!d(null===(t=this._spec.tick)||void 0===t?void 0:t.tickCount))return;const e=this._scale.range(),i=Math.abs(X(e)-e[0]);i<=1||k(this._lastNiceAxisLength)&&Math.abs(this._lastNiceAxisLength-i)<1||this.updateScaleDomain()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(HV),e.sort(HV),{domain:zV(t,e),scope:NV(t,e,i)}}(r,dM(t),this._spec.breaks[0].scopeType);e=dM(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=X(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=cU(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-K(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=UV?10:n>=VV?5:n>=WV?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(X(t),0))}setExtendDomain(t,e){if(void 0===e){if(!Object.prototype.hasOwnProperty.call(this._extend,t))return;delete this._extend[t]}else{if(this._extend[t]===e)return;this._extend[t]=e}this.updateScaleDomain()}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=X(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(X(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>k(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}function YV(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function XV(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!Iw(t.type))return eU(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return eU([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=YV(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=YV(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=YV(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=nU(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=nU(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=X(l),r=f&&f()?$V.greedy:$V.parity;for(;l.length>=3&&mw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;fw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),XV(t,l,a,(e=>fw(e,t,i))),XV(n,l,o,(e=>fw(e,n,i)||!(!a||e===t)&&fw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),X(h)!==X(m)&&h.push(X(m))),m=h}}return eU(m)},$V={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&fw(i,t,e)||(i=t,0))))}},qV={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}};class ZV extends GU{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}updateScaleRange(){const t=super.updateScaleRange();return t&&this.reTransformDomainByLayout(),t}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!zj(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=Dj(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=ZE(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=dM(this._break.scope).map((t=>i[0]+(X(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,KV),t}}ZV.type=r.cartesianLinearAxis,ZV.specKey="axes",ZV.builtInTheme={axis:RV,axisLinear:qV,axisX:IV,axisY:OV},G(ZV,GV);const JV=()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),VU(),bB.registerComponent(ZV.type,ZV)},QV=`${WB}_hide_`;function tW(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const eW=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[QV]&&(tW(t,!0),t[QV]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[QV]=!0,tW(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},iW=()=>{bB.registerGrammarTransform("symbolOverlap",{transform:eW,runType:"afterEncode"})},sW={min:$,max:K,average:xw,sum:bw};function nW(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function rW(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 aW(t,e,i,s){return rW(t,e,i,"min",s)}function oW(t,e,i,s){return rW(t,e,i,"max",s)}function lW(t,e,i,s){return rW(t,e,i,"average",s)}function hW(t,e,i,s){return rW(t,e,i,"sum",s)}const cW=(t,e)=>{let i=d(t.size)?t.size():t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=nW;if("min"===n?l=aW:"max"===n?l=oW:"average"===n?l=lW:"sum"===n&&(l=hW),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[]},dW=()=>{bB.registerGrammarTransform("dataSampling",{transform:cW})};class uW extends Lj{constructor(){super(...arguments),this.type=PE.line,this.transformerConstructor=KN,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Qj)})}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),yj("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Oj(this);this._symbolMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),yj("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}uW.type=PE.line,uW.mark=eN,uW.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},uW.transformerConstructor=KN,G(uW,tN);class pW{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{aR(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof za)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];gM(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];gM(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class gW{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)=>{CM(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{vP(e,[{key:t,operations:Iw(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&&vP(e,[{key:i.field,operations:Iw(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?YE("colorOrdinal"):YE(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(CM(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified)){if("color"!==s.id)return e.reMake=!0,e;const t=n;if(t.setSpecified)t.setSpecified(s.specified);else{if(!s.specified||!t.specified)return e.reMake=!0,e;t.specified(s.specified)}e.reRender=!0}s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),CM(s.domain)?e.reRender=!0:V(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(!CM(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Iw(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Iw(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;Iw(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(Iw(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Iw(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));Iw(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 fW{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}_getMarkById(t){const e=new Map;return t.getMarks().forEach((t=>{t&&e.set(t.id,t)})),e}_hasAnimationByGraphicState(t,e){var i,s,n;const r=null!==(s=null===(i=t.parent)||void 0===i?void 0:i.mark)&&void 0!==s?s:e.get(t.context.markId);return!!(null===(n=null==r?void 0:r.hasAnimationByState)||void 0===n?void 0:n.call(r,"state"))}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):(i&&i.length&&this.clearAllStatesOfTrigger(t,s,n),[])}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);qz(t,s,!0,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Zz(t,s,e)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState(),r=this._getMarkById(t);i.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);Zz(t,s,e)}})),e.forEach((t=>{if(s&&n[s]&&n[s].includes(t.context.markId)){const e=this._hasAnimationByGraphicState(t,r);qz(t,s,!0,e)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&qz(t,i,!0,l):a&&qz(t,s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&qz(t,i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{Zz(t,i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&Zz(t,e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}const mW={[r.markPoint]:!0,[r.markLine]:!0,[r.markArea]:!0},vW={regionId:!0,regionIndex:!0,seriesId:!0,seriesIndex:!0,specifiedDataSeriesId:!0,specifiedDataSeriesIndex:!0};class yW extends oz{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=AM(),this._regions=[],this._series=[],this._components=[],this._specTransformer=null,this._layoutRect={x:0,y:0,width:GB,height:YB},this._viewRect={width:GB,height:YB},this._viewBox={x1:0,y1:0,x2:GB,y2:YB},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._isMarkerAdditionSpecSafeWithoutRemake=t=>{if(!t||"object"!=typeof t)return!1;const e=t;return!1!==e.visible&&!Object.keys(vW).some((t=>!u(e[t])))},this._paddingSpec=iB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new HP(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new pW(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._specTransformer=t,this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new fW;const t=this.getAllSeries(),e=[],i=[];t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=i.find((e=>e.regionId===n&&V(e.config,t)));if(r)r.trigger.marks.push(...s);else{const r=Object.assign(Object.assign({},t),{marks:[...s]});i.push({regionId:n,config:Object.assign({},t),trigger:r}),e.push(r)}}))}})),e.forEach((t=>{const e=bB.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(vj({},yj("stage",this._spec,{}),null))}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=j(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=bB.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=bB.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof hz)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 Qz))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof Qz)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&aR(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=KF(this._spec,this._option,{width:GB,height:YB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=DE(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new gW(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){JF(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=DE(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0,xField:!0,yField:!0};return Object.keys(t).filter((t=>!e[t])).sort()}_isSeriesRelatedSpecKey(t){var e,i;return!!(null===(i=null===(e=this._specTransformer)||void 0===e?void 0:e.getSeriesRelatedSpecKeys())||void 0===i?void 0:i[t])}_canChangeSpecKeysWithoutRemake(t,e){const i=new Set(t),s=new Set(e),n=[...t.filter((t=>!s.has(t))),...e.filter((t=>!i.has(t)))];return n.length>0&&n.every((t=>this._isSeriesRelatedSpecKey(t)))}updateSpec(t){var e,i;const s={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(t.type!==this.type)return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const n=this._getSpecKeys(this._spec),r=this._getSpecKeys(t);if(!V(n,r)&&!this._canChangeSpecKeysWithoutRemake(n,r))return s.reMake=!0,this.setLayoutTag(!0,null,!1),s;const a=Array.from(new Set([...n,...r])).sort();for(let e=0;e{t.reInit(t.getSpec())})),(null===(i=s.effects)||void 0===i?void 0:i.layout)&&this.setLayoutTag(!0,null,!1),s):(this.setLayoutTag(!0,null,!1),this.updateSeriesSpec(s),s.reMake||(this.reInit(),d&&this._canSkipChartDataStages(s)||(this.updateDataSpec(),this.reDataFlow(),this._reRunStackDataFlow(),this.getAllModels().forEach((t=>t.onDataUpdate())))),s))}updateChartConfig(t,e){var i,s;this._paddingSpec=iB(null!==(i=this._spec.padding)&&void 0!==i?i:null===(s=this._option)||void 0===s?void 0:s.getTheme("padding")),this._updateLayoutRect(this._viewBox)}updateDataSpec(){this._spec.data&&this._chartData.updateData(this._spec.data,!1,!0)}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{JF(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e=[];let i=!1;const s={},n={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0},a=[];let o=!1;this._components.forEach((l=>{var h,c;if(l.type===r.label||l.type===r.totalLabel)return void(l.getSpecInfo()||(a.push(l),o=!0,i=!0));n[l.type]&&(n[l.type]=!1);const d=l.specKey||l.type,u=null!==(h=this._spec[d])&&void 0!==h?h:{};if(_(u)){if(s[d]=s[d]||{specCount:u.length,componentCount:0},this._canRemoveMarkerComponentsWithoutRemake(d,[l.getSpec()],u))return void a.push(l);s[d].componentCount++;const n=null!==(c=u[l.getSpecIndex()])&&void 0!==c?c:{},r=l.getSpec(),o=l.updateSpec(n,u);ZF(o)||this._isComponentScaleDomainOnlyUpdate(o)?e.push(l):V(r,n)||(i=!0),JF(t,o)}else{const s=l.getSpec(),n=l.updateSpec(u);ZF(n)||this._isComponentScaleDomainOnlyUpdate(n)?e.push(l):V(s,u)||(i=!0),JF(t,n)}})),t.reMake||this._createMissingMarkerComponentsForSpecs(t,s);for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const i=s[e];i.componentCount!==i.specCount&&(t.reMake=!0)}a.length&&(a.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),o?{layout:!0,render:!0}:{localOnly:!0}));const l=t=>t&&!1!==t.visible;return Object.keys(n).forEach((e=>{if(n[e]){const i=this._spec[e];(_(i)?i.some(l):l(i))&&(t.reMake=!0)}})),{componentOnlyUpdatedComponents:e,hasNonComponentOnlyUpdate:i}}_canChangeMarkerComponentsWithoutRemake(t,e,i){return this._canRemoveMarkerComponentsWithoutRemake(t,e,i)||this._canAddMarkerComponentsWithoutRemake(t,e,i)}_canAddMarkerComponentsWithoutRemake(t,e,i){return!!(mW[t]&&_(e)&&_(i))&&(!(i.length<=e.length)&&i.slice(e.length).every(this._isMarkerAdditionSpecSafeWithoutRemake))}_isAutoRangeMarkerSpec(t){return!!t&&"object"==typeof t&&!0===t.autoRange}_canRemoveMarkerComponentsWithoutRemake(t,e,i){return mW[t]&&_(e)&&e.length>0&&_(i)&&0===i.length}_isOnlyMarkerComponentsRemoved(t,e,i){let s=!1;const n=i.every((i=>this._canRemoveMarkerComponentsWithoutRemake(i,t[i],e[i])?(s=!0,!0):V(t[i],e[i])));return s&&n}_isComponentSpecKey(t){return!!mW[t]||this._components.some((e=>(e.specKey||e.type)===t))}_isOnlyComponentSpecsChanged(t,e,i){let s=!1;const n=t,r=e,a=i.every((t=>!!V(n[t],r[t])||!!this._isComponentSpecKey(t)&&(s=!0,!0)));return s&&a}_isOnlySeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!!l[t]&&(r=!0,!0)));return r&&h}_isOnlyComponentOrSeriesSpecsChanged(t,e,i){var s,n;let r=!1;const a=t,o=e,l=null!==(n=null===(s=this._specTransformer)||void 0===s?void 0:s.getSeriesRelatedSpecKeys())&&void 0!==n?n:{},h=i.every((t=>!!V(a[t],o[t])||!(!this._isComponentSpecKey(t)&&!l[t])&&(r=!0,!0)));return r&&h}_canSkipChartDataStages(t){const e=t.effects;return!(!(null==e?void 0:e.series)||e.remake||e.data||e.scaleDomain||t.reMake)}_isComponentScaleDomainOnlyUpdate(t){const e=t.effects;return!(!(null==e?void 0:e.component)||!e.scaleDomain||t.reMake||t.reCompile||t.reSize||e.remake||e.compile||e.data||e.series||e.animation||t.reTransformSpec||t.reAnimate||t.changeTheme||t.changeBackground)}_reRunStackDataFlow(){var t,e;this._series.some((t=>{var e;return null===(e=t.getStack)||void 0===e?void 0:e.call(t)}))&&(null===(e=null===(t=this._stack)||void 0===t?void 0:t.stackAll)||void 0===e||e.call(t),this._series.forEach((t=>{t.getViewDataFilter()&&t.reTransformViewData()})))}_getModelSpecIndex(t){var e;const i=null!==(e=t.specPath)&&void 0!==e?e:[],s=i[i.length-1];return"number"==typeof s?s:0}_hasComponentForSpecInfo(t,e){const i=this._getModelSpecIndex(e);return this._components.some((e=>(e.specKey||e.type)===t&&e.getSpecIndex()===i))}_createMissingMarkerComponentsForSpecs(t,e){var i;let s=0,n=!1;null===(i=this._specTransformer)||void 0===i||i.forEachComponentInSpec(this._spec,((i,r)=>{if(t.reMake)return;const a=i.specKey||i.type;mW[a]&&!this._hasComponentForSpecInfo(a,r)&&(this._isMarkerAdditionSpecSafeWithoutRemake(r.spec)?(this._createComponent(i,r),e[a]&&e[a].componentCount++,s++,n=n||this._isAutoRangeMarkerSpec(r.spec)):t.reMake=!0)}),this._option.getSpecInfo()),s&&(t.change=!0,t.effects=Object.assign(Object.assign(Object.assign(Object.assign({},t.effects),{component:!0}),n?{scaleDomain:!0}:null),{layout:!0,render:!0}))}_removeMarkerComponentsForEmptySpecs(t){const e=this._components.filter((t=>{var e;const i=t.specKey||t.type,s=null!==(e=this._spec[i])&&void 0!==e?e:{};return this._canRemoveMarkerComponentsWithoutRemake(i,[t.getSpec()],s)}));e.length&&(e.forEach((t=>{this._removeComponent(t)})),t.change=!0,t.effects=Object.assign(Object.assign({},t.effects),{component:!0,localOnly:!0}))}_removeComponent(t){this._components=this._components.filter((e=>e!==t)),this._idMap.delete(t.id),t.getMarks().forEach((t=>{this.getCompiler().removeRootMark(t)})),t.release()}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];JF(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=tB(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(t=!0){t&&[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(jP.AFTER_MARK_RENDER_END,e)};this._event.on(jP.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:FP;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(DP(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===Zj.dimensionHover||s===Zj.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>Lw(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>Lw(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const _W=(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)},bW={series:!0,label:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0};class xW{constructor(t){this._seriesRelatedSpecKeys=Object.assign({},bW),this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):uB(t,a,c.spec),uB(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=_W(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=_W(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}getSeriesRelatedSpecKeys(){return this._seriesRelatedSpecKeys}_addSeriesRelatedSpecKeys(...t){t.forEach((t=>{null==t||t.forEach((t=>{this._seriesRelatedSpecKeys[t]=!0}))}))}_getDefaultSeriesSpec(t,e,i){var s,n,r,a,o;this._addSeriesRelatedSpecKeys(e,i);const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(this._addSeriesRelatedSpecKeys([h]),l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(bB.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(bB.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=bB.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=bB.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=bB.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):UH(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=UH(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class SW extends xW{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&fB(i,QF(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class AW extends SW{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),XF(t)}}const kW=(t,e)=>{const i={nodes:{}},{fields:s}=d(e)?e():e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=bP(t,!0);for(const e in o)for(const i in o[e].nodes)kP(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)AP(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&SP(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class TW{_beforeInit(){this._dataSet&&$P(this._dataSet,"stackSplit",kW)}_initStack(){this._stack=new CW(this),this._stack.init()}}const MW={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:Zj.dimensionHover};class wW extends kH{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},MW,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=FP(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}wW.type="dimension-hover",wW.defaultOptions=MW;const EW=()=>{bB.registerInteractionTrigger(wW.type,wW)},BW=()=>{bB.registerComposedEvent(Zj.dimensionHover,qj),bB.registerComposedEvent(Zj.dimensionClick,Wj)},PW=t=>t.fieldX[0],RW=t=>t.fieldY[0],IW=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},OW=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},LW=(t,e)=>t?e?PW:IW:e?RW:OW,DW=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=$j(t,(t=>Dj(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=$j(t,(t=>Fj(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{Lw(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=FW(t,i,LW(e,Lw(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=FW(t,i,LW(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},FW=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:zW(t,s,i)},zW=(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=Xj(e,t,"cartesian",null!=i?i:Dj(t.getOrient())?PW:RW);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},HW=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(d.size){const t=Array.from(d.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(Lw(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(Iw(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=hU(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(d=_.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(u=_.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};NW(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&jW(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),jW=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=NH(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},NW=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},UW=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=VW(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},VW=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},WW=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return HW(c,r,e),c.xField.cacheInfo?UW(c.xField):c.yField.cacheInfo?UW(c.yField):void 0},GW=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],YW=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&GW.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(XW(s).every((t=>{var e;return!XH("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},XW=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},KW={dom:`${WB}_TOOLTIP_HANDLER_DOM`,canvas:`${WB}_TOOLTIP_HANDLER_CANVAS`},$W={key:"其他",value:"..."};var qW;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(qW||(qW={}));class ZW{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=YW(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},$W),t):$W;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&XH(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class JW extends ZW{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Lw(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const QW=()=>{bB.registerTooltipProcessor("dimension",JW)};class tG extends ZW{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,yo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(FP(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const eG=()=>{bB.registerTooltipProcessor("mark",tG)};class iG extends ZW{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const sG=()=>{bB.registerTooltipProcessor("group",iG)};class nG extends yW{constructor(){super(...arguments),this.transformerConstructor=AW,this.type="line",this.seriesType=PE.line}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}nG.type="line",nG.seriesType=PE.line,nG.transformerConstructor=AW,G(nG,TW);const rG=[...sN,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class aG extends nN{constructor(){super(...arguments),this.type=aG.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return rG}_getIgnoreAttributes(){return[]}}aG.type="area";const oG=()=>{bB.registerMark(aG.type,aG),KT(),wC(),jN(),VN(),SH(),bB.registerGraphicComponent("area",Yp)};class lG extends ZH{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 hG=Object.assign(Object.assign(Object.assign({},hj),Jj),{area:{name:"area",type:"area"}}),cG=()=>{bB.registerAnimation("area",bH),xH(),yH()};class dG extends KN{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible);this._addMarkLabelSpec(t,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=fB({},f.style,g.style),l.state=fB({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}function uG(){HC(),IT()}function pG(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const gG={debounce:St,throttle:At};uG();let fG=class t extends MN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=yt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=yt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{this._clearDragEvents();const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t});const r=pG(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=yt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:gG[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent(KM,{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",gG[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:oi(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]=oi(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=yt(t[0],0,1),c=yt(t[1],0,1),d=yt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=pG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};fG.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1],delayType:"throttle",delayTime:0,realTime:!0};class mG{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ue).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=mG.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(KM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new fG(v),h.name=a,e.add(h),h.isScrollBar=!0);const y=this.childrenBounds,{scrollX:_,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/y.width(),1),e=Math.max(Math.min(_/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/y.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=iA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Xt(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Xt(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ht/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ht/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ht/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ht/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ht,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ht:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}CG.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},panel:{},maxWidthPercent:.8,space:8,padding:10};class TG{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};H(s,CG.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new CG(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};f=n,H(e,YF.poptip,f),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}}class MG{constructor(){this.activeEvent="onRegister",this._uid=Va.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}class wG extends MG{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}}class EG extends MG{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}}function BG(t){t.isBound(TG)||(t.bind(TG).toSelf().inSingletonScope(),t.bind(o_).toService(TG)),t.isBound(wG)||(t.bind(wG).toSelf(),t.bind(Sv).toService(wG)),t.isBound(EG)||(t.bind(EG).toSelf(),t.bind(Sv).toService(EG))}class PG extends MN{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}HC(),iT();class RG extends PG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},RG.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})}}RG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},HC(),IT();class IG extends PG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},IG.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})}}IG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},HC(),gC();class OG extends PG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},OG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}OG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},HC(),gC();class LG extends PG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},LG.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=UM,endAngle:s=VM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}LG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},HC(),cT();class DG extends PG{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},DG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=ce(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=ae.distancePP(t,e);this.setAttribute("radius",i)}}DG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class FG{isInValidValue(t){const{startAngle:e=UM,endAngle:i=VM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=UM,endAngle:i=VM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return uw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function zG(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=zG(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var NG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=pw(n,l,c,e,i);h=NM.path(Object.assign(Object.assign({},a.style),{path:gw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=NM.circle(t)}h.name=FU.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=H({},HU,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=NG(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let y="middle",{position:_}=this.attribute.title;u(_)&&(_=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:y,textAlign:"center"},l),state:{text:H({},HU,d.text),shape:H({},HU,d.shape),panel:H({},HU,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=zG(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&HG(e,c,i)}else e.AABBBounds.width()>r&&HG(e,r,i)}else o>a.x&&h.x2>n.x2?(HG(e,n.x2-o,i),r&&jG(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}UG.defaultAttributes=nw,G(UG,FG);const VG=(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=$M(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const y={align:n.textAlign,baseline:n.textBaseline},{x:_,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=dw(r,uw(s,r,e,n));return o=a,l=uw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return y.align||(gt(_,f.x)?y.baseline||(y.baseline=b>f.y?"top":"bottom"):_>f.x?y.align="left":_{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h||h<=0)return eU(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=VG(t,i,e),r=$(s),l=K(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=GG(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 eU(c)},GG=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&iU(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};var YG=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id),h=this.getGraphicFinalLayoutAttributes(l),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new $G(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):vN(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=vN(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=vN(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=vN(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?vN(t.quadrant)?"left":"right":vN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.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*(vN(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=>{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>r&&(r=e.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{const e=this.getGraphicFinalLayoutAttributes(t);e.outerRadius>a&&(a=e.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}_finalizeExitRelease(){var t,e,i;const s=this._exitReleaseState;if(null==s?void 0:s.finalized)return;s&&(s.finalized=!0);const n=this.parent,r=!!(null==s?void 0:s.removeFromParent),a=null!==(t=null==s?void 0:s.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,null===(e=this._componentMap)||void 0===e||e.clear(),this.removeAllChild(!0),super.release(!0),r&&(null===(i=null!=n?n:this.parent)||void 0===i||i.removeChild(this)),RN(a)}releaseWithExitAnimation(t={}){var e;if("released"===this.releaseStatus)return!1;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,PN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!(null===(e=this._componentMap)||void 0===e?void 0:e.size))return!1;const i={pendingCount:0,finalized:!1,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},s=[],n=[];let r=!0;const a=()=>{i.finalized||(i.pendingCount-=1,i.pendingCount<=0&&!r&&this._finalizeExitRelease())};return this._exitReleaseState=i,this._componentMap.forEach((t=>{i.pendingCount+=1,t.releaseWithExitAnimation({removeFromParent:!1,onComplete:a})?s.push(t):(i.pendingCount-=1,n.push(t))})),s.length?(n.forEach((t=>{t.release(!0),this.removeChild(t)})),this.setAttribute("childrenPickable",!1),this.releaseStatus="willRelease",r=!1,i.pendingCount<=0&&this._finalizeExitRelease(),!0):(this._exitReleaseState=void 0,!1)}release(t){var e;this._exitReleaseState?this._finalizeExitRelease():(t&&this.removeAllChild(!0),super.release(t),null===(e=this._componentMap)||void 0===e||e.clear())}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}JG.defaultAttributes={pickable:!1};var QG,tY,eY,iY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}G(sY,FG),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(QG||(QG={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(tY||(tY={})),function(t){t.dataZoomChange="dataZoomChange"}(eY||(eY={}));const nY="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",rY={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:nY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:nY,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},aY={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}},oY=0,lY=1,hY=2,cY=3,dY=4,uY=5,pY=5,gY=999,fY=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var mY=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:hY},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:hY},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:oY},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,k,C,T;const{orient:M,middleHandlerStyle:w={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:R,end:I}=this._getState(),{position:O,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,H=this._getContainer();if(this._isHorizontal){if(w.visible){const t=(null===(i=w.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+R*L,y:O.y-t,width:(I-R)*L,height:t,zIndex:uY},null===(s=w.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=w.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(R+I)/2*L,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=w.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:uY},w.icon),{pickable:!P&&(null===(h=w.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+R*L,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},aY.horizontal),{zIndex:uY}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+I*L,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},aY.horizontal),{zIndex:uY}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+R*L-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:gY},aY.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I*L-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:gY},aY.horizontal),{pickable:!P}),"rect")}else{if(w.visible){const t=(null===(g=w.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=H.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===M?O.x-t:O.x+L,y:O.y+R*D,width:t,height:(I-R)*D,zIndex:uY},null===(f=w.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(y=null===(v=null===(m=w.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===y||y)}),"rect"),this._middleHandlerSymbol=H.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===M?O.x-t/2:O.x+L+t/2,y:O.y+(R+I)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(_=w.icon)||void 0===_?void 0:_.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:uY},w.icon),{pickable:!P&&(null===(S=null===(x=w.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=H.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+L/2,y:O.y+R*D,size:L,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},aY.vertical),{zIndex:uY}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=H.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+L/2,y:O.y+I*D,size:L,symbolType:null!==(C=B.symbolType)&&void 0!==C?C:"square",zIndex:uY},aY.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=H.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L/2+t/2,y:O.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:gY},aY.vertical),{pickable:!P}),"rect"),this._endHandlerMask=H.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+L/2+i/2,y:O.y+I*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:gY},aY.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:cY},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:cY},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:lY},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:dY},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return qA(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}_getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}_getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this._simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this._computeBasePoints(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){t=this._startText.AABBBounds,e=this._endText.AABBBounds,this._setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ue).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=mY(c,["formatMethod"]),{formatMethod:g}=d,f=mY(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:y,width:_,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:y.x,y1:y.y,x2:y.x+_,y2:y.y+b};let k,C,T,M;this._isHorizontal?(k={x:y.x+m*_,y:y.y+b/2},C={x:y.x+v*_,y:y.y+b/2},T={textAlign:fY(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},M={textAlign:fY(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:y.x+_/2,y:y.y+m*b},C={x:y.x+_/2,y:y.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:fY(A,t,"start",this._isHorizontal)?"top":"bottom"},M={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:fY(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),H({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:pY}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),H({},f,{text:S,x:C.x,y:C.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:M,zIndex:pY}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new uV(e),s.name=i,t.add(s)),s}}const yY={debounce:St,throttle:At};class _Y extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=QG.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=QG.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=QG.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=QG.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=QG.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=pG();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===QG.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===QG.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===QG.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===QG.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(tY.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(tY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(tY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===QG.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(tY.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(tY.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:yY[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=pG();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:yt(e+t,0,1),end:yt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=QG.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}cV(),IT(),iM(),wC(),iT();let bY=class t extends MN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,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)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:y,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new vY(this._getRendererAttrs()),this._interaction=new _Y(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(tY.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(tY.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(eY.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(tY.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(eY.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var xY,SY,AY,kY;function CY(){HC(),cV(),fb()}bY.defaultAttributes=rY,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"}(xY||(xY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(SY||(SY={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(AY||(AY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(kY||(kY={}));class TY extends MN{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=pV(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=gV(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=fV(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:H({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:H({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:H({},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=NM.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=NM.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=NM.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})}_finalizeExitRelease(){var t,e;const i=this._exitReleaseState;if(null==i?void 0:i.finalized)return;i&&(i.finalized=!0);const s=this.parent,n=!!(null==i?void 0:i.removeFromParent),r=!!(null==i?void 0:i.releaseSelf),a=null!==(t=null==i?void 0:i.onComplete)&&void 0!==t?t:[];this._exitReleaseState=void 0,this._releaseEvent(),this._container=null,this._containerClip=null,this.removeAllChild(!0),r&&(super.release(!0),n&&(null===(e=null!=s?s:this.parent)||void 0===e||e.removeChild(this))),RN(a)}_runExitAnimationBeforeCleanup(t={}){var e;const i=!!t.releaseSelf;if(this._exitReleaseState&&!this._exitReleaseState.finalized)return this._exitReleaseState.releaseSelf=this._exitReleaseState.releaseSelf||i,this._exitReleaseState.removeFromParent=this._exitReleaseState.removeFromParent||!!t.removeFromParent,PN(this._exitReleaseState,t.onComplete),!0;if(!this.stage||!1===this.attribute.animation||!1===this.attribute.animationExit||!this._container)return!1;if(this.transAnimationConfig(),!(null===(e=this._animationConfig)||void 0===e?void 0:e.exit))return!1;const s=BN(this);this.markerAnimate("exit");const n=BN(this).filter((t=>!s.includes(t)));if(!n.length)return!1;this._releaseEvent(),this.setAttribute("childrenPickable",!1),i&&(this.releaseStatus="willRelease");const r=new Set(n);return this._exitReleaseState={pendingAnimates:r,finalized:!1,releaseSelf:i,removeFromParent:!!t.removeFromParent,onComplete:t.onComplete?[t.onComplete]:[]},IN(n,(()=>this._exitReleaseState),(()=>this._finalizeExitRelease())),!0}releaseWithExitAnimation(t={}){return"released"!==this.releaseStatus&&this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({},t),{releaseSelf:!0}))}render(){var t,e;if(null===(t=this._exitReleaseState)||void 0===t?void 0:t.releaseSelf)return;this.transAnimationConfig(),this.setAttribute("pickable",!1);const i=null===(e=this.attribute.visible)||void 0===e||e;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),i&&this.isValidPoints()?(this._exitReleaseState&&this._finalizeExitRelease(),this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter"))):this._runExitAnimationBeforeCleanup()||(this._container=null,this._containerClip=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(t){this._exitReleaseState?this._finalizeExitRelease():(!1!==this.attribute.animation&&!1!==this.attribute.animationExit&&this.markerAnimate("exit"),t&&this.removeAllChild(!0),super.release(t),this._releaseEvent(),this._container=null,this._containerClip=null)}}function MY(t){var e;return t?[...null!==(e=t.lines)&&void 0!==e?e:[],t.line].filter(Boolean):[]}function wY(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;EN(t,{fillOpacity:h,strokeOpacity:c},{fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function EY(t,e,i,s){t&&(wY(t.startSymbol,e,i,s),MY(t).forEach((t=>wY(t,e,i,s))),wY(t.endSymbol,e,i,s))}function BY(t,e,i,s){t&&(wY(t.getTextShape(),e,i,s),wY(t.getBgRect(),e,i,s))}function PY(t,e,i,s){var n,r,a,o;t&&(EN(t,{fillOpacity:0,strokeOpacity:0},{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 RY(t,e,i,s){t&&(PY(t.startSymbol,e,i,s),MY(t).forEach((t=>PY(t,e,i,s))),PY(t.endSymbol,e,i,s))}function IY(t,e,i,s){t&&(PY(t.getTextShape(),e,i,s),PY(t.getBgRect(),e,i,s))}function OY(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;wY(t.startSymbol,s,r,n);const h=MY(t);h.forEach((t=>EN(t,{clipRange:1},{clipRange:0}))),h.forEach(((t,e)=>{const i=a/h.length;t.animate().wait(s+r+e*i).to({clipRange:1},i,n)})),wY(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;wY(t.getTextShape(),e,l,n),wY(t.getBgRect(),e,l,n)}))}function LY(t,e,i,s,n){EY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}function DY(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}function FY(t,e,i,s,n){wY(t,s,i,n),Y(e).forEach((t=>{BY(t,s,i,n)}))}function zY(t,e,i,s,n,r){var a;EY(t,n,s,r),wY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?BY(i,n,s,r):wY(i,n,s,r)}function HY(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;wY(t.startSymbol,n,o,r);const u=MY(t);u.forEach((t=>EN(t,{clipRange:1},{clipRange:0}))),u.forEach(((t,e)=>{const i=l/u.length;t.animate().wait(n+o+e*i).to({clipRange:1},i,r)})),wY(e,n+o+l,h,r),wY(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(wY(i.getTextShape(),n+o+l+h+c,d,r),wY(i.getBgRect(),n+o+l+c,d,r)):wY(i,n+o+l+c,d,r)}function jY(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?OY(t,e,s,r,a):"fadeIn"===i&&LY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?OY(t,e,s,n,a):"fadeIn"===i&&LY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){RY(t,s,i,n),Y(e).forEach((t=>{IY(t,s,i,n)}))}(t,e,i,s,n)}}function NY(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&&DY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&DY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){PY(t,s,i,n),Y(e).forEach((t=>{IY(t,s,i,n)}))}(t,e,i,s,n)}}function UY(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&&FY(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&FY(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){PY(t,s,i,n),Y(e).forEach((t=>{IY(t,s,i,n)}))}(t,e,i,s,n)}}function VY(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?zY(n,r,e,i,s,o):"callIn"===t&&HY(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?zY(n,r,e,i,s,a):"callIn"===t&&HY(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;RY(t,n,s,r),PY(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?IY(i,n,s,r):PY(i,n,s,r)}(n,r,e,t,i,s)}}const WY={type:"clipIn",duration:500,easing:"linear",delay:0},GY={type:"fadeIn",duration:500,easing:"linear",delay:0},YY={type:"callIn",duration:500,easing:"linear",delay:0},XY={type:"fadeOut",duration:500,easing:"linear",delay:0};class KY{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=H({},i,s),c=new uV(Object.assign(Object.assign({},h),{state:{panel:H({},YM,null!==(o=a[n])&&void 0!==o?o:X(a)),text:H({},YM,null!==(l=r[n])&&void 0!==l?l:X(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=H({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:H({},YM,null!==(a=r[s])&&void 0!==a?a:X(r)),text:H({},YM,null!==(o=n[s])&&void 0!==o?o:X(n))}})),this.setLabelPos(e,l)}))}}}class $Y extends TY{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=WY,this.defaultExitAnimation=XY}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;sw(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G($Y,KY);const qY=.001,ZY={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:xY.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]}},JY={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"}}},QY={interactive:!0,startSymbol:{visible:!1,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},endSymbol:{visible:!0,symbolType:"triangle",size:12,fill:"rgba(46, 47, 50)",lineWidth:0},label:{autoRotate:!0,position:AY.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]}},tX={interactive:!0,label:{position:SY.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}},eX={interactive:!0,label:{autoRotate:!0,position:AY.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}},iX={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"}},sX={left:{textAlign:"right",textBaseline:"middle"},insideLeft:{textAlign:"left",textBaseline:"middle"},right:{textAlign:"left",textBaseline:"middle"},insideRight:{textAlign:"right",textBaseline:"middle"},top:{textAlign:"center",textBaseline:"bottom"},insideTop:{textAlign:"center",textBaseline:"top"},bottom:{textAlign:"center",textBaseline:"top"},insideBottom:{textAlign:"center",textBaseline:"bottom"},middle:{textAlign:"center",textBaseline:"middle"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},nX={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 rX(){aX._animate=jY}CY(),aV(),fb();class aX extends $Y{markerAnimate(t){aX._animate&&this._animationConfig&&aX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},aX.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t,e){var i;return(wM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return EM(Math.abs(e),Math.PI/2,qY)||EM(Math.abs(e),3*Math.PI/2,qY)?BM(i,e,t):wM(e)?JY.postiveXAxis[t]:JY.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new lV({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==a?void 0:a.line),startSymbol:H({},YM,null==a?void 0:a.lineStartSymbol),endSymbol:H({},YM,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",aX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(aX.defaultAttributes.label)}}function oX(){lX._animate=NY}aX.defaultAttributes=ZY,CY(),yT(),fb();class lX extends TY{markerAnimate(t){lX._animate&&this._animationConfig&&lX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},lX.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=GY,this.defaultExitAnimation=XY}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},sX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=NM.polygon(Object.assign({points:e},i));n.states=H({},YM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",lX.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=H({},YM,null==i?void 0:i.area)),this._updateMarkLabels(lX.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}lX.defaultAttributes=tX,G(lX,KY),CY(),oV(),fb();class hX extends $Y{markerAnimate(t){hX._animate&&this._animationConfig&&hX._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},hX.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case AY.arcInnerStart:l=n;case AY.arcOuterStart:l=n;break;case AY.arcInnerEnd:l=r;case AY.arcOuterEnd:l=r;break;case AY.center:case AY.arcInnerMiddle:case AY.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return iX[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new hV({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,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:H({},YM,null==o?void 0:o.line),startSymbol:H({},YM,null==o?void 0:o.lineStartSymbol),endSymbol:H({},YM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",hX.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(hX.defaultAttributes.label)}}hX.defaultAttributes=QY,CY(),gC(),fb();class cX extends TY{markerAnimate(t){cX._animate&&this._animationConfig&&cX._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},cX.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=GY,this.defaultExitAnimation=XY}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case AY.center:h=(s+n)/2,c=(r+a)/2;break;case AY.arcInnerStart:h=s,c=r;break;case AY.arcOuterStart:h=n,c=r;break;case AY.arcInnerEnd:h=s,c=a;break;case AY.arcOuterEnd:h=n,c=a;break;case AY.arcInnerMiddle:h=s,c=(r+a)/2;break;case AY.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},iX[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;sw(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=NM.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=H({},YM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",cX.defaultAttributes.label)}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=H({},YM,null==o?void 0:o.area)),this._updateMarkLabels(cX.defaultAttributes.label)}isValidPoints(){return!0}}function dX(){uX._animate=VY}cX.defaultAttributes=eX,G(cX,KY),CY(),aV(),oV(),iM(),XC(),iT(),fb();class uX extends TY{markerAnimate(t){uX._animate&&this._animationConfig&&uX._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},uX.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=YY,this.defaultExitAnimation=XY,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return EM(Math.abs(s),Math.PI/2,qY)||EM(Math.abs(s),3*Math.PI/2,qY)?BM(t,s,n):wM(s)?nX.postiveXAxis[n]:nX.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,style:d,position:u=kY.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:H({},YM,null==p?void 0:p.textBackground),text:H({},YM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=H({},YM,null==p?void 0:p.itemContent));const v=wM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=NM.symbol(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"text"===n?o=new uV(Object.assign(Object.assign({},i),{state:{panel:H({},YM,null==s?void 0:s.textBackground),text:H({},YM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=NM.richtext(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"image"===n?(o=NM.image(Object.assign(Object.assign({},i),r)),o.states=H({},YM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=H({},YM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=EM(c,0,qY)||EM(d,0,qY),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=ew(e-u,t-d),o=ew(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(xX.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(xX.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===xX.focus||"focus"===o){const s=a.hasState(_X.focus);a.toggleState(_X.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[_X.unSelected,_X.unSelectedHover,_X.focus],t),this._setLegendItemState(e,_X.selected,t)})):(this._setLegendItemState(a,_X.selected,t),this._removeLegendItemState(a,[_X.unSelected,_X.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[_X.selected,_X.selectedHover,_X.focus],t),this._setLegendItemState(e,_X.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(_X.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(_X.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(bX.legendItemClick,a,t);i?(this._removeLegendItemState(a,[_X.selected,_X.selectedHover],t),this._setLegendItemState(a,_X.unSelected,t)):(this._setLegendItemState(a,_X.selected,t),this._removeLegendItemState(a,[_X.unSelected,_X.unSelectedHover],t))}else this._setLegendItemState(a,_X.selected,t),this._removeLegendItemState(a,[_X.unSelected,_X.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[_X.selected,_X.selectedHover],t),this._setLegendItemState(e,_X.unSelected,t))}))}this._dispatchLegendEvent(bX.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,_X.selected),this._removeLegendItemState(e,[_X.unSelected,_X.unSelectedHover])):(this._removeLegendItemState(e,[_X.selected,_X.selectedHover]),this._setLegendItemState(e,_X.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=mX,spaceRow:l=vX,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,C=0,T=0;const M=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||M.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,M.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),M.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=C+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=NM.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),C=this._handleStyle(x,t,e,i,s),T=oi(c);let M;!1===x.visible?(M=NM.group({x:0,y:0,cursor:null===(n=C.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(M,xX.item,t,M)):(M=NM.group(Object.assign({x:0,y:0},C.style)),this._appendDataToShape(M,xX.item,t,M,C.state)),M.id=`${null!=a?a:o}-${i}`,M.addState(e?_X.selected:_X.unSelected);const w=NM.group({x:0,y:0,pickable:!1});M.add(w);let E,B=0,P=0,I=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,I=R(v,"space",8);const s=NM.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,xX.itemShape,t,M,S.state),s.addState(e?_X.selected:_X.unSelected),w.add(s)}let O=0;if(d){const e=R(g,"size",10);E=NM.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,xX.focus,t,M),O=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=QM(Object.assign(Object.assign({x:P/2+I,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,xX.itemLabel,t,M,A.state),D.addState(e?_X.selected:_X.unSelected),w.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=QM(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,xX.itemValue,t,M,k.state),r.addState(e?_X.selected:_X.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-I-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),w.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-I-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),w.add(E));const z=w.AABBBounds,H=z.width();if("right"===f){const t=z.x2,e=z.x1;w.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 j=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:H+T[1]+T[3],U=this._itemHeightByUser||j+T[0]+T[2];return M.setAttributes({width:N,height:U}),E&&E.setAttribute("visible",!1),w.translateTo(-z.x1+T[3],-z.y1+T[0]),M}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new fX(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},H({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new fX(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new fG(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new fG(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=mX,spaceRow:o=vX}=n,l=this._itemsContainer,{space:h=yX,defaultCurrent:c=1}=r,d=CX(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=NM.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=mX,spaceRow:a=vX}=s,o=this._itemsContainer,{space:l=yX,defaultCurrent:h=1}=n,c=CX(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=NM.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=NM.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(yt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(yt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(_X.selected)?this._setLegendItemState(t,_X.selectedHover,e):this._setLegendItemState(t,_X.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===xX.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(bX.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(_X.unSelectedHover)||t.hasState(_X.selectedHover))&&(i=!0),t.removeState(_X.unSelectedHover),t.removeState(_X.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(_X.unSelectedHover)&&!t.hasState(_X.selectedHover)||(i=!0),t.removeState(_X.unSelectedHover),t.removeState(_X.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===xX.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(bX.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(bX.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!==xX.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(bX.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!==xX.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(bX.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(_X.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=H({},TX,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(_X.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var wX;function EX(t){return _(t)?t:[t,t]}function BX(t){return t?"ew-resize":"ns-resize"}MX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:mX,spaceRow:vX,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:yX,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"}(wX||(wX={})),AX();class PX extends MN{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:H({},PX.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=yt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=pG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=yt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=pG(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?yt(t+p,h,c):yt(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?yt(t+p,0,c-h):yt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:EX(d)[0],endValue:EX(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=NM.group({x:0,y:0});f.name=wX.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=NM.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),m.name=wX.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const y=NM.group({x:g?v:0,y:g?0:v});f.add(y);const _=NM.group({x:0,y:0});let b;if(_.name=wX.railContainer,this._railContainer=_,y.add(_),this._mainContainer=y,this._renderRail(_),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=NM.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=wX.endText,f.add(b)}this._renderTrack(_),h&&(this._renderHandlers(y),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=NM.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=wX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,f]=EX(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":BX(p)},r));if(v.name=wX.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=wX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":BX(p)},r));if(i.name=wX.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=wX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=yt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=NM.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=wX.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":BX(p);const y=this.calculatePosByValue(c,"start"),_=this.calculatePosByValue(d,e?"end":"start"),b=NM.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=wX.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return NM.symbol(t)}_renderHandlerText(t,e){return NM.text(this._getHandlerTextAttributes(t,e))}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":BX(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=NM.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=NM.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(this._startHandler&&this._startHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._startHandlerText&&this._startHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandler&&this._endHandler.addEventListener("pointerdown",this._onHandlerPointerdown),this._endHandlerText&&this._endHandlerText.addEventListener("pointerdown",this._onHandlerPointerdown),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=pG(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===wX.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===wX.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===wX.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===wX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}PX.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}}},kX(),AX();class RX extends SX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},RX.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:m,showTooltip:v,tooltip: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 IX(t="bottom"){let e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}RX.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"}}},kX(),AX(),cT();class OX extends SX{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},OX.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=NM.group({x:0,y:0});this._innerView.add(x);const S=new PX({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:IX(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 C=NM.path(Object.assign(Object.assign({x:0,y:k,path:A},y),{zIndex:0}));x.add(C);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))}}OX.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)"}},HC(),cM(),YT();let LX=class t extends MN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y,b,x;const{textType:S,text:A,subtextType:k,textStyle:C={},subtext:T,subtextStyle:M={},width:w,height:E,minWidth:B,maxWidth:P,minHeight:R,maxHeight:I,align:O,verticalAlign:L,padding:D=0}=this.attribute,F=oi(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),H=null!==(t=C.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==C.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=C;if("rich"===S||p(C.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:w)&&void 0!==e?e:0,height:null!=H?H:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:I,maxWidth:null!=l?l:g,textConfig:null!==(i=C.character)&&void 0!==i?i:A},C);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},XM),C),x:h,y:c,width:null!==(s=null!=t?t:w)&&void 0!==s?s:0,height:null!=H?H:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:I,maxWidth:null!=l?l:g,textConfig:[]},C);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(A)?A:[A],whiteSpace:"normal"},C),{maxLineWidth:null!==(r=null!==(n=C.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:w,heightLimit:null!==(a=C.height)&&void 0!==a?a:I,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const j=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=M,v=Math.max(Number.MIN_VALUE,I-j);if("rich"===k||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=M.character)&&void 0!==h?h:T},M);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},XM),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},M);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(T)?T:[T],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:j}),"text"))}const U=this._subTitle?this._subTitle.AABBBounds.height():0,V=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,V),G=j+(null!==(f=M.height)&&void 0!==f?f:U);if(p(w)&&(W=w),p(E)&&(G=E),p(B)&&WP&&(W=P),p(R)&&GI&&(G=I),z.setAttributes({width:W,height:G,boundsPadding:F}),this._mainTitle){if(p(O)||p(C.align)){const t=C.align?C.align:O,e=null!==(m=C.width)&&void 0!==m?m:W;"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t?(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=C.verticalAlign?C.verticalAlign:L,e=null!=H?H:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(y=null!==(v=M.width)&&void 0!==v?v:C.width)&&void 0!==y?y:W;"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t?(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=this._mainTitle?p(H)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),H):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=M.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t?(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};LX.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 DX={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"}}};HC(),cM(),YT();let FX=class extends MN{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=H({},R(DX,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=QM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=qM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,f=c/2,m=g**2+1,v=2*f*g,y=f**2-l**2,_=2*(g*((-v+Math.sqrt(v**2-4*m*y))/(2*m))+f),b=(_-c)/h.length;k(_)&&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 zX extends Wg{constructor(t){super(t)}}var HX,jX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(HX||(HX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(jX||(jX={}));class NX extends MN{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},NX.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"},NX.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"},NX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},NX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},NX.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 zX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new zX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new zX(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(HX.OnPlay)},this.pause=()=>{this._dispatchEvent(HX.OnPause)},this.forward=()=>{this._dispatchEvent(HX.OnForward)},this.backward=()=>{this._dispatchEvent(HX.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()}}NX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},NX.defaultAttributes={[jX.Start]:{},[jX.Pause]:{},[jX.Backward]:{},[jX.Forward]:{}};const UX={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},VX=[200,10];var WX,GX;!function(t){t.Default="default",t.Reverse="reverse"}(WX||(WX={})),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"}(GX||(GX={}));const YX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===WX.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===WX.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),XX=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===WX.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===WX.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),KX=t=>"top"===t||"bottom"===t;class $X extends MN{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},$X.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Yt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:k(i)?i:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1},disableTriggerEvent:this.attribute.disableTriggerEvent};if(KX(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:VX[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:VX[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 PX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=KX(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new NX(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=KX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:VX[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(KX(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:KX(this._orient)?t+s:(this._size.width-r)/2,y:KX(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:KX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:KX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:KX(this._orient)?t+s:(this._size.width-r)/2,y:KX(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function qX(){AX(),HC(),iM()}$X.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({},UX),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},UX),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},UX),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},UX),{key:"backward",position:"start"})}},qX();class ZX extends $X{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:H({},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:WX.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(HX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(HX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(HX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(HX.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(GX.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(YX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||XX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===WX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(GX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(GX.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(GX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(GX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(GX.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(GX.change),this.dispatchCustomEvent(GX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var JX,QX=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())}))};qX();class tK extends $X{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(HX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(HX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(HX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(HX.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(GX.change))},this.play=()=>QX(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(GX.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(GX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(GX.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(GX.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(GX.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushActive="brushActive",t.brushClear="brushClear"}(JX||(JX={}));const eK={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],resetTrigger:"pointerupoutside",hasMask:!0,brushMode:"single",brushType:"rect",brushStyle:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",strokeWidth:2},brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:10,interactiveRange:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},iK=5;const sK={debounce:St,throttle:At};HC(),yT();let nK=class t extends MN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushEventStage=null,this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=eK.updateTrigger,endTrigger:i=eK.endTrigger,brushMoved:s=!0}=this.attribute,n=this.stage;n&&(Y(e).forEach((t=>n.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>n.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos])},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:sK[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(JX.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const t=this.stage;if(!t)return;this._brushEventStage=t;const{trigger:e=eK.trigger,resetTrigger:i=eK.resetTrigger}=this.attribute;Y(e).forEach((e=>t.addEventListener(e,this._onBrushStart))),Y(i).forEach((e=>t.addEventListener(e,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(JX.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(JX.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=iK}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(JX.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(JX.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchBrushEvent(JX.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=iK}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(JX.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(JX.brushClear,t)):Math.abs(r-s)e.removeEventListener(t,this._onBrushStart))),Y(s).forEach((t=>e.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents(e),this._brushEventStage=null}_releaseBrushUpdateEvents(t){var e;if(void 0===t&&(t=null!==(e=this._brushEventStage)&&void 0!==e?e:this.stage),!t)return;const{updateTrigger:i=eK.updateTrigger,endTrigger:s=eK.endTrigger}=this.attribute;Y(i).forEach((e=>t.removeEventListener(e,this._onBrushingWithDelay))),Y(s).forEach((e=>t.removeEventListener(e,this._onBrushEnd)))}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=NM.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Re(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.ythis._brushMaskAABBBoundsDict[t].empty()))}};nK.defaultAttributes=eK;const rK=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return H(t,...e,{shape:i.every(u)?void 0:H({},...i),key:s.every(u)?void 0:H({},...s),value:n.every(u)?void 0:H({},...n)})},aK=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}},oK={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:WM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:WM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},lK=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];HC(),IT(),iM(),cM(),YT();let hK=class t extends MN{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:H({},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=oi(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",H({symbolType:"circle"},u.shape,{visible:MM(u)&&MM(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:MM(u)&&MM(u.value)},aK(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:MM(u)&&MM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:MM(u)&&MM(u.value)},aK(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},XM),u.value),visible:MM(u)&&MM(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=MM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=MM(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]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!MM(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)+(MM(n.key)?r+n.key.spacing:0)+(MM(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&&(tw(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:MM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),tw(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(MM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ch(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(MM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},aK(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},aK(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},XM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(MM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},aK(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},aK(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=>lK.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)&&MM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=MM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=$M(d),y=$M(u);let _=0;if(MM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),_=Math.max(_,e)}if(MM(u)){const{width:t,height:e}=y.quickMeasure(u.text);h.push(t),_=Math.max(_,e)}f&&Bc[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return rK({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return rK({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};hK.defaultAttributes=oK;class cK extends ZV{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{Dj(this.getOrient())?gU(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):gU(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=fB({},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 za(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Ez(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=yi.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=>pU(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=>pU(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,KV),t}transformScaleDomain(){}}cK.type=r.cartesianTimeAxis,cK.specKey="axes",cK.builtInTheme={axis:RV,axisX:IV,axisY:OV};class dK extends ZV{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new ME}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,KV),t}transformScaleDomain(){}}dK.type=r.cartesianLogAxis,dK.specKey="axes",dK.builtInTheme={axis:RV,axisLinear:qV,axisX:IV,axisY:OV},G(dK,GV);class uK extends ZV{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new wE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,KV),t}transformScaleDomain(){}}uK.type=r.cartesianSymlogAxis,uK.specKey="axes",uK.builtInTheme={axis:RV,axisLinear:qV,axisX:IV,axisY:OV},G(uK,GV);class pK extends Lj{constructor(){super(...arguments),this.type=PE.area,this.transformerConstructor=dG,this._sortDataByAxis=!1}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),Qj)})}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(pK.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===DH?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return XE(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return XE(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[tP]},"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(vj(null===(e=bB.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),yj("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),yj("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Oj(this);this._symbolMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),yj("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new lG(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(){super.onLayoutEnd(),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}pK.type=PE.area,pK.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},pK.mark=hG,pK.transformerConstructor=dG,G(pK,tN);class gK extends SW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),XF(t)}}class fK extends yW{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="area",this.seriesType=PE.area}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}fK.type="area",fK.seriesType=PE.area,fK.transformerConstructor=gK,G(fK,TW);function mK(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 vK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:mK(t,e)}),yK=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:mK(t,e)}),_K={type:"fadeIn"},bK={type:"growCenterIn"};function xK(t,e){if(!1===e)return{};switch(e){case"fadeIn":return _K;case"scaleIn":return bK;default:return vK(t)}}class SK extends Qz{constructor(){super(...arguments),this.type=SK.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}SK.type="rect";const AK=()=>{KT(),IT(),FN("rect",XG),bB.registerMark(SK.type,SK),w_.registerBuiltInAnimate("growHeightIn",NL),w_.registerBuiltInAnimate("growHeightOut",UL),w_.registerBuiltInAnimate("growWidthIn",nD),w_.registerBuiltInAnimate("growWidthOut",rD),w_.registerBuiltInAnimate("growCenterIn",zL),w_.registerBuiltInAnimate("growCenterOut",HL),bB.registerGraphicComponent("rect",mg)},kK=Object.assign(Object.assign({},hj),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function CK(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=nB(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[cj]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):XE(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[dj]):XE(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=XE(this._dataToPosX(t),e,i),n=XE(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[uj]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):XE(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[pj]):XE(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=XE(this._dataToPosY(t),e,i),n=XE(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),wK)})}getStatisticFields(){var t;const e=super.getStatisticFields(),i="horizontal"===this.direction?this.getYAxisHelper():this.getXAxisHelper(),s="horizontal"===this.direction?this._fieldY:this._fieldX,n=null===(t=null==i?void 0:i.getScale)||void 0===t?void 0:t.call(i,0);return n&&Iw(n.type)&&s.forEach((t=>{const i=e.find((e=>e.key===t));i?i.operations.includes("values")||i.operations.push("values"):e.push({key:t,operations:["values"]})})),e}initMark(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},EK.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:xj(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(EK.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.initRectMarkStyle()}initRectMarkStyle(){var t;if(!this._barMark)return;const e="vertical"===this.direction?this._xAxisHelper:this._yAxisHelper,i=null===(t=null==e?void 0:e.getScale)||void 0===t?void 0:t.call(e,0);i&&("band"===i.type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle())}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($P(this._option.dataSet,"addVChartProperty",WH),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};$P(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new za(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:rj.bind(this),call:aj}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new Ez(this._option,n)}init(t){super.init(t),this.initRectMarkStyle()}_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=pj,s=uj,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=dj,s=cj,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=bP(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)CK(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=XE(this[r](t),l,i),u=XE(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!KE(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius){const t=this._barMark.getMarkConfig();return void(!t.clip&&u(t.clipPath)||this._barMark.setMarkConfig({clip:!1,clipPath:[]}))}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),a="vertical"===this.direction;this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=!!this._shouldDoPreCalculate();t&&this._calculateStackRectPosition(a);const e=[];return this._forEachStackGroup((i=>{let s=1/0,o=-1/0,l=1/0,h=-1/0,c=!1,u=1/0,g=-1/0;i.values.forEach((e=>{const i=e[QB],n=e[tP],r=e[eP],d=e[iP];if(s=Math.min(s,i,n),o=Math.max(o,i,n),t){const t=e[a?uj:cj],i=e[a?pj:dj];l=Math.min(l,t,i),h=Math.max(h,t,i)}p(r)&&p(d)&&(c=!0,u=Math.min(u,r,d),g=Math.max(g,r,d))}));const f=Object.assign(Object.assign(Object.assign({},i.values[0]),{[QB]:s,[tP]:o}),c?{[eP]:u,[iP]:g}:void 0),m="horizontal"===this.direction?{x:t?l:this._getBarXStart(f,n),x1:t?h:this._getBarXEnd(f,n),y:this._getPosition(this.direction,f),height:this._getBarWidth(this._yAxisHelper)}:{y:t?l:this._getBarYStart(f,r),y1:t?h:this._getBarYEnd(f,r),x:this._getPosition(this.direction,f),width:this._getBarWidth(this._xAxisHelper)};e.push(mg(Object.assign(Object.assign({},m),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(m,f,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),e}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>XE(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>XE(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=K(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Oj(this);this._barMark.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),yj(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i;const s=this._groups?this._groups.fields.length:1,n=u(e)?s:Math.min(s,e),r=p(this._spec.barWidth)&&n===s,a=r&&"number"==typeof this._spec.barWidth&&"string"!=typeof this._spec.barMinWidth&&"string"!=typeof this._spec.barMaxWidth||null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,n-1),o=null!=a?a:6,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=!t.isContinuous||u(a)||r?o:.5*o;return r&&(c=nB(this._spec.barWidth,o)),l&&(c=Math.max(c,nB(this._spec.barMinWidth,o))),h&&(c=Math.min(c,nB(this._spec.barMaxWidth,o))),c}_getPosition(t,e,i,s){var n,r,a,o,l,h;let c,d,g;"horizontal"===t?(c=this.getYAxisHelper(),d="height",g="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(c=this.getXAxisHelper(),d="width",g="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const f=c.getScale(0),m=this._groups?this._groups.fields.length:1,v=u(i)?m:Math.min(m,i),y=null!==(r=null===(n=c.getBandwidth)||void 0===n?void 0:n.call(c,v-1))&&void 0!==r?r:6,_=v===m?this._barMark.getAttribute(d,e):y;if(v>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 h=t[r],d=null!==(o=null===(a=c.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=nB(null!==(l=i[r-1])&&void 0!==l?l:X(i),y),g=d.indexOf(e[h]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return f.scale(e[t[0]])+(null!==(h=c.getBandwidth(0))&&void 0!==h?h:y)/2-s/2+n}const b=Iw(f.type||"band");return g(e,v)+.5*(y-_)+(b?-y/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}EK.type=PE.bar,EK.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},EK.mark=kK,EK.transformerConstructor=MK;const BK=()=>{dW(),AK(),bB.registerAnimation("bar",((t,e)=>({appear:xK(t,e),enter:vK(t,!1),exit:yK(t,!1),disappear:{duration:fH.disappear.duration}}))),DV(),JV(),bB.registerSeries(EK.type,EK)};class PK extends SW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),XF(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 RK extends yW{constructor(){super(...arguments),this.transformerConstructor=PK,this.type="bar",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}RK.type="bar",RK.seriesType=PE.bar,RK.transformerConstructor=PK,G(RK,TW);const IK=[10,20],OK=Pw.Linear,LK="circle",DK=Pw.Ordinal,FK=["circle","square","triangle","diamond","star"],zK=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},HK=Object.assign(Object.assign({},hj),{point:{name:"point",type:"symbol"}});class jK extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}const NK={sizeField:!0};class UK extends Lj{constructor(){super(...arguments),this.type=PE.scatter,this.transformerConstructor=jK,this._invalidType="zero"}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),NK)})}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=`${WB}_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=`${WB}_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:OK,defaultRange:IK},"size")}getShapeAttribute(t,e){return u(e)?LK:y(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:DK,defaultRange:FK},"shape")}initMark(){this._symbolMark=this._createMark(UK.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:xj(this._spec,UK.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Oj(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(vj(null===(i=bB.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),yj("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:LK},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}_updateSymbolGraphicPosition(){var t;const e=null===(t=this._symbolMark)||void 0===t?void 0:t.getGraphics();e&&e.length&&e.forEach((t=>{var e,i;const s=null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0],n=this.dataToPosition(s);n&&t&&t.setAttributes({x:n.x,y:n.y})}))}_ensureLabelGraphicPostMatrix(){var t,e;const i=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();return i&&!i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge}),i}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._updateSymbolGraphicPosition();const s=this._ensureLabelGraphicPostMatrix();s&&s.scale(e,e,i)}handlePan(t){const{delta:e}=t;if(0===(null==e?void 0:e[0])&&0===(null==e?void 0:e[1]))return;this._updateSymbolGraphicPosition();const i=this._ensureLabelGraphicPostMatrix();i&&i.translate(e[0],e[1])}onLayoutEnd(){var t,e,i;super.onLayoutEnd(),this._updateSymbolGraphicPosition();const s=null===(e=null===(t=this._labelMark)||void 0===t?void 0:t.getComponent())||void 0===e?void 0:e.getComponent();(null==s?void 0:s.attribute.postMatrix)&&s.setAttributes({postMatrix:new Ge});const n=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent();n&&n.renderInner()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}UK.type=PE.scatter,UK.mark=HK,UK.builtInTheme={scatter:{point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},UK.transformerConstructor=jK;const VK=()=>{XN(),bB.registerAnimation("scatter",((t,e)=>Object.assign({appear:zK(0,e)},mH))),DV(),JV(),bB.registerSeries(UK.type,UK)};class WK extends SW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class GK extends yW{constructor(){super(...arguments),this.transformerConstructor=WK,this.type="scatter",this.seriesType=PE.scatter}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}GK.type="scatter",GK.seriesType=PE.scatter,GK.transformerConstructor=WK,G(GK,TW);class YK extends Rj{constructor(){super(...arguments),this.type=PE.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=`${WB}_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 XK=(t,e)=>{const i=d(e)?e():e,s=t.features;return s&&s.forEach(((t,e)=>{var s,n;t[KB]=e;const r=null===(s=t.properties)||void 0===s?void 0:s[i.nameProperty],a=null===(n=i.nameMap)||void 0===n?void 0:n[`${r}`];t[mP]=a||r})),s};class KK extends ZH{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 $K extends Qz{constructor(){super(...arguments),this.type=$K.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}$K.type="path";const qK=()=>{bB.registerMark($K.type,$K),KT(),cT(),bB.registerGraphicComponent("path",hg)},ZK=Object.assign(Object.assign({},hj),{area:{name:"area",type:"path"}});class JK{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ua(i,e):ja[i]?(Ha[i]||(Ha[i]=Ua(i,ja[i])),Ha[i]):null}(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class QK{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}}class t${constructor(){this._lastScale=0}clearZoom(){this._lastScale=0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function e$(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:QK}:bM(e)||xM(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:t$}:null}const i$={debounce:St,throttle:At};class s${constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=bM(this._renderMode)||xM(this._renderMode),e$(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return e$(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:WP.chart,consume:!1}];l.on(...c,i$[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,i$[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||e$(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||e$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:WP.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:WP.chart,consume:!1}];l.on(...c,i$[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,i$[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){e$(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||e$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:WP.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:WP.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||e$(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||e$(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:WP.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=i$[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=i$[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:WP.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:WP.chart,source:VP.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:WP.chart,source:VP.chart},this._handleDragMouseUp)}))}}class n$ extends RU{constructor(){var e,i;super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:(e=this.type,i=this.id,`${WB}_${i}_${e}`),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=fB(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))}))}}initProjection(){var t;this._projection=new JK(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===PE.map||e.type===PE.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),Tw(this._regions,(t=>{var e;if(t.type===PE.map||t.type===PE.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ge})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==PE.map&&e.type!==PE.pictogram||t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[mP],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!V(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}n$.type=r.geoCoordinate,G(n$,s$);const r$=()=>{bB.registerComponent(n$.type,n$)};class a$ extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class o$ extends YK{constructor(){super(...arguments),this.type=PE.map,this.transformerConstructor=a$,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 !`),ZP.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),$P(this._dataSet,"copyDataView",sR),$P(this._dataSet,"map",XK),$P(this._dataSet,"lookup",VH);const s=ZP.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new za(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.copyDataView}).transform({type:"map",options:()=>({nameMap:this._nameMap,nameProperty:this._nameProperty})}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:mP,fields:()=>this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new Ez(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(o$.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:xj(this._spec,o$.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:qB])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:qB]):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(vj(null===(t=bB.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),yj("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new KK(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[KB]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[KB],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ge}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ge}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:k(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return KB}getActiveMarks(){return[this._pathMark]}}o$.type=PE.map,o$.mark=ZK,o$.builtInTheme={map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}}},o$.transformerConstructor=a$;const l$=`${WB}_waterfall_default_seriesField`,h$=(t,e)=>{if(!t||0===t.length)return t;const i=d(e)?e():e,{indexField:s,total:n,groupData:r,calculationMode:a}=i,o=[],{dimensionValues:l,dimensionData:h}=r().latestData;let c=Array.from(l[s]);"decrease"===a&&(c=c.reverse());let u={start:0,end:0,positive:0,negative:0,lastIndex:null};return c.forEach(((t,e)=>{const s={start:u.end,end:u.end,lastIndex:u.lastIndex,lastEnd:u.end,index:t,isTotal:!1,positive:u.end,negative:u.end},r=!0===i.stackInverse?h[t].reverse():h[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[oP]=!0:delete t[oP]})),r.length>1){const a=t=>{if(n&&"end"!==n.type){if("field"===n.type||"custom"===n.type){return!!t[n.tagField]}}else if(e===c.length-1)return!0;return!1};if(r.some((t=>a(t))))return u=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach(((t,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=c$([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}=d$(f,i,s,n,u);i.start=m,i.end=v;let y=m,_=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+y,y=se(y,e)):(t[c]=+_,_=se(_,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,s,o,u,c,e,i,a),void o.push(s)}u=c$(r,t,s,o,u,c,e,i),o.push(s)})),o};function c$(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}=d$(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===l$)&&(t[l$]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function d$(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?gM("total.collectCountField error"):n=e[a].start;o<0?gM("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=se(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const u$=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=d(e)?e():e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?[o,...t]:[...t,o]},p$={type:"fadeIn"},g$={type:"growCenterIn"};function f$(t,e){switch(e){case"fadeIn":return p$;case"scaleIn":return g$;default:return vK(t,!1)}}class m$ extends Qz{constructor(){super(...arguments),this.type=m$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return ag(t)}}m$.type="rule";const v$=()=>{bB.registerMark(m$.type,m$),KT(),iT(),bB.registerGraphicComponent("line",ag)},y$=Object.assign(Object.assign({},kK),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),_$=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:b$(t.map((t=>t.latestData)).flat(),e.fields,i)}};function b$(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)=>b$(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class x${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 za(e instanceof Fa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),$P(e,"dimensionTree",_$),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 S$ extends MK{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const A$={rect:E$,symbol:M$,arc:P$,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=M$(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:R$,line:I$,area:I$,rect3d:E$,arc3d:P$,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function k$(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=A$[t])&&void 0!==i?i:A$.point;return e.series.type===PE.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=T$(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:O$(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function C$(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==PE.sankey){const{formatFunc:t,args:n}=NH(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function T$(t){return d(t)?e=>t(e.data):t}function M$(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=T$(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:w$(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function w$(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function E$(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=T$(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:B$(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function B$(t){const e=[{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"]}}];return e}function P$(t){var e;const{labelSpec:i}=t,s=null!==(e=T$(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 R$(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=C$(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),Jg(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 I$(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[{index:0,[qB]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function O$(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}const L$={calculationMode:!0};class D$ extends EK{constructor(){super(...arguments),this.type=PE.waterfall,this.transformerConstructor=S$,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&SP(t,e)}}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),L$)})}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new x$(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=l$)}getSeriesKeys(){return this._seriesField===l$?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),$P(this._dataSet,"waterfallFillTotal",u$),$P(this._dataSet,"waterfall",h$),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",stackInverse:this.getRegion().getStackInverse()}}},!1));const e=nR(this.getViewData(),this._dataSet,{name:`${WB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new Ez(this._option,e),e.transform({type:"waterfall",options:()=>{var t;return{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:QB,endAs:tP,total:this._spec.total,calculationMode:null!==(t=this._spec.calculationMode)&&void 0!==t?t:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}}},!1),e.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Oj(this);this._barMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),yj("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),yj("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){super.initMark();const t=this._createMark(D$.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return R$(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?XE(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):XE(s([t[e]],{bandPosition:this._bandPosition}))}_isCategoryAxisInverse(){var t,e,i,s;return"horizontal"===this._direction?null===(e=null===(t=this._yAxisHelper)||void 0===t?void 0:t.isInverse)||void 0===e?void 0:e.call(t):null===(s=null===(i=this._xAxisHelper)||void 0===i?void 0:i.isInverse)||void 0===s?void 0:s.call(i)}_getLeaderLineCategoryPos(t,e){const i=t?e?0:1:e?1:0;return!!this._isCategoryAxisInverse()?1-i:i}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,y1:t=>this.totalPositionY(t,"index",this._getLeaderLineCategoryPos(!1,e))},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",this._getLeaderLineCategoryPos(!0,e)):0,x1:t=>this.totalPositionX(t,"index",this._getLeaderLineCategoryPos(!1,e)),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&KE([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}D$.type=PE.waterfall,D$.mark=y$,D$.builtInTheme={waterfall:{seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{visible:!0,offset:12,position:"withChange",style:{fill:"black",fontSize:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}}},D$.transformerConstructor=S$;const F$=()=>{v$(),AK(),bB.registerAnimation("waterfall",((t,e)=>({appear:f$(t,e),enter:vK(t,!1),exit:yK(t,!1),disappear:{duration:fH.disappear.duration}}))),_H(),DV(),JV(),bB.registerSeries(D$.type,D$)},z$=`${WB}_BOX_PLOT_OUTLIER_VALUE`;var H$;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(H$||(H$={}));const j$=(t,e)=>{const i=[],s=d(e)?e():e,{outliersField:n,dimensionField:r,seriesField:a}=s;return(t[0].latestData||[]).forEach((t=>{const e=t[n],s=_(e)?e:[e];i.push(...s.map((e=>{const i={[z$]:e};return r.forEach((e=>{i[e]=t[e]})),p(a)&&(i[a]=t[a]),i})))})),i};class N$ extends ZH{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===H$.OUTLIER)return this.series.getOutliersField();if(t===H$.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case H$.MIN:return this.series.getMinField();case H$.MAX:return this.series.getMaxField();case H$.MEDIAN:return this.series.getMedianField();case H$.Q1:return this.series.getQ1Field();case H$.Q3:return this.series.getQ3Field();case H$.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===H$.OUTLIER)return e[z$];if(t===H$.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case H$.MIN:return e[this.series.getMinField()];case H$.MAX:return e[this.series.getMaxField()];case H$.MEDIAN:return e[this.series.getMedianField()];case H$.Q1:return e[this.series.getQ1Field()];case H$.Q3:return e[this.series.getQ3Field()];case H$.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[z$])}getDefaultContentList(t){return[{key:this.getContentKey(H$.OUTLIER),value:this.getContentValue(H$.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(H$.MAX),value:this.getContentValue(H$.MAX)},{key:this.getContentKey(H$.Q3),value:this.getContentValue(H$.Q3)},{key:this.getContentKey(H$.MEDIAN),value:this.getContentValue(H$.MEDIAN)},{key:this.getContentKey(H$.Q1),value:this.getContentValue(H$.Q1)},{key:this.getContentKey(H$.MIN),value:this.getContentValue(H$.MIN)},{key:this.getContentKey(H$.SERIES_FIELD),value:this.getContentValue(H$.SERIES_FIELD)}]}}const U$=new Set(["fill","fillOpacity","stroke","strokeOpacity","opacity","lineWidth","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","visible","pickable","cursor"]);class V$ extends Qz{constructor(){super(...arguments),this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.context.diffState!==sz.enter&&t.context.diffState!==sz.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states,e))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_getInheritedStyleAttrs(t){let e=null;return Object.keys(t).forEach((i=>{U$.has(i)&&(e=null!=e?e:{},e[i]=t[i])})),e}_getInheritedStyleAttrsMap(t,e){const i=this._getInheritedStyleAttrs(e);return i?t.getSubGraphic().reduce(((t,e)=>(e&&(t[e.name]=Object.assign({},i)),t)),{}):null}_syncInheritedStyleAttrs(t,e){const i=this._getInheritedStyleAttrs(e);i&&t.getSubGraphic().forEach((t=>{null==t||t.setAttributes(Object.assign({},i))}))}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?H(r,i):i}}));const a=this._getInheritedStyleAttrsMap(t,e);return a&&(r=r?H(a,r):a),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Zp(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=e.onAttributeUpdate.bind(e);e.onAttributeUpdate=t=>{i(t),2===(null==t?void 0:t.type)&&this._syncInheritedStyleAttrs(e,e.attribute)};const s=this._subMarks;if(s){const t=[];Object.keys(s).forEach((e=>{const i=bB.createGraphicComponent(s[e].type,Object.assign({},s[e].defaultAttributes));i&&(t.push(i),i.name=e,i.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const W$=()=>{bB.registerGraphicComponent("glyph",Zp),KT(),FC()},G$=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],Y$=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class X$ extends V${constructor(){super(...arguments),this.type=X$.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=G$,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=Y$,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}X$.type="boxPlot";const K$=Object.assign(Object.assign({},hj),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),$$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},q$=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},Z$=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),J$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,y,_,b,x,S,A,C;if(i&&k(i.center))return i.center;let T,M,w,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=Z$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,M=null===(h=null===(l=null===(o=null===(a=Z$(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,w=null===(p=null===(u=null===(d=null===(c=Z$(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=Z$(t,"box").attribute.width,i=Z$(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=Z$(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,M=null===(b=null===(_=null===(y=null===(v=Z$(t,"max"))||void 0===v?void 0:v.attribute)||void 0===y?void 0:y.points)||void 0===_?void 0:_[0])||void 0===b?void 0:b.y,w=null===(C=null===(A=null===(S=null===(x=Z$(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===C?void 0:C.y;const e=Z$(t,"box").attribute.height,i=Z$(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(M)&&k(w)?(M+w)/2:k(w)?w:k(M)?M:NaN},Q$=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,y,_,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=Z$(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=Z$(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=Z$(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;_=i,y=i+e;const c=(null===(l=Z$(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=Z$(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=Z$(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=Z$(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=Z$(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;_=i,y=i+e;const s=(null===(f=Z$(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=Z$(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(y)&&k(_)?(y+_)/2:k(_)?_:k(y)?y:NaN};class tq extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return $$(J$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class eq extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return q$(J$)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class iq extends tq{computeAttribute(){return $$(Q$)(this.target,this.params,this.params.options)}}class sq extends eq{computeAttribute(){return q$(Q$)(this.target,this.params,this.params.options)}}class nq extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}const rq={boxWidth:!0,boxMinWidth:!0,boxMaxWidth:!0,boxGapInGroup:!0};class aq extends Lj{constructor(){super(...arguments),this.type=PE.boxPlot,this.transformerConstructor=nq,this._bandPosition=0}getMinField(){return this._minField}getMaxField(){return this._maxField}getQ1Field(){return this._q1Field}getMedianField(){return this._medianField}getQ3Field(){return this._q3Field}getOutliersField(){return this._outliersField}getShaftShape(){return this._shaftShape}getBoxFillColor(){return this._boxFillColor}getStrokeColor(){return this._strokeColor}getOutliersStyle(){return this._outliersStyle}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),rq)})}setAttrFromSpec(){var t,e,i,s,n,r,a;super.setAttrFromSpec();const o=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this._minField=this._spec.minField,this._maxField=this._spec.maxField,this._q1Field=this._spec.q1Field,this._medianField=this._spec.medianField,this._q3Field=this._spec.q3Field,this._outliersField=this._spec.outliersField,this._lineWidth=null!==(i=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(aq.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(aq.mark.outlier,{key:KB,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return nB(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return nB(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.initBoxPlotMarkStyle()}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=>XE(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>XE(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>XE(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>XE(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>XE(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:t=>XE(e(this.getDatumPositionValues(t,z$),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>XE(e(this.getDatumPositionValues(t,z$),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;$P(this._dataSet,"foldOutlierData",j$),$P(this._dataSet,"addVChartProperty",WH);const t=new za(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${WB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:()=>({dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField})}),t.transform({type:"addVChartProperty",options:{beforeCall:rj.bind(this),call:aj}},!1),this._outlierData=new Ez(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t,e;if(this._autoBoxWidth)return this._autoBoxWidth;const i="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,s=this._groups?this._groups.fields.length:1,n=null!==(e=null===(t=i.getBandwidth)||void 0===t?void 0:t.call(i,s-1))&&void 0!==e?e:Math.max(this._boxWidth,this._shaftWidth);let r=n;return p(this._spec.boxWidth)&&(r=nB(this._spec.boxWidth,n)),p(this._spec.boxMinWidth)&&(r=Math.max(r,nB(this._spec.boxMinWidth,n))),p(this._spec.boxMaxWidth)&&(r=Math.min(r,nB(this._spec.boxMaxWidth,n))),this._autoBoxWidth=r,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r,a,o;let l,h,c;"horizontal"===t?(l=this.getYAxisHelper(),h="boxHeight",c=this.dataToPositionY.bind(this)):(l=this.getXAxisHelper(),h="boxWidth",c=this.dataToPositionX.bind(this));const d=l.getScale(0),u=this._groups?this._groups.fields.length:1,g=null!==(s=null===(i=l.getBandwidth)||void 0===i?void 0:i.call(l,u-1))&&void 0!==s?s:Math.max(this._boxWidth,this._shaftWidth),f=this._boxPlotMark.getAttribute(h,e);if(u>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let s=0,h=0;for(let o=t.length-1;o>=1;o--){const c=t[o],d=null!==(r=null===(n=l.getScale(o))||void 0===n?void 0:n.domain())&&void 0!==r?r:[],u=d.length,p=nB(null!==(a=i[o-1])&&void 0!==a?a:X(i),g),m=d.indexOf(e[c]);o===t.length-1?(s+=u*f+(u-1)*p,h+=m*(f+p)):(h+=m*(s+p),s+=s+(u-1)*p)}return d.scale(e[t[0]])+(null!==(o=l.getBandwidth(0))&&void 0!==o?o:Math.max(this._boxWidth,this._shaftWidth))/2-s/2+h+f/2}const m=Iw(d.type||"band");return c(e)+.5*g+(m?-g/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=H({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Oj(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=bB.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(yj("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(vj(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(vj(null===(a=bB.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new N$(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}aq.type=PE.boxPlot,aq.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},aq.mark=K$,aq.transformerConstructor=nq;const oq=()=>{W$(),iT(),IT(),bB.registerGraphicComponent("line",(t=>ag(t))),bB.registerGraphicComponent("rect",(t=>mg(t))),bB.registerMark(X$.type,X$),XN(),yH(),DV(),JV(),w_.registerBuiltInAnimate("boxplotScaleIn",tq),w_.registerBuiltInAnimate("boxplotScaleOut",eq),w_.registerBuiltInAnimate("barBoxplotScaleIn",iq),w_.registerBuiltInAnimate("barBoxplotScaleOut",sq),bB.registerSeries(aq.type,aq)};class lq extends Qz{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=lq.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?jg(t):Jg(t)}}lq.type="text";const hq=()=>{bB.registerMark(lq.type,lq),KT(),cM(),YT(),bB.registerGraphicComponent("text",Jg),bB.registerGraphicComponent("richtext",jg)};class cq extends ZH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const dq=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),uq={type:"fadeIn"},pq=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function gq(t,e){return"fadeIn"===e?uq:dq(t)}const fq=Object.assign(Object.assign({},kK),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class mq extends MK{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 vq extends EK{constructor(){super(...arguments),this.type=PE.rangeColumn,this._barMarkType="rect",this._barName=PE.bar,this.transformerConstructor=mq}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(vq.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:xj(this._spec,vq.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(vq.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(vq.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Oj(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(vj(null===(i=bB.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),yj("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),yj("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(vj(null===(n=bB.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),yj("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new cq(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)}}vq.type=PE.rangeColumn,vq.mark=fq,vq.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},vq.transformerConstructor=mq;const yq=()=>{AK(),hq(),bB.registerAnimation("rangeColumn",((t,e)=>({appear:gq(t,e),enter:dq(t),exit:pq(t),disappear:{duration:fH.disappear.duration}}))),_H(),DV(),JV(),bB.registerSeries(vq.type,vq)};var _q,bq;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(_q||(_q={})),function(t){t.middle="middle",t.start="start",t.end="end"}(bq||(bq={}));class xq extends ZH{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const Sq=Object.assign({},hG);class Aq extends pK{constructor(){super(...arguments),this.type=PE.rangeArea}initMark(){this._areaMark=this._createMark(Aq.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new xq(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}Aq.type=PE.rangeArea,Aq.mark=Sq;class kq extends Rj{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=TU,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};Iw(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:[]};Iw(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)&&Ij(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function Cq(t){return kM(t)?Number.parseFloat(t):0}const Tq=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&Mq(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,C=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[mU],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/C;A=p,m.forEach((e=>{const i=e[r]===f?f:e[mU]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},Mq=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===Cq(t[e])))||!i&&0===t.reduce(((t,i)=>t+Cq(i[e])),0)));function wq(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const Eq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:wq(t,!0,lR.appear)}),Bq={type:"fadeIn"},Pq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:wq(t,!0,lR.enter)}),Rq=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:wq(t,!0,lR.exit)});function Iq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Bq;case"growRadius":return Eq(Object.assign(Object.assign({},t),{growField:"radius"}));default:return Eq(Object.assign(Object.assign({},t),{growField:"angle"}))}}class Oq extends Qz{constructor(t,e){super(t,e),this.type=Lq.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[xU])[t]+s,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class Lq extends Oq{constructor(){super(...arguments),this.type=Lq.type}}Lq.type="arc";const Dq=()=>{KT(),gC(),FN("arc",qG),w_.registerBuiltInAnimate("growRadiusIn",eD),w_.registerBuiltInAnimate("growRadiusOut",iD),w_.registerBuiltInAnimate("growAngleIn",DL),w_.registerBuiltInAnimate("growAngleOut",FL),bB.registerGraphicComponent("arc",Vp),bB.registerMark(Lq.type,Lq)},Fq=Object.assign(Object.assign({},hj),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class zq extends Cj{_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=fB({},this._theme,i,t);const n=(t,e)=>fB({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const Hq=`${WB}_LABEL_VISIBLE`,jq={valueField:!0,angleField:!0,startAngle:!0,endAngle:!0,minAngle:!0},Nq={outerRadius:!0};class Uq extends kq{constructor(){super(...arguments),this.transformerConstructor=zq,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:QE(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:QE(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=kU,this._endAngle=CU,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[xU];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;$P(this._dataSet,"pie",Tq),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:yU,asEndAngle:_U,asRatio:vU,asMiddleAngle:xU,asRadian:AU,asQuadrant:SU,asK:bU,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new za(this._dataSet,{name:`${WB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new Ez(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},Uq.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:$B,groupKey:this._seriesField,isSeriesMark:!0},{morph:xj(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return Ew(yU)(t)}endAngleScale(t){return Ew(_U)(t)}_computeLayoutRadius(){return MU((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:$E(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:$E(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:Ew(Hq).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Nq),dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),jq)})}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[xU];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===lR.appear)return this._startAngle;if(i===lR.disappear)return this._endAngle;const r=[lR.disappear,lR.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[KB];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[KB]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[KB])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[KB])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[xU]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[xU]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[xU]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[xU]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=vj(null===(i=bB.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}Uq.transformerConstructor=zq,Uq.mark=Fq,Uq.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class Vq extends Uq{constructor(){super(...arguments),this.type=PE.pie}}Vq.type=PE.pie;const Wq=()=>{Dq(),bB.registerAnimation("pie",((t,e)=>({appear:Iq(t,e),enter:Pq(t),exit:Rq(t),disappear:{duration:fH.disappear.duration}}))),bB.registerAnimation("emptyCircle",((t,e)=>({appear:Iq(t,e)}))),bB.registerSeries(Vq.type,Vq)};function Gq(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const Yq=t=>({type:Gq(t.growField),options:{overall:!0}}),Xq={type:"fadeIn"},Kq=t=>({type:Gq(t.growField)}),$q=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function qq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Xq;case"growAngle":return Yq(Object.assign(Object.assign({},t),{growField:"angle"}));default:return Yq(Object.assign(Object.assign({},t),{growField:"radius"}))}}const Zq={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0};class Jq extends kq{_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),Zq)})}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(tP),this.setInnerRadiusField(QB)}setValueFieldToPercent(){this.setRadiusField(iP),this.setInnerRadiusField(eP)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const Qq=Object.assign(Object.assign({},hj),{rose:{name:"rose",type:"arc"}});class tZ extends Cj{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class eZ extends UU{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const y={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(y),"radius"===i.orient?(o.push(y),a=h):(l.push(y),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=bB.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=kU,this._endAngle=CU,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),Tw(this._regions,(t=>{"radius"===this.getOrient()?gU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):gU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:QE(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:QE(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:hU(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){Tw(this._regions,(t=>{"radius"===this.getOrient()?gU(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):gU(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return Iw(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:Iw(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>pU(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=ae.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return MU((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=TU,e=0;const i=this.getChart().getSpec();return Tw(this.getRegions(),(s=>{const n=s;if(r=n.type,[PE.rose,PE.radar,PE.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getComponent().setAttributes(fB({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(fB({},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)}}eZ.type=r.polarAxis,eZ.specKey="axes";const iZ={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},sZ={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class nZ extends eZ{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new AE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,KV),t}}nZ.type=r.polarLinearAxis,nZ.specKey="axes",nZ.builtInTheme={axis:RV,axisLinear:qV,axisAngle:sZ,axisRadius:iZ},G(nZ,GV);const rZ=()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),bB.registerGraphicComponent(IU.circleAxis,((t,e)=>new UG(t,e))),bB.registerGraphicComponent(OU.circleAxisGrid,((t,e)=>new sY(t,e))),VU(),bB.registerComponent(nZ.type,nZ)};class aZ extends eZ{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new iE}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)}reInit(t){super.reInit(t),this._updateData()}registerTicksTransform(){const t=`${this.type}-ticks`;return $P(this._option.dataSet,t,WG),t}transformScaleDomain(){}}aZ.type=r.polarBandAxis,aZ.specKey="axes",aZ.builtInTheme={axis:RV,axisBand:PV,axisAngle:sZ,axisRadius:iZ},G(aZ,YU);const oZ=()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),bB.registerGraphicComponent(IU.circleAxis,((t,e)=>new UG(t,e))),bB.registerGraphicComponent(OU.circleAxisGrid,((t,e)=>new sY(t,e))),VU(),bB.registerComponent(aZ.type,aZ)};class lZ extends Jq{constructor(){super(...arguments),this.type=PE.rose,this.transformerConstructor=tZ,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){this._roseMark=this._createMark(lZ.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:xj(this._spec,lZ.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),fill:this.getColorAttribute(),outerRadius:t=>XE(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=XE(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(vj(null===(i=bB.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),yj("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}lZ.type=PE.rose,lZ.mark=Qq,lZ.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},lZ.transformerConstructor=tZ;const hZ=()=>{bB.registerSeries(lZ.type,lZ),Dq(),bB.registerAnimation("rose",((t,e)=>({appear:qq(t,e),enter:Kq(t),exit:$q(t),disappear:{duration:fH.disappear.duration}}))),oZ(),rZ()};class cZ extends sb{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,vw(this._fromAngle,this._toAngle)&&vw(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class dZ extends uH{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!Cw(t)&&!Cw(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const uZ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function pZ(t,e,i){return"fadeIn"===e?uZ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function gZ(t,e,i){return"fadeIn"===e?uZ(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 fZ=(t,e)=>({custom:cH,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),mZ=Object.assign(Object.assign(Object.assign({},hj),Jj),{area:{name:"area",type:"area"}});class vZ extends Jq{constructor(){super(...arguments),this.type=PE.radar,this.transformerConstructor=KN,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(vZ.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:FH,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?oe(this._spec.startAngle):kU},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(vj(null===(s=bB.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),yj("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=bB.getAnimationInKey(e);t.setAnimationConfig(vj(null==i?void 0:i(n,r),yj(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}}}vZ.type=PE.radar,vZ.mark=mZ,vZ.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},vZ.transformerConstructor=KN,G(vZ,tN);const yZ=()=>{bB.registerSeries(vZ.type,vZ),oG(),GN(),XN(),bB.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:pZ(t,e,"in"),enter:pZ(t,e,"in"),exit:pZ(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:fH.disappear.duration},update:[{channel:["points","center"],custom:dZ,customParameters:t,duration:fH.update.duration,easing:fH.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),bB.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:gZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:fH.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:cZ,customParameters:t,duration:fH.update.duration,easing:fH.update.easing}]}))),bB.registerAnimation("radarGroup",((t,e)=>({appear:fZ(t,"in"),disappear:{duration:fH.disappear.duration}}))),gC(),oZ(),rZ()};class _Z extends ZH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>yi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const bZ=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(WB)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[KB]:r,[$B]:`${s}_${e}`})),r++}))})),n},xZ={fill:"#bbb",fillOpacity:.2},SZ=Object.assign(Object.assign({},hj),{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"}}),AZ={highLightSeriesGroup:!0,titleField:!0,subTitleField:!0},kZ={grid:{background:!0}};class CZ extends Lj{constructor(){super(...arguments),this.type=PE.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)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),AZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),kZ)})}initData(){var e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),$P(this._option.dataSet,"objFlat",bZ),$P(this._option.dataSet,"copyDataView",sR),qP(this._option.dataSet,"dataview",Oa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(fB(xZ,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(CZ.mark.group),this._containerMark=this._createMark(CZ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(CZ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(CZ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(CZ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(CZ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(CZ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(CZ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{x:this.getRegionRectLeft.bind(this),x1:this.getRegionRectRight.bind(this),y:this.dataToGridBackgroundPositionY.bind(this),y1:this.dataToGridBackgroundPositionY1.bind(this),fill:this._gridBackground.fill,fillOpacity:this.dataToGridBackgroundOpacity.bind(this)},"normal",t.AttributeLevel.Series);const r=this._gridMark;r&&this.setMarkStyle(r,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",t.AttributeLevel.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:qB}}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 WE).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:qB}}initTooltip(){this._tooltipHelper=new _Z(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}CZ.type=PE.dot,CZ.mark=SZ,CZ.builtInTheme={dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}};class TZ extends ZH{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>yi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const MZ=Object.assign(Object.assign({},hj),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),wZ=(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 EZ extends Lj{constructor(){super(...arguments),this.type=PE.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var e;super.initData(),$P(this._option.dataSet,"linkDotInfo",wZ),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.linkDotInfo},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}initMark(){this._clipMark=this._createMark(EZ.mark.group),this._containerMark=this._createMark(EZ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(EZ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(EZ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:qB}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new TZ(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}EZ.type=PE.link,EZ.mark=MZ,EZ.builtInTheme={link:{arrow:{style:{size:10}}}};const BZ=Object.assign(Object.assign({},hj),{group:{name:"group",type:"group"}}),PZ={radius:!0,outerRadius:!0,innerRadius:!0,startAngle:!0,endAngle:!0,centerX:!0,centerY:!0,clamp:!0};class RZ extends kq{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()?QB:pP],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?tP:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),PZ)})}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?oe(n):kU;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):CU,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=XE(this.angleAxisHelper.dataToPosition([t[QB]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=XE(this.angleAxisHelper.dataToPosition([t[tP]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?XE(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(RZ.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return Vp(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[mg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const DZ=()=>{bB.registerAnimation("circularProgress",((t,e)=>({appear:LZ(t,e),enter:{type:"growAngleIn"},disappear:{duration:fH.disappear.duration}})))};class FZ extends Cj{constructor(){super(...arguments),this._supportStack=!0}}const zZ={cornerRadius:!0,roundCap:!0};class HZ extends RZ{constructor(){super(...arguments),this.type=PE.circularProgress,this.transformerConstructor=FZ,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()}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),zZ)})}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){super.initMark(),this._initTrackMark(),this._initProgressMark()}initMarkStyle(){super.initMarkStyle(),this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){return this._progressMark=this._createMark(HZ.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:xj(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){return this._trackMark=this._createMark(HZ.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?QB:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?tP: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(vj(null===(i=bB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),yj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),yj("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}HZ.type=PE.circularProgress,HZ.mark=IZ,HZ.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},HZ.transformerConstructor=FZ;const jZ=()=>{bB.registerSeries(HZ.type,HZ),Dq(),DZ(),_H(),oZ(),rZ()};function NZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const UZ={type:"fadeIn"};function VZ(t,e="grow"){return!1===e?{}:"fadeIn"===e?UZ:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:NZ(t)}))(t)}class WZ extends ZH{enableByType(t){return"dimension"!==t}}const GZ=Object.assign(Object.assign({},hj),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}}),YZ={bandWidth:!0,cornerRadius:!0,clamp:!0},XZ={progress:{topPadding:!0,bottomPadding:!0,leftPadding:!0,rightPadding:!0}};class KZ extends Lj{constructor(){super(...arguments),this.type=PE.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{compileOnlyKeys:Object.assign(Object.assign({},t.compileOnlyKeys),YZ),compileOnlySubKeys:Object.assign(Object.assign({},t.compileOnlySubKeys),XZ)})}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(KZ.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var e,s;return XE(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?XE(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(KZ.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return XE(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return XE(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),yj("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),yj("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new WZ(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}KZ.type=PE.linearProgress,KZ.mark=GZ,KZ.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const $Z=()=>{AK(),bB.registerAnimation("linearProgress",((t,e)=>({appear:VZ(t,e),enter:VZ(t),disappear:{duration:fH.disappear.duration}}))),_H(),bB.registerSeries(KZ.type,KZ)},qZ=[0],ZZ=[20,40],JZ=[200,500],QZ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},tJ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class eJ{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const iJ=`${WB}_WORD_CLOUD_TEXT`,sJ=Object.assign(Object.assign({},hj),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),nJ={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class rJ extends Rj{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=ZZ}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:JZ,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:qZ,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?iJ:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:QZ},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||_M(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:qZ,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!tJ.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new eJ(1e3))}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(rJ.mark.word,{key:$B,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(rJ.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(vj(bB.getAnimationInKey("wordCloud")(n,s),yj("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 WE).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:qB])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new AE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new AE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[KB])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:$B,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:b_.createCanvas.bind(b_),getTextBounds:gv}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:sg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}rJ.mark=sJ,rJ.builtInTheme={wordCloud:nJ};function aJ(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",options:{fromScale:0},duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||fH.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=oJ(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},lJ=(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=lJ(t.children,e,t,n))})),s},hJ=(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=hJ(t.children,e,t,n)),n=e(t,s,i,n)})),n},cJ=(t,e=[],i)=>{const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):cJ(t.children,e,i)))})),e};function dJ(t,e){let i,s;if(gJ(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function gJ(t,e){for(let i=0;i1e-6?(M+Math.sqrt(M*M-4*T*w))/(2*T):w/M);return{x:s+S+A*E,y:n+k+C*E,radius:E}}function yJ(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 _J(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 bJ(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 xJ(t){return{_:t,next:null,prev:null}}function SJ(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];yJ(n,s,r);let a,o,l,h,c,d,u,p=xJ(s),g=xJ(n),f=xJ(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=oJ(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:TJ.defaultOpionts.nodeSort;lJ([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)lJ([o],AJ(h)),hJ([o],kJ(this._getPadding,.5,a)),lJ([o],CJ(1,this._maxDepth));else{const t=Math.min(s.width,s.height);lJ([o],AJ(TJ.defaultOpionts.setRadius)),hJ([o],kJ(It,1,a)),c&&hJ([o],kJ(this._getPadding,o.radius/t,a)),lJ([o],CJ(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}TJ.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const MJ=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=MJ(t.children):t.value=0),e+=Math.abs(t.value)})),e};function wJ(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){MJ(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function EJ(t){return t.depth}function BJ(t,e){return e-1-t.endDepth}const PJ=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),RJ=(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},IJ={left:EJ,right:BJ,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:EJ,end:BJ},OJ=bt(0,1);class LJ{constructor(t){this._ascendingSourceBreadth=(t,e)=>PJ(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>PJ(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},LJ.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):IJ[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};"vertical"===this.options.direction?this._viewBox={x0:i.y0,x1:i.y1,y0:i.x0,y1:i.x1,width:i.height,height:i.width}:this._viewBox=i;const s=this.computeNodeLinks(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){return wJ(t,this._getNodeKey)}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[RJ(s[t.source]),RJ(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(y(e)){const t=yt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*OJ(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(PJ),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(PJ),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];DJ(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),FJ);const s=_(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},zJ.defaultOpionts,t):Object.assign({},zJ.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Rt(this.options.center[0],t.width),s=t.y0+Rt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Rt(t,n))):Rt(r,n),h=_(a),c=this.options.gapRadius,d=h?a.map((t=>Rt(t,n))):Rt(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]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Rt(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-(_(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=oJ(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=ce({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}function HJ(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,v,y,_,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,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),p{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:DJ,slice:HJ,sliceDice:function(t,e,i,s,n){(t.depth%2==1?HJ:DJ)(t,e,i,s,n)}};class UJ{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=_(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},UJ.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?jJ(this.options.aspectRatio):null!==(e=NJ[this.options.splitType])&&void 0!==e?e:NJ.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=oJ(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}function VJ(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ui?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=VJ(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Bi(o.map(Bi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=WJ(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function ZJ(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Ii((function(i){return-1*JJ({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},tQ=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||YJ,s=e.lossFunction||GJ,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];pi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:QJ(f),arcs:f})}))},eQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:iQ,triangle:iQ,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=0?1/(Math.cos(2*Math.PI/10-e)+3.07768*Math.sin(2*Math.PI/10-e)):1/(Math.cos(e)+3.07768*Math.sin(e))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function iQ(){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 sQ(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const nQ=t=>eQ[t]?eQ[t]():eQ.circle(),rQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function aQ(t){return d(t)?t:function(){return t}}class oQ{constructor(t){var e,i;switch(this.options=H({},oQ.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=nQ(this.options.shape),this.getText=null!==(e=aQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=aQ(this.options.fontWeight),this.getTextFontSize=aQ(this.options.fontSize),this.getTextFontStyle=aQ(this.options.fontStyle),this.getTextFontFamily=aQ(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>rQ(10,50);break;case"random-light":this.getTextColor=()=>rQ(50,90);break;default:this.getTextColor=aQ(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return oe(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():Mt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class hQ extends oQ{constructor(t){var e;super(H({},hQ.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<=hQ.defaultOptions.minFontSize&&(this.options.minFontSize=hQ.defaultOptions.minFontSize),this.spiral=y(this.options.spiral)?null!==(e=lQ[this.options.spiral])&&void 0!==e?e:lQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=aQ(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}=sQ(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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(pQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(uQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}pQ(p,this._size)&&(p=gQ(p,this._size))}else if(pQ(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||dQ(p,i))&&(!i||!cQ(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 cQ(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 dQ(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,pQ=(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 gQ(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},mQ=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},vQ=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},yQ=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=sQ(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=nQ("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)vQ(n,mQ({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)vQ(n,mQ({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)vQ(n,mQ({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)vQ(n,mQ({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)vQ(n,mQ({x:l,y:h},o,0,3));else if("star"===t.shape){const t=mQ({x:l,y:h},o,-Math.PI/2,5),e=mQ({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);vQ(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let _Q=class t extends oQ{constructor(e){super(H({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),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 C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[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(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?fQ(t,o,l.width,l.height,h):"geometric"===t.type&&yQ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=sQ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};_Q.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class bQ extends oQ{constructor(t){super(H({},bQ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}bQ.defaultOptions={enlarge:!1};const SQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},AQ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?kQ(t.fontFamily):"sans-serif",d=t.fontStyle?kQ(t.fontStyle):"normal",u=t.fontWeight?kQ(t.fontWeight):"normal",p=t.rotate?kQ(t.rotate):0,g=kQ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?kQ(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},SQ),t.as):SQ,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?kQ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=TQ(MQ(t,l),w);M=i=>e(t(i))}let E=hQ;"fast"===t.layoutType?E=bQ:"grid"===t.layoutType&&(E=_Q);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},kQ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],CQ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),TQ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=CQ(t[0]),n=CQ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(CQ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},MQ=(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 wQ(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{bB.registerGrammarTransform("wordcloud",{transform:AQ}),hq(),bB.registerAnimation("wordCloud",((t,e)=>({appear:aJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:fH.disappear.duration}}))),bB.registerSeries(EQ.type,EQ)},PQ=t=>d(t)?t():t,RQ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=PQ(e.valueField),v=null!==(i=PQ(e.heightVisual))&&void 0!==i&&i,y=null===(s=PQ(e.isCone))||void 0===s||s,_=PQ(e.range),b=a.reduce(((t,e)=>{const i=Number.parseFloat(e[m]);return k(i)?Math.max(t,i):t}),-1/0),x=null!==(n=null==_?void 0:_.min)&&void 0!==n?n:0,S=null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b,A=t=>k(t)&&k(x)&&k(S)?x===S?t{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0,S=A(n);p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=S),d&&(t[d]=e===a.length-1?y?0:t[c]:A(_)),u&&(t[u]=0===e?1:A(r)),g&&(t[g]=n)})),a},IQ=(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},OQ=`${WB}_FUNNEL_TRANSFORM_RATIO`,LQ=`${WB}_FUNNEL_REACH_RATIO`,DQ=`${WB}_FUNNEL_HEIGHT_RATIO`,FQ=`${WB}_FUNNEL_VALUE_RATIO`,zQ=`${WB}_FUNNEL_LAST_VALUE_RATIO`,HQ=`${WB}_FUNNEL_NEXT_VALUE_RATIO`,jQ=`${WB}_FUNNEL_LAST_VALUE`,NQ=`${WB}_FUNNEL_CURRENT_VALUE`,UQ=`${WB}_FUNNEL_NEXT_VALUE`,VQ=`${WB}_FUNNEL_TRANSFORM_LEVEL`;class WQ extends ZH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[LQ])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class GQ extends Qz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class YQ extends GQ{constructor(){super(...arguments),this.type=YQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}YQ.type="polygon";const XQ=()=>{bB.registerMark(YQ.type,YQ),KT(),yT(),w_.registerBuiltInAnimate("growPointsOut",YL),bB.registerGraphicComponent("polygon",ug)},KQ=Object.assign(Object.assign({},hj),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class $Q extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class qQ extends Rj{constructor(){super(...arguments),this.type=PE.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=$Q,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;$P(this._dataSet,"funnel",RQ),$P(this._dataSet,"funnelTransform",IQ);const t=new za(this._dataSet,{name:`${WB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new Ez(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:NQ,asTransformRatio:OQ,asReachRatio:LQ,asHeightRatio:DQ,asValueRatio:FQ,asNextValueRatio:HQ,asLastValueRatio:zQ,asLastValue:jQ,asNextValue:UQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:VQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},qQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:xj(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},qQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(qQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(qQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new WQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&uM(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&uM(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ew(LQ).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(vj(null===(s=bB.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),yj("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(vj(bB.getAnimationInKey("fadeInOut")(),yj(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(vj(bB.getAnimationInKey("funnel")({},o),yj(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(vj(null===(a=bB.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),yj("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[zQ])/2:this._getSecondaryAxisLength(t[FQ])/2,n=this._getSecondaryAxisLength(t[FQ])/2):(s=this._getSecondaryAxisLength(t[FQ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[HQ])/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[VQ])}_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[$B]===t[$B]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{XQ(),hq(),v$(),bB.registerSeries(qQ.type,qQ),bB.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},vH))),bB.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:dH,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),_H()},JQ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},QQ=t=>{const e=t.filter((t=>t.context.diffState===sz.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},t0=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},e0=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QQ(i.parent.children),a=t0(r,s,n);return JQ(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QQ(i.parent.children),a=t0(r,s,n);return JQ(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),i0=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},s0=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QQ(i.parent.children),a=i0(r);return JQ(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QQ(i.parent.children),a=i0(r);return JQ(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),n0=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},r0=(t,e={})=>{if(!t)return[];const i=[];return cJ(t,i,e),i},a0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new zJ(i).layout(t,{width:s,height:n})};class o0 extends ZH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var l0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(l0||(l0={}));const h0=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===l0.DrillDown){return Y(TP(t,n,s,"children"))}if(i.type===l0.DrillUp){const e=MP(t,n,s,"children");if(e)return Y(e)}return t};class c0{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=e$(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;$P(t,"drillFilter",h0),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:l0.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:l0.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:l0.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:l0.DrillUp},model:this}),r}}const d0=Object.assign(Object.assign({},hj),{sunburst:{name:"sunburst",type:"arc"}}),u0=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:ij,operations:["max","min","values"]}),t.push({key:sj,operations:["values"]}),t),p0={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class g0 extends kq{constructor(){super(...arguments),this.type=PE.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:sj),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:$B},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),$P(this._dataSet,"sunburstLayout",a0),$P(this._dataSet,"flatten",r0),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 u0(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||($P(t.dataSet,"addVChartProperty",WH),t.transform({type:"addVChartProperty",options:{beforeCall:oj.bind(this),call:lj}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(g0.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(g0.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new o0(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(vj(null===(e=bB.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),yj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),yj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}g0.type=PE.sunburst,g0.mark=d0,g0.builtInTheme={sunburst:p0},G(g0,c0);const f0=()=>{bB.registerSeries(g0.type,g0),Dq(),hq(),_H(),bB.registerAnimation("sunburst",((t,e)=>({appear:n0(0,e),enter:e0(t),exit:s0(t),disappear:{duration:fH.disappear.duration}})))},m0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new TJ(i).layout(t,{width:s,height:n})};class v0 extends ZH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const y0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},_0=Object.assign(Object.assign({},hj),{circlePacking:{name:"circlePacking",type:"arc"}});class b0 extends Lj{constructor(){super(...arguments),this.type=PE.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:sj),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:$B},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),$P(this._dataSet,"circlePackingLayout",m0),$P(this._dataSet,"flatten",r0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||($P(t.dataSet,"addVChartProperty",WH),t.transform({type:"addVChartProperty",options:{beforeCall:oj.bind(this),call:lj}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(b0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(b0.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return u0(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new v0(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),yj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),yj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}b0.type=PE.circlePacking,b0.mark=_0,b0.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(b0,c0);const x0=()=>{bB.registerSeries(b0.type,b0),Dq(),hq(),yH(),bB.registerAnimation("circlePacking",((t,e)=>({appear:y0(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:fH.disappear.duration}})))},S0=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&S0(t,e.children,i)}))},A0=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},k0=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=C0(n,i),a=new LJ(i),o=[];return o.push(a.layout(r,s)),o},C0=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},T0=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:[]},M0=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 w0 extends ZH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const E0=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),B0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:E0(t),P0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class R0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class I0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const O0=(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`},L0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class D0 extends V${constructor(){super(...arguments),this.type=D0.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?L0:O0,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}D0.type="linkPath";const F0=Object.assign(Object.assign({},hj),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class z0 extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const H0=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&Zz(t,e),qz(t,e,s,n)};class j0 extends Lj{constructor(){super(...arguments),this.type=PE.sankey,this.transformerConstructor=z0,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{Zz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{Zz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=FP(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=FP(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):r.target===i.key?(s.includes(r.source)||s.push(r.source),Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=FP(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(Zz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),H0(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation())):(Zz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),qz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=FP(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=FP(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=FP(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=FP(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=FP(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return Zz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void H0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s},!0,this._hasLinkStateAnimation())}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),Zz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void H0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value},!0,this._hasLinkStateAnimation());Zz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),qz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(FP(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{Zz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{Zz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=FP(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=FP(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void H0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation());const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void H0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a},!0,this._hasLinkStateAnimation())}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void H0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value},!0,this._hasLinkStateAnimation());Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}_hasStateAnimation(t){var e;return kj(this)&&!!(null===(e=null==t?void 0:t.hasAnimationByState)||void 0===e?void 0:e.call(t,"state"))}_hasLinkStateAnimation(){return this._hasStateAnimation(this._linkMark)}_hasNodeStateAnimation(){return this._hasStateAnimation(this._nodeMark)}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){$P(this._dataSet,"sankeyLayout",k0),$P(this._dataSet,"sankeyFormat",A0),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;$P(s,"sankeyNodes",T0),$P(s,"flatten",r0);const n=new za(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.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),n.transform({type:"addVChartProperty",options:{beforeCall:rj.bind(this),call:aj}},!1),this._nodesSeriesData=n,$P(s,"sankeyLinks",M0);const r=new za(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:rj.bind(this),call:aj}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(j0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(j0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=NH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),yj("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),yj("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:WP.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{Zz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(FP(e).key)?qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasNodeStateAnimation()):qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasNodeStateAnimation())}))}initTooltip(){this._tooltipHelper=new w0(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new WE;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return S0(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}j0.type=PE.sankey,j0.transformerConstructor=z0,j0.mark=F0,j0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const N0=()=>{AK(),W$(),cT(),bB.registerGraphicComponent("path",(t=>hg(t))),bB.registerMark(D0.type,D0),hq(),bB.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:B0(t,e)},vH))),bB.registerAnimation("sankeyLinkPath",((t,e)=>({appear:P0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:fH.disappear.duration}}))),w_.registerBuiltInAnimate("linkPathGrowOut",I0),w_.registerBuiltInAnimate("linkPathGrowIn",R0),_H(),bB.registerSeries(j0.type,j0)},U0=(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=r0(n);return i=QH([{latestData:r}],e),i};class V0 extends ZH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const W0=Object.assign(Object.assign({},hj),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),G0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class Y0 extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const X0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new UJ(i).layout(t,s),n=[];return cJ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[sj,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class K0 extends Lj{constructor(){super(...arguments),this.type=PE.treemap,this.transformerConstructor=Y0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,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:sj),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),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:$B},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),$P(this._dataSet,"treemap",X0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&($P(this._rawData.dataSet,"addVChartProperty",WH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:oj.bind(this),call:lj}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=U0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){$P(this._dataSet,"hierarchyDimensionStatistics",U0),$P(this._dataSet,"flatten",r0);const i=new za(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 u0(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(K0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(K0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("treemap"))||void 0===e?void 0:e(),yj(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 V0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(jP.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(jP.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}K0.type=PE.treemap,K0.mark=W0,K0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},K0.transformerConstructor=Y0,G(K0,c0),G(K0,s$);const $0=()=>{bB.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),bB.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),AK(),hq(),bB.registerAnimation("treemap",((t,e)=>({appear:G0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:fH.disappear.duration}}))),_H(),bB.registerSeries(K0.type,K0)},q0=Object.assign(Object.assign({},BZ),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),Z0=Object.assign(Object.assign({},hj),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),J0={type:"fadeIn"};function Q0(t,e){return"fadeIn"===e?J0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class t1 extends Cj{constructor(){super(...arguments),this._supportStack=!1}}class e1 extends ZH{enableByType(t){return"dimension"!==t}}const i1="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",s1={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:i1,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:i1,fill:"#ddd"}}};class n1 extends RZ{constructor(){super(...arguments),this.type=PE.gaugePointer,this.transformerConstructor=t1,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(n1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},n1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(n1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new e1(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),yj("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}n1.type=PE.gaugePointer,n1.mark=Z0,n1.builtInTheme={gaugePointer:s1},n1.transformerConstructor=t1;const r1=()=>{bB.registerSeries(n1.type,n1),qK(),AK(),bB.registerAnimation("gaugePointer",((t,e)=>{const i=Q0(t,e);return{appear:i,enter:i,disappear:{duration:fH.disappear.duration}}})),oZ(),rZ()};class a1 extends Cj{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class o1 extends RZ{constructor(){super(...arguments),this.type=PE.gauge,this.transformerConstructor=a1,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();$P(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[gP]=t[this._angleField[0]],t[pP]=e>0?i[e-1][gP]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(o1.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(o1.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[pP])?this.angleAxisHelper.dataToPosition([t[pP]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[gP]])}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(vj(null===(i=bB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),yj("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}o1.type=PE.gauge,o1.mark=q0,o1.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},o1.transformerConstructor=a1;class l1 extends Qz{constructor(){super(...arguments),this.type=l1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Gg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}l1.type="cell";function h1(t){return!1===t?{}:{type:"fadeIn"}}class c1 extends ZH{enableByType(t){return"dimension"!==t}}const d1=Object.assign(Object.assign({},hj),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class u1 extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const p1={valueField:!0};class g1 extends Lj{constructor(){super(...arguments),this.type=PE.heatmap,this.transformerConstructor=u1}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),p1)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(g1.mark.cell,{isSeriesMark:!0},{morph:xj(this._spec,g1.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(g1.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Oj(this);this._cellMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),yj("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 c1(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}g1.type=PE.heatmap,g1.mark=d1,g1.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},g1.transformerConstructor=u1;const f1=()=>{hq(),bB.registerMark(l1.type,l1),bB.registerGraphicComponent("symbol",Gg),KT(),iM(),VN(),bB.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},vH),{appear:h1(e)}))),DV(),JV(),bB.registerSeries(g1.type,g1)},m1=Object.assign(Object.assign({},hj),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),v1=`${WB}_CORRELATION_X`,y1=`${WB}_CORRELATION_Y`,_1=`${WB}_CORRELATION_SIZE`,b1=t=>d(t)?t():t,x1=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=b1(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=b1(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=b1(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(b1(e.outerRadius),f),y=b1(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(b1(e.field)),A=c.map(x),[k,C]=Ot(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=b1(e.radiusField),w=b1(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?Ot(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),I=Math.max(p,g),O=S1(R,I,c.length),L=[],D=(I-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=O[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),A1({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>I?a=R: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},A1=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,C1=(t,e)=>{if(!t||!_(t))return[];const i=k1(e.keyword),s=k1(e.categoryField),n=t[0].latestData[0];return{[s]:i,[KB]:null==n?void 0:n[KB],[qB]:null==n?void 0:n[qB]}};class T1 extends V${constructor(){super(...arguments),this.type=T1.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}T1.type="ripple";const M1=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class w1 extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class E1 extends kq{constructor(){super(...arguments),this.type=PE.correlation,this.transformerConstructor=w1,this._viewBox=new Ue}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(){if(super.initData(),!this._data)return;$P(this._dataSet,"correlation",x1);const t=new Fa;qP(t,"dataview",Oa),$P(t,"correlationCenter",C1);const e=new za(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return 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 Ez(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(E1.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:KB});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(E1.mark.ripplePoint,{key:KB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(E1.mark.centerPoint,{key:KB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[v1],y:t=>t[y1],size:t=>t[_1],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),yj("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}E1.type=PE.correlation,E1.mark=m1,E1.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},E1.transformerConstructor=w1;const B1=()=>{XN(),W$(),iM(),bB.registerMark(T1.type,T1),bB.registerGraphicComponent("symbol",(t=>Gg(t))),bB.registerSeries(E1.type,E1),bB.registerAnimation("correlation",((t,e)=>Object.assign({appear:M1(0,e)},mH)))},P1=Object.assign(Object.assign({},hj),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class R1 extends V${constructor(){super(...arguments),this.type=R1.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}R1.type="liquid";const I1=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class O1 extends ZH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class L1 extends Rj{constructor(){super(...arguments),this.type=PE.liquid,this.transformerConstructor=KN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=mg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Gg({x:s,y:n,size:r,symbolType:I1(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=iB(this._spec.outlineMargin),this._paddingSpec=iB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(L1.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(L1.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(L1.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(L1.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new O1(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),yj("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),yj("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=RM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}L1.type=PE.liquid,L1.mark=P1,L1.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},L1.transformerConstructor=KN;const D1=t=>Y(t).join(",");class F1 extends ZH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>D1(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>D1(null==t?void 0:t[this.series.getDimensionField()[0]])}}const z1=Object.assign(Object.assign({},hj),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class H1 extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const j1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?tQ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class N1 extends Rj{constructor(){super(...arguments),this.type=PE.venn,this.transformerConstructor=H1,this._viewBox=new Ue}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:$B)}initData(){var t;super.initData(),$P(this._dataSet,"venn",j1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(N1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(N1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>D1(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>D1(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new F1(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:D1(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return D1(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[D1(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(D1(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),yj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),yj(t.name,this._spec,this._markAttributeContext)))}))}}N1.type=PE.venn,N1.mark=z1,N1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},N1.transformerConstructor=H1;class U1 extends EK{constructor(){super(...arguments),this.type=PE.mosaic,this.transformerConstructor=MK}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(cP),this.setFieldX2(hP)),this.setFieldY(uP),this.setFieldY2(dP)):(t&&(this.setFieldY(cP),this.setFieldY2(hP)),this.setFieldX(uP),this.setFieldX2(dP)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}U1.type=PE.mosaic,U1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},U1.transformerConstructor=MK;class V1 extends xW{_isValidSeries(t){return t===PE.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class W1 extends yW{constructor(){super(...arguments),this.transformerConstructor=V1,this.type="map",this.seriesType=PE.map}}W1.type="map",W1.seriesType=PE.map,W1.transformerConstructor=V1;class G1 extends xW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class Y1 extends G1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=cU(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,fB({},s,l)),n&&Object.assign(o,fB({},n,o))}}class X1 extends G1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class K1 extends G1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class $1 extends yW{constructor(){super(...arguments),this.transformerConstructor=K1}}$1.transformerConstructor=K1;class q1 extends $1{constructor(){super(...arguments),this.transformerConstructor=K1,this.type="pie",this.seriesType=PE.pie}}q1.type="pie",q1.seriesType=PE.pie,q1.transformerConstructor=K1;class Z1 extends X1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:TU,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:TU,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>fB({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const J1=(t,e)=>{if(!t)return null;const i=$j(t,(t=>"angle"===t.getOrient()),e),s=$j(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Lw(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=Aw({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=kw(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=Xj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Lw(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=Aw({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=kw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=Xj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class Q1 extends yW{constructor(){super(...arguments),this.transformerConstructor=Z1,this.type="rose",this.seriesType=PE.rose}_setModelOption(){this._modelOption.getDimensionInfo=J1}}Q1.type="rose",Q1.seriesType=PE.rose,Q1.transformerConstructor=Z1,G(Q1,TW);class t2 extends X1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=fB({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}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=>fB({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class e2 extends yW{constructor(){super(...arguments),this.transformerConstructor=t2,this.type="radar",this.seriesType=PE.radar}_setModelOption(){this._modelOption.getDimensionInfo=J1}}e2.type="radar",e2.seriesType=PE.radar,e2.transformerConstructor=t2,G(e2,TW);class i2 extends xW{_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")&&fB(e,QF(this.type,t))})),this._transformAxisSpec(t)}}class s2 extends yW{constructor(){super(...arguments),this.transformerConstructor=i2,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=DW(t,e,i))&&void 0!==s?s:[],...null!==(n=J1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}s2.type="common",s2.transformerConstructor=i2,G(s2,TW);class n2 extends SW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class r2 extends yW{constructor(){super(...arguments),this.transformerConstructor=n2}}r2.transformerConstructor=n2,G(r2,TW);class a2 extends n2{transformSpec(t){super.transformSpec(t),XF(t)}}class o2 extends r2{constructor(){super(...arguments),this.transformerConstructor=a2,this.type="histogram",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}o2.type="histogram",o2.seriesType=PE.bar,o2.transformerConstructor=a2;class l2 extends Y1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class h2 extends yW{constructor(){super(...arguments),this.transformerConstructor=l2,this.type="circularProgress",this.seriesType=PE.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=J1}}h2.type="circularProgress",h2.seriesType=PE.circularProgress,h2.transformerConstructor=l2,G(h2,TW);class c2 extends Y1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=PE.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===PE.gauge||t.type===PE.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===PE.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 d2 extends yW{constructor(){super(...arguments),this.transformerConstructor=c2,this.type="gauge",this.seriesType=PE.gaugePointer}}d2.type="gauge",d2.seriesType=PE.gaugePointer,d2.transformerConstructor=c2;class u2 extends xW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class p2 extends yW{constructor(){super(...arguments),this.transformerConstructor=u2,this.type="wordCloud",this.seriesType=PE.wordCloud}}p2.transformerConstructor=u2;class g2 extends p2{constructor(){super(...arguments),this.transformerConstructor=u2,this.type="wordCloud",this.seriesType=PE.wordCloud}}g2.type="wordCloud",g2.seriesType=PE.wordCloud,g2.transformerConstructor=u2;class f2 extends xW{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class m2 extends yW{constructor(){super(...arguments),this.transformerConstructor=f2,this.type="funnel",this.seriesType=PE.funnel}}m2.type="funnel",m2.seriesType=PE.funnel,m2.transformerConstructor=f2;class v2 extends SW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=cU(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=cU(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class y2 extends yW{constructor(){super(...arguments),this.transformerConstructor=v2,this.type="linearProgress",this.seriesType=PE.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}y2.type="linearProgress",y2.seriesType=PE.linearProgress,y2.transformerConstructor=v2,G(y2,TW);class _2 extends SW{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),XF(t)}}class b2 extends yW{constructor(){super(...arguments),this.transformerConstructor=_2,this.type="rangeColumn",this.seriesType=PE.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}b2.type="rangeColumn",b2.seriesType=PE.rangeColumn,b2.transformerConstructor=_2;class x2 extends xW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class S2 extends yW{constructor(){super(...arguments),this.transformerConstructor=x2,this.type="sunburst",this.seriesType=PE.sunburst}}S2.type="sunburst",S2.seriesType=PE.sunburst,S2.transformerConstructor=x2;class A2 extends xW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class k2 extends yW{constructor(){super(...arguments),this.transformerConstructor=A2,this.type="circlePacking",this.seriesType=PE.circlePacking}}k2.type="circlePacking",k2.seriesType=PE.circlePacking,k2.transformerConstructor=A2;class C2 extends xW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class T2 extends yW{constructor(){super(...arguments),this.transformerConstructor=C2,this.type="treemap",this.seriesType=PE.treemap}}T2.type="treemap",T2.seriesType=PE.treemap,T2.transformerConstructor=C2;class M2 extends PK{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),XF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class w2 extends RK{constructor(){super(...arguments),this.transformerConstructor=M2,this.type="waterfall",this.seriesType=PE.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}w2.type="waterfall",w2.seriesType=PE.waterfall,w2.transformerConstructor=M2;class E2 extends SW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),XF(t)}}class B2 extends yW{constructor(){super(...arguments),this.transformerConstructor=E2,this.type="boxPlot",this.seriesType=PE.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}B2.type="boxPlot",B2.seriesType=PE.boxPlot,B2.transformerConstructor=E2;class P2 extends xW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class R2 extends yW{constructor(){super(...arguments),this.transformerConstructor=P2,this.type="sankey",this.seriesType=PE.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=FP(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}R2.type="sankey",R2.seriesType=PE.sankey,R2.transformerConstructor=P2;class I2 extends SW{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),XF(t)}}class O2 extends yW{constructor(){super(...arguments),this.transformerConstructor=I2,this.type="rangeArea",this.seriesType=PE.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}O2.type="rangeArea",O2.seriesType=PE.rangeArea,O2.transformerConstructor=I2;class L2 extends SW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class D2 extends yW{constructor(){super(...arguments),this.transformerConstructor=L2,this.type="heatmap",this.seriesType=PE.heatmap}}D2.type="heatmap",D2.seriesType=PE.heatmap,D2.transformerConstructor=L2;class F2 extends xW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class z2 extends yW{constructor(){super(...arguments),this.transformerConstructor=F2,this.type="correlation",this.seriesType=PE.correlation}}z2.type="correlation",z2.seriesType=PE.correlation,z2.transformerConstructor=F2;function H2(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=OP(t.style)),P(t.textStyle)||fB(s.textStyle,OP(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&OP(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&OP(s.background.style),s}function j2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const N2=(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},U2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:qB;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},V2={position:!0,item:!0,title:!0,pager:!0,background:!0};class W2 extends RU{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:()=>{Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(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=qE(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||V2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Ez(this._option,e),this._initSelectedData(),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(Tw(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(fB({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(fB({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(fB({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}W2.specKey="legends";class G2 extends W2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){$P(this._option.dataSet,"discreteLegendFilter",U2),$P(this._option.dataSet,"discreteLegendDataMake",N2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return Tw(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(!CM(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=_P(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,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=qE(s)?s:qE(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=H2(A):M.title={visible:!1},P(k.focusIconStyle)||OP(k.focusIconStyle),k.shape&&(k.shape=j2(PP(k.shape))),k.label&&(k.label=PP(k.label)),k.value&&(k.value=PP(k.value)),k.background&&(k.background=PP(k.background)),ZE(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),ZE(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),ZE(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||OP(C.railStyle),P(C.sliderStyle)||OP(C.sliderStyle)):(P(C.textStyle)||OP(C.textStyle),C.handler&&PP(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(fB(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return MX}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(bX.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(bX.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(bX.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,datum:t.datum,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}=NH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=NH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}G2.specKey="legends",G2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},G2.type=r.discreteLegend;const Y2=(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[]},X2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?wP(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function K2(t){const i=fB({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=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=H2(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=OP(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=OP(r.style)),P(a.style)||(w.trackStyle=OP(a.style)),w.startText=PP(o),w.endText=PP(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>OP(i(t,e,s)):P(i)||(e.style=OP(i)),e}(h),P(c)||(w.sizeBackground=OP(c)),u.visible&&!P(u.style)&&(fB(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const $2={color:RX,size:OX},q2={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}},Z2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},q2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},J2={horizontal:Z2(!0),vertical:Z2(!1)},Q2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},q2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},t5={horizontal:Q2(!0),vertical:Q2(!1)},e5=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],i5=[2,10];class s5 extends W2{static getSpecInfo(t){const e=UH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){$P(this._option.dataSet,"continuousLegendFilter",X2),$P(this._option.dataSet,"continuousLegendDataMake",Y2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>Mw(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=_P(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!CM(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=_P(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?e5:i5);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},K2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return $2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}s5.specKey="legends",s5.builtInTheme={colorLegend:J2,sizeLegend:t5},s5.type=r.continuousLegend;const n5=(t,e)=>p(e)?t.map((t=>e[t])):void 0,r5=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),a5=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function o5(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=l5(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>r5(i,s)(t)&&r5(n,r)(t)&&(u(a)||r5([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:VP.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return LH.globalConfig.uniqueTooltip&&LH.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:VP.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return LH.globalConfig.uniqueTooltip&&LH.hideTooltip(a.id),m}return"none"}const l5=(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=n5(c,t);let y=n5(d,t);const _=a5(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(r5(c,v));if(!_&&(y=n5(d,i),!a5(y)))return;const n=e.type===PE.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=Lw(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(r5(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=n5(d,o),!a5(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(r5(c,n));if(!_&&(y=n5(d,r),!a5(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===PE.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(r5(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=n5(d,i),!a5(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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(r5(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=n5(d,a),h=y,!a5(y)&&!a)return;a5(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},h5=t=>p(t)&&!_(t),c5=t=>p(t)&&_(t),d5=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class u5 extends PU{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=fB({},...d5.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=fB({},s);d5.forEach((t=>{delete r[t]})),delete r.style;const a=fB({},r,i);return a.style=fB({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:xM(this._option.mode)||!_M(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=b_.getElementById(t.parentElement)):_M(this._option.mode)&&(t.parentElement=null==yM?void 0:yM.body)}}const p5={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class g5 extends RU{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=u5,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=_M(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&h5(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&LH.globalConfig.uniqueTooltip&&l&&LH.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:VP.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:VP.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?KW.canvas:KW.dom,n=bB.getComponentPluginInType(t);n||fM("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=bB.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(bM(s)||xM(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=o5(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(c5(t)){if(h5(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>Gj(t,e[i])))}if(c5(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}g5.type=r.tooltip,g5.transformerConstructor=u5,g5.builtInTheme={tooltip:p5},g5.specKey="tooltip";var f5,m5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(f5||(f5={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(m5||(m5={}));const v5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},y5={labelZIndex:!0,gridZIndex:!0},_5={xField:!0,yField:!0,categoryField:!0,valueField:!0},b5={visible:!0,width:!0,style:!0};class x5 extends RU{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Lw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||y5[i]||_5[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||b5[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:WP.chart}:{source:VP.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:bM(e)||xM(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:VP.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:VP.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:VP.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)=>{v5[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}x5.specKey="crosshair";const S5={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class A5 extends x5{static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=Dj(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){Dj(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Fj(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"cartesian");e&&(HW(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=UW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new RG(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new IG(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}A5.specKey="crosshair",A5.builtInTheme={crosshair:S5},A5.type=r.cartesianCrosshair;class k5 extends x5{static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=hU(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=NH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new RG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new LG(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new DG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new OG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}k5.specKey="crosshair",k5.builtInTheme={crosshair:S5},k5.type=r.polarCrosshair;const C5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},T5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},M5=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},w5=(t,e,i)=>{const s=e.domain();if(Iw(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},E5=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Iw(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},B5=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},P5=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}},R5=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),I5=(t,e,i)=>{if(Iw(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class O5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===jj(Hj(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(O5,s$);class L5 extends RU{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:E5(t,this._stateScale,this._isHorizontal),a="percent"===n?e:E5(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=B5(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=I5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&P5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=Hj(t),this._isHorizontal="horizontal"===jj(this._orient),this._dataFilterEvent=new O5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Iw(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>jj(t._orient)===jj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Iw(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};Tw(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Iw(d.getScale(0).type),p=Iw(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else Tw(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;qP(r,"dataview",Oa),$P(r,"dataFilterComputeDomain",M5);const a=new za(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Ez(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||($P(this._option.dataSet,"dataFilterWithNewDomain",T5),$P(this._option.dataSet,"lockStatisticsFilter",C5),Tw(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Iw(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Iw(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Iw(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;R5("start",i,this._spec)&&R5("end",s,this._spec)&&(t="percent"===i?this._spec.start:E5(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:E5(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?E5(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?E5(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=w5(this._start,this._stateScale,B5(i,this._isHorizontal)),this._endValue=w5(this._end,this._stateScale,B5(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Iw(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=I5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&Tw(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new AE:new iE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=P5(h);if(!this._dataUpdating&&Lw(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,Lw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(L5,s$);class D5 extends PU{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=fB({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const F5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),z5={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:F5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:F5(!0)},H5={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class j5 extends L5{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=D5,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=w5(e,this._stateScale,B5(s,this._isHorizontal)),a=w5(i,this._stateScale,B5(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new AE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(B5(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=B5(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return H5}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new AE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(B5(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Iw(t.type)||e[0]!==X(e))&&(!Lw(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:B5(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>w5(t,this._stateScale,B5(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new bY(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>w5(t,this._stateScale,B5(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:OP(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:OP(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:OP(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:OP(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:OP(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:OP(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:OP(g.style)},selectedBackgroundStyle:OP(this._spec.selectedBackground.style),dragMaskStyle:OP(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:fB(OP(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},OP(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:fB(OP(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},OP(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}=NH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(B5(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}j5.type=r.dataZoom,j5.transformerConstructor=D5,j5.builtInTheme={dataZoom:z5},j5.specKey="dataZoom";const N5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},U5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class V5 extends L5{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=vw(this._start,e)&&vw(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=B5(n,this._isHorizontal),a=w5(e,this._stateScale,r),o=w5(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return U5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new fG(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=OP(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=OP(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}V5.type=r.scrollBar,V5.builtInTheme={scrollBar:N5},V5.specKey="scrollBar";const W5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():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},G5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),Y5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:G5("l1FontSize","primaryFontColor")},content:{visible:!0,style:G5("l2FontSize","tertiaryFontColor")}};class X5 extends RU{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(FP(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(FP(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){$P(this._option.dataSet,"indicatorFilter",W5);const t=new za(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 Ez(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=fB({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},IP(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?nB(l,this._computeLayoutRadius()):0,dy:h?nB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},IP(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new FX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}X5.type=r.indicator,X5.builtInTheme={indicator:Y5},X5.specKey="indicator";const K5=["sum","average","min","max","variance","standardDeviation","median"];function $5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function q5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function Z5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&$5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,q5(a,"xAxis"),t.x)),c=ZE(t.x)?e3(t.x,n)+r.x:i3(h.getXAxisHelper(),[t.x])+r.x,c}function J5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&$5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,q5(a,"yAxis"),t.y)),c=ZE(t.y)?e3(t.y,n)+r.y:i3(h.getYAxisHelper(),[t.y])+r.y,c}function Q5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&$5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,q5(n,"angleAxis"),t.angle)),i3(o.angleAxisHelper,[t.angle])}function t3(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&$5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,q5(n,"radiusAxis"),t.radius)),i3(o.radiusAxisHelper,[t.radius])}function e3(t,e){return Number(t.substring(0,t.length-1))*e/100}function i3(t,e){const i=t.getScale(0);return Iw(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function s3(t){return K5.includes(t)}function n3(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=Z5(t,_,n,g,d,l,a),r=J5(t,b,n,g,u,l,a),r3(s,x,A,f.length),r3(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=Z5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);r3(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=J5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);r3(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function r3(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=Q5(t,h,n,a,r),i=t3(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=Q5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=t3(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function o3(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function l3(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&$5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,q5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&$5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,q5(s,"yAxis"),d[0]))}(t,o3(t,e),i,n)})),a.forEach(((t,i)=>{const n=o3(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=ZE(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=ZE(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:i3(n.getXAxisHelper(),p)+l.x+d,y:i3(n.getYAxisHelper(),g)+l.y+u})})),r}function h3(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&$5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,q5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&$5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,q5(s,"radiusAxis"),p[0])),n.push({angle:i3(h.angleAxisHelper,u),radius:i3(h.radiusAxisHelper,p)})})),n}function c3(t,e,i){let{x:s,y:n}=t;return ZE(s)&&(s=e3(s,e)),ZE(n)&&(n=e3(n,i)),{x:s,y:n}}function d3(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=c3(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>c3(t,n,r)))}function u3(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 p3(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},OP(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},f3(OP(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=f3(OP(r),i,s)),t}return{visible:!1}}function g3(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function f3(t,e,i){return d(t)?t(e,i):t}function m3(t,e){return d(t)?t(e):t}function v3(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 y3(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function _3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=y3(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function b3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=y3(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function x3(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function S3(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&s3(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&s3(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&s3(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&s3(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>k3(i,t,e))):i.x=k3(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>k3(i,t,e))):i.y=k3(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>k3(i,t,e))):i.angle=k3(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>k3(i,t,e))):i.radius=k3(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=k3(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const A3={min:(t,e)=>yw(t[0].latestData,e.field),max:(t,e)=>_w(t[0].latestData,e.field),sum:function(t,e){return bw(t[0].latestData,e.field)},average:function(t,e){return xw(t[0].latestData,e.field)},variance:function(t,e){return Sw(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(Sw(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function k3(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 A3[i](e,{field:s})}return t}function C3(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}const T3=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},M3=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},w3=t=>{if(!t)return;T3(t).forEach((e=>{M3(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{M3(e,t)}))},E3=(t,e)=>{if(!t)return;const i=new Set(T3(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(w3),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},B3="__vchart_marker_coordinate__",P3=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],R3=["position","positions","coordinatesOffset","regionRelative"],I3=["offsetX","offsetY","confine"],O3=t=>Array.isArray(t)?t.map(O3):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,L3=t=>{if(Array.isArray(t))return t.map(L3);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=L3(e[t])})),e},D3=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&P3.forEach((t=>{i[t]=B3})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),R3.forEach((t=>{t in i&&(i[t]=B3)})),"label"in i&&(i.label=O3(i.label)),Object.keys(i).forEach((t=>{i[t]=L3(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),I3.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=B3)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},O3(t)),{text:"__vchart_marker_text__"}))}return i};class F3 extends RU{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&s3(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Fa;return e.registerParser("array",s),new za(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&E3(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}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._updateMarkerLayout()}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._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=ww(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=QE(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QE(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(D3(e,{normalizeDomainPosition:i}),D3(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(D3(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),D3(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();$P(this._option.dataSet,"markerAggregation",S3),$P(this._option.dataSet,"markerFilter",C3),this._releaseMarkerData();const i=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function z3(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=yw(t,e),r=_w(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class H3 extends F3{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}=_3(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:f3(OP(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>p3(t,this._markerData,this._markAttributeContext))),state:{line:g3(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:g3(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:g3(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return g3(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return g3(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:f3(OP(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:f3(OP(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=u3([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=_3(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;$P(this._option.dataSet,"markerAggregation",S3),$P(this._option.dataSet,"markerRegression",z3),$P(this._option.dataSet,"markerFilter",C3);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new za(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()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}H3.specKey="markLine";const j3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),N3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},U3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:j3(!1),endSymbol:j3(!0),label:N3};class V3 extends H3{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new aX(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}=_3(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=n3(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=l3(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=d3(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(ZE(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.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));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=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}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_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}=_3(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 za(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}V3.type=r.markLine,V3.coordinateType="cartesian",V3.builtInTheme={markLine:U3};class W3 extends H3{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=_3(this._spec);return e||i?new hX(t):new aX(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}=_3(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=a3(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=h3(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=_3(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}}}W3.type=r.polarMarkLine,W3.coordinateType="polar",W3.builtInTheme={polarMarkLine:U3};class G3 extends RU{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=qE(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return UH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=QE(this._spec.width,a.width,null,a.width),l=QE(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new LX(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}}G3.type=r.title,G3.specKey=r.title,G3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class Y3 extends F3{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=b3(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:f3(OP(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>p3(t,this._markerData,this._markAttributeContext))),state:{area:g3(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>g3(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return g3(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=u3([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=b3(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}Y3.specKey="markArea";const X3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class K3 extends Y3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new lX(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=b3(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=n3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=n3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=l3(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=d3(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=b3(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}}}K3.type=r.markArea,K3.coordinateType="cartesian",K3.builtInTheme={markArea:X3};class $3 extends Y3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=b3(this._spec);return i||e||s?new cX(t):new lX(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}=b3(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=a3(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());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=h3(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=b3(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}}}$3.type=r.polarMarkArea,$3.coordinateType="polar",$3.builtInTheme={polarMarkArea:X3};const q3=t=>OP(Object.assign({},t)),Z3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},OP(t.style))}),J3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=q3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=q3(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:{},OP(Object.assign({},_)));var _;const b=Z3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Z3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Z3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Z3(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},Q3=t=>"left"===t||"right"===t,t4=t=>"top"===t||"bottom"===t,e4={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class i4 extends RU{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({},J3(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({},J3(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?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new ZX(t):this._playerComponent=new tK(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=Q3(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=Q3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(GX.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(GX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(GX.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(GX.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(GX.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(GX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=Q3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=t4(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):Q3(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))):t4(this._orient)?this._maxSize():t.height}_computeDx(t){return Q3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return t4(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){var i,s;const n=null===(i=this._specs)||void 0===i?void 0:i[e];n&&(null===(s=this._option)||void 0===s?void 0:s.globalInstance)&&(this._option.globalInstance.updateFullData(n.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:n,index:e,specs:this._specs}}))}release(){var e,i,s,n;null===(i=null===(e=this._playerComponent)||void 0===e?void 0:e.pause)||void 0===i||i.call(e),null===(n=null===(s=this._option)||void 0===s?void 0:s.globalInstance)||void 0===n||n.off(t.ChartEvent.rendered,this.autoPlayCallback),super.release(),this._playerComponent=null,this._cacheAttrs=null,this._specs=[]}}i4.builtInTheme={player:e4},i4.specKey="player",i4.type=r.player;class s4 extends RU{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,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=HE({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==sz.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}s4.type=r.label;class n4 extends lq{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}n4.type="text",n4.constructorType="label";const r4=()=>{hq(),bB.registerMark(n4.constructorType,n4)};class a4 extends PU{_initTheme(t,e){return{spec:t,theme:this._theme}}}class o4 extends s4{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=a4,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(jP.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(jP.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Tw(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=fB({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},k$(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[lP])):t=>t.filter((t=>t.data[oP]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?C$(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}o4.type=r.label,o4.specKey="label",o4.transformerConstructor=a4;class l4 extends s4{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[rP]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return fB({textStyle:{pickable:!0===this._spec.interactive},position:h4(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[lP]:t.data[oP]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>C$({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function h4(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}l4.type=r.totalLabel,l4.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},l4.specKey="totalLabel";class c4 extends F3{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=x3(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,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,I,O,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=f3(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=p3(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=f3(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=OP(f3(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=f3(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=f3(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:m3(D.offsetX,j),offsetY:m3(D.offsetY,j)},et),{style:f3(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:f3(z.style,this._markerData,this._markAttributeContext)},state:{line:g3(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:g3(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:g3(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:g3(it,this._markerData,this._markAttributeContext),textBackground:g3(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:g3(null!==(O=null===(I=this._spec.targetSymbol)||void 0===I?void 0:I.state)&&void 0!==O?O:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:OP(lt.style)}):{visible:!1};return new uX(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:OP(C.style)}):{visible:!1},w=p3(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=u3([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=m3(S.offsetX,A),f=m3(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:v3(y,s,A),offsetY:v3(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=x3(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}c4.specKey="markPoint";const d4={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class u4 extends c4{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=n3(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=l3(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=d3(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=x3(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}}}u4.type=r.markPoint,u4.coordinateType="cartesian",u4.builtInTheme={markPoint:d4};class p4 extends c4{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=a3(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}p4.type=r.polarMarkPoint,p4.coordinateType="polar",p4.builtInTheme={polarMarkPoint:d4};class g4 extends c4{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}])]}}}g4.type=r.geoMarkPoint,g4.coordinateType="geo",g4.builtInTheme={geoMarkPoint:d4};const f4="inBrush",m4="outOfBrush",v4={style:!0,inBrush:!0,outOfBrush:!0};class y4 extends RU{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),f4,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),m4,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||v4[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:OP(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new nK(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:OP(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(JX.brushActive,(s=>{this._initMarkBrushState(i,m4),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(JX.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(JX.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(JX.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(JX.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(JX.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(JX.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(JX.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},OP(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];$z(t,[...s.filter((t=>t!==f4&&t!==m4)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,f4),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,m4),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,f4),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,m4),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;Zz(s,[f4,m4]),i&&qz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}y4.type=r.brush,y4.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},y4.specKey="brush";const _4={style:!0,state:!0};class b4 extends RU{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${WB}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=vj({},yj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||_4[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_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 Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}b4.type=r.customMark,b4.specKey="customMark";class x4{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>S4(t))),a=n.filter((t=>!S4(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>S4(t))),h=o.filter((t=>!S4(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 S4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}x4.type="grid";const A4=t=>{t?function(t){if(!t)throw new Error("installPoptipToApp requires an app instance");WA(t),BG(NA()),UA(),GA(t)}(t):(BG(m_()),BG(NA()),UA())},k4="vchart-tooltip",C4=`${k4}-container`,T4=`${k4}-title`,M4=`${k4}-content-box`,w4={offsetX:10,offsetY:10},E4="99999999999999";function B4(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const P4=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,R4=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?B4(t):"",I4=(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},O4={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},L4=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=O4[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class D4 extends aU{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=YH(null==T?void 0:T.position,b,e),w=null!==(r=YH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),I=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:GB,O=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:YB;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=_M(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=I,D.height=O),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=P4(e,F),N=P4(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(L4(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=I4(t,y),W.top=I4(i,y),W.right=I4(e,y),W.bottom=I4(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=I4(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?I:O,n="x"===t?A:C,r=L4(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",z4=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=F4(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=F4(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},H4=(t={})=>{const{lineHeight:e}=t;return t.fontSize?QE(e,t.fontSize):0},j4=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=F4(o)),{panelStyle:a,panelPadding:o}};function N4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const U4=t=>{bB.registerComponentPlugin(t.type,t)};const V4=t=>!!t&&1===t.nodeType&&"function"==typeof t.appendChild&&!!t.children;class W4 extends D4{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(W4.type),this.type=KW.dom,this._tooltipContainer=null==yM?void 0:yM.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}_getTooltipParentElement(t){return V4(t.parentElement)?t.parentElement:V4(this._chartContainer)?this._chartContainer:V4(null==yM?void 0:yM.body)?yM.body:void 0}initEl(){const t=this._component.getSpec(),e=this._getTooltipParentElement(t);if(yM&&e){for(let t=0;t{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=j4(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:F4(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=z4(h),x=z4(d),S=z4(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=F4(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=F4(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=F4(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(H4(p),H4(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(T4))),l=a.find((t=>t.className.includes(M4)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(T4),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(N4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${k4}-column`),e.classList.add(`${k4}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(M4),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];N4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));N4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${k4}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=R4(e.key),e.keyStyle&&z4(e.keyStyle,l)):"value"===i?(o.innerHTML=R4(e.value),e.valueStyle&&z4(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?B4(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?B4(c):m,_=p,b=t=>new Wg({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=su.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?B4(u):"currentColor",`\n \n \n \n `;const M=T?su.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),N4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(M4))),h=[...o.children].find((t=>t.className.includes(T4)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(T4)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=QE(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,N4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=fv({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function X4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:G4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const K4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class $4 extends D4{constructor(){super($4.type),this.type=KW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new hK({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=iB(d.padding),x=X4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=X4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=X4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:K4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,I=0,O=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.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:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=fB({},S,X4(b,void 0,{})),{width:s,height:n,text:r}=Y4(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=fB({},A,X4(x,void 0,{})),{width:e,height:s,text:n}=Y4(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};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=fB({},x,X4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=Y4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}$4.type=KW.canvas;const q4=()=>{U4($4)},Z4=(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(PE).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=bB.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=bB.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},J4=(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=Z4(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):dB(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=fB({},i),m=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:fB(f,m),hasChanged:!0};const i=fB({},t,m);uB(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[c])?f[c].push(t):u(f[c])?f[c]="component"===h?t:[t]:f[c]=[f[c],t]}return{chartSpec:f,hasChanged:!0}},Q4=t=>{bB.registerChartPlugin(t.type,t)};class t8 extends aU{constructor(){super(t8.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[t8.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[t8.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=gB(this._option.globalInstance.getSpec(),["data",t8.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=gB(this._baseChartSpec,["data",t8.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=J4(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=gB(i,["data",t8.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()}}t8.pluginType="chart",t8.specKey="media",t8.type="MediaQueryPlugin";const e8=/\{([^}]+)\}/,i8=/\{([^}]+)\}/g,s8=/:/;class n8 extends aU{constructor(){super(n8.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.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[n8.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)),bB.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=e8.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(i8,((t,i)=>{if(!s8.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 this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}n8.pluginType="chart",n8.specKey="formatter",n8.type="formatterPlugin";class r8 extends aU{constructor(){super(r8.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[r8.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=e$(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{QW(),eG(),sG(),BW(),EW(),dW(),iW(),GN(),XN(),xH(),yH(),DV(),JV(),bB.registerSeries(uW.type,uW),bB.registerChart(nG.type,nG)},()=>{QW(),eG(),sG(),EW(),dW(),iW(),GN(),oG(),XN(),cG(),DV(),JV(),bB.registerSeries(pK.type,pK),BW(),bB.registerChart(fK.type,fK)},()=>{QW(),eG(),sG(),EW(),BK(),BW(),bB.registerChart(RK.type,RK)},()=>{QW(),eG(),BW(),EW(),VK(),bB.registerChart(GK.type,GK)},()=>{eG(),Wq(),bB.registerChart(q1.type,q1)},()=>{QW(),eG(),BW(),EW(),hZ(),bB.registerChart(Q1.type,Q1)},()=>{QW(),eG(),sG(),BW(),EW(),yZ(),bB.registerChart(e2.type,e2)},()=>{QW(),eG(),sG(),BW(),EW(),BK(),bB.registerTransform("bin",Qr),bB.registerChart(o2.type,o2)},()=>{eG(),r$(),qK(),bB.registerSeries(o$.type,o$),bB.registerImplement("registerMap",tR),bB.registerImplement("unregisterMap",eR),_H(),bB.registerChart(W1.type,W1)},()=>{eG(),r1(),bB.registerSeries(o1.type,o1),Dq(),DZ(),rZ(),jZ(),bB.registerChart(d2.type,d2)},()=>{eG(),BQ(),bB.registerChart(g2.type,g2)},()=>{eG(),ZQ(),bB.registerChart(m2.type,m2)},()=>{QW(),eG(),sG(),BW(),EW(),F$(),bB.registerChart(w2.type,w2)},()=>{QW(),eG(),BW(),EW(),oq(),bB.registerTransform("boxplot",ta),bB.registerChart(B2.type,B2)},()=>{QW(),eG(),BW(),EW(),jZ(),bB.registerChart(h2.type,h2)},()=>{QW(),eG(),BW(),EW(),$Z(),bB.registerChart(y2.type,y2)},()=>{QW(),eG(),BW(),EW(),yq(),bB.registerChart(b2.type,b2)},()=>{QW(),eG(),sG(),BW(),EW(),oG(),DV(),JV(),bB.registerSeries(Aq.type,Aq),bB.registerChart(O2.type,O2)},()=>{eG(),f0(),bB.registerChart(S2.type,S2)},()=>{eG(),x0(),bB.registerChart(k2.type,k2)},()=>{eG(),$0(),bB.registerChart(T2.type,T2)},()=>{eG(),vG(),N0(),bB.registerChart(R2.type,R2)},()=>{eG(),f1(),bB.registerChart(D2.type,D2)},()=>{eG(),B1(),bB.registerChart(z2.type,z2)},()=>{QW(),eG(),sG(),BW(),bB.registerChart(s2.type,s2),EW()},JV,DV,()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),VU(),bB.registerComponent(cK.type,cK)},()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),VU(),bB.registerComponent(dK.type,dK)},()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),VU(),bB.registerComponent(uK.type,uK)},oZ,rZ,()=>{bB.registerComponent(G2.type,G2)},()=>{bB.registerComponent(s5.type,s5)},()=>{bB.registerComponent(g5.type,g5)},()=>{bB.registerComponent(A5.type,A5)},()=>{bB.registerComponent(k5.type,k5)},()=>{bB.registerComponent(j5.type,j5)},()=>{bB.registerComponent(V5.type,V5)},()=>{bB.registerComponent(X5.type,X5)},r$,()=>{bB.registerComponent(V3.type,V3),rX()},()=>{bB.registerComponent(K3.type,K3),oX()},()=>{bB.registerComponent(u4.type,u4),dX()},()=>{bB.registerComponent(W3.type,W3),hX._animate=jY,rX()},()=>{bB.registerComponent($3.type,$3),cX._animate=UY,oX()},()=>{bB.registerComponent(p4.type,p4),dX()},()=>{bB.registerComponent(g4.type,g4),dX()},()=>{bB.registerComponent(G3.type,G3)},()=>{bB.registerComponent(i4.type,i4)},()=>{bB.registerGraphicComponent(o4.type,(t=>new JG(t))),r4(),DU(),bB.registerComponent(o4.type,o4,!0,1/0)},()=>{bB.registerGraphicComponent(l4.type,(t=>new JG(t))),r4(),DU(),bB.registerComponent(l4.type,l4,!0)},()=>{bB.registerComponent(y4.type,y4)},()=>{bB.registerComponent(b4.type,b4)},()=>{bB.registerRuntimePluginInstaller("poptipForText",A4),A4()},()=>{bB.registerLayout(x4.type,x4)},q4,MH,BH]),LH.useRegisters([()=>{zO(iA)}]),t.AxisSyncPlugin=oU,t.CanvasTooltipHandler=$4,t.ChartResizeZoomPlugin=r8,t.DEFAULT_CHART_HEIGHT=YB,t.DEFAULT_CHART_WIDTH=GB,t.DEFAULT_CLOSE_STROKE_JOIN=zH,t.DEFAULT_DATA_INDEX=KB,t.DEFAULT_DATA_KEY=$B,t.DEFAULT_DATA_SERIES_FIELD=qB,t.DEFAULT_KEY=fP,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=FH,t.DEFAULT_MAP_LOOK_UP_KEY=mP,t.DEFAULT_MEASURE_CANVAS_ID=XB,t.DEFAULT_SERIES_STYLE_NAME=ZB,t.DEFAULT_SMOOTH_INTERPOLATE=DH,t.DomTooltipHandler=W4,t.Factory=bB,t.FormatterPlugin=n8,t.MOSAIC_CAT_END_PERCENT=uP,t.MOSAIC_CAT_START_PERCENT=dP,t.MOSAIC_VALUE_END_PERCENT=cP,t.MOSAIC_VALUE_START_PERCENT=hP,t.ManualTicker=class extends pb{constructor(t){super(t),this.lastFrameTime=0,this.status=wl.RUNNING}setupTickHandler(){const t=new HH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,!0}},t.MediaQuery=t8,t.PREFIX=WB,t.SEGMENT_FIELD_END=gP,t.SEGMENT_FIELD_START=pP,t.STACK_FIELD_END=tP,t.STACK_FIELD_END_OffsetSilhouette=nP,t.STACK_FIELD_END_PERCENT=iP,t.STACK_FIELD_KEY=JB,t.STACK_FIELD_START=QB,t.STACK_FIELD_START_OffsetSilhouette=sP,t.STACK_FIELD_START_PERCENT=eP,t.STACK_FIELD_TOTAL=rP,t.STACK_FIELD_TOTAL_BOTTOM=lP,t.STACK_FIELD_TOTAL_PERCENT=aP,t.STACK_FIELD_TOTAL_TOP=oP,t.StreamLight=nF,t.ThemeManager=DB,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=LH,t.boundsInRect=eB,t.builtinThemes=CB,t.calcLayoutNumber=QE,t.calcPadding=tB,t.computeActualDataScheme=FE,t.convertPoint=sB,t.createArc=Vp,t.createArea=Yp,t.createGroup=tg,t.createLine=ag,t.createRect=mg,t.createRichText=jg,t.createSymbol=Gg,t.createText=Jg,t.darkTheme=cB,t.dataScheme=rB,t.default=LH,t.defaultThemeName=TB,t.getActualColor=HE,t.getActualNumValue=nB,t.getColorSchemeBySeries=VE,t.getDataScheme=DE,t.getFunnelTheme=AB,t.getMergedTheme=OB,t.getSpecInfo=UH,t.getTheme=PB,t.hasThemeMerged=EB,t.isColorKey=jE,t.isPercent=ZE,t.isPercentOffset=JE,t.isProgressiveDataColorScheme=NE,t.isTokenKey=oB,t.isValidOrient=qE,t.lightTheme=hB,t.lookup=VH,t.measureText=VB,t.normalizeLayoutPaddingSpec=iB,t.queryColorFromColorScheme=zE,t.queryToken=aB,t.registerCanvasTooltipHandler=q4,t.registerChartPlugin=Q4,t.registerChartResizeZoomPlugin=()=>{Q4(r8)},t.registerDataSetInstanceParser=qP,t.registerDataSetInstanceTransform=$P,t.registerDomTooltipHandler=()=>{U4(W4)},t.registerFormatPlugin=()=>{Q4(n8)},t.registerMediaQuery=()=>{Q4(t8)},t.registerTheme=BB,t.removeTheme=RB,t.themeExist=IB,t.themes=MB,t.token=lB,t.transformColorSchemeToStandardStruct=UE,t.transformToGraphic=OP,t.version="2.1.3",t.vglobal=b_,t.warn=gM,Object.defineProperty(t,"__esModule",{value:!0})})); +let _Q=class t extends oQ{constructor(e){super(H({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),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 C=u.getImageData(0,0,A,k).data;if(this.exceedTime())return null;const T=[];let M,w=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(C[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(;w--;)for(M=x;M--;)B(w,M,T);return{datum:t,occupied:T,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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?fQ(t,o,l.width,l.height,h):"geometric"===t.type&&yQ(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=sQ(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};_Q.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class bQ extends oQ{constructor(t){super(H({},bQ.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}bQ.defaultOptions={enlarge:!1};const SQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},AQ=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?kQ(t.fontFamily):"sans-serif",d=t.fontStyle?kQ(t.fontStyle):"normal",u=t.fontWeight?kQ(t.fontWeight):"normal",p=t.rotate?kQ(t.rotate):0,g=kQ(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?kQ(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},SQ),t.as):SQ,C=t.depth_3d,T=t.postProjection;let M=t.fontSize?kQ(t.fontSize):14;const w=t.fontSizeRange;if(w&&!S(M)){const t=M,e=TQ(MQ(t,l),w);M=i=>e(t(i))}let E=hQ;"fast"===t.layoutType?E=bQ:"grid"===t.layoutType&&(E=_Q);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:M,shrink:y,clip:b,enlarge:_,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},kQ=t=>y(t)||S(t)||d(t)||_(t)?t:e=>e[t.field],CQ=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),TQ=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=CQ(t[0]),n=CQ(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(CQ(t)-r)/(a-r)*(e[1]-e[0])+e[0]},MQ=(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 wQ(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{bB.registerGrammarTransform("wordcloud",{transform:AQ}),hq(),bB.registerAnimation("wordCloud",((t,e)=>({appear:aJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:fH.disappear.duration}}))),bB.registerSeries(EQ.type,EQ)},PQ=t=>d(t)?t():t,RQ=(t,e)=>{var i,s,n,r;const a=t.map((t=>Object.assign({},t)));if(!a||0===a.length)return a;const{asTransformRatio:o,asReachRatio:l,asHeightRatio:h,asValueRatio:c,asNextValueRatio:d,asLastValueRatio:u,asLastValue:p,asCurrentValue:g,asNextValue:f}=e,m=PQ(e.valueField),v=null!==(i=PQ(e.heightVisual))&&void 0!==i&&i,y=null===(s=PQ(e.isCone))||void 0===s||s,_=PQ(e.range),b=a.reduce(((t,e)=>{const i=Number.parseFloat(e[m]);return k(i)?Math.max(t,i):t}),-1/0),x=null!==(n=null==_?void 0:_.min)&&void 0!==n?n:0,S=null!==(r=null==_?void 0:_.max)&&void 0!==r?r:b,A=t=>k(t)&&k(x)&&k(S)?x===S?t{var i,s;const n=Number.parseFloat(t[m]),r=Number.parseFloat(null===(i=a[e-1])||void 0===i?void 0:i[m]),_=Number.parseFloat(null===(s=a[e+1])||void 0===s?void 0:s[m]),b=k(_*n)&&0!==n?_/n:0,x=k(n*r)&&0!==r?n/r:0,S=A(n);p&&(t[p]=r),f&&(t[f]=_),o&&(t[o]=b),l&&(t[l]=0===e?1:x),h&&(t[h]=!0===v?b:1/a.length),c&&(t[c]=S),d&&(t[d]=e===a.length-1?y?0:t[c]:A(_)),u&&(t[u]=0===e?1:A(r)),g&&(t[g]=n)})),a},IQ=(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},OQ=`${WB}_FUNNEL_TRANSFORM_RATIO`,LQ=`${WB}_FUNNEL_REACH_RATIO`,DQ=`${WB}_FUNNEL_HEIGHT_RATIO`,FQ=`${WB}_FUNNEL_VALUE_RATIO`,zQ=`${WB}_FUNNEL_LAST_VALUE_RATIO`,HQ=`${WB}_FUNNEL_NEXT_VALUE_RATIO`,jQ=`${WB}_FUNNEL_LAST_VALUE`,NQ=`${WB}_FUNNEL_CURRENT_VALUE`,UQ=`${WB}_FUNNEL_NEXT_VALUE`,VQ=`${WB}_FUNNEL_TRANSFORM_LEVEL`;class WQ extends ZH{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[LQ])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class GQ extends Qz{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class YQ extends GQ{constructor(){super(...arguments),this.type=YQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}YQ.type="polygon";const XQ=()=>{bB.registerMark(YQ.type,YQ),KT(),yT(),w_.registerBuiltInAnimate("growPointsOut",YL),bB.registerGraphicComponent("polygon",ug)},KQ=Object.assign(Object.assign({},hj),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class $Q extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class qQ extends Rj{constructor(){super(...arguments),this.type=PE.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=$Q,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;$P(this._dataSet,"funnel",RQ),$P(this._dataSet,"funnelTransform",IQ);const t=new za(this._dataSet,{name:`${WB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new Ez(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:()=>this.getValueField(),isCone:()=>this._spec.isCone,asCurrentValue:NQ,asTransformRatio:OQ,asReachRatio:LQ,asHeightRatio:DQ,asValueRatio:FQ,asNextValueRatio:HQ,asLastValueRatio:zQ,asLastValue:jQ,asNextValue:UQ,range:()=>this._spec.range}}),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.transform({type:"funnelTransform",options:{asIsTransformLevel:VQ}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},qQ.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:xj(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},qQ.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(qQ.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(qQ.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new WQ(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&uM(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&uM(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*Ew(LQ).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(vj(null===(s=bB.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),yj("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(vj(bB.getAnimationInKey("fadeInOut")(),yj(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(vj(bB.getAnimationInKey("funnel")({},o),yj(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(vj(null===(a=bB.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),yj("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[zQ])/2:this._getSecondaryAxisLength(t[FQ])/2,n=this._getSecondaryAxisLength(t[FQ])/2):(s=this._getSecondaryAxisLength(t[FQ])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[HQ])/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[VQ])}_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[$B]===t[$B]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,y,_;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(y=this._getPolygonCenter(i).y-s/2-e,_=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:y-e,m=this._getPolygonCenter(i).x,y-_{XQ(),hq(),v$(),bB.registerSeries(qQ.type,qQ),bB.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},vH))),bB.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:dH,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),_H()},JQ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},QQ=t=>{const e=t.filter((t=>t.context.diffState===sz.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},t0=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},e0=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QQ(i.parent.children),a=t0(r,s,n);return JQ(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QQ(i.parent.children),a=t0(r,s,n);return JQ(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),i0=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=K(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},s0=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QQ(i.parent.children),a=i0(r);return JQ(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QQ(i.parent.children),a=i0(r);return JQ(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),n0=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},r0=(t,e={})=>{if(!t)return[];const i=[];return cJ(t,i,e),i},a0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new zJ(i).layout(t,{width:s,height:n})};class o0 extends ZH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var l0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(l0||(l0={}));const h0=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===l0.DrillDown){return Y(TP(t,n,s,"children"))}if(i.type===l0.DrillUp){const e=MP(t,n,s,"children");if(e)return Y(e)}return t};class c0{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=e$(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;$P(t,"drillFilter",h0),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:l0.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:l0.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:l0.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:l0.DrillUp},model:this}),r}}const d0=Object.assign(Object.assign({},hj),{sunburst:{name:"sunburst",type:"arc"}}),u0=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:ij,operations:["max","min","values"]}),t.push({key:sj,operations:["values"]}),t),p0={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class g0 extends kq{constructor(){super(...arguments),this.type=PE.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:sj),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:$B},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),$P(this._dataSet,"sunburstLayout",a0),$P(this._dataSet,"flatten",r0),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 u0(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||($P(t.dataSet,"addVChartProperty",WH),t.transform({type:"addVChartProperty",options:{beforeCall:oj.bind(this),call:lj}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(g0.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(g0.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new o0(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(vj(null===(e=bB.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),yj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),yj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}g0.type=PE.sunburst,g0.mark=d0,g0.builtInTheme={sunburst:p0},G(g0,c0);const f0=()=>{bB.registerSeries(g0.type,g0),Dq(),hq(),_H(),bB.registerAnimation("sunburst",((t,e)=>({appear:n0(0,e),enter:e0(t),exit:s0(t),disappear:{duration:fH.disappear.duration}})))},m0=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new TJ(i).layout(t,{width:s,height:n})};class v0 extends ZH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const y0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},_0=Object.assign(Object.assign({},hj),{circlePacking:{name:"circlePacking",type:"arc"}});class b0 extends Lj{constructor(){super(...arguments),this.type=PE.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:sj),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:$B},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),$P(this._dataSet,"circlePackingLayout",m0),$P(this._dataSet,"flatten",r0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||($P(t.dataSet,"addVChartProperty",WH),t.transform({type:"addVChartProperty",options:{beforeCall:oj.bind(this),call:lj}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(b0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(b0.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return u0(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new v0(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),yj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),yj(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}b0.type=PE.circlePacking,b0.mark=_0,b0.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(b0,c0);const x0=()=>{bB.registerSeries(b0.type,b0),Dq(),hq(),yH(),bB.registerAnimation("circlePacking",((t,e)=>({appear:y0(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:fH.disappear.duration}})))},S0=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&S0(t,e.children,i)}))},A0=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},k0=(t,e)=>{const i=d(e)?e():e;if(!t||!(null==i?void 0:i.view)||!t.length)return[];const s=i.view();if(s.x1-s.x0==0||s.y1-s.y0==0||s.x1-s.x0==-1/0||s.x1-s.x0==1/0||s.y1-s.y0==-1/0||s.y1-s.y0==1/0)return[];const n=t[0],r=C0(n,i),a=new LJ(i),o=[];return o.push(a.layout(r,s)),o},C0=(t,e)=>{if("source"===e.sourceField&&"target"===e.targetField&&"value"===e.valueField)return t;const i=t.links;return i?Object.assign(Object.assign({},t),{links:i.map((t=>{const i={};return Object.keys(t).forEach((s=>{s===e.sourceField?i.source=t[e.sourceField]:s===e.targetField?i.target=t[e.targetField]:s===e.valueField?i.value=t[e.valueField]:i[s]=t[s]})),i}))}):t},T0=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:[]},M0=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 w0 extends ZH{constructor(){super(...arguments),this._getDimensionData=t=>{if(!u(null==t?void 0:t.source)&&!u(null==t?void 0:t.target)){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const E0=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),B0=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:E0(t),P0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class R0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class I0 extends sb{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const O0=(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`},L0=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class D0 extends V${constructor(){super(...arguments),this.type=D0.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?L0:O0,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}D0.type="linkPath";const F0=Object.assign(Object.assign({},hj),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class z0 extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const H0=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&Zz(t,e),qz(t,e,s,n)};class j0 extends Lj{constructor(){super(...arguments),this.type=PE.sankey,this.transformerConstructor=z0,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ue,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{Zz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),n.forEach((e=>{Zz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=FP(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=FP(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):r.target===i.key?(s.includes(r.source)||s.push(r.source),Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=FP(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(Zz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),H0(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation())):(Zz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),qz(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=FP(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=FP(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=FP(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=FP(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasLinkStateAnimation())):(Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation()))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=FP(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return Zz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void H0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s},!0,this._hasLinkStateAnimation())}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),Zz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void H0(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value},!0,this._hasLinkStateAnimation());Zz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),qz(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(FP(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{Zz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])})),this._nodeMark&&i.forEach((e=>{Zz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE])}));else{const n=FP(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=FP(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void H0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1},!0,this._hasLinkStateAnimation());const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void H0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a},!0,this._hasLinkStateAnimation())}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void H0(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value},!0,this._hasLinkStateAnimation());Zz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasLinkStateAnimation())})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}_hasStateAnimation(t){var e;return kj(this)&&!!(null===(e=null==t?void 0:t.hasAnimationByState)||void 0===e?void 0:e.call(t,"state"))}_hasLinkStateAnimation(){return this._hasStateAnimation(this._linkMark)}_hasNodeStateAnimation(){return this._hasStateAnimation(this._nodeMark)}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){super.initData();const e=this.getViewData(),i=this.getRawData();if(i&&e){$P(this._dataSet,"sankeyLayout",k0),$P(this._dataSet,"sankeyFormat",A0),i.transform({type:"sankeyFormat"},!1),e.transform({type:"sankeyLayout",options:()=>{var t,e,i,s;return{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse}},level:t.TransformLevel.sankeyLayout});const{dataSet:s}=this._option;$P(s,"sankeyNodes",T0),$P(s,"flatten",r0);const n=new za(s,{name:`sankey-node-${this.id}-data`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyNodes"}),n.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),n.transform({type:"addVChartProperty",options:{beforeCall:rj.bind(this),call:aj}},!1),this._nodesSeriesData=n,$P(s,"sankeyLinks",M0);const r=new za(s,{name:`sankey-link-${this.id}-data`});r.parse([this.getViewData()],{type:"dataview"}),r.transform({type:"sankeyLinks"}),r.transform({type:"addVChartProperty",options:{beforeCall:rj.bind(this),call:aj}},!1),this._linksSeriesData=r}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(j0.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(j0.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=NH(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),yj("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),yj("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:WP.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{Zz(e,[t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(FP(e).key)?qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0,this._hasNodeStateAnimation()):qz(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0,this._hasNodeStateAnimation())}))}initTooltip(){this._tooltipHelper=new w0(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new WE;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return S0(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}j0.type=PE.sankey,j0.transformerConstructor=z0,j0.mark=F0,j0.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const N0=()=>{AK(),W$(),cT(),bB.registerGraphicComponent("path",(t=>hg(t))),bB.registerMark(D0.type,D0),hq(),bB.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:B0(t,e)},vH))),bB.registerAnimation("sankeyLinkPath",((t,e)=>({appear:P0(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:fH.disappear.duration}}))),w_.registerBuiltInAnimate("linkPathGrowOut",I0),w_.registerBuiltInAnimate("linkPathGrowIn",R0),_H(),bB.registerSeries(j0.type,j0)},U0=(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=r0(n);return i=QH([{latestData:r}],e),i};class V0 extends ZH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const W0=Object.assign(Object.assign({},hj),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),G0=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class Y0 extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const X0=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();if(s){const e=new UJ(i).layout(t,s),n=[];return cJ(e,n,{maxDepth:null==i?void 0:i.maxDepth}),n.forEach((t=>{t&&[sj,"name"].forEach((e=>{t[e]=t.datum[t.depth][i.nameField]}))})),n}return[]};class K0 extends Lj{constructor(){super(...arguments),this.type=PE.treemap,this.transformerConstructor=Y0,this._categoryField="name",this._valueField="value",this._viewBox=new Ue,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:sj),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ge),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:$B},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t;super.initData(),$P(this._dataSet,"treemap",X0),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:()=>{var t,e,i,s;return{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(s=this._spec.minVisibleArea)&&void 0!==s?s:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&($P(this._rawData.dataSet,"addVChartProperty",WH),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:oj.bind(this),call:lj}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=U0([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=H(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){$P(this._dataSet,"hierarchyDimensionStatistics",U0),$P(this._dataSet,"flatten",r0);const i=new za(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 u0(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(K0.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(K0.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("treemap"))||void 0===e?void 0:e(),yj(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 V0(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(jP.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(jP.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}K0.type=PE.treemap,K0.mark=W0,K0.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},K0.transformerConstructor=Y0,G(K0,c0),G(K0,s$);const $0=()=>{bB.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),bB.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),AK(),hq(),bB.registerAnimation("treemap",((t,e)=>({appear:G0(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:fH.disappear.duration}}))),_H(),bB.registerSeries(K0.type,K0)},q0=Object.assign(Object.assign({},BZ),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),Z0=Object.assign(Object.assign({},hj),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),J0={type:"fadeIn"};function Q0(t,e){return"fadeIn"===e?J0:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class t1 extends Cj{constructor(){super(...arguments),this._supportStack=!1}}class e1 extends ZH{enableByType(t){return"dimension"!==t}}const i1="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",s1={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:i1,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:i1,fill:"#ddd"}}};class n1 extends RZ{constructor(){super(...arguments),this.type=PE.gaugePointer,this.transformerConstructor=t1,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(n1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},n1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(n1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new e1(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=K(e),s=$(e),n=yt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),yj("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}n1.type=PE.gaugePointer,n1.mark=Z0,n1.builtInTheme={gaugePointer:s1},n1.transformerConstructor=t1;const r1=()=>{bB.registerSeries(n1.type,n1),qK(),AK(),bB.registerAnimation("gaugePointer",((t,e)=>{const i=Q0(t,e);return{appear:i,enter:i,disappear:{duration:fH.disappear.duration}}})),oZ(),rZ()};class a1 extends Cj{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class o1 extends RZ{constructor(){super(...arguments),this.type=PE.gauge,this.transformerConstructor=a1,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();$P(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[gP]=t[this._angleField[0]],t[pP]=e>0?i[e-1][gP]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(o1.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(o1.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?XE(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[pP])?this.angleAxisHelper.dataToPosition([t[pP]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[gP]])}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(vj(null===(i=bB.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),yj("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}o1.type=PE.gauge,o1.mark=q0,o1.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},o1.transformerConstructor=a1;class l1 extends Qz{constructor(){super(...arguments),this.type=l1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Gg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}l1.type="cell";function h1(t){return!1===t?{}:{type:"fadeIn"}}class c1 extends ZH{enableByType(t){return"dimension"!==t}}const d1=Object.assign(Object.assign({},hj),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class u1 extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}const p1={valueField:!0};class g1 extends Lj{constructor(){super(...arguments),this.type=PE.heatmap,this.transformerConstructor=u1}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}_getSpecUpdatePolicy(){const t=super._getSpecUpdatePolicy();return Object.assign(Object.assign({},t),{dataRelatedKeys:Object.assign(Object.assign({},t.dataRelatedKeys),p1)})}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(g1.mark.cell,{isSeriesMark:!0},{morph:xj(this._spec,g1.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(g1.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=oi(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Oj(this);this._cellMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),yj("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 c1(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}g1.type=PE.heatmap,g1.mark=d1,g1.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},g1.transformerConstructor=u1;const f1=()=>{hq(),bB.registerMark(l1.type,l1),bB.registerGraphicComponent("symbol",Gg),KT(),iM(),VN(),bB.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},vH),{appear:h1(e)}))),DV(),JV(),bB.registerSeries(g1.type,g1)},m1=Object.assign(Object.assign({},hj),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),v1=`${WB}_CORRELATION_X`,y1=`${WB}_CORRELATION_Y`,_1=`${WB}_CORRELATION_SIZE`,b1=t=>d(t)?t():t,x1=(t,e)=>{var i,s,n,r,a,o,l,h;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const c=t,d=e.view();if(d.x1-d.x0==0||d.y1-d.y0==0||d.x1-d.x0==-1/0||d.x1-d.x0==1/0||d.y1-d.y0==-1/0||d.y1-d.y0==1/0)return t;const p=oe(null!==(i=b1(e.startAngle))&&void 0!==i?i:-90),g=oe(null!==(s=b1(e.endAngle))&&void 0!==s?s:270),f=Math.max((d.x1-d.x0)/2,(d.y1-d.y0)/2),m=Rt(null!==(n=b1(e.innerRadius))&&void 0!==n?n:0,f),v=Rt(b1(e.outerRadius),f),y=b1(e.center),b=[S(null==y?void 0:y[0])?y[0]:d.x0+Rt(null!==(r=null==y?void 0:y[0])&&void 0!==r?r:"50%",d.x1-d.x0),S(null==y?void 0:y[1])?y[1]:d.y0+Rt(null!==(a=null==y?void 0:y[1])&&void 0!==a?a:"50%",d.y1-d.y0)],x=Pt(b1(e.field)),A=c.map(x),[k,C]=Ot(A),T=k===C?t=>(m+v)/2:t=>m+(v-m)*(t-k)/(C-k),M=b1(e.radiusField),w=b1(e.radiusRange),E=u(M)?x:Pt(M),B=null!==(o=null==w?void 0:w[1])&&void 0!==o?o:5;let P=t=>B;if(E){const[t,e]=E!==x?Ot(c.map(E)):[k,C],i=null!==(l=null==w?void 0:w[0])&&void 0!==l?l:5,s=null!==(h=null==w?void 0:w[1])&&void 0!==h?h:5;t!==e&&(P=n=>i+(s-i)*(E(n)-t)/(e-t))}const R=Math.min(p,g),I=Math.max(p,g),O=S1(R,I,c.length),L=[],D=(I-R)/60;return c.forEach(((t,e)=>{const i=T(A[e]),s=P(t);let n,r,a=O[e];for(let t=0;t<60&&(n=b[0]+i*Math.cos(a),r=b[1]+i*Math.sin(a),A1({x:n,y:r,size:s},L)||n-sd.x1||r-sd.y1);t++)t<59&&(a+=D,a>I?a=R: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},A1=(t,e)=>!(!e||!e.length)&&e.some((e=>{const i=e.x,s=e.y,n=e.size;return Math.pow(t.x-i,2)+Math.pow(t.y-s,2)d(t)?t():t,C1=(t,e)=>{if(!t||!_(t))return[];const i=k1(e.keyword),s=k1(e.categoryField),n=t[0].latestData[0];return{[s]:i,[KB]:null==n?void 0:n[KB],[qB]:null==n?void 0:n[qB]}};class T1 extends V${constructor(){super(...arguments),this.type=T1.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=yt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}T1.type="ripple";const M1=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class w1 extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class E1 extends kq{constructor(){super(...arguments),this.type=PE.correlation,this.transformerConstructor=w1,this._viewBox=new Ue}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(){if(super.initData(),!this._data)return;$P(this._dataSet,"correlation",x1);const t=new Fa;qP(t,"dataview",Oa),$P(t,"correlationCenter",C1);const e=new za(t,{name:`${this.type}_${this.id}_center`});e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"correlationCenter",options:{keyword:()=>{var t,e,i;return 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 Ez(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:()=>this._spec.valueField,radiusRange:()=>this._spec.sizeRange,radiusField:()=>this._spec.sizeField,center:()=>[this._spec.centerX,this._spec.centerY],innerRadius:()=>this._spec.innerRadius,outerRadius:()=>this._spec.outerRadius,startAngle:()=>this._spec.startAngle,endAngle:()=>this._spec.endAngle}})}initMark(){const e=this._createMark(E1.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:KB});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(E1.mark.ripplePoint,{key:KB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(E1.mark.centerPoint,{key:KB,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[v1],y:t=>t[y1],size:t=>t[_1],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),yj("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}E1.type=PE.correlation,E1.mark=m1,E1.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},E1.transformerConstructor=w1;const B1=()=>{XN(),W$(),iM(),bB.registerMark(T1.type,T1),bB.registerGraphicComponent("symbol",(t=>Gg(t))),bB.registerSeries(E1.type,E1),bB.registerAnimation("correlation",((t,e)=>Object.assign({appear:M1(0,e)},mH)))},P1=Object.assign(Object.assign({},hj),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class R1 extends V${constructor(){super(...arguments),this.type=R1.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}R1.type="liquid";const I1=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class O1 extends ZH{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class L1 extends Rj{constructor(){super(...arguments),this.type=PE.liquid,this.transformerConstructor=KN,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=mg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Gg({x:s,y:n,size:r,symbolType:I1(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=iB(this._spec.outlineMargin),this._paddingSpec=iB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(L1.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(L1.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(L1.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(L1.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new O1(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(vj(null===(i=bB.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),yj("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(vj(null===(s=bB.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),yj("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=RM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}L1.type=PE.liquid,L1.mark=P1,L1.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},L1.transformerConstructor=KN;const D1=t=>Y(t).join(",");class F1 extends ZH{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>D1(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>D1(null==t?void 0:t[this.series.getDimensionField()[0]])}}const z1=Object.assign(Object.assign({},hj),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class H1 extends Cj{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const j1=(t,e)=>{const i=d(e)?e():e,s=i.getViewBox();return s&&(null==t?void 0:t.length)?tQ(Object.assign({setField:i.setField,valueField:i.valueField},s),t):[]};class N1 extends Rj{constructor(){super(...arguments),this.type=PE.venn,this.transformerConstructor=H1,this._viewBox=new Ue}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:$B)}initData(){var t;super.initData(),$P(this._dataSet,"venn",j1),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:()=>({getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField})})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(N1.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(N1.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>D1(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>D1(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new F1(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:D1(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return D1(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[D1(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(D1(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),yj(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(vj(null===(e=bB.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),yj(t.name,this._spec,this._markAttributeContext)))}))}}N1.type=PE.venn,N1.mark=z1,N1.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},N1.transformerConstructor=H1;class U1 extends EK{constructor(){super(...arguments),this.type=PE.mosaic,this.transformerConstructor=MK}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(cP),this.setFieldX2(hP)),this.setFieldY(uP),this.setFieldY2(dP)):(t&&(this.setFieldY(cP),this.setFieldY2(hP)),this.setFieldX(uP),this.setFieldX2(dP)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}U1.type=PE.mosaic,U1.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},U1.transformerConstructor=MK;class V1 extends xW{_isValidSeries(t){return t===PE.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class W1 extends yW{constructor(){super(...arguments),this.transformerConstructor=V1,this.type="map",this.seriesType=PE.map}}W1.type="map",W1.seriesType=PE.map,W1.transformerConstructor=V1;class G1 extends xW{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","centerX","centerY","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class Y1 extends G1{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY","clamp"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=cU(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,fB({},s,l)),n&&Object.assign(o,fB({},n,o))}}class X1 extends G1{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class K1 extends G1{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return this._addSeriesRelatedSpecKeys(["valueField","angleField"]),i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class $1 extends yW{constructor(){super(...arguments),this.transformerConstructor=K1}}$1.transformerConstructor=K1;class q1 extends $1{constructor(){super(...arguments),this.transformerConstructor=K1,this.type="pie",this.seriesType=PE.pie}}q1.type="pie",q1.seriesType=PE.pie,q1.transformerConstructor=K1;class Z1 extends X1{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["radius","outerRadius","innerRadius"]),n.radius=null!==(e=t.radius)&&void 0!==e?e:TU,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:TU,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>fB({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const J1=(t,e)=>{if(!t)return null;const i=$j(t,(t=>"angle"===t.getOrient()),e),s=$j(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Lw(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=Aw({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=K(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=kw(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=Xj(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Lw(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=Aw({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=kw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=Xj(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class Q1 extends yW{constructor(){super(...arguments),this.transformerConstructor=Z1,this.type="rose",this.seriesType=PE.rose}_setModelOption(){this._modelOption.getDimensionInfo=J1}}Q1.type="rose",Q1.seriesType=PE.rose,Q1.transformerConstructor=Z1,G(Q1,TW);class t2 extends X1{_getDefaultSeriesSpec(t){var e,i,s,n;const r=super._getDefaultSeriesSpec(t),a=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e,"series","radar","area");return this._addSeriesRelatedSpecKeys(["line","point","area"]),r.line=t.line,r.point=t.point,r.stack=t.stack,r.percent=t.percent,r.area=fB({visible:null!==(s=null==a?void 0:a.visible)&&void 0!==s&&s},t.area),r.seriesMark=null!==(n=t.seriesMark)&&void 0!==n?n:"area",r.activePoint=t.activePoint,r.pointDis=t.pointDis,r.pointDisMul=t.pointDisMul,r.markOverlap=t.markOverlap,r}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=>fB({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class e2 extends yW{constructor(){super(...arguments),this.transformerConstructor=t2,this.type="radar",this.seriesType=PE.radar}_setModelOption(){this._modelOption.getDimensionInfo=J1}}e2.type="radar",e2.seriesType=PE.radar,e2.transformerConstructor=t2,G(e2,TW);class i2 extends xW{_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")&&fB(e,QF(this.type,t))})),this._transformAxisSpec(t)}}class s2 extends yW{constructor(){super(...arguments),this.transformerConstructor=i2,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=DW(t,e,i))&&void 0!==s?s:[],...null!==(n=J1(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}s2.type="common",s2.transformerConstructor=i2,G(s2,TW);class n2 extends SW{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class r2 extends yW{constructor(){super(...arguments),this.transformerConstructor=n2}}r2.transformerConstructor=n2,G(r2,TW);class a2 extends n2{transformSpec(t){super.transformSpec(t),XF(t)}}class o2 extends r2{constructor(){super(...arguments),this.transformerConstructor=a2,this.type="histogram",this.seriesType=PE.bar}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}o2.type="histogram",o2.seriesType=PE.bar,o2.transformerConstructor=a2;class l2 extends Y1{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["cornerRadius","progress","track","roundCap"]),s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class h2 extends yW{constructor(){super(...arguments),this.transformerConstructor=l2,this.type="circularProgress",this.seriesType=PE.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=J1}}h2.type="circularProgress",h2.seriesType=PE.circularProgress,h2.transformerConstructor=l2,G(h2,TW);class c2 extends Y1{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["pin","pinBackground","pointer"]),e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=PE.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===PE.gauge||t.type===PE.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===PE.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 d2 extends yW{constructor(){super(...arguments),this.transformerConstructor=c2,this.type="gauge",this.seriesType=PE.gaugePointer}}d2.type="gauge",d2.seriesType=PE.gaugePointer,d2.transformerConstructor=c2;class u2 extends xW{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class p2 extends yW{constructor(){super(...arguments),this.transformerConstructor=u2,this.type="wordCloud",this.seriesType=PE.wordCloud}}p2.transformerConstructor=u2;class g2 extends p2{constructor(){super(...arguments),this.transformerConstructor=u2,this.type="wordCloud",this.seriesType=PE.wordCloud}}g2.type="wordCloud",g2.seriesType=PE.wordCloud,g2.transformerConstructor=u2;class f2 extends xW{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class m2 extends yW{constructor(){super(...arguments),this.transformerConstructor=f2,this.type="funnel",this.seriesType=PE.funnel}}m2.type="funnel",m2.seriesType=PE.funnel,m2.transformerConstructor=f2;class v2 extends SW{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",this._addSeriesRelatedSpecKeys(["cornerRadius"]),s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=cU(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=cU(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class y2 extends yW{constructor(){super(...arguments),this.transformerConstructor=v2,this.type="linearProgress",this.seriesType=PE.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}y2.type="linearProgress",y2.seriesType=PE.linearProgress,y2.transformerConstructor=v2,G(y2,TW);class _2 extends SW{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),XF(t)}}class b2 extends yW{constructor(){super(...arguments),this.transformerConstructor=_2,this.type="rangeColumn",this.seriesType=PE.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}b2.type="rangeColumn",b2.seriesType=PE.rangeColumn,b2.transformerConstructor=_2;class x2 extends xW{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class S2 extends yW{constructor(){super(...arguments),this.transformerConstructor=x2,this.type="sunburst",this.seriesType=PE.sunburst}}S2.type="sunburst",S2.seriesType=PE.sunburst,S2.transformerConstructor=x2;class A2 extends xW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class k2 extends yW{constructor(){super(...arguments),this.transformerConstructor=A2,this.type="circlePacking",this.seriesType=PE.circlePacking}}k2.type="circlePacking",k2.seriesType=PE.circlePacking,k2.transformerConstructor=A2;class C2 extends xW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class T2 extends yW{constructor(){super(...arguments),this.transformerConstructor=C2,this.type="treemap",this.seriesType=PE.treemap}}T2.type="treemap",T2.seriesType=PE.treemap,T2.transformerConstructor=C2;class M2 extends PK{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),XF(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["bar","stackLabel","leaderLine","total","calculationMode"]),e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class w2 extends RK{constructor(){super(...arguments),this.transformerConstructor=M2,this.type="waterfall",this.seriesType=PE.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}w2.type="waterfall",w2.seriesType=PE.waterfall,w2.transformerConstructor=M2;class E2 extends SW{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),XF(t)}}class B2 extends yW{constructor(){super(...arguments),this.transformerConstructor=E2,this.type="boxPlot",this.seriesType=PE.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}B2.type="boxPlot",B2.seriesType=PE.boxPlot,B2.transformerConstructor=E2;class P2 extends xW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class R2 extends yW{constructor(){super(...arguments),this.transformerConstructor=P2,this.type="sankey",this.seriesType=PE.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=FP(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}R2.type="sankey",R2.seriesType=PE.sankey,R2.transformerConstructor=P2;class I2 extends SW{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return this._addSeriesRelatedSpecKeys(["area","point","line"]),s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),XF(t)}}class O2 extends yW{constructor(){super(...arguments),this.transformerConstructor=I2,this.type="rangeArea",this.seriesType=PE.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=DW,this._modelOption.getDimensionInfoByValue=zW,this._modelOption.getRectByDimensionData=WW}}O2.type="rangeArea",O2.seriesType=PE.rangeArea,O2.transformerConstructor=I2;class L2 extends SW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class D2 extends yW{constructor(){super(...arguments),this.transformerConstructor=L2,this.type="heatmap",this.seriesType=PE.heatmap}}D2.type="heatmap",D2.seriesType=PE.heatmap,D2.transformerConstructor=L2;class F2 extends xW{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class z2 extends yW{constructor(){super(...arguments),this.transformerConstructor=F2,this.type="correlation",this.seriesType=PE.correlation}}z2.type="correlation",z2.seriesType=PE.correlation,z2.transformerConstructor=F2;function H2(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=OP(t.style)),P(t.textStyle)||fB(s.textStyle,OP(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&OP(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&OP(s.background.style),s}function j2(t){const e=t=>function(t){return p(null==t?void 0:t.texture)?Object.assign(Object.assign({},t),{texturePadding:p(t.texturePadding)?t.texturePadding:1,textureSize:p(t.textureSize)?t.textureSize:4}):t}(t);if(d(t.style)){const i=t.style;t.style=(...t)=>e(i(...t))}else P(t.style)||(t.style=e(t.style));return P(t.state)||Object.keys(t.state).forEach((i=>{if(d(t.state[i])){const s=t.state[i];t.state[i]=(...t)=>e(s(...t))}else P(t.state[i])||(t.state[i]=e(t.state[i]))})),t}const N2=(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},U2=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:qB;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)},V2={position:!0,item:!0,title:!0,pager:!0,background:!0};class W2 extends RU{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:()=>{Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(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=qE(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);i.reRender=!0;const s=!V(e,t);return i.reMake?i:(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):s&&!i.reCompile&&this._isComponentOnlySpecChange(t,e)?(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}),i):(s&&(i.reCompile=!0),i)}_isComponentOnlySpecChange(t,e){const i=e,s=t;return Object.keys(Object.assign(Object.assign({},e),t)).every((t=>V(null==i?void 0:i[t],null==s?void 0:s[t])||V2[t]))}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Ez(this._option,e),this._initSelectedData(),Tw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(Tw(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(fB({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(fB({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(fB({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._legendComponent=null,this._cacheAttrs=null,this._preSelectedData=null}}W2.specKey="legends";class G2 extends W2{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){$P(this._option.dataSet,"discreteLegendFilter",U2),$P(this._option.dataSet,"discreteLegendDataMake",N2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return Tw(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(!CM(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=_P(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,s){const{title:n={},item:r={},pager:a={},background:o={},type:l,id:h,visible:c,orient:u,position:g,data:f,filter:m,regionId:v,regionIndex:y,seriesIndex:_,seriesId:b,padding:x}=t,S=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:A={},item:k={},pager:C={},background:T={}}=t;A=L(A),k=L(k),C=L(C),T=L(T);const M=S;if(d(M.maxRow)||d(M.maxCol)){const t=qE(s)?s:qE(u)?u:"left";d(M.maxRow)&&(M.maxRow=M.maxRow({rect:i,orient:t,id:h})),d(M.maxCol)&&(M.maxCol=M.maxCol({rect:i,orient:t,id:h}))}return A.visible?M.title=H2(A):M.title={visible:!1},P(k.focusIconStyle)||OP(k.focusIconStyle),k.shape&&(k.shape=j2(PP(k.shape))),k.label&&(k.label=PP(k.label)),k.value&&(k.value=PP(k.value)),k.background&&(k.background=PP(k.background)),ZE(k.maxWidth)&&(k.maxWidth=Number(k.maxWidth.substring(0,k.maxWidth.length-1))*i.width/100),ZE(k.width)&&(k.width=Number(k.width.substring(0,k.width.length-1))*i.width/100),ZE(k.height)&&(k.height=Number(k.height.substring(0,k.height.length-1))*i.width/100),M.item=k,"scrollbar"===C.type?(P(C.railStyle)||OP(C.railStyle),P(C.sliderStyle)||OP(C.sliderStyle)):(P(C.textStyle)||OP(C.textStyle),C.handler&&PP(C.handler)),M.pager=C,T.visible&&!P(T.style)&&(fB(M,T.style),p(T.padding)&&(M.padding=T.padding)),M}(this._spec,t,this.layoutOrient)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return MX}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(bX.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(bX.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(bX.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,datum:t.datum,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}=NH(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=NH(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}G2.specKey="legends",G2.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},G2.type=r.discreteLegend;const Y2=(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[]},X2=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?wP(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function K2(t){const i=fB({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:y,data:_,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:C,seriesId:T,padding:M}=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=H2(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=OP(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=OP(r.style)),P(a.style)||(w.trackStyle=OP(a.style)),w.startText=PP(o),w.endText=PP(l),w.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>OP(i(t,e,s)):P(i)||(e.style=OP(i)),e}(h),P(c)||(w.sizeBackground=OP(c)),u.visible&&!P(u.style)&&(fB(w,u.style),p(u.padding)&&(w.padding=u.padding)),w}const $2={color:RX,size:OX},q2={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}},Z2=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},q2),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},J2={horizontal:Z2(!0),vertical:Z2(!1)},Q2=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},q2),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},t5={horizontal:Q2(!0),vertical:Q2(!1)},e5=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],i5=[2,10];class s5 extends W2{static getSpecInfo(t){const e=UH(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(e){super.init(e),Tw(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){$P(this._option.dataSet,"continuousLegendFilter",X2),$P(this._option.dataSet,"continuousLegendDataMake",Y2);const t=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>Mw(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=_P(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!CM(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=_P(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?e5:i5);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},K2(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return $2[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=R(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}s5.specKey="legends",s5.builtInTheme={colorLegend:J2,sizeLegend:t5},s5.type=r.continuousLegend;const n5=(t,e)=>p(e)?t.map((t=>e[t])):void 0,r5=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),a5=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function o5(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=l5(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>r5(i,s)(t)&&r5(n,r)(t)&&(u(a)||r5([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const l=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:VP.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return LH.globalConfig.uniqueTooltip&&LH.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:VP.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return LH.globalConfig.uniqueTooltip&&LH.hideTooltip(a.id),m}return"none"}const l5=(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=n5(c,t);let y=n5(d,t);const _=a5(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(r5(c,v));if(!_&&(y=n5(d,i),!a5(y)))return;const n=e.type===PE.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=Lw(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(r5(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=n5(d,o),!a5(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(r5(c,n));if(!_&&(y=n5(d,r),!a5(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===PE.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(r5(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=n5(d,i),!a5(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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(r5(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=n5(d,a),h=y,!a5(y)&&!a)return;a5(y)||(y=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},h5=t=>p(t)&&!_(t),c5=t=>p(t)&&_(t),d5=["panel","shape","titleLabel","keyLabel","valueLabel","spaceRow","maxContentHeight","align"];class u5 extends PU{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){const{spec:i,theme:s}=super._initTheme(t,e),n=fB({},...d5.map((t=>void 0!==(null==s?void 0:s[t])?{[t]:s[t]}:void 0)),null==s?void 0:s.style),r=fB({},s);d5.forEach((t=>{delete r[t]})),delete r.style;const a=fB({},r,i);return a.style=fB({},n,a.style),{spec:a,theme:s}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:xM(this._option.mode)||!_M(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=b_.getElementById(t.parentElement)):_M(this._option.mode)&&(t.parentElement=null==yM?void 0:yM.body)}}const p5={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class g5 extends RU{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=u5,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=_M(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&h5(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&LH.globalConfig.uniqueTooltip&&l&&LH.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:VP.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:VP.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?KW.canvas:KW.dom,n=bB.getComponentPluginInType(t);n||fM("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=bB.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(bM(s)||xM(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=o5(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(c5(t)){if(h5(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>Gj(t,e[i])))}if(c5(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}g5.type=r.tooltip,g5.transformerConstructor=u5,g5.builtInTheme={tooltip:p5},g5.specKey="tooltip";var f5,m5;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(f5||(f5={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(m5||(m5={}));const v5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]},y5={labelZIndex:!0,gridZIndex:!0},_5={xField:!0,yField:!0,categoryField:!0,valueField:!0},b5={visible:!0,width:!0,style:!0};class x5 extends RU{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Lw(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return!V(e,t)&&(i.change=!0,i.reRender=!0,i.reMake||(this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0)),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||y5[i]||_5[i]&&this._isFieldComponentOnlySpecChange(null==e?void 0:e[i],null==t?void 0:t[i])))}_isFieldComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||"label"===i||"line"===i&&this._isLineComponentOnlySpecChange(null==t?void 0:t.line,null==e?void 0:e.line)))}_isLineComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},t),e)).every((i=>V(null==t?void 0:t[i],null==e?void 0:e[i])||b5[i]))}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:WP.chart}:{source:VP.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:bM(e)||xM(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:VP.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:VP.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:VP.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)=>{v5[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}x5.specKey="crosshair";const S5={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class A5 extends x5{static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=Dj(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){Dj(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:Fj(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"cartesian");e&&(HW(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=UW(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new RG(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new IG(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}A5.specKey="crosshair",A5.builtInTheme={crosshair:S5},A5.type=r.cartesianCrosshair;class k5 extends x5{static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=ww(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=hU(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=NH(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=ye([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=yt(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new RG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new LG(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new DG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new OG(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(u):function(t){let e="center",i="middle";return e=(t=pe(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}k5.specKey="crosshair",k5.builtInTheme={crosshair:S5},k5.type=r.polarCrosshair;const C5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},T5=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=X(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},M5=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},w5=(t,e,i)=>{const s=e.domain();if(Iw(e.type))return i?s[0]+(X(s)-s[0])*(1-t):s[0]+(X(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(X(n)-n[0])*t;return e.invert(r)},E5=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&Iw(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(X(n)-n[0])))},B5=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},P5=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}},R5=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),I5=(t,e,i)=>{if(Iw(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class O5{enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this.handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this.handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}constructor(t,e,i,s,n,r,a,o){this._activeRoam=!0,this._zoomAttr={enable:!0,rate:1,focus:!0},this._dragAttr={enable:!0,rate:1,reverse:!0},this._scrollAttr={enable:!0,rate:1,reverse:!0},this.initZoomEvent=()=>{var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=yt(this.getState().start+f,0,1),y=yt(this.getState().end-m,0,1);this._handleChange(Math.min(v,y),Math.max(v,y),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this.handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this.handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===jj(Hj(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=H({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=H({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=H({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&this._spec.roam,this._dragAttr.enable=this._spec.roam,this._scrollAttr.enable=this._spec.roam),(this._zoomAttr.enable||this._dragAttr.enable||this._scrollAttr.enable)&&this.initZoomable(this.getEvent(),this._option.mode)}}G(O5,s$);class L5 extends RU{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:E5(t,this._stateScale,this._isHorizontal),a="percent"===n?e:E5(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=B5(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=I5(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this.effect={onZoomChange:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&P5(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else Tw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Tw(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=Hj(t),this._isHorizontal="horizontal"===jj(this._orient),this._dataFilterEvent=new O5(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.change=!0,i.reRender=!0,!i.reCompile&&this._isComponentOnlySpecChange(t,e)?i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0}):i.reMake=!0),i}_getComponentOnlySpecKeys(){return null}_isComponentOnlySpecChange(t,e){const i=this._getComponentOnlySpecKeys();if(!i)return!1;return Object.keys(Object.assign(Object.assign({},e),t)).every((s=>V(null==e?void 0:e[s],null==t?void 0:t[s])||i[s]))}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(Iw(n.type)){const r=n.domain(),a=r[0],o=X(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(p(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):p(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>jj(t._orient)===jj(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!Iw(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};Tw(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=Iw(d.getScale(0).type),p=Iw(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else Tw(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;qP(r,"dataview",Oa),$P(r,"dataFilterComputeDomain",M5);const a=new za(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Ez(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||($P(this._option.dataSet,"dataFilterWithNewDomain",T5),$P(this._option.dataSet,"lockStatisticsFilter",C5),Tw(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Iw(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>Iw(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(Iw(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!V(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;R5("start",i,this._spec)&&R5("end",s,this._spec)&&(t="percent"===i?this._spec.start:E5(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:E5(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?E5(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?E5(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=w5(this._start,this._stateScale,B5(i,this._isHorizontal)),this._endValue=w5(this._end,this._stateScale,B5(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,Iw(this._stateScale.type)&&this._stateScale.domain()[0]!==X(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(X(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=I5(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&Tw(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new AE:new iE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[$(t),K(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=P5(h);if(!this._dataUpdating&&Lw(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,Lw(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(L5,s$);class D5 extends PU{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=fB({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const F5=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),z5={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:F5(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:F5(!0)},H5={width:!0,height:!0,showDetail:!0,middleHandler:!0,background:!0,startHandler:!0,endHandler:!0,startText:!0,endText:!0,dragMask:!0,selectedBackground:!0,backgroundChart:!0,selectedBackgroundChart:!0,showBackgroundChart:!0};class j5 extends L5{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=D5,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"filter"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=w5(e,this._stateScale,B5(s,this._isHorizontal)),a=w5(i,this._stateScale,B5(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=i;(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new AE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(B5(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=B5(t,this._isHorizontal),this.effect.onZoomChange())}_getComponentOnlySpecKeys(){return H5}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);this._backgroundSize=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new AE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(B5(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),K(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!Iw(t.type)||e[0]!==X(e))&&(!Lw(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance,isReverse:B5(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>w5(t,this._stateScale,B5(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new bY(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>w5(t,this._stateScale,B5(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:OP(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:OP(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:OP(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:OP(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:OP(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:OP(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:OP(g.style)},selectedBackgroundStyle:OP(this._spec.selectedBackground.style),dragMaskStyle:OP(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:fB(OP(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},OP(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:fB(OP(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},OP(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}=NH(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(B5(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}j5.type=r.dataZoom,j5.transformerConstructor=D5,j5.builtInTheme={dataZoom:z5},j5.specKey="dataZoom";const N5={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}},U5={width:!0,height:!0,rail:!0,slider:!0,round:!0,innerPadding:!0,minSliderSize:!0};class V5 extends L5{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=vw(this._start,e)&&vw(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=B5(n,this._isHorizontal),a=w5(e,this._stateScale,r),o=w5(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentOnlySpecKeys(){return U5}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new fG(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=OP(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=OP(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}V5.type=r.scrollBar,V5.builtInTheme={scrollBar:N5},V5.specKey="scrollBar";const W5=(t,e)=>{const{datum:i,title:s,content:n}=d(e)?e():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},G5=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),Y5={title:{visible:!0,autoLimit:!1,autoFit:!1,style:G5("l1FontSize","primaryFontColor")},content:{visible:!0,style:G5("l2FontSize","tertiaryFontColor")}};class X5 extends RU{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}_compareSpec(t,e){const i=super._compareSpec(t,e);return!!V(e,t)||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(FP(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(FP(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){$P(this._option.dataSet,"indicatorFilter",W5);const t=new za(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 Ez(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=fB({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},IP(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?nB(l,this._computeLayoutRadius()):0,dy:h?nB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},IP(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)V(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new FX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}X5.type=r.indicator,X5.builtInTheme={indicator:Y5},X5.specKey="indicator";const K5=["sum","average","min","max","variance","standardDeviation","median"];function $5(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=K(s);return er}function q5(t,e){return t?`${t}_${e}_extend`:`marker_${e}_extend`}function Z5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.x)&&$5(e,t.x,i)&&(null===(l=null==h?void 0:(o=h.getXAxisHelper()).setExtendDomain)||void 0===l||l.call(o,q5(a,"xAxis"),t.x)),c=ZE(t.x)?e3(t.x,n)+r.x:i3(h.getXAxisHelper(),[t.x])+r.x,c}function J5(t,e,i,s,n,r,a){var o,l;const{relativeSeries:h}=s;let c;return S(t.y)&&$5(e,t.y,i)&&(null===(l=null===(o=h.getYAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,q5(a,"yAxis"),t.y)),c=ZE(t.y)?e3(t.y,n)+r.y:i3(h.getYAxisHelper(),[t.y])+r.y,c}function Q5(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.angle)&&$5(e,t.angle,i)&&(null===(a=null===(r=o.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,q5(n,"angleAxis"),t.angle)),i3(o.angleAxisHelper,[t.angle])}function t3(t,e,i,s,n){var r,a;const{relativeSeries:o}=s;return S(t.radius)&&$5(e,t.radius,i)&&(null===(a=null===(r=o.radiusAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,q5(n,"radiusAxis"),t.radius)),i3(o.radiusAxisHelper,[t.radius])}function e3(t,e){return Number(t.substring(0,t.length-1))*e/100}function i3(t,e){const i=t.getScale(0);return Iw(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function s3(t){return K5.includes(t)}function n3(t,e,i,s,n,r=!1,a){const o=e.getRegion(),l=o.getLayoutStartPoint(),h=i.getRegion(),c=h.getLayoutStartPoint(),d=Math.abs(Math.min(l.x,c.x)-Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width)),u=Math.abs(Math.min(l.y,c.y)-Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height)),g={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},f=[],m=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,v=s.getXAxisHelper(),y=s.getYAxisHelper(),_=v.getScale(0).domain(),b=y.getScale(0).domain(),x=r&&!v.isContinuous&&!!v.getBandwidth,S=r&&!y.isContinuous&&!!y.getBandwidth,A={min:null,max:null},k={min:null,max:null};return m.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=Z5(t,_,n,g,d,l,a),r=J5(t,b,n,g,u,l,a),r3(s,x,A,f.length),r3(r,S,k,f.length),f.push([{x:s,y:r}]);else if(e){s=Z5(t,_,n,g,d,l,a),r=Math.max(l.y+o.getLayoutRect().height,c.y+h.getLayoutRect().height);const e=Math.min(l.y,c.y);r3(s,x,A,f.length),f.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(l.x,c.x),r=J5(t,b,n,g,u,l,a);const e=Math.max(l.x+o.getLayoutRect().width,c.x+h.getLayoutRect().width);r3(r,S,k,f.length),f.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(f,v,y,A,k),f}function r3(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=Q5(t,h,n,a,r),i=t3(t,c,n,a,r);o.push([{angle:e,radius:i}])}else if(e){const e=Q5(t,h,n,a,r);o.push([{angle:e,radius:-d},{angle:e,radius:d}])}else if(i){const e=t3(t,c,n,a,r);o.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),o}function o3(t,e){return(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e}function l3(t,e,i,s,n){const r=[],a=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,o=_(s);return i&&a.forEach((t=>{!function(t,e,i,s){var n,r,a,o;const l=e.getXAxisHelper().getScale(0).domain(),h=e.getYAxisHelper().getScale(0).domain(),c=Y(t.x),d=Y(t.y);1===c.length&&S(c[0])&&$5(l,c[0],i)&&(null===(r=null===(n=e.getXAxisHelper())||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,q5(s,"xAxis"),c[0])),1===d.length&&S(d[0])&&$5(h,d[0],i)&&(null===(o=null===(a=e.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,q5(s,"yAxis"),d[0]))}(t,o3(t,e),i,n)})),a.forEach(((t,i)=>{const n=o3(t,e),a=n.getRegion(),l=a.getLayoutStartPoint(),{width:h,height:c}=a.getLayoutRect();let d=0,u=0;if(s){const t=o?s[i]:s,e=t.x,n=t.y;e&&(d=ZE(e)?Number(e.substring(0,e.length-1))*h/100:e),n&&(u=ZE(n)?Number(n.substring(0,n.length-1))*c/100:n)}const p=Y(t.x),g=Y(t.y);r.push({x:i3(n.getXAxisHelper(),p)+l.x+d,y:i3(n.getYAxisHelper(),g)+l.y+u})})),r}function h3(t,e,i,s){const n=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var r,a,o,l;const h=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,c=h.angleAxisHelper.getScale(0).domain(),d=h.radiusAxisHelper.getScale(0).domain(),u=Y(t.angle),p=Y(t.radius);1===u.length&&S(u[0])&&$5(c,u[0],i)&&(null===(a=null===(r=h.angleAxisHelper)||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,q5(s,"angleAxis"),u[0])),1===p.length&&S(p[0])&&$5(d,p[0],i)&&(null===(l=null===(o=h.radiusAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,q5(s,"radiusAxis"),p[0])),n.push({angle:i3(h.angleAxisHelper,u),radius:i3(h.radiusAxisHelper,p)})})),n}function c3(t,e,i){let{x:s,y:n}=t;return ZE(s)&&(s=e3(s,e)),ZE(n)&&(n=e3(n,i)),{x:s,y:n}}function d3(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=c3(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>c3(t,n,r)))}function u3(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 p3(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},OP(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},f3(OP(n.style),i,s)),p(n.padding)&&(t.padding=oi(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=f3(OP(r),i,s)),t}return{visible:!1}}function g3(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function f3(t,e,i){return d(t)?t(e,i):t}function m3(t,e){return d(t)?t(e):t}function v3(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 y3(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function _3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=y3(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function b3(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=y3(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function x3(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function S3(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),y(t[c])&&s3(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),y(t[d])&&s3(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),y(t[a])&&s3(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),y(t[l])&&s3(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;_(s)?i.x=s.map((i=>k3(i,t,e))):i.x=k3(s,t,e)}if(p(e.y)){const s=e.y;_(s)?i.y=s.map((i=>k3(i,t,e))):i.y=k3(s,t,e)}if(p(e.angle)){const s=e.angle;_(s)?i.angle=s.map((i=>k3(i,t,e))):i.angle=k3(s,t,e)}if(p(e.radius)){const s=e.radius;_(s)?i.radius=s.map((i=>k3(i,t,e))):i.radius=k3(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=k3(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const A3={min:(t,e)=>yw(t[0].latestData,e.field),max:(t,e)=>_w(t[0].latestData,e.field),sum:function(t,e){return bw(t[0].latestData,e.field)},average:function(t,e){return xw(t[0].latestData,e.field)},variance:function(t,e){return Sw(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(Sw(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function k3(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 A3[i](e,{field:s})}return t}function C3(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}const T3=t=>{var e;const i=null===(e=null==t?void 0:t.dataSet)||void 0===e?void 0:e.dataViewMap;return i?Object.values(i).filter(Boolean):[]},M3=(t,e)=>{var i,s;null===(i=null==t?void 0:t.target)||void 0===i||i.removeListener("change",e.reRunAllTransform),null===(s=null==t?void 0:t.target)||void 0===s||s.removeListener("markRunning",e.markRunning)},w3=t=>{if(!t)return;T3(t).forEach((e=>{M3(e,t)}));const e=null==t?void 0:t.rawData;Array.isArray(e)&&e.forEach((e=>{M3(e,t)}))},E3=(t,e)=>{if(!t)return;const i=new Set(T3(t)),s=[],n=t=>{const r=null==t?void 0:t.rawData;Array.isArray(r)&&r.forEach((t=>{i.has(t)&&e(t)&&!s.includes(t)&&(s.push(t),n(t))}))};n(t),(t=>{const e=Array.from(new Set(t.filter(Boolean)));e.length&&(e.forEach(w3),e.forEach((t=>{var e;null===(e=t.destroy)||void 0===e||e.call(t)})))})([t,...s])},B3="__vchart_marker_coordinate__",P3=["coordinate","coordinates","x","y","x1","y1","angle","angle1","radius","radius1"],R3=["position","positions","coordinatesOffset","regionRelative"],I3=["offsetX","offsetY","confine"],O3=t=>Array.isArray(t)?t.map(O3):t&&"object"==typeof t?"function"!=typeof t.formatMethod?t:Object.assign(Object.assign({},t),{formatMethod:"__vchart_marker_format_method__"}):t,L3=t=>{if(Array.isArray(t))return t.map(L3);if(!t||"object"!=typeof t)return t;const e=Object.assign({},t);return Object.keys(e).forEach((t=>{"style"===t||t.endsWith("Style")?e[t]="__vchart_marker_style__":e[t]=L3(e[t])})),e},D3=(t,e)=>{if(!t||"object"!=typeof t)return t;const i=Object.assign({},t);e.normalizeDomainPosition&&P3.forEach((t=>{i[t]=B3})),e.normalizeAutoRange&&"autoRange"in i&&(i.autoRange="__vchart_marker_auto_range__"),R3.forEach((t=>{t in i&&(i[t]=B3)})),"label"in i&&(i.label=O3(i.label)),Object.keys(i).forEach((t=>{i[t]=L3(i[t])}));const s=i.itemContent;if(s&&"object"==typeof s){i.itemContent=Object.assign({},s),I3.forEach((t=>{t in i.itemContent&&(i.itemContent[t]=B3)}));const t=i.itemContent.text;t&&"object"==typeof t&&(i.itemContent.text=Object.assign(Object.assign({},O3(t)),{text:"__vchart_marker_text__"}))}return i};class F3 extends RU{constructor(){super(...arguments),this.layoutType="none",this._markerDataChangeHandler=null,this._markerDataOwned=!1,this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getAutoRangeExtendDomainKeyPrefix(){return`marker_${this.type}_${this.id}`}_getAutoRangeExtendDomainKey(t){return`${this._getAutoRangeExtendDomainKeyPrefix()}_${t}_extend`}_clearAutoRangeExtendDomain(){var t,e;Y(null===(e=(t=this._option).getAllSeries)||void 0===e?void 0:e.call(t)).forEach((t=>{var e,i,s,n,r,a,o,l,h,c;null===(s=null===(i=null===(e=null==t?void 0:t.getXAxisHelper)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.setExtendDomain)||void 0===s||s.call(i,this._getAutoRangeExtendDomainKey("xAxis"),void 0),null===(a=null===(r=null===(n=null==t?void 0:t.getYAxisHelper)||void 0===n?void 0:n.call(t))||void 0===r?void 0:r.setExtendDomain)||void 0===a||a.call(r,this._getAutoRangeExtendDomainKey("yAxis"),void 0),null===(l=null===(o=null==t?void 0:t.angleAxisHelper)||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,this._getAutoRangeExtendDomainKey("angleAxis"),void 0),null===(c=null===(h=null==t?void 0:t.radiusAxisHelper)||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,this._getAutoRangeExtendDomainKey("radiusAxis"),void 0)}))}_updateMarkerLayout(){this._clearAutoRangeExtendDomain(),this._markerLayout()}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return y(e)&&s3(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Fa;return e.registerParser("array",s),new za(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}_setMarkerData(t,e=!1){this._releaseMarkerData(),this._markerData=t,this._markerDataOwned=e}_bindMarkerDataChange(){var t;(null===(t=this._markerData)||void 0===t?void 0:t.target)&&(this._markerDataChangeHandler=()=>{this._updateMarkerLayout()},this._markerData.target.on("change",this._markerDataChangeHandler))}_releaseMarkerData(){const t=this._markerData;(null==t?void 0:t.target)&&this._markerDataChangeHandler&&t.target.removeListener("change",this._markerDataChangeHandler),this._markerDataChangeHandler=null,this._markerDataOwned&&E3(t,(t=>t.name===`${this.type}_${this.id}_data`)),this._markerData=null,this._markerDataOwned=!1}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._updateMarkerLayout()}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._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._updateMarkerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._updateMarkerLayout.bind(this)))}clear(){super.clear(),this._markerComponent=null,this._firstSeries=null}release(){this._releaseMarkerData(),super.release()}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=ww(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){u(this._spec.offsetX)||(this._layoutOffsetX=QE(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=QE(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reRender=!0,i.change=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake||i.reCompile||!this._isAutoRangeSpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,scaleDomain:!0,layout:!0,render:!0}):i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){const i=!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange);return V(D3(e,{normalizeDomainPosition:i}),D3(t,{normalizeDomainPosition:i}))}_isAutoRangeSpecChange(t,e){return!(!(null==t?void 0:t.autoRange)&&!(null==e?void 0:e.autoRange))&&V(D3(e,{normalizeDomainPosition:!0,normalizeAutoRange:!0}),D3(t,{normalizeDomainPosition:!0,normalizeAutoRange:!0}))}reInit(t){super.reInit(t),this._releaseMarkerData(),this._bindSeries(),this._initDataView(),this._buildMarkerAttributeContext(),this._markerComponent&&this._updateMarkerLayout()}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();$P(this._option.dataSet,"markerAggregation",S3),$P(this._option.dataSet,"markerFilter",C3),this._releaseMarkerData();const i=new za(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),this._setMarkerData(i,!0),this._bindMarkerDataChange()}}function z3(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=yw(t,e),r=_w(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class H3 extends F3{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}=_3(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:f3(OP(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>p3(t,this._markerData,this._markAttributeContext))),state:{line:g3(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:g3(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:g3(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return g3(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return g3(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:f3(OP(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:f3(OP(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=u3([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=_3(t);if(this._setMarkerData(this._getRelativeDataView()),!(i||s||n||r||a||o||l||h||c||d||e))return;$P(this._option.dataSet,"markerAggregation",S3),$P(this._option.dataSet,"markerRegression",z3),$P(this._option.dataSet,"markerFilter",C3);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new za(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()}),this._setMarkerData(m,!0),this._bindMarkerDataChange()}}H3.specKey="markLine";const j3=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),N3={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},U3={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:j3(!1),endSymbol:j3(!0),label:N3};class V3 extends H3{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new aX(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}=_3(e);let _=[];if(u||f||g||m||v||a&&l||a&&h){const t=n3(i,s,n,r,d,!1,this._getAutoRangeExtendDomainKeyPrefix());_=1===t.length?t[0]:t.map((t=>t[0]))}else y?_=l3(i,r,d,e.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):c&&(_=d3(e.positions,r,e.regionRelative));return{points:_}}_markerLayout(){var t,e,i,s,n,r,a,o,l;const h=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const l=this._startRelativeSeries,c=this._endRelativeSeries,{multiSegment:u,mainSegmentIndex:g}=this._spec.line||{},{connectDirection:f}=this._spec;let{expandDistance:m=0}=this._spec;const{points:v,limitRect:y}=h,_=Y(v).filter(Boolean);if(d(m)){const n=null===(t=null==l?void 0:l.getRegion)||void 0===t?void 0:t.call(l),r=null===(e=null==c?void 0:c.getRegion)||void 0===e?void 0:e.call(c);m=m(this._markerData,Object.assign(Object.assign({},this.getMarkAttributeContext()),{region:null===(s=null===(i=this._relativeSeries)||void 0===i?void 0:i.getRegion)||void 0===s?void 0:s.call(i),startRegion:n,endRegion:r,coordinatePoints:_}))}let b;if(ZE(m)){const t=l.getRegion(),e=t.getLayoutStartPoint(),i=c.getRegion(),s=i.getLayoutStartPoint();if("bottom"===f||"top"===f){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));b=Number(m.substring(0,m.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));b=Number(m.substring(0,m.length-1))*n/100}}else b=m;if(!v||v.length<2)return void(null===(n=this._markerComponent)||void 0===n||n.setAttributes(h));const x=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}(v[0],v[1],f,b);let S;S=u&&p(g)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(v[0],v[1],f,b));const A=Y((null!==(a=null===(r=this._markerComponent)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{}).label),C=Y(h.label),T=Y(this._spec.label);null===(o=this._markerComponent)||void 0===o||o.setAttributes({points:u?[[x[0],x[1]],[x[1],x[2]],[x[2],x[3]]]:x,label:C.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=S.dx)&&void 0!==i?i:0,h=null!==(s=S.dy)&&void 0!==s?s:0;const c=null!==(n=T[e])&&void 0!==n?n:T[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),S),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=A[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:y,multiSegment:u,mainSegmentIndex:g,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(l=this._markerComponent)||void 0===l||l.setAttributes(h)}_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}=_3(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 za(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}V3.type=r.markLine,V3.coordinateType="cartesian",V3.builtInTheme={markLine:U3};class W3 extends H3{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=_3(this._spec);return e||i?new hX(t):new aX(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}=_3(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=a3(i,s,n,r,a,this._getAutoRangeExtendDomainKeyPrefix());p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=h3(i,r,a,this._getAutoRangeExtendDomainKeyPrefix()),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=_3(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}}}W3.type=r.polarMarkLine,W3.coordinateType="polar",W3.builtInTheme={polarMarkLine:U3};class G3 extends RU{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=qE(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return UH(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,s&&!i.reMake&&(i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=QE(this._spec.width,a.width,null,a.width),l=QE(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)V(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new LX(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}}G3.type=r.title,G3.specKey=r.title,G3.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class Y3 extends F3{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=b3(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:f3(OP(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>p3(t,this._markerData,this._markAttributeContext))),state:{area:g3(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>g3(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return g3(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=u3([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=b3(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}Y3.specKey="markArea";const X3={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class K3 extends Y3{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new lX(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=b3(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=n3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=n3(s,n,r,a,u,g,this._getAutoRangeExtendDomainKeyPrefix());const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=l3(s,a,u,i.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix()):d&&(f=d3(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=b3(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}}}K3.type=r.markArea,K3.coordinateType="cartesian",K3.builtInTheme={markArea:X3};class $3 extends Y3{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=b3(this._spec);return i||e||s?new cX(t):new lX(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}=b3(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=a3(i,s,n,r,c,this._getAutoRangeExtendDomainKeyPrefix());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=h3(i,r,c,this._getAutoRangeExtendDomainKeyPrefix()),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=b3(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}}}$3.type=r.polarMarkArea,$3.coordinateType="polar",$3.builtInTheme={polarMarkArea:X3};const q3=t=>OP(Object.assign({},t)),Z3=t=>Object.assign(Object.assign({},t),{style:Object.assign({},OP(t.style))}),J3=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=q3(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=q3(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:{},OP(Object.assign({},_)));var _;const b=Z3(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Z3(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Z3(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Z3(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},Q3=t=>"left"===t||"right"===t,t4=t=>"top"===t||"bottom"===t,e4={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class i4 extends RU{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({},J3(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({},J3(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?V(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new ZX(t):this._playerComponent=new tK(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=Q3(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=Q3(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(GX.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(GX.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(GX.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(GX.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(GX.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(GX.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}_compareSpec(t,e){const i=super._compareSpec(t,e),s=!V(e,t);return(null==e?void 0:e.type)!==(null==t?void 0:t.type)?(i.reMake=!0,i):(!s||i.reMake||i.reCompile||(i.change=!0,i.reRender=!0,i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i)}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=Q3(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=t4(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):Q3(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))):t4(this._orient)?this._maxSize():t.height}_computeDx(t){return Q3(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return t4(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){var i,s;const n=null===(i=this._specs)||void 0===i?void 0:i[e];n&&(null===(s=this._option)||void 0===s?void 0:s.globalInstance)&&(this._option.globalInstance.updateFullData(n.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:n,index:e,specs:this._specs}}))}release(){var e,i,s,n;null===(i=null===(e=this._playerComponent)||void 0===e?void 0:e.pause)||void 0===i||i.call(e),null===(n=null===(s=this._option)||void 0===s?void 0:s.globalInstance)||void 0===n||n.off(t.ChartEvent.rendered,this.autoPlayCallback),super.release(),this._playerComponent=null,this._cacheAttrs=null,this._specs=[]}}i4.builtInTheme={player:e4},i4.specKey="player",i4.type=r.player;class s4 extends RU{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,V(e,t)||(i.change=!0,i.reMake||i.reCompile?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=HE({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==sz.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}s4.type=r.label;class n4 extends lq{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}n4.type="text",n4.constructorType="label";const r4=()=>{hq(),bB.registerMark(n4.constructorType,n4)};class a4 extends PU{_initTheme(t,e){return{spec:t,theme:this._theme}}}class o4 extends s4{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=a4,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(jP.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(jP.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Tw(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.releaseWithExitAnimation()||i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=fB({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},k$(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[lP])):t=>t.filter((t=>t.data[oP]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?C$(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}o4.type=r.label,o4.specKey="label",o4.transformerConstructor=a4;class l4 extends s4{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[rP]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return fB({textStyle:{pickable:!0===this._spec.interactive},position:h4(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[lP]:t.data[oP]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>C$({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function h4(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}l4.type=r.totalLabel,l4.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},l4.specKey="totalLabel";class c4 extends F3{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=x3(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,g,f,m,v,y,_,b,x,S,A,k,C,T,M,w,E,B,P,R,I,O,L;const{itemContent:D={},itemLine:F={},targetSymbol:z={}}=this._spec,j=this._relativeSeries.getRegion(),N=D,{type:U="text",text:V,symbol:W,image:G,richText:Y,customMark:X,textStyle:K,symbolStyle:$,imageStyle:q,richTextStyle:Z,customMarkStyle:J,style:Q={},state:tt={}}=N,et=e(N,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let it=null,st=null,nt=U,rt={};if("text"===U){it=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:tt;const r=null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:K)&&void 0!==n?n:Q;(t=>"rich"===(null==t?void 0:t.type))(r)?(nt="richText",rt={width:100,height:100},st=f3(H(rt,(t=>{if(!t)return t;const{type:i,text:s,textConfig:n}=t,r=e(t,["type","text","textConfig"]),a=Object.assign({},r),o=p(n)?n:s;return p(o)&&(a.textConfig=o),a})(r)),this._markerData,this._markAttributeContext)):(rt={dx:0,dy:0},st=p3(Object.assign(Object.assign({},V),{style:H(rt,r)}),this._markerData,this._markAttributeContext))}else"richText"===U?(it=null!==(r=null==Y?void 0:Y.state)&&void 0!==r?r:tt,rt={width:100,height:100},st=f3(H(rt,null!==(o=null!==(a=null==Y?void 0:Y.style)&&void 0!==a?a:Z)&&void 0!==o?o:Q),this._markerData,this._markAttributeContext)):"symbol"===U?(it=null!==(l=null==W?void 0:W.state)&&void 0!==l?l:tt,rt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},st=OP(f3(H(rt,null!==(c=null!==(h=null==W?void 0:W.style)&&void 0!==h?h:$)&&void 0!==c?c:Q),this._markerData,this._markAttributeContext))):"image"===U?(it=null!==(d=null==G?void 0:G.state)&&void 0!==d?d:tt,rt={width:80,height:80},st=f3(H(rt,null!==(g=null!==(u=null==G?void 0:G.style)&&void 0!==u?u:q)&&void 0!==g?g:Q),this._markerData,this._markAttributeContext)):"custom"===U&&(it=null!==(f=null==X?void 0:X.state)&&void 0!==f?f:tt,st=f3(null!==(v=null!==(m=null==X?void 0:X.style)&&void 0!==m?m:J)&&void 0!==v?v:Q,this._markerData,this._markAttributeContext));const at={zIndex:this.layoutZIndex,interactive:null===(y=this._spec.interactive)||void 0===y||y,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(b=this._spec.interactive)||void 0===b||b,position:{x:0,y:0},clipInRange:null!==(x=this._spec.clip)&&void 0!==x&&x,itemContent:Object.assign(Object.assign({type:nt,offsetX:m3(D.offsetX,j),offsetY:m3(D.offsetY,j)},et),{style:f3(st,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(S=z.offset)&&void 0!==S?S:0,visible:null!==(A=z.visible)&&void 0!==A&&A,size:null!==(k=z.size)&&void 0!==k?k:20,style:f3(z.style,this._markerData,this._markAttributeContext)},state:{line:g3(null!==(T=null===(C=this._spec.itemLine.line)||void 0===C?void 0:C.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineStartSymbol:g3(null!==(w=null===(M=this._spec.itemLine.startSymbol)||void 0===M?void 0:M.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:g3(null!==(B=null===(E=this._spec.itemLine.endSymbol)||void 0===E?void 0:E.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:g3(it,this._markerData,this._markAttributeContext),textBackground:g3(null===(R=null===(P=this._spec.itemContent.text)||void 0===P?void 0:P.labelBackground)||void 0===R?void 0:R.state,this._markerData,this._markAttributeContext),targetItem:g3(null!==(O=null===(I=this._spec.targetSymbol)||void 0===I?void 0:I.state)&&void 0!==O?O:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:ot,line:lt={}}=F,ht=e(F,["visible","line"]);at.itemLine=!1!==ot?Object.assign(Object.assign({},ht),{visible:!0,lineStyle:OP(lt.style)}):{visible:!1};return new uX(at)}_markerLayout(){var t,i,s,n,r,a,o,l,h,c,d,u,g;const f=this._spec,m=this._markerData,v=this._relativeSeries,{point:y}=this._computePointsAttr(),_=this._getRelativeDataView().latestData,b=m?m.latestData[0]&&m.latestData[0].latestData?m.latestData[0].latestData:m.latestData:_,{itemLine:x={},itemContent:S={}}=this._spec,A=this._relativeSeries.getRegion(),{visible:k,line:C={}}=x,T=e(x,["visible","line"]),M=!1!==k?Object.assign(Object.assign({},T),{visible:!0,lineStyle:OP(C.style)}):{visible:!1},w=p3(Object.assign(Object.assign({},S.text),{style:H({dx:0,dy:0},null!==(i=null===(t=S.text)||void 0===t?void 0:t.style)&&void 0!==i?i:S.style)}),m,this._markAttributeContext);let E;if(f.clip||(null===(s=f.itemContent)||void 0===s?void 0:s.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=u3([v.getRegion()]);E={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(n=this._markerComponent.attribute)&&void 0!==n?n:{},e=null!==(a=null===(r=t.itemContent)||void 0===r?void 0:r.textStyle)&&void 0!==a?a:{},i=null===(o=this._spec.itemContent.text)||void 0===o?void 0:o.text,s=m3(S.offsetX,A),f=m3(S.offsetY,A);this._markerComponent.setAttributes({position:void 0===y?{x:null,y:null}:y,itemContent:Object.assign(Object.assign({},t.itemContent),{panel:null!==(l=w.panel)&&void 0!==l?l:null===(h=t.itemContent)||void 0===h?void 0:h.panel,padding:null!==(c=w.padding)&&void 0!==c?c:null===(d=t.itemContent)||void 0===d?void 0:d.padding,textStyle:Object.assign(Object.assign(Object.assign({},e),null!==(u=w.textStyle)&&void 0!==u?u:{}),{text:(null===(g=this._spec.itemContent.text)||void 0===g?void 0:g.formatMethod)?this._spec.itemContent.text.formatMethod(b,_):p(i)?i:e.text}),offsetX:v3(y,s,A),offsetY:v3(y,f,A)}),itemLine:M,limitRect:E,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=x3(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}c4.specKey="markPoint";const d4={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class u4 extends c4{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=n3(n,r,r,r,h,!1,this._getAutoRangeExtendDomainKeyPrefix()))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=l3(n,r,h,s.coordinatesOffset,this._getAutoRangeExtendDomainKeyPrefix())[0]:l&&(c=d3(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=x3(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}}}u4.type=r.markPoint,u4.coordinateType="cartesian",u4.builtInTheme={markPoint:d4};class p4 extends c4{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=a3(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e,this._getAutoRangeExtendDomainKeyPrefix())[0][0];return{point:ce({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}p4.type=r.polarMarkPoint,p4.coordinateType="polar",p4.builtInTheme={polarMarkPoint:d4};class g4 extends c4{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}])]}}}g4.type=r.geoMarkPoint,g4.coordinateType="geo",g4.builtInTheme={geoMarkPoint:d4};const f4="inBrush",m4="outOfBrush",v4={style:!0,inBrush:!0,outOfBrush:!0};class y4 extends RU{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return UH(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),f4,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),m4,t.AttributeLevel.Series))}))}))}reInit(t){super.reInit(t),this.init()}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return V(e,t)||(i.change=!0,i.reRender=!0,i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,layout:!0,render:!0})),i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||v4[i]))}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){var i;const s=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(Object.assign({brushStyle:OP(null===(i=this._spec)||void 0===i?void 0:i.style)},s)),this._initMarkBrushState(e,""),n.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new nK(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:OP(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(JX.brushActive,(s=>{this._initMarkBrushState(i,m4),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(JX.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(JX.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(JX.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(JX.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(JX.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(JX.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(a&&this._handleBrushChange(e,s),null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(JX.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec;n&&this._handleBrushChange(e,i);const r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},OP(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_setBrushState(t,e){var i;const s=null!==(i=t.currentStates)&&void 0!==i?i:[];$z(t,[...s.filter((t=>t!==f4&&t!==m4)),e])}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(this._setBrushState(i,f4),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(this._setBrushState(i,m4),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:y=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(y.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(this._setBrushState(i,f4),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(this._setBrushState(i,m4),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;Zz(s,[f4,m4]),i&&qz(s,i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=X(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}y4.type=r.brush,y4.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},y4.specKey="brush";const _4={style:!0,state:!0};class b4 extends RU{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${WB}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=vj({},yj(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(e,t)||(i.reMake||i.reCompile||!this._isComponentOnlySpecChange(t,e)?i.reMake=!0:i.effects=Object.assign(Object.assign({},i.effects),{component:!0,render:!0})),i.change=!0,i.reRender=!0,i}_isComponentOnlySpecChange(t,e){return Object.keys(Object.assign(Object.assign({},e),t)).every((i=>V(null==e?void 0:e[i],null==t?void 0:t[i])||_4[i]))}reInit(t){super.reInit(t),this._updateMarkStyleWithSpec(this._spec,this.getMarks()[0]),this.getMarks().forEach((t=>{t.commit(!1,!0)}))}_updateMarkStyleWithSpec(t,e){var i,s,n,r;if(t&&e&&(this.initMarkStyleWithSpec(e,t),"group"===t.type)){const a=null!==(n=null===(s=(i=e).getMarks)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[];null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._updateMarkStyleWithSpec(t,a[e])}))}}_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 Ue).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ue;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}b4.type=r.customMark,b4.specKey="customMark";class x4{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>S4(t))),a=n.filter((t=>!S4(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>S4(t))),h=o.filter((t=>!S4(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 S4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}x4.type="grid";const A4=t=>{t?function(t){if(!t)throw new Error("installPoptipToApp requires an app instance");WA(t),BG(NA()),UA(),GA(t)}(t):(BG(m_()),BG(NA()),UA())},k4="vchart-tooltip",C4=`${k4}-container`,T4=`${k4}-title`,M4=`${k4}-content-box`,w4={offsetX:10,offsetY:10},E4="99999999999999";function B4(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const P4=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,R4=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?B4(t):"",I4=(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},O4={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},L4=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=O4[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class D4 extends aU{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:C}=this._option,T=m[_],M=YH(null==T?void 0:T.position,b,e),w=null!==(r=YH(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),I=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:GB,O=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:YB;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},H={x:0,y:0},j=1,N=1;const U=_M(this._env);if(U&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=I,D.height=O),U&&!P){const t=this._getParentElement(m);H=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-H.x,y:F.y-H.y},j=P4(e,F),N=P4(t,H)}const V=N/j,W={},G={x:M,y:M},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:C;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?E:B;switch(L4(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},K=["x","y"];if(g(M))if((t=>g(t)&&(p(t.left)||p(t.right)||p(t.top)||p(t.bottom)))(M)){const{left:t,right:e,top:i,bottom:s}=M;W.left=I4(t,y),W.top=I4(i,y),W.right=I4(e,y),W.bottom=I4(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(M)&&K.forEach((t=>{const e=M[t];S(e)||d(e)?W[Y[t][0]]=I4(e,y):X(e,t)}));else p(M)&&(X({orient:M,mode:w},"x"),X({orient:M,mode:w},"y"));const $={x:null,y:null};return K.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?I:O,n="x"===t?A:C,r=L4(G[t],t);if(k(W[Y[t][0]]))$[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))$[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;$[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}$[t]*=j,U&&($[t]+=z[t]),$[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(H[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/j)/N:-H[t]/N,l=a/N+o-i;2!==r&&$[t]l&&($[t]=l)):-2!==r&&$[t]>l&&(L?$[t]=l:($[t]-=0===r?n+i/2:2*n+i,$[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",z4=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=F4(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=F4(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},H4=(t={})=>{const{lineHeight:e}=t;return t.fontSize?QE(e,t.fontSize):0},j4=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=oi(r),a.padding=F4(o)),{panelStyle:a,panelPadding:o}};function N4(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const U4=t=>{bB.registerComponentPlugin(t.type,t)};const V4=t=>!!t&&1===t.nodeType&&"function"==typeof t.appendChild&&!!t.children;class W4 extends D4{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(W4.type),this.type=KW.dom,this._tooltipContainer=null==yM?void 0:yM.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}_getTooltipParentElement(t){return V4(t.parentElement)?t.parentElement:V4(this._chartContainer)?this._chartContainer:V4(null==yM?void 0:yM.body)?yM.body:void 0}initEl(){const t=this._component.getSpec(),e=this._getTooltipParentElement(t);if(yM&&e){for(let t=0;t{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=j4(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(y.marginBottom=`${g}px`);const _={width:F4(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=z4(h),x=z4(d),S=z4(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[A]=F4(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=F4(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=F4(null!==(n=p.spacing)&&void 0!==n?n:0);const C=Math.max(H4(p),H4(d));return y.lineHeight=C>0?`${C}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(T4))),l=a.find((t=>t.className.includes(M4)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(T4),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(N4(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${k4}-column`),e.classList.add(`${k4}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(M4),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];N4(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));N4(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${k4}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=R4(e.key),e.keyStyle&&z4(e.keyStyle,l)):"value"===i?(o.innerHTML=R4(e.value),e.valueStyle&&z4(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?B4(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?B4(c):m,_=p,b=t=>new Wg({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ue));let C=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=C.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));C=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=su.IsGradientStr(u);if(!u||y(u)&&!T||d)return m=d?"none":u?B4(u):"currentColor",`\n \n \n \n `;const M=T?su.Parse(u):g(u)?u:null;if(M){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=M.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===M.gradient?t=`\n ${i}\n `:"linear"===M.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),N4(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(M4))),h=[...o.children].find((t=>t.className.includes(T4)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(T4)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=QE(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,N4(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=fv({wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n});return{width:r.width(),height:r.height(),text:s}};function X4(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:G4),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const K4=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class $4 extends D4{constructor(){super($4.type),this.type=KW.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new hK({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=oi(d.padding),b=iB(d.padding),x=X4(Object.assign({textAlign:"right"===y?"right":"left"},u),i),S=X4(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=X4(m,i),k={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},C={panel:K4(d),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:M=[]}=t;let w=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!M.length;let R=0,I=0,O=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;C.content=M.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:C}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=fB({},S,X4(b,void 0,{})),{width:s,height:n,text:r}=Y4(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=fB({},A,X4(x,void 0,{})),{width:e,height:s,text:n}=Y4(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};C?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(H){V=fB({},x,X4(N,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=Y4(j,V);C.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=C.title.value.width,F=C.title.value.height,z=F+(P?C.title.spaceRow:0)}return E+=z,C.title.width=D,C.title.height=F,W()?w+=B||D:w+=Math.max(D,B),P&&C.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=w-b.left-b.right-L-R-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),C.valueWidth=Math.max(C.valueWidth,i.width))})),C.panel.width=w,C.panel.height=E,C})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}$4.type=KW.canvas;const q4=()=>{U4($4)},Z4=(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(PE).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=bB.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=bB.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},J4=(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=Z4(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):dB(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=fB({},i),m=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:fB(f,m),hasChanged:!0};const i=fB({},t,m);uB(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[c])?f[c].push(t):u(f[c])?f[c]="component"===h?t:[t]:f[c]=[f[c],t]}return{chartSpec:f,hasChanged:!0}},Q4=t=>{bB.registerChartPlugin(t.type,t)};class t8 extends aU{constructor(){super(t8.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[t8.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[t8.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=gB(this._option.globalInstance.getSpec(),["data",t8.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=gB(this._baseChartSpec,["data",t8.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=J4(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=gB(i,["data",t8.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()}}t8.pluginType="chart",t8.specKey="media",t8.type="MediaQueryPlugin";const e8=/\{([^}]+)\}/,i8=/\{([^}]+)\}/g,s8=/:/;class n8 extends aU{constructor(){super(n8.type),this.type="formatterPlugin",this._timeModeFormat={utc:yi.getInstance().timeUTCFormat,local:yi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ti.getInstance().format,this._numericSpecifier=Ti.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[n8.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)),bB.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=e8.test(i),this._isNumericFormatterCache.set(i,s))),s){return i.replace(i8,((t,i)=>{if(!s8.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 this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ai.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}n8.pluginType="chart",n8.specKey="formatter",n8.type="formatterPlugin";class r8 extends aU{constructor(){super(r8.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[r8.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=e$(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{QW(),eG(),sG(),BW(),EW(),dW(),iW(),GN(),XN(),xH(),yH(),DV(),JV(),bB.registerSeries(uW.type,uW),bB.registerChart(nG.type,nG)},()=>{QW(),eG(),sG(),EW(),dW(),iW(),GN(),oG(),XN(),cG(),DV(),JV(),bB.registerSeries(pK.type,pK),BW(),bB.registerChart(fK.type,fK)},()=>{QW(),eG(),sG(),EW(),BK(),BW(),bB.registerChart(RK.type,RK)},()=>{QW(),eG(),BW(),EW(),VK(),bB.registerChart(GK.type,GK)},()=>{eG(),Wq(),bB.registerChart(q1.type,q1)},()=>{QW(),eG(),BW(),EW(),hZ(),bB.registerChart(Q1.type,Q1)},()=>{QW(),eG(),sG(),BW(),EW(),yZ(),bB.registerChart(e2.type,e2)},()=>{QW(),eG(),sG(),BW(),EW(),BK(),bB.registerTransform("bin",Qr),bB.registerChart(o2.type,o2)},()=>{eG(),r$(),qK(),bB.registerSeries(o$.type,o$),bB.registerImplement("registerMap",tR),bB.registerImplement("unregisterMap",eR),_H(),bB.registerChart(W1.type,W1)},()=>{eG(),r1(),bB.registerSeries(o1.type,o1),Dq(),DZ(),rZ(),jZ(),bB.registerChart(d2.type,d2)},()=>{eG(),BQ(),bB.registerChart(g2.type,g2)},()=>{eG(),ZQ(),bB.registerChart(m2.type,m2)},()=>{QW(),eG(),sG(),BW(),EW(),F$(),bB.registerChart(w2.type,w2)},()=>{QW(),eG(),BW(),EW(),oq(),bB.registerTransform("boxplot",ta),bB.registerChart(B2.type,B2)},()=>{QW(),eG(),BW(),EW(),jZ(),bB.registerChart(h2.type,h2)},()=>{QW(),eG(),BW(),EW(),$Z(),bB.registerChart(y2.type,y2)},()=>{QW(),eG(),BW(),EW(),yq(),bB.registerChart(b2.type,b2)},()=>{QW(),eG(),sG(),BW(),EW(),oG(),DV(),JV(),bB.registerSeries(Aq.type,Aq),bB.registerChart(O2.type,O2)},()=>{eG(),f0(),bB.registerChart(S2.type,S2)},()=>{eG(),x0(),bB.registerChart(k2.type,k2)},()=>{eG(),$0(),bB.registerChart(T2.type,T2)},()=>{eG(),vG(),N0(),bB.registerChart(R2.type,R2)},()=>{eG(),f1(),bB.registerChart(D2.type,D2)},()=>{eG(),B1(),bB.registerChart(z2.type,z2)},()=>{QW(),eG(),sG(),BW(),bB.registerChart(s2.type,s2),EW()},JV,DV,()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),VU(),bB.registerComponent(cK.type,cK)},()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),VU(),bB.registerComponent(dK.type,dK)},()=>{bB.registerGraphicComponent(IU.lineAxis,((t,e)=>new BV(t,e))),bB.registerGraphicComponent(OU.lineAxisGrid,((t,e)=>new rV(t,e))),VU(),bB.registerComponent(uK.type,uK)},oZ,rZ,()=>{bB.registerComponent(G2.type,G2)},()=>{bB.registerComponent(s5.type,s5)},()=>{bB.registerComponent(g5.type,g5)},()=>{bB.registerComponent(A5.type,A5)},()=>{bB.registerComponent(k5.type,k5)},()=>{bB.registerComponent(j5.type,j5)},()=>{bB.registerComponent(V5.type,V5)},()=>{bB.registerComponent(X5.type,X5)},r$,()=>{bB.registerComponent(V3.type,V3),rX()},()=>{bB.registerComponent(K3.type,K3),oX()},()=>{bB.registerComponent(u4.type,u4),dX()},()=>{bB.registerComponent(W3.type,W3),hX._animate=jY,rX()},()=>{bB.registerComponent($3.type,$3),cX._animate=UY,oX()},()=>{bB.registerComponent(p4.type,p4),dX()},()=>{bB.registerComponent(g4.type,g4),dX()},()=>{bB.registerComponent(G3.type,G3)},()=>{bB.registerComponent(i4.type,i4)},()=>{bB.registerGraphicComponent(o4.type,(t=>new JG(t))),r4(),DU(),bB.registerComponent(o4.type,o4,!0,1/0)},()=>{bB.registerGraphicComponent(l4.type,(t=>new JG(t))),r4(),DU(),bB.registerComponent(l4.type,l4,!0)},()=>{bB.registerComponent(y4.type,y4)},()=>{bB.registerComponent(b4.type,b4)},()=>{bB.registerRuntimePluginInstaller("poptipForText",A4),A4()},()=>{bB.registerLayout(x4.type,x4)},q4,MH,BH]),LH.useRegisters([()=>{zO(iA)}]),t.AxisSyncPlugin=oU,t.CanvasTooltipHandler=$4,t.ChartResizeZoomPlugin=r8,t.DEFAULT_CHART_HEIGHT=YB,t.DEFAULT_CHART_WIDTH=GB,t.DEFAULT_CLOSE_STROKE_JOIN=zH,t.DEFAULT_DATA_INDEX=KB,t.DEFAULT_DATA_KEY=$B,t.DEFAULT_DATA_SERIES_FIELD=qB,t.DEFAULT_KEY=fP,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=FH,t.DEFAULT_MAP_LOOK_UP_KEY=mP,t.DEFAULT_MEASURE_CANVAS_ID=XB,t.DEFAULT_SERIES_STYLE_NAME=ZB,t.DEFAULT_SMOOTH_INTERPOLATE=DH,t.DomTooltipHandler=W4,t.Factory=bB,t.FormatterPlugin=n8,t.MOSAIC_CAT_END_PERCENT=uP,t.MOSAIC_CAT_START_PERCENT=dP,t.MOSAIC_VALUE_END_PERCENT=cP,t.MOSAIC_VALUE_START_PERCENT=hP,t.ManualTicker=class extends pb{constructor(t){super(t),this.lastFrameTime=0,this.status=wl.RUNNING}setupTickHandler(){const t=new HH;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wl.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wl.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wl.RUNNING,!0}},t.MediaQuery=t8,t.PREFIX=WB,t.SEGMENT_FIELD_END=gP,t.SEGMENT_FIELD_START=pP,t.STACK_FIELD_END=tP,t.STACK_FIELD_END_OffsetSilhouette=nP,t.STACK_FIELD_END_PERCENT=iP,t.STACK_FIELD_KEY=JB,t.STACK_FIELD_START=QB,t.STACK_FIELD_START_OffsetSilhouette=sP,t.STACK_FIELD_START_PERCENT=eP,t.STACK_FIELD_TOTAL=rP,t.STACK_FIELD_TOTAL_BOTTOM=lP,t.STACK_FIELD_TOTAL_PERCENT=aP,t.STACK_FIELD_TOTAL_TOP=oP,t.StreamLight=nF,t.ThemeManager=DB,t.USER_LAYOUT_RECT_LEVEL=9,t.VChart=LH,t.boundsInRect=eB,t.builtinThemes=CB,t.calcLayoutNumber=QE,t.calcPadding=tB,t.computeActualDataScheme=FE,t.convertPoint=sB,t.createArc=Vp,t.createArea=Yp,t.createGroup=tg,t.createLine=ag,t.createRect=mg,t.createRichText=jg,t.createSymbol=Gg,t.createText=Jg,t.darkTheme=cB,t.dataScheme=rB,t.default=LH,t.defaultThemeName=TB,t.getActualColor=HE,t.getActualNumValue=nB,t.getColorSchemeBySeries=VE,t.getDataScheme=DE,t.getFunnelTheme=AB,t.getMergedTheme=OB,t.getSpecInfo=UH,t.getTheme=PB,t.hasThemeMerged=EB,t.isColorKey=jE,t.isPercent=ZE,t.isPercentOffset=JE,t.isProgressiveDataColorScheme=NE,t.isTokenKey=oB,t.isValidOrient=qE,t.lightTheme=hB,t.lookup=VH,t.measureText=VB,t.normalizeLayoutPaddingSpec=iB,t.queryColorFromColorScheme=zE,t.queryToken=aB,t.registerCanvasTooltipHandler=q4,t.registerChartPlugin=Q4,t.registerChartResizeZoomPlugin=()=>{Q4(r8)},t.registerDataSetInstanceParser=qP,t.registerDataSetInstanceTransform=$P,t.registerDomTooltipHandler=()=>{U4(W4)},t.registerFormatPlugin=()=>{Q4(n8)},t.registerMediaQuery=()=>{Q4(t8)},t.registerTheme=BB,t.removeTheme=RB,t.themeExist=IB,t.themes=MB,t.token=lB,t.transformColorSchemeToStandardStruct=UE,t.transformToGraphic=OP,t.version="2.1.4",t.vglobal=b_,t.warn=gM,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/wx-vchart/package.json b/packages/wx-vchart/package.json index 769432cd7c..e91349d14b 100644 --- a/packages/wx-vchart/package.json +++ b/packages/wx-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/wx-vchart", - "version": "2.1.3", + "version": "2.1.4", "description": "", "main": "index.js", "miniprogram": ".", diff --git a/tools/bugserver-trigger/package.json b/tools/bugserver-trigger/package.json index 33ec5d1272..ffe10eeed1 100644 --- a/tools/bugserver-trigger/package.json +++ b/tools/bugserver-trigger/package.json @@ -8,8 +8,8 @@ "ci": "ts-node --transpileOnly --skipProject ./scripts/trigger-test.ts" }, "dependencies": { - "@visactor/vchart": "workspace:2.1.3", - "@visactor/vchart-extension": "workspace:2.1.3" + "@visactor/vchart": "workspace:2.1.4", + "@visactor/vchart-extension": "workspace:2.1.4" }, "devDependencies": { "@rushstack/eslint-patch": "~1.1.4", diff --git a/tools/story-player/package.json b/tools/story-player/package.json index de28056939..46008b9022 100644 --- a/tools/story-player/package.json +++ b/tools/story-player/package.json @@ -58,7 +58,7 @@ "dependencies": { "@visactor/vrender-core": "~1.1.4", "@visactor/vrender-kits": "~1.1.4", - "@visactor/vchart": "workspace:2.1.3", + "@visactor/vchart": "workspace:2.1.4", "@visactor/vrender": "~1.1.4", "@visactor/vutils": "~1.0.23" }